ARTEMIS-290 PageCountSyncOnNonTXTest.testSendNoTx: fails on slower machines

This commit is contained in:
Erich Duda 2015-10-30 09:18:45 +01:00
parent 73f8fbf4c7
commit effe95c0ba
2 changed files with 20 additions and 1 deletions

View File

@ -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();

View File

@ -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");