diff options
| author | Rajith Muditha Attapattu <rajith@apache.org> | 2010-08-20 13:50:00 +0000 |
|---|---|---|
| committer | Rajith Muditha Attapattu <rajith@apache.org> | 2010-08-20 13:50:00 +0000 |
| commit | fdfefb5e9721cb85d70a81928044f61b7f48ccf3 (patch) | |
| tree | 593409095679a83a428942fc63869ab688d91d63 /java | |
| parent | 5dd92ba051ee9c7c794a0545dc43316720b66b71 (diff) | |
| download | qpid-python-fdfefb5e9721cb85d70a81928044f61b7f48ccf3.tar.gz | |
Added a test case for QPID-2809 to ensure that if the same destination is used in topics, each subscription will get it's own queue unless a named queue is used.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@987507 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
| -rw-r--r-- | java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java | 36 |
1 files changed, 36 insertions, 0 deletions
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 bd7f146a94..d7e19a2e19 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 @@ -440,6 +440,7 @@ public class AddressBasedDestinationTest extends QpidBrokerTestCase Session jmsSession = _connection.createSession(false,Session.CLIENT_ACKNOWLEDGE); AMQDestination topic1 = new AMQAnyDestination("ADDR:amq.topic/topic1; {link:{name: queue1}}"); + MessageProducer prod = jmsSession.createProducer(topic1); Message m = jmsSession.createTextMessage("Hello"); @@ -675,4 +676,39 @@ public class AddressBasedDestinationTest extends QpidBrokerTestCase assertNull("Should not receive anymore messages",browseCons.receive(500)); } + + /** + * Test Goal : Verify that unique subscription queues are created when consumers are + * created using the same destination except when the subscription queue + * has a name. + */ + public void testSubscriptionForSameDestination() throws Exception + { + Session ssn = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE); + Destination dest = ssn.createTopic("ADDR:amq.topic/foo"); + MessageConsumer consumer1 = ssn.createConsumer(dest); + MessageConsumer consumer2 = ssn.createConsumer(dest); + MessageProducer prod = ssn.createProducer(dest); + + prod.send(ssn.createTextMessage("A")); + TextMessage m = (TextMessage)consumer1.receive(1000); + assertEquals("Consumer1 should recieve message A",m.getText(),"A"); + m = (TextMessage)consumer2.receive(1000); + assertEquals("Consumer2 should recieve message A",m.getText(),"A"); + + consumer1.close(); + consumer2.close(); + + dest = ssn.createTopic("ADDR:amq.topic/foo; { link: {name: my-queue}}"); + consumer1 = ssn.createConsumer(dest); + try + { + consumer2 = ssn.createConsumer(dest); + fail("An exception should be thrown as 'my-queue' already have an exclusive subscriber"); + } + catch(Exception e) + { + } + } + } |
