summaryrefslogtreecommitdiff
path: root/qpid/java/systests
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2010-08-20 13:50:00 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2010-08-20 13:50:00 +0000
commit0962757a7601d8b9fe97679868c1fa8f69b5b681 (patch)
tree2c5e9b157d7a5ca3fb89607125ebb95e6fd87faa /qpid/java/systests
parent9cc194a04f40775afcd3e33addf8cca485eaf8a4 (diff)
downloadqpid-python-0962757a7601d8b9fe97679868c1fa8f69b5b681.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@987507 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/systests')
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java
index bd7f146a94..d7e19a2e19 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java
+++ b/qpid/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)
+ {
+ }
+ }
+
}