From d507154be94ec0ac45e796e26a6c913369052c74 Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Mon, 7 Jun 2010 20:55:38 +0000 Subject: For testOderingWithSyncConsumer I added a timeout for the individual receive() methods, and another timeout for the while loop to prevent the test from hanging in case of an error. For testOderingWithAsyncConsumer I increased the timeout to 8 secs as there have been occasional failures with the test not being completed inside 5 secs. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@952430 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/qpid/test/unit/ack/RecoverTest.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'qpid/java') diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/RecoverTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/RecoverTest.java index a3dd7e4a99..5e7ba5482d 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/RecoverTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/RecoverTest.java @@ -339,10 +339,18 @@ public class RecoverTest extends FailoverBaseCase int messageSeen = 0; int expectedMsg = 0; - // need to add a timer here as well. + long startTime = System.currentTimeMillis(); + while(expectedMsg < 8) { - Message message = cons.receive(); + // Based on historical data, on average the test takes about 6 secs to complete. + if (System.currentTimeMillis() - startTime > 8000) + { + fail("Test did not complete on time. Received " + + expectedMsg + " msgs so far. Please check the logs"); + } + + Message message = cons.receive(2000); String text=((TextMessage) message).getText(); assertEquals("Received Message Out Of Order","Msg"+expectedMsg,text); @@ -430,7 +438,8 @@ public class RecoverTest extends FailoverBaseCase synchronized(lock) { - lock.wait(5000); + // Based on historical data, on average the test takes about 6 secs to complete. + lock.wait(8000); } if (!pass.get()) -- cgit v1.2.1