From e366fbe041f11c5fec4f864e4f1dc25f19731482 Mon Sep 17 00:00:00 2001 From: Martin Ritchie Date: Tue, 1 Sep 2009 10:23:04 +0000 Subject: QPID-2059 : Add some validation to verify suspension has been lifted correctly. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@809957 13f79535-47bb-0310-9956-ffa450edef68 --- .../server/logging/SubscriptionLoggingTest.java | 33 ++++++++++++---------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'java') diff --git a/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java b/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java index 033c0533f8..3326ad0dd1 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java @@ -29,6 +29,7 @@ import javax.jms.MessageConsumer; import javax.jms.Queue; import javax.jms.Session; import javax.jms.Topic; +import javax.jms.Message; import java.io.IOException; import java.util.List; @@ -335,31 +336,33 @@ public class SubscriptionLoggingTest extends AbstractTestLogging //Fill the prefetch and two extra so that our receive bellow allows the // subscription to become active then return to a suspended state. - sendMessage(_session, _queue, 17); + int SEND_COUNT = 17; + sendMessage(_session, _queue, SEND_COUNT); _session.commit(); // Retreive the first message, and start the flow of messages - assertNotNull("First message not retreived", consumer.receive(1000)); + Message msg = consumer.receive(1000); + assertNotNull("First message not retreived", msg); _session.commit(); //Validate List results = _monitor.findMatches("SUB-1003"); - - int i = 0; - while (results.size() != 3 && i < 10) + + // It has been seen on occasion that we do not get 3 messages logged. + // This could indicate that the broker has not received the above commit + + // Check that we can received all the messages + int receivedCount = 0; + while (msg != null) { - try - { - Thread.sleep(1500); - } - catch (InterruptedException e) - { - - } - results = _monitor.findMatches("SUB-1003"); - i++; + receivedCount++; + msg = consumer.receive(1000); + _session.commit(); } + System.err.println("All messasges received correctly."); + assertEquals("Not all sent messages received.", SEND_COUNT, receivedCount); + try { // Validation expects three messages. -- cgit v1.2.1