more hardening for intermittent failure

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@799631 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2009-07-31 15:06:27 +00:00
parent c20430459a
commit 9caa5c8d4d
1 changed files with 7 additions and 1 deletions

View File

@ -51,6 +51,7 @@ import org.apache.activemq.command.ActiveMQTopic;
import org.apache.activemq.store.PersistenceAdapter; import org.apache.activemq.store.PersistenceAdapter;
import org.apache.activemq.store.amq.AMQPersistenceAdapter; import org.apache.activemq.store.amq.AMQPersistenceAdapter;
import org.apache.activemq.store.amq.AMQPersistenceAdapterFactory; import org.apache.activemq.store.amq.AMQPersistenceAdapterFactory;
import org.apache.activemq.util.Wait;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -273,9 +274,14 @@ public class DurableConsumerTest extends TestCase {
} }
} }
Thread.sleep(2000);
executor.shutdown(); executor.shutdown();
executor.awaitTermination(30, TimeUnit.SECONDS); 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("got some messages: " + receivedCount.get(), receivedCount.get() > numMessages);
assertTrue("no exceptions, but: " + exceptions, exceptions.isEmpty()); assertTrue("no exceptions, but: " + exceptions, exceptions.isEmpty());
} }