Author: davsclaus
Date: Tue Jul 8 10:22:22 2008
New Revision: 674890
URL: http://svn.apache.org/viewvc?rev=674890&view=rev
Log:
JMS concurrent consumers with JMSReply (InOut MEP) unit test based on user
request on forum. Now with timing assertions.
Modified:
activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsConcurrentConsumersTest.java
Modified:
activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsConcurrentConsumersTest.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsConcurrentConsumersTest.java?rev=674890&r1=674889&r2=674890&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsConcurrentConsumersTest.java
(original)
+++
activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsConcurrentConsumersTest.java
Tue Jul 8 10:22:22 2008
@@ -37,6 +37,7 @@
public void testConcurrentConsumersWithReply() throws Exception {
// latch for the 5 exchanges we expect
final CountDownLatch latch = new CountDownLatch(5);
+ long start = System.currentTimeMillis();
// setup a task executor to be able send the messages in parallel
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
@@ -56,6 +57,9 @@
// wait for test completion, timeout after 30 sec to let other unit
test run to not wait forever
latch.await(30000L, TimeUnit.MILLISECONDS);
assertEquals("Latch should be zero", 0, latch.getCount());
+
+ long delta = System.currentTimeMillis() - start;
+ assertTrue("Should be faster than 10000 millis, took " + delta + "
millis", delta < 10000L);
}
protected CamelContext createCamelContext() throws Exception {
@@ -76,8 +80,8 @@
from("activemq:b?concurrentConsumers=3").process(new
Processor() {
public void process(Exchange exchange) throws Exception {
String body = exchange.getIn().getBody(String.class);
- // sleep a little for concurrency issues
- Thread.sleep(1000);
+ // sleep a little to simulate heacy work and force
concurrency processing
+ Thread.sleep(3000);
exchange.getOut().setBody("Bye " + body);
}
});