From 9caa5c8d4d8281539670e1c1b623173aa814fbe2 Mon Sep 17 00:00:00 2001 From: Gary Tully Date: Fri, 31 Jul 2009 15:06:27 +0000 Subject: [PATCH] more hardening for intermittent failure git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@799631 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/activemq/bugs/DurableConsumerTest.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/activemq-core/src/test/java/org/apache/activemq/bugs/DurableConsumerTest.java b/activemq-core/src/test/java/org/apache/activemq/bugs/DurableConsumerTest.java index 749ee181b1..81dfa2dd35 100755 --- a/activemq-core/src/test/java/org/apache/activemq/bugs/DurableConsumerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/bugs/DurableConsumerTest.java @@ -51,6 +51,7 @@ import org.apache.activemq.command.ActiveMQTopic; import org.apache.activemq.store.PersistenceAdapter; import org.apache.activemq.store.amq.AMQPersistenceAdapter; import org.apache.activemq.store.amq.AMQPersistenceAdapterFactory; +import org.apache.activemq.util.Wait; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -273,9 +274,14 @@ public class DurableConsumerTest extends TestCase { } } - Thread.sleep(2000); executor.shutdown(); executor.awaitTermination(30, TimeUnit.SECONDS); + + Wait.waitFor(new Wait.Condition() { + public boolean isSatisified() throws Exception { + return receivedCount.get() > numMessages; + } + }); assertTrue("got some messages: " + receivedCount.get(), receivedCount.get() > numMessages); assertTrue("no exceptions, but: " + exceptions, exceptions.isEmpty()); }