summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2013-09-23 23:50:31 +0000
committerRobert Gemmell <robbie@apache.org>2013-09-23 23:50:31 +0000
commitf0261d72e3f630feda33958e1ce171e98456ea1c (patch)
treea5ac3b1c4158c01bc8fba1e5b327b28a04cf2034 /qpid/java
parentd87fdf58eb371b1c95951bb6dd83a0ac85cb6b23 (diff)
downloadqpid-python-f0261d72e3f630feda33958e1ce171e98456ea1c.tar.gz
QPID-5161: prevent StoreOverfullTest from infinite looping if the client isn't flow controlled as expected
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1525750 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java
index 61ca6d9c28..c4b16133f0 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java
@@ -106,9 +106,15 @@ public class StoreOverfullTest extends QpidBrokerTestCase
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 QpidBrokerTestCase
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 QpidBrokerTestCase
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);