diff options
| author | Rajith Muditha Attapattu <rajith@apache.org> | 2010-07-21 15:43:59 +0000 |
|---|---|---|
| committer | Rajith Muditha Attapattu <rajith@apache.org> | 2010-07-21 15:43:59 +0000 |
| commit | 07e2da7a5d9cc0e737bb9f820fcaf58544242269 (patch) | |
| tree | 0bc4bec8abd69255dea0dc60d34077098c9fc710 /java/systests | |
| parent | f66202efc1d42ebc8a636d399c31c05df2d13af1 (diff) | |
| download | qpid-python-07e2da7a5d9cc0e737bb9f820fcaf58544242269.tar.gz | |
QPID-2738
You could now susbcribe to any queue using browse mode and use a regular MessageConsumer (even with a MessageListener) instead of having to use a Queue Browser.
Ex. 'my-ring-queue; {mode: browse}'
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@966284 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/systests')
| -rw-r--r-- | java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java | 40 |
1 files changed, 40 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 5bf2de836d..bd7f146a94 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 @@ -608,6 +608,7 @@ public class AddressBasedDestinationTest extends QpidBrokerTestCase } /** + * Test Goal : Verify the default subjects used for each exchange type. * The default for amq.topic is "#" and for the rest it's "" */ public void testDefaultSubjects() throws Exception @@ -635,4 +636,43 @@ public class AddressBasedDestinationTest extends QpidBrokerTestCase "with '#' binding key should have received the message ", ((TextMessage)topicCons.receive(1000)).getText(),"1000"); } + + /** + * Test Goal : Verify that 'mode : browse' works as expected using a regular consumer. + * This indirectly tests ring queues as well. + */ + public void testBrowseMode() throws Exception + { + + Session ssn = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE); + + String addr = "ADDR:my-ring-queue; {create: always, mode: browse, " + + "node: {x-bindings: [{exchange : 'amq.direct', key : test}], " + + "x-declare:{'qpid.policy_type':ring, 'qpid.max_count':2}}}"; + + Destination dest = ssn.createQueue(addr); + MessageConsumer browseCons = ssn.createConsumer(dest); + MessageProducer prod = ssn.createProducer(ssn.createQueue("ADDR:amq.direct/test")); + + prod.send(ssn.createTextMessage("Test1")); + prod.send(ssn.createTextMessage("Test2")); + + TextMessage msg = (TextMessage)browseCons.receive(1000); + assertEquals("Didn't receive the first message",msg.getText(),"Test1"); + + msg = (TextMessage)browseCons.receive(1000); + assertEquals("Didn't receive the first message",msg.getText(),"Test2"); + + browseCons.close(); + prod.send(ssn.createTextMessage("Test3")); + browseCons = ssn.createConsumer(dest); + + msg = (TextMessage)browseCons.receive(1000); + assertEquals("Should receive the second message again",msg.getText(),"Test2"); + + msg = (TextMessage)browseCons.receive(1000); + assertEquals("Should receive the third message since it's a ring queue",msg.getText(),"Test3"); + + assertNull("Should not receive anymore messages",browseCons.receive(500)); + } } |
