From c6f039a4ec24d7fa1bca2683ea56ea8778315043 Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Thu, 17 Mar 2011 21:29:50 +0000 Subject: Added testReplyToWithNamelessExchange as a test case for QPID-2959 Added testReplyToWithCustomExchange as a test case for QPID-3011 Removed testAddressBasedReplyTo as the above test cases cover it adequately. Currently the testReplyToWithNamelessExchange fails with the java.0.10 test profile. This is due to the default being BURL and the replyTo address is evaluated as a BURL and as part of the logic an exchange declare is being set. The C++ broker does seem to ignore the exchange declare of a known type (the nameless exchange in this case), while the java broker throws an exception. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1082709 13f79535-47bb-0310-9956-ffa450edef68 --- .../destination/AddressBasedDestinationTest.java | 65 +++++++++++----------- 1 file changed, 32 insertions(+), 33 deletions(-) (limited to 'java') diff --git a/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java b/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java index 4e34e7a48b..931833408e 100644 --- a/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java +++ b/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java @@ -473,39 +473,6 @@ public class AddressBasedDestinationTest extends QpidBrokerTestCase } - /** - * Test goal: Verifies that and address based destination can be used successfully - * as a reply to. - */ - public void testAddressBasedReplyTo() throws Exception - { - Session jmsSession = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE); - - String addr = "ADDR:amq.direct/x512; {create: receiver, " + - "link : {name : 'MY.RESP.QUEUE', " + - "x-declare : { auto-delete: true, exclusive: true, " + - "arguments : {'qpid.max_size': 1000, 'qpid.policy_type': ring }} } }"; - - Destination replyTo = new AMQAnyDestination(addr); - Destination dest =new AMQAnyDestination("ADDR:amq.direct/Hello"); - - MessageConsumer cons = jmsSession.createConsumer(dest); - MessageProducer prod = jmsSession.createProducer(dest); - Message m = jmsSession.createTextMessage("Hello"); - m.setJMSReplyTo(replyTo); - prod.send(m); - - Message msg = cons.receive(1000); - assertNotNull("consumer should have received the message",msg); - - MessageConsumer replyToCons = jmsSession.createConsumer(replyTo); - MessageProducer replyToProd = jmsSession.createProducer(msg.getJMSReplyTo()); - replyToProd.send(jmsSession.createTextMessage("reply")); - - Message replyToMsg = replyToCons.receive(1000); - assertNotNull("The reply to consumer should have got the message",replyToMsg); - } - /** * Test goal: Verifies that session.createQueue method * works as expected both with the new and old addressing scheme. @@ -1020,4 +987,36 @@ public class AddressBasedDestinationTest extends QpidBrokerTestCase prod.close(); cons.close(); } + + public void testReplyToWithNamelessExchange() throws Exception + { + replyToTest("ADDR:my-queue;{create: always}"); + } + + public void testReplyToWithCustomExchange() throws Exception + { + replyToTest("ADDR:hello;{create:always,node:{type:topic}}"); + } + + private void replyToTest(String replyTo) throws Exception + { + Session session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + Destination replyToDest = AMQDestination.createDestination(replyTo); + MessageConsumer replyToCons = session.createConsumer(replyToDest); + + Destination dest = session.createQueue("amq.direct/test"); + + MessageConsumer cons = session.createConsumer(dest); + MessageProducer prod = session.createProducer(dest); + Message m = session.createTextMessage("test"); + m.setJMSReplyTo(replyToDest); + prod.send(m); + + Message msg = cons.receive(); + MessageProducer prodR = session.createProducer(msg.getJMSReplyTo()); + prodR.send(session.createTextMessage("x")); + + Message m1 = replyToCons.receive(); + assertNotNull("The reply to consumer should have received the messsage",m1); + } } -- cgit v1.2.1