diff options
author | Rajith Muditha Attapattu <rajith@apache.org> | 2010-11-05 00:09:54 +0000 |
---|---|---|
committer | Rajith Muditha Attapattu <rajith@apache.org> | 2010-11-05 00:09:54 +0000 |
commit | 44df5c88eb28815f9c81cf9e8b03910b3577a139 (patch) | |
tree | 76177491ef31eb7f38727fbc363b44c9414cff1d /qpid/java/systests | |
parent | 278adc7bd022825e24d01452175799d01ac6a39e (diff) | |
download | qpid-python-44df5c88eb28815f9c81cf9e8b03910b3577a139.tar.gz |
Added a test case for QPID-2737, QPID-2774, QPID-2928
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1031364 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.java | 50 |
1 files changed, 47 insertions, 3 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 af7c08ca65..1d1f4a53d5 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 @@ -280,6 +280,10 @@ public class AddressBasedDestinationTest extends QpidBrokerTestCase assertTrue("Queue not bound as expected",( (AMQSession_0_10)jmsSession).isQueueBound("my-exchange", dest.getQueueName(),"hello", Collections.<String, Object>emptyMap())); + + // The client should be able to query and verify the existence of my-exchange (QPID-2774) + dest = new AMQAnyDestination("ADDR:my-exchange; {create: never}"); + cons = jmsSession.createConsumer(dest); } public void testBindQueueWithArgs() throws Exception @@ -684,9 +688,11 @@ public class AddressBasedDestinationTest extends QpidBrokerTestCase } /** - * 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. + * Test Goal : When the same destination is used when creating two consumers, + * If the type == topic, verify that unique subscription queues are created, + * unless subscription queue has a name. + * + * If the type == queue, same queue should be shared. */ public void testSubscriptionForSameDestination() throws Exception { @@ -715,6 +721,28 @@ public class AddressBasedDestinationTest extends QpidBrokerTestCase catch(Exception e) { } + _connection.close(); + + _connection = getConnection() ; + _connection.start(); + ssn = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE); + dest = ssn.createTopic("ADDR:my_queue; {create: always}"); + consumer1 = ssn.createConsumer(dest); + consumer2 = ssn.createConsumer(dest); + prod = ssn.createProducer(dest); + + prod.send(ssn.createTextMessage("A")); + Message m1 = consumer1.receive(1000); + Message m2 = consumer2.receive(1000); + + if (m1 != null) + { + assertNull("Only one consumer should receive the message",m2); + } + else + { + assertNotNull("Only one consumer should receive the message",m2); + } } public void testXBindingsWithoutExchangeName() throws Exception @@ -752,4 +780,20 @@ public class AddressBasedDestinationTest extends QpidBrokerTestCase assertNotNull("consumer should receive a message",cons.receive(1000)); cons.close(); } + + public void testXSubscribeOverrides() throws Exception + { + Session ssn = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE); + String str = "ADDR:my_queue; {create:always,link: {x-subscribes:{exclusive: true, arguments: {a:b,x:y}}}}"; + Destination dest = ssn.createTopic(str); + MessageConsumer consumer1 = ssn.createConsumer(dest); + try + { + MessageConsumer consumer2 = ssn.createConsumer(dest); + fail("An exception should be thrown as 'my-queue' already have an exclusive subscriber"); + } + catch(Exception e) + { + } + } } |