make tests more resiliant to running on slower/loaded machines

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@943091 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2010-05-11 11:50:22 +00:00
parent 4a2b796acc
commit 0e1d63269d
2 changed files with 8 additions and 3 deletions

View File

@ -29,6 +29,7 @@ import org.apache.activemq.broker.region.RegionBroker;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.test.JmsTopicSendReceiveTest;
import org.apache.activemq.util.Wait;
/**
@ -106,8 +107,12 @@ public class JmsQueueCompositeSendReceiveTest extends JmsTopicSendReceiveTest {
Thread.sleep(200); // wait for messages to be queued
BrokerService broker = BrokerRegistry.getInstance().lookup("localhost");
Queue dest = (Queue)((RegionBroker)broker.getRegionBroker()).getQueueRegion().getDestinationMap().get(new ActiveMQQueue("TEST"));
assertEquals(data.length, dest.getDestinationStatistics().getMessages().getCount());
final Queue dest = (Queue)((RegionBroker)broker.getRegionBroker()).getQueueRegion().getDestinationMap().get(new ActiveMQQueue("TEST"));
assertTrue("all messages were received", Wait.waitFor(new Wait.Condition(){
public boolean isSatisified() throws Exception {
return data.length == dest.getDestinationStatistics().getMessages().getCount();
}}));
dest.purge();
assertEquals(0, dest.getDestinationStatistics().getMessages().getCount());
}

View File

@ -55,7 +55,7 @@ public class VmTransportNetworkBrokerTest extends TestCase {
int threadCountAfterSleep = Thread.activeCount();
assertTrue("Threads are leaking, threadCount=" + threadCount + " threadCountAfterSleep=" + threadCountAfterSleep,
threadCountAfterSleep < threadCount + 5);
threadCountAfterSleep < threadCount + 8);
broker.stop();
}