summaryrefslogtreecommitdiff
path: root/java/systests/src
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2010-01-19 19:26:30 +0000
committerMartin Ritchie <ritchiem@apache.org>2010-01-19 19:26:30 +0000
commit869426dba3c152af0403dd2a87c50a98298317c6 (patch)
treec5267355245c5ceb75e3b5d34ae3511ab7582592 /java/systests/src
parent804201b2f47d74d90cf7ad791e85ddda6305af9c (diff)
downloadqpid-python-869426dba3c152af0403dd2a87c50a98298317c6.tar.gz
QPID-1825 : Updated test to only start the 'clock' for timeout when the message count on the queue hasn't changed after a 100ms sleep.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@900919 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/systests/src')
-rw-r--r--java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java b/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
index 428368f859..c73959676d 100644
--- a/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
+++ b/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
@@ -177,15 +177,26 @@ public class TimeToLiveTest extends QpidTestCase
{
producer.send(producerSession.createTextMessage("Message: "+i));
}
- long failureTime = System.currentTimeMillis() + 2*SERVER_TTL_TIMEOUT;
+ long failureTime = System.currentTimeMillis() + 2 * SERVER_TTL_TIMEOUT;
- // check Queue depth for up to TIMEOUT seconds
- long messageCount;
+ // check Queue depth for up to TIMEOUT seconds after the Queue Depth hasn't changed for 100ms.
+ long messageCount = MSG_COUNT;
+ long lastPass;
do
{
+ lastPass = messageCount;
Thread.sleep(100);
messageCount = producerSession.getQueueDepth((AMQDestination) queue);
+
+ // If we have received messages in the last loop then extend the timeout time.
+ // if we get messages stuck that are not expiring then the failureTime will occur
+ // failing the test. This will help with the scenario when the broker does not
+ // have enough CPU cycles to process the TTLs.
+ if (lastPass != messageCount)
+ {
+ failureTime = System.currentTimeMillis() + 2 * SERVER_TTL_TIMEOUT;
+ }
}
while(messageCount > 0L && System.currentTimeMillis() < failureTime);