You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2013/09/24 01:50:32 UTC

svn commit: r1525750 - /qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java

Author: robbie
Date: Mon Sep 23 23:50:31 2013
New Revision: 1525750

URL: http://svn.apache.org/r1525750
Log:
QPID-5161: prevent StoreOverfullTest from infinite looping if the client isn't flow controlled as expected

Modified:
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java?rev=1525750&r1=1525749&r2=1525750&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java Mon Sep 23 23:50:31 2013
@@ -106,9 +106,15 @@ public class StoreOverfullTest extends Q
 
         MessageSender sender = sendMessagesAsync(_producer, _producerSession, TEST_SIZE, 50L, sentMessages);
 
+        long timeoutPoint = System.currentTimeMillis() + 20 * 1000;
+
         while(!((AMQSession<?,?>)_producerSession).isFlowBlocked())
         {
             Thread.sleep(100l);
+            if(System.currentTimeMillis() > timeoutPoint)
+            {
+                throw new RuntimeException("Timed out waiting for session to be blocked");
+            }
         }
         int sentCount = sentMessages.get();
         assertFalse("Did not block before sending all messages", TEST_SIZE == sentCount);
@@ -168,17 +174,28 @@ public class StoreOverfullTest extends Q
         sendMessagesAsync(_producer, _producerSession, TEST_SIZE, 50L, sentMessages);
         sendMessagesAsync(secondProducer, secondProducerSession, TEST_SIZE, 50L, sentMessages2);
 
+        long timeoutPoint = System.currentTimeMillis() + 20 * 1000;
+
         while(!((AMQSession<?,?>)_producerSession).isFlowBlocked())
         {
             Thread.sleep(100l);
+            if(System.currentTimeMillis() > timeoutPoint)
+            {
+                throw new RuntimeException("Timed out waiting for session to be blocked");
+            }
         }
         int sentCount = sentMessages.get();
         assertFalse("Did not block before sending all messages", TEST_SIZE == sentCount);
 
+        timeoutPoint = System.currentTimeMillis() + 20 * 1000;
 
         while(!((AMQSession<?,?>)secondProducerSession).isFlowBlocked())
         {
             Thread.sleep(100l);
+            if(System.currentTimeMillis() > timeoutPoint)
+            {
+                throw new RuntimeException("Timed out waiting for second session to be blocked");
+            }
         }
         int sentCount2 = sentMessages2.get();
         assertFalse("Did not block before sending all messages", TEST_SIZE == sentCount2);
@@ -220,18 +237,30 @@ public class StoreOverfullTest extends Q
 
         sendMessagesAsync(_producer, _producerSession, TEST_SIZE, 50L, sentMessages);
 
+        long timeoutPoint = System.currentTimeMillis() + 20 * 1000;
+
         while(!((AMQSession<?,?>)_producerSession).isFlowBlocked())
         {
             Thread.sleep(100l);
+            if(System.currentTimeMillis() > timeoutPoint)
+            {
+                throw new RuntimeException("Timed out waiting for session to be blocked");
+            }
         }
         int sentCount = sentMessages.get();
         assertFalse("Did not block before sending all messages", TEST_SIZE == sentCount);
 
         sendMessagesAsync(secondProducer, secondProducerSession, TEST_SIZE, 50L, sentMessages2);
 
+        timeoutPoint = System.currentTimeMillis() + 20 * 1000;
+
         while(!((AMQSession<?,?>)_producerSession).isFlowBlocked())
         {
             Thread.sleep(100l);
+            if(System.currentTimeMillis() > timeoutPoint)
+            {
+                throw new RuntimeException("Timed out waiting for session to be blocked");
+            }
         }
         int sentCount2 = sentMessages2.get();
         assertFalse("Did not block before sending all messages", TEST_SIZE == sentCount2);



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org