You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2013/09/30 09:17:46 UTC

[2/2] git commit: Added test based on user forum issue

Added test based on user forum issue


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/21b407b0
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/21b407b0
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/21b407b0

Branch: refs/heads/camel-2.12.x
Commit: 21b407b07d3bb5da213b8307cee0adbf91bad040
Parents: a18b88c
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Sep 30 09:16:46 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Sep 30 09:17:34 2013 +0200

----------------------------------------------------------------------
 ...isabledButJMSReplyToHeaderPreservedTest.java | 67 ++++++++++++++++++++
 1 file changed, 67 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/21b407b0/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOnlyWithReplyToDisabledButJMSReplyToHeaderPreservedTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOnlyWithReplyToDisabledButJMSReplyToHeaderPreservedTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOnlyWithReplyToDisabledButJMSReplyToHeaderPreservedTest.java
new file mode 100644
index 0000000..d779a1b
--- /dev/null
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOnlyWithReplyToDisabledButJMSReplyToHeaderPreservedTest.java
@@ -0,0 +1,67 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jms;
+
+import javax.jms.ConnectionFactory;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+import static org.apache.camel.component.jms.JmsComponent.jmsComponentAutoAcknowledge;
+
+/**
+ * @version 
+ */
+public class JmsInOnlyWithReplyToDisabledButJMSReplyToHeaderPreservedTest extends CamelTestSupport {
+
+    @Test
+    public void testJMSReplyToHeaderPreserved() throws Exception {
+        getMockEndpoint("mock:foo").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:foo").expectedHeaderReceived("JMSReplyTo", "queue://bar");
+        getMockEndpoint("mock:done").expectedBodiesReceived("Hello World");
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext camelContext = super.createCamelContext();
+        ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
+        camelContext.addComponent("activemq", jmsComponentAutoAcknowledge(connectionFactory));
+        return camelContext;
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                    // must use preserveMessageQos to include JMSReplyTo
+                    .to("activemq:queue:foo?replyTo=queue:bar&preserveMessageQos=true")
+                    .to("mock:done");
+
+                // and disable reply to as we do not want to send back a reply message in this route
+                from("activemq:queue:foo?disableReplyTo=true")
+                    .to("log:foo?showAll=true", "mock:foo");
+            }
+        };
+    }
+}