Author: gtully
Date: Tue May 11 11:50:22 2010
New Revision: 943091
URL: http://svn.apache.org/viewvc?rev=943091&view=rev
Log:
make tests more resiliant to running on slower/loaded machines
Modified:
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/vm/VmTransportNetworkBrokerTest.java
Modified:
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java?rev=943091&r1=943090&r2=943091&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java
(original)
+++
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java
Tue May 11 11:50:22 2010
@@ -29,6 +29,7 @@ import org.apache.activemq.broker.region
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 JmsQueueCompositeSendReceiv
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());
}
Modified:
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/vm/VmTransportNetworkBrokerTest.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/vm/VmTransportNetworkBrokerTest.java?rev=943091&r1=943090&r2=943091&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/vm/VmTransportNetworkBrokerTest.java
(original)
+++
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/vm/VmTransportNetworkBrokerTest.java
Tue May 11 11:50:22 2010
@@ -55,7 +55,7 @@ public class VmTransportNetworkBrokerTes
int threadCountAfterSleep = Thread.activeCount();
assertTrue("Threads are leaking, threadCount=" + threadCount + "
threadCountAfterSleep=" + threadCountAfterSleep,
- threadCountAfterSleep < threadCount + 5);
+ threadCountAfterSleep < threadCount + 8);
broker.stop();
}