From 0146109d6a06f9702f245034a43c49dffc5779bd Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Wed, 3 May 2017 16:12:01 -0400 Subject: [PATCH] ARTEMIS-1140: Trivial test fix --- .../artemis/jms/tests/ActiveMQServerTestCase.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java index 3fae9525bb..c5128d43c6 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java @@ -350,7 +350,15 @@ public abstract class ActiveMQServerTestCase { if (binding != null && binding instanceof LocalQueueBinding) { ((LocalQueueBinding) binding).getQueue().flushExecutor(); } - Long messageCount = ActiveMQServerTestCase.servers.get(0).getMessageCountForQueue(queueName); + Long messageCount = null; + for (int i = 0; i < 10; i++) { + messageCount = servers.get(0).getMessageCountForQueue(queueName); + if (messageCount.longValue() == expected) { + break; + } else { + Thread.sleep(100); + } + } ProxyAssertSupport.assertEquals(expected, messageCount.intValue()); return expected == messageCount.intValue();