You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2009/09/01 12:23:04 UTC

svn commit: r809957 - /qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java

Author: ritchiem
Date: Tue Sep  1 10:23:04 2009
New Revision: 809957

URL: http://svn.apache.org/viewvc?rev=809957&view=rev
Log:
QPID-2059 : Add some validation to verify suspension has been lifted correctly.

Modified:
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java?rev=809957&r1=809956&r2=809957&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java Tue Sep  1 10:23:04 2009
@@ -29,6 +29,7 @@
 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 @@
 
         //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<String> 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.



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org