camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [1/2] git commit: Added an unit test to show how to set the get parameters from message header dynamically
Date Mon, 30 Jun 2014 04:15:21 GMT
Repository: camel
Updated Branches:
  refs/heads/master b19004f30 -> ed13d4ee0


Added an unit test to show how to set the get parameters from message header dynamically


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

Branch: refs/heads/master
Commit: 01d3dad9d4beaf371290c10ded5017fe7f7e467a
Parents: b19004f
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Mon Jun 30 12:14:19 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Mon Jun 30 12:14:19 2014 +0800

----------------------------------------------------------------------
 .../component/jetty/JettyHttpGetWithParamTest.java   | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/01d3dad9/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamTest.java
b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamTest.java
index 9e6f8f5..c2aeecb 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamTest.java
@@ -55,10 +55,25 @@ public class JettyHttpGetWithParamTest extends BaseJettyTest {
         assertMockEndpointsSatisfied();
     }
 
+    @Test
+    public void testHttpGetFromOtherRoute() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Bye World");
+        mock.expectedHeaderReceived("one", "eins");
+        mock.expectedHeaderReceived("two", "zwei");
+
+        template.requestBodyAndHeader("direct:start", "Hello World", "parameters", "one=uno&two=dos");
+
+        assertMockEndpointsSatisfied();
+    }
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
                 from("jetty:" + serverUri).process(processor).to("mock:result");
+                from("direct:start")
+                    .setHeader(Exchange.HTTP_METHOD, constant("GET"))
+                    .setHeader(Exchange.HTTP_URI, simple(serverUri + "?${in.headers.parameters}"))
+                    .to("http://example");
             }
         };
     }


Mime
View raw message