Repository: camel Updated Branches: refs/heads/camel-2.13.x 785cbc8cd -> ff82f3869 refs/heads/camel-2.14.x eb033ec0d -> 73c5d2c08
Fixed the intermittent error of JmsRequestReplyCorrelationTest Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/026f6542 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/026f6542 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/026f6542 Branch: refs/heads/camel-2.14.x Commit: 026f6542e0fc1a6bd8a69f277abb3030a9c36df0 Parents: eb033ec Author: Willem Jiang <willem.ji...@gmail.com> Authored: Wed Feb 4 14:43:47 2015 +0800 Committer: Willem Jiang <willem.ji...@gmail.com> Committed: Wed Feb 4 21:05:21 2015 +0800 ---------------------------------------------------------------------- .../camel/component/jms/JmsRequestReplyCorrelationTest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/026f6542/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyCorrelationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyCorrelationTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyCorrelationTest.java index 634e975..6e31aad 100644 --- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyCorrelationTest.java +++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyCorrelationTest.java @@ -16,6 +16,8 @@ */ package org.apache.camel.component.jms; +import java.util.concurrent.TimeUnit; + import javax.jms.ConnectionFactory; import org.apache.camel.CamelContext; @@ -23,11 +25,11 @@ import org.apache.camel.Exchange; import org.apache.camel.ExchangePattern; import org.apache.camel.Message; import org.apache.camel.Processor; +import org.apache.camel.builder.NotifyBuilder; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; - import static org.apache.camel.component.jms.JmsComponent.jmsComponentAutoAcknowledge; /** @@ -71,6 +73,7 @@ public class JmsRequestReplyCorrelationTest extends CamelTestSupport { public void testRequestReplyCorrelationWithDuplicateId() throws Exception { MockEndpoint result = getMockEndpoint("mock:result"); result.expectedMessageCount(1); + NotifyBuilder notify = new NotifyBuilder(context).whenReceived(1).create(); // just send out the request to fill the correlation id first template.asyncSend("jms:queue:helloDelay", new Processor() { @@ -81,6 +84,8 @@ public class JmsRequestReplyCorrelationTest extends CamelTestSupport { in.setHeader("JMSCorrelationID", "b"); } }); + // Added use the notify to make sure the message is processed, so we get the exception later + notify.matches(1, TimeUnit.SECONDS); Exchange out = template.send("jms:queue:helloDelay", ExchangePattern.InOut, new Processor() { public void process(Exchange exchange) throws Exception {