mirror of https://github.com/apache/activemq.git
Remove commented out tests.
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1478549 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ede1705e34
commit
943011e92e
|
@ -99,210 +99,4 @@ public class AmqpTestSupport {
|
|||
autoFailTestSupport.stopAutoFailThread();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// @Test
|
||||
// public void testSendAndReceiveAMQP() throws Exception {
|
||||
// addAMQPConnector(brokerService);
|
||||
// brokerService.start();
|
||||
// AMQP amqp = new AMQP();
|
||||
// final BlockingConnection subscribeConnection = amqp.blockingConnection();
|
||||
// subscribeConnection.connect();
|
||||
// Topic topic = new Topic("foo/bah",QoS.AT_MOST_ONCE);
|
||||
// Topic[] topics = {topic};
|
||||
// subscribeConnection.subscribe(topics);
|
||||
// final CountDownLatch latch = new CountDownLatch(numberOfMessages);
|
||||
//
|
||||
// Thread thread = new Thread(new Runnable() {
|
||||
// public void run() {
|
||||
// for (int i = 0; i < numberOfMessages; i++){
|
||||
// try {
|
||||
// Message message = subscribeConnection.receive();
|
||||
// message.ack();
|
||||
// latch.countDown();
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// thread.start();
|
||||
//
|
||||
// BlockingConnection publisherConnection = amqp.blockingConnection();
|
||||
// publisherConnection.connect();
|
||||
// for (int i = 0; i < numberOfMessages; i++){
|
||||
// String payload = "Message " + i;
|
||||
// publisherConnection.publish(topic.name().toString(),payload.getBytes(),QoS.AT_LEAST_ONCE,false);
|
||||
// }
|
||||
//
|
||||
// latch.await(10, TimeUnit.SECONDS);
|
||||
// assertEquals(0, latch.getCount());
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testSendAndReceiveAtMostOnce() throws Exception {
|
||||
// addAMQPConnector(brokerService);
|
||||
// brokerService.start();
|
||||
// AMQP amqp = createAMQPConnection();
|
||||
// amqp.setKeepAlive(Short.MAX_VALUE);
|
||||
// BlockingConnection connection = amqp.blockingConnection();
|
||||
//
|
||||
// connection.connect();
|
||||
//
|
||||
//
|
||||
// Topic[] topics = {new Topic(utf8("foo"), QoS.AT_MOST_ONCE)};
|
||||
// connection.subscribe(topics);
|
||||
// for (int i = 0; i < numberOfMessages; i++) {
|
||||
// String payload = "Test Message: " + i;
|
||||
// connection.publish("foo", payload.getBytes(), QoS.AT_MOST_ONCE, false);
|
||||
// Message message = connection.receive();
|
||||
// assertEquals(payload, new String(message.getPayload()));
|
||||
// }
|
||||
// connection.disconnect();
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testSendAndReceiveAtLeastOnce() throws Exception {
|
||||
// addAMQPConnector(brokerService);
|
||||
// brokerService.start();
|
||||
// AMQP amqp = createAMQPConnection();
|
||||
// amqp.setKeepAlive(Short.MAX_VALUE);
|
||||
// BlockingConnection connection = amqp.blockingConnection();
|
||||
//
|
||||
// connection.connect();
|
||||
//
|
||||
// Topic[] topics = {new Topic(utf8("foo"), QoS.AT_LEAST_ONCE)};
|
||||
// connection.subscribe(topics);
|
||||
// for (int i = 0; i < numberOfMessages; i++) {
|
||||
// String payload = "Test Message: " + i;
|
||||
// connection.publish("foo", payload.getBytes(), QoS.AT_LEAST_ONCE, false);
|
||||
// Message message = connection.receive();
|
||||
// message.ack();
|
||||
// assertEquals(payload, new String(message.getPayload()));
|
||||
// }
|
||||
// connection.disconnect();
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testSendAndReceiveExactlyOnce() throws Exception {
|
||||
// addAMQPConnector(brokerService);
|
||||
// brokerService.start();
|
||||
// AMQP publisher = createAMQPConnection();
|
||||
// BlockingConnection pubConnection = publisher.blockingConnection();
|
||||
//
|
||||
// pubConnection.connect();
|
||||
//
|
||||
// AMQP subscriber = createAMQPConnection();
|
||||
// BlockingConnection subConnection = subscriber.blockingConnection();
|
||||
//
|
||||
// subConnection.connect();
|
||||
//
|
||||
// Topic[] topics = {new Topic(utf8("foo"), QoS.EXACTLY_ONCE)};
|
||||
// subConnection.subscribe(topics);
|
||||
// for (int i = 0; i < numberOfMessages; i++) {
|
||||
// String payload = "Test Message: " + i;
|
||||
// pubConnection.publish("foo", payload.getBytes(), QoS.EXACTLY_ONCE, false);
|
||||
// Message message = subConnection.receive();
|
||||
// message.ack();
|
||||
// assertEquals(payload, new String(message.getPayload()));
|
||||
// }
|
||||
// subConnection.disconnect();
|
||||
// pubConnection.disconnect();
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testSendAndReceiveLargeMessages() throws Exception {
|
||||
// byte[] payload = new byte[1024 * 32];
|
||||
// for (int i = 0; i < payload.length; i++){
|
||||
// payload[i] = '2';
|
||||
// }
|
||||
// addAMQPConnector(brokerService);
|
||||
// brokerService.start();
|
||||
//
|
||||
// AMQP publisher = createAMQPConnection();
|
||||
// BlockingConnection pubConnection = publisher.blockingConnection();
|
||||
//
|
||||
// pubConnection.connect();
|
||||
//
|
||||
// AMQP subscriber = createAMQPConnection();
|
||||
// BlockingConnection subConnection = subscriber.blockingConnection();
|
||||
//
|
||||
// subConnection.connect();
|
||||
//
|
||||
// Topic[] topics = {new Topic(utf8("foo"), QoS.AT_LEAST_ONCE)};
|
||||
// subConnection.subscribe(topics);
|
||||
// for (int i = 0; i < 10; i++) {
|
||||
// pubConnection.publish("foo", payload, QoS.AT_LEAST_ONCE, false);
|
||||
// Message message = subConnection.receive();
|
||||
// message.ack();
|
||||
// assertArrayEquals(payload, message.getPayload());
|
||||
// }
|
||||
// subConnection.disconnect();
|
||||
// pubConnection.disconnect();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Test
|
||||
// public void testSendAMQPReceiveJMS() throws Exception {
|
||||
// addAMQPConnector(brokerService);
|
||||
// brokerService.addConnector(ActiveMQConnectionFactory.DEFAULT_BROKER_BIND_URL);
|
||||
// brokerService.start();
|
||||
// AMQP amqp = createAMQPConnection();
|
||||
// BlockingConnection connection = amqp.blockingConnection();
|
||||
// final String DESTINATION_NAME = "foo.*";
|
||||
// connection.connect();
|
||||
//
|
||||
// ActiveMQConnection activeMQConnection = (ActiveMQConnection) new ActiveMQConnectionFactory().createConnection();
|
||||
// activeMQConnection.start();
|
||||
// Session s = activeMQConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
// javax.jms.Topic jmsTopic = s.createTopic(DESTINATION_NAME);
|
||||
// MessageConsumer consumer = s.createConsumer(jmsTopic);
|
||||
//
|
||||
// for (int i = 0; i < numberOfMessages; i++) {
|
||||
// String payload = "Test Message: " + i;
|
||||
// connection.publish("foo/bah", payload.getBytes(), QoS.AT_LEAST_ONCE, false);
|
||||
// ActiveMQMessage message = (ActiveMQMessage) consumer.receive();
|
||||
// ByteSequence bs = message.getContent();
|
||||
// assertEquals(payload, new String(bs.data, bs.offset, bs.length));
|
||||
// }
|
||||
//
|
||||
//
|
||||
// activeMQConnection.close();
|
||||
// connection.disconnect();
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testSendJMSReceiveAMQP() throws Exception {
|
||||
// addAMQPConnector(brokerService);
|
||||
// brokerService.addConnector(ActiveMQConnectionFactory.DEFAULT_BROKER_BIND_URL);
|
||||
// brokerService.start();
|
||||
// AMQP amqp = createAMQPConnection();
|
||||
// amqp.setKeepAlive(Short.MAX_VALUE);
|
||||
// BlockingConnection connection = amqp.blockingConnection();
|
||||
// connection.connect();
|
||||
//
|
||||
// ActiveMQConnection activeMQConnection = (ActiveMQConnection) new ActiveMQConnectionFactory().createConnection();
|
||||
// activeMQConnection.start();
|
||||
// Session s = activeMQConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
// javax.jms.Topic jmsTopic = s.createTopic("foo.far");
|
||||
// MessageProducer producer = s.createProducer(jmsTopic);
|
||||
//
|
||||
// Topic[] topics = {new Topic(utf8("foo/+"), QoS.AT_MOST_ONCE)};
|
||||
// connection.subscribe(topics);
|
||||
// for (int i = 0; i < numberOfMessages; i++) {
|
||||
// String payload = "This is Test Message: " + i;
|
||||
// TextMessage sendMessage = s.createTextMessage(payload);
|
||||
// producer.send(sendMessage);
|
||||
// Message message = connection.receive();
|
||||
// message.ack();
|
||||
// assertEquals(payload, new String(message.getPayload()));
|
||||
// }
|
||||
// connection.disconnect();
|
||||
// }
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
}
|
|
@ -64,77 +64,6 @@ public class JMSClientTest extends AmqpTestSupport {
|
|||
|
||||
}
|
||||
|
||||
// @Test
|
||||
// public void testSendReceive() throws Exception {
|
||||
// ActiveMQAdmin.enableJMSFrameTracing();
|
||||
// QueueImpl queue = new QueueImpl("queue://testqueue");
|
||||
// int nMsgs = 1;
|
||||
// final String dataFormat = "%01024d";
|
||||
//
|
||||
//
|
||||
// try {
|
||||
// Connection connection = createConnection();
|
||||
// {
|
||||
// Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
// MessageProducer p = session.createProducer(queue);
|
||||
// for (int i = 0; i < nMsgs; i++) {
|
||||
// System.out.println("Sending " + i);
|
||||
// p.send(session.createTextMessage(String.format(dataFormat, i)));
|
||||
// }
|
||||
// }
|
||||
// connection.close();
|
||||
//
|
||||
// System.out.println("=======================================================================================");
|
||||
// System.out.println(" failing a receive ");
|
||||
// System.out.println("=======================================================================================");
|
||||
// connection = createConnection();
|
||||
// {
|
||||
// Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
|
||||
// MessageConsumer c = session.createConsumer(queue);
|
||||
//
|
||||
// // Receive messages non-transacted
|
||||
// int i = 0;
|
||||
// while ( i < 1) {
|
||||
// TextMessage msg = (TextMessage) c.receive();
|
||||
// if( msg!=null ) {
|
||||
// String s = msg.getText();
|
||||
// assertEquals(String.format(dataFormat, i), s);
|
||||
// System.out.println("Received: " + i);
|
||||
// i++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// connection.close();
|
||||
//
|
||||
//
|
||||
// System.out.println("=======================================================================================");
|
||||
// System.out.println(" receiving ");
|
||||
// System.out.println("=======================================================================================");
|
||||
// connection = createConnection();
|
||||
// {
|
||||
// Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
// MessageConsumer c = session.createConsumer(queue);
|
||||
//
|
||||
// // Receive messages non-transacted
|
||||
// int i = 0;
|
||||
// while ( i < nMsgs) {
|
||||
// TextMessage msg = (TextMessage) c.receive();
|
||||
// if( msg!=null ) {
|
||||
// String s = msg.getText();
|
||||
// assertEquals(String.format(dataFormat, i), s);
|
||||
// System.out.println("Received: " + i);
|
||||
// i++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// connection.close();
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
private Connection createConnection() throws JMSException {
|
||||
final ConnectionFactoryImpl factory = new ConnectionFactoryImpl("localhost", port, "admin", "password");
|
||||
final Connection connection = factory.createConnection();
|
||||
|
|
Loading…
Reference in New Issue