From effe95c0bad05e4888e9f71b9284213e191ede71 Mon Sep 17 00:00:00 2001 From: Erich Duda Date: Fri, 30 Oct 2015 09:18:45 +0100 Subject: [PATCH] ARTEMIS-290 PageCountSyncOnNonTXTest.testSendNoTx: fails on slower machines --- .../paging/PageCountSyncOnNonTXTest.java | 16 +++++++++++++++- .../integration/paging/PageCountSyncServer.java | 5 +++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncOnNonTXTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncOnNonTXTest.java index cd8be0beb3..ae68d0dc3a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncOnNonTXTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncOnNonTXTest.java @@ -30,8 +30,13 @@ import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.junit.Before; import org.junit.Test; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + public class PageCountSyncOnNonTXTest extends ActiveMQTestBase { + public static final String WORD_START = "&*STARTED&*"; + // We will add a random factor on the wait time private long timeToRun; @@ -49,7 +54,16 @@ public class PageCountSyncOnNonTXTest extends ActiveMQTestBase { public void testSendNoTx() throws Exception { String QUEUE_NAME = "myQueue"; - process = PageCountSyncServer.spawnVM(getTestDir(), timeToRun); + final CountDownLatch latch = new CountDownLatch(1); + Runnable runnable = new Runnable() { + @Override + public void run() { + latch.countDown(); + } + }; + + process = PageCountSyncServer.spawnVMWithLogMacher(WORD_START, runnable, getTestDir(), timeToRun); + assertTrue("Server didn't start in 30 seconds", latch.await(30, TimeUnit.SECONDS)); ServerLocator locator = createNettyNonHALocator(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncServer.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncServer.java index ab3e1bc010..982dfe0faa 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncServer.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncServer.java @@ -30,6 +30,10 @@ public class PageCountSyncServer extends SpawnedServerSupport { return SpawnedVMSupport.spawnVM(PageCountSyncServer.class.getName(), testDir, "" + timeToRun); } + public static Process spawnVMWithLogMacher(final String wordMatch, final Runnable runnable, final String testDir, final long timeToRun) throws Exception { + return SpawnedVMSupport.spawnVMWithLogMacher(wordMatch, runnable, PageCountSyncServer.class.getName(), null, true, testDir, "" + timeToRun); + } + public void perform(final String folder, final long timeToRun) throws Exception { try { @@ -37,6 +41,7 @@ public class PageCountSyncServer extends SpawnedServerSupport { server.start(); + System.out.println(PageCountSyncOnNonTXTest.WORD_START); System.out.println("Server started!!!"); System.out.println("Waiting " + timeToRun + " seconds");