add autofail

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1159168 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2011-08-18 11:14:49 +00:00
parent c2179d15b7
commit 039b646b4e
1 changed files with 5 additions and 2 deletions

View File

@ -67,12 +67,14 @@ public class OnePrefetchAsyncConsumerTest extends EmbeddedBrokerTestSupport {
// wait for test to complete and the test result to get set
// this happens asynchronously since the messages are delivered asynchronously
long done = System.currentTimeMillis() + getMaxTestTime();
synchronized (testMutex) {
while (!testMutex.testCompleted) {
while (!testMutex.testCompleted && System.currentTimeMillis() < done) {
testMutex.wait();
}
}
assertTrue("completed on time", testMutex.testCompleted);
//test completed, result is ready
assertTrue("Attempted to retrieve more than one ServerSession at a time", testMutex.testSuccessful);
}
@ -177,7 +179,7 @@ public class OnePrefetchAsyncConsumerTest extends EmbeddedBrokerTestSupport {
// let the test check if the test was completed
synchronized (testMutex) {
testMutex.notify();
testMutex.notifyAll();
}
}
}.start();
@ -197,6 +199,7 @@ public class OnePrefetchAsyncConsumerTest extends EmbeddedBrokerTestSupport {
if (!testMutex.testCompleted) {
testMutex.testSuccessful = true;
testMutex.testCompleted = true;
testMutex.notifyAll();
}
}
}