From b7fcbdb8db0f9d210c107db77cf5d16af366b3fd Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Wed, 11 Jan 2012 02:12:48 +0000 Subject: NO_JIRA Modified the test to stop the connection to ensure the consumer doesn't prefetch the messages until after the first message is replaced. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1229858 13f79535-47bb-0310-9956-ffa450edef68 --- .../qpid/test/client/queue/QueuePolicyTest.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'qpid') diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/queue/QueuePolicyTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/queue/QueuePolicyTest.java index e3557efd97..e7c3fad27d 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/queue/QueuePolicyTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/queue/QueuePolicyTest.java @@ -53,6 +53,10 @@ public class QueuePolicyTest extends QpidBrokerTestCase super.tearDown(); } + /** + * Test Goal : To create a ring queue programitcally with max queue count using the + * address string and observe that it works as expected. + */ public void testRejectPolicy() throws Exception { String addr = "ADDR:queue; {create: always, " + @@ -82,6 +86,10 @@ public class QueuePolicyTest extends QpidBrokerTestCase } } + /** + * Test Goal : To create a ring queue programitcally using the address string and observe + * that it works as expected. + */ public void testRingPolicy() throws Exception { Session ssn = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE); @@ -94,17 +102,18 @@ public class QueuePolicyTest extends QpidBrokerTestCase MessageConsumer consumer = ssn.createConsumer(dest); MessageProducer prod = ssn.createProducer(ssn.createQueue("ADDR:amq.direct/test")); + _connection.stop(); + prod.send(ssn.createTextMessage("Test1")); prod.send(ssn.createTextMessage("Test2")); prod.send(ssn.createTextMessage("Test3")); + + _connection.start(); TextMessage msg = (TextMessage)consumer.receive(1000); - assertEquals("The consumer should receive the msg with body='Test2'",msg.getText(),"Test2"); + assertEquals("The consumer should receive the msg with body='Test2'","Test2",msg.getText()); msg = (TextMessage)consumer.receive(1000); - assertEquals("The consumer should receive the msg with body='Test3'",msg.getText(),"Test3"); - - prod.send(ssn.createTextMessage("Test4")); - assertEquals("The consumer should receive the msg with body='Test4'",msg.getText(),"Test3"); + assertEquals("The consumer should receive the msg with body='Test3'","Test3",msg.getText()); } } -- cgit v1.2.1