[ARTEMIS-1209] Just enhancing the OpenWire test with a Wait.waitFor()
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/4e173cfa Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/4e173cfa Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/4e173cfa Branch: refs/heads/master Commit: 4e173cfa8e61406650de08caba6c16f7ec4339ca Parents: 45321c6 Author: Clebert Suconic <[email protected]> Authored: Wed Jun 7 16:26:25 2017 -0400 Committer: Clebert Suconic <[email protected]> Committed: Wed Jun 7 16:27:16 2017 -0400 ---------------------------------------------------------------------- .../tests/integration/openwire/SimpleOpenWireTest.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/4e173cfa/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java index cb4bd11..a41acc6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java @@ -63,6 +63,7 @@ import org.apache.activemq.artemis.core.postoffice.PostOffice; import org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; +import org.apache.activemq.artemis.tests.util.Wait; import org.apache.activemq.command.ActiveMQQueue; import org.apache.activemq.command.ActiveMQTopic; import org.junit.Assert; @@ -1478,9 +1479,9 @@ public class SimpleOpenWireTest extends BasicOpenWireTest { subscriber.setMessageListener(receivedMessages::add); topicConnection.start(); - while (receivedMessages.size() == 0) { - Thread.sleep(1000); - } + Wait.waitFor(() -> receivedMessages.size() > 0); + + Assert.assertTrue(receivedMessages.size() > 0); for (Message message : receivedMessages) { assertNotNull(message);
