Repository: activemq-artemis Updated Branches: refs/heads/master 2968e0a7d -> 303d97c76
NO-JIRA: Trivial test fixes Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/303d97c7 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/303d97c7 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/303d97c7 Branch: refs/heads/master Commit: 303d97c76d439aa861c16e75f79070fe222c1a48 Parents: 2968e0a Author: Clebert Suconic <[email protected]> Authored: Wed May 3 09:33:12 2017 -0400 Committer: Clebert Suconic <[email protected]> Committed: Wed May 3 10:32:22 2017 -0400 ---------------------------------------------------------------------- .../artemis/tests/integration/server/LVQTest.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/303d97c7/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/LVQTest.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/LVQTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/LVQTest.java index 8eabb28..9cc87b3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/LVQTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/LVQTest.java @@ -29,6 +29,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; +import org.apache.activemq.artemis.tests.util.Wait; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -506,7 +507,7 @@ public class LVQTest extends ActiveMQTestBase { @Test public void testScheduledMessages() throws Exception { - final long DELAY_TIME = 5000; + final long DELAY_TIME = 10; final int MESSAGE_COUNT = 5; Queue queue = server.locateQueue(qName1); ClientProducer producer = clientSession.createProducer(address); @@ -518,25 +519,16 @@ public class LVQTest extends ActiveMQTestBase { m.setDurable(true); m.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); timeSent = System.currentTimeMillis(); - m.putLongProperty(Message.HDR_SCHEDULED_DELIVERY_TIME, timeSent + DELAY_TIME); + m.putLongProperty(Message.HDR_SCHEDULED_DELIVERY_TIME, timeSent + (i * DELAY_TIME)); producer.send(m); - Thread.sleep(100); } // allow schedules to elapse so the messages will be delivered to the queue - long start = System.currentTimeMillis(); - while (queue.getScheduledCount() > 0 && System.currentTimeMillis() - start <= DELAY_TIME) { - Thread.sleep(50); - } - - assertTrue(queue.getScheduledCount() == 0); + Wait.waitFor(() -> queue.getScheduledCount() == 0); clientSession.start(); - ClientMessage m = consumer.receive(DELAY_TIME); + ClientMessage m = consumer.receive(5000); assertNotNull(m); - long actualDelay = System.currentTimeMillis() - timeSent + 50; - assertTrue(actualDelay >= DELAY_TIME); - m.acknowledge(); assertEquals(m.getBodyBuffer().readString(), "m" + (MESSAGE_COUNT - 1)); assertEquals(0, queue.getScheduledCount()); }
