camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject [03/23] camel git commit: CAMEL-8239 Split jetty8 and jetty9 support into separate modules
Date Thu, 15 Jan 2015 08:48:39 GMT
http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoEndpointTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoEndpointTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoEndpointTest.java
new file mode 100644
index 0000000..bae3655
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoEndpointTest.java
@@ -0,0 +1,76 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class HttpJettyProducerTwoEndpointTest extends BaseJettyTest {
+
+    @Test
+    public void testTwoEndpoints() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        Exchange a = template.request("direct:a", null);
+        assertNotNull(a);
+
+        Exchange b = template.request("direct:b", null);
+        assertNotNull(b);
+
+        assertEquals("Bye cheese", a.getOut().getBody(String.class));
+        assertEquals(246, a.getOut().getHeader("foo", Integer.class).intValue());
+
+        assertEquals("Bye cake", b.getOut().getBody(String.class));
+        assertEquals(912, b.getOut().getHeader("foo", Integer.class).intValue());
+
+        assertEquals(5, context.getEndpoints().size());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:a").to("jetty://http://localhost:{{port}}/myapp?foo=123&bar=cheese");
+
+                from("direct:b").to("jetty://http://localhost:{{port}}/myapp?foo=456&bar=cake");
+
+                from("jetty://http://localhost:{{port}}/myapp").process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        int foo = exchange.getIn().getHeader("foo", Integer.class);
+                        String bar = exchange.getIn().getHeader("bar", String.class);
+
+                        exchange.getOut().setHeader("foo", foo * 2);
+                        exchange.getOut().setBody("Bye " + bar);
+                    }
+                });
+            }
+        };
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoParametersWithSameKeyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoParametersWithSameKeyTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoParametersWithSameKeyTest.java
new file mode 100644
index 0000000..0b9ea95
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoParametersWithSameKeyTest.java
@@ -0,0 +1,119 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class HttpJettyProducerTwoParametersWithSameKeyTest extends BaseJettyTest {
+
+    @Test
+    public void testTwoParametersWithSameKey() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        Exchange out = template.request("jetty:http://localhost:{{port}}/myapp?from=me&to=foo&to=bar", null);
+
+        assertNotNull(out);
+        assertFalse("Should not fail", out.isFailed());
+        assertEquals("OK", out.getOut().getBody(String.class));
+        assertEquals("yes", out.getOut().getHeader("bar"));
+
+        List<?> foo = out.getOut().getHeader("foo", List.class);
+        assertEquals(2, foo.size());
+        assertEquals("123", foo.get(0));
+        assertEquals("456", foo.get(1));
+    }
+
+    @Test
+    public void testTwoHeadersWithSameKeyHeader() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        Exchange out = template.request("jetty:http://localhost:{{port}}/myapp", new Processor() {
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setBody(null);
+                exchange.getIn().setHeader("from", "me");
+                List<String> list = new ArrayList<String>();
+                list.add("foo");
+                list.add("bar");
+                exchange.getIn().setHeader("to", list);
+            }
+        });
+
+        assertNotNull(out);
+        assertFalse("Should not fail", out.isFailed());
+        assertEquals("OK", out.getOut().getBody(String.class));
+        assertEquals("yes", out.getOut().getHeader("bar"));
+
+        List<?> foo = out.getOut().getHeader("foo", List.class);
+        assertNotNull(foo);
+        assertEquals(2, foo.size());
+        assertEquals("123", foo.get(0));
+        assertEquals("456", foo.get(1));
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("jetty://http://localhost:{{port}}/myapp").process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        String from = exchange.getIn().getHeader("from", String.class);
+                        assertEquals("me", from);
+
+                        List<?> values = exchange.getIn().getHeader("to", List.class);
+                        assertNotNull(values);
+                        assertEquals(2, values.size());
+                        assertEquals("foo", values.get(0));
+                        assertEquals("bar", values.get(1));
+
+                        // response
+                        exchange.getOut().setBody("OK");
+                        // use multiple values for the foo header in the reply
+                        List<Integer> list = new ArrayList<Integer>();
+                        list.add(123);
+                        list.add(456);
+                        exchange.getOut().setHeader("foo", list);
+                        exchange.getOut().setHeader("bar", "yes");
+                    }
+                });
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyUrlRewriteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyUrlRewriteTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyUrlRewriteTest.java
new file mode 100644
index 0000000..e5f4fd8
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyUrlRewriteTest.java
@@ -0,0 +1,65 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.apache.camel.component.jetty.MyUrlRewrite;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.JndiRegistry;
+import org.junit.Test;
+
+public class HttpJettyUrlRewriteTest extends BaseJettyTest {
+
+    private int port1;
+    private int port2;
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+        jndi.bind("myRewrite", new MyUrlRewrite());
+        return jndi;
+    }
+
+    @Test
+    public void testUrlRewrite() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+
+        String response = template.requestBody("jetty:http://localhost:" + port1 + "/foo?phrase=Bye", "Camel", String.class);
+        assertEquals("Get a wrong response", "Bye Camel", response);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() {
+                port1 = getPort();
+                port2 = getNextPort();
+
+                from("jetty:http://localhost:" + port1 + "?matchOnUriPrefix=true")
+                    .to("jetty:http://localhost:" + port2 + "?throwExceptionOnFailure=false&bridgeEndpoint=true&urlRewrite=#myRewrite");
+
+                from("jetty://http://localhost:" + port2 + "/bar")
+                        .transform().simple("${header.phrase} ${body}")
+                        .to("mock:result");
+            }
+        };
+    }    
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProderReturnFaultTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProderReturnFaultTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProderReturnFaultTest.java
new file mode 100644
index 0000000..628cd5b
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProderReturnFaultTest.java
@@ -0,0 +1,70 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.http.HttpOperationFailedException;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class JettyHttpProderReturnFaultTest extends BaseJettyTest {
+
+    @Test
+    public void testHttpFault() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        Exchange exchange = template.request("jetty://http://localhost:{{port}}/test", new Processor() {
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setBody("Hello World!");
+            }
+            
+        });
+        assertTrue(exchange.isFailed());
+        HttpOperationFailedException exception = exchange.getException(HttpOperationFailedException.class);
+        assertNotNull(exception);
+        assertEquals("This is a fault", exception.getResponseBody());
+        assertEquals(500, exception.getStatusCode());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("jetty://http://localhost:{{port}}/test")
+                    .process(new Processor() {
+                        public void process(Exchange exchange) throws Exception {
+                            exchange.getOut().setFault(true);
+                            exchange.getOut().setBody("This is a fault");
+                        }
+                    });
+            }
+        };
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerAsyncTimeoutTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerAsyncTimeoutTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerAsyncTimeoutTest.java
new file mode 100644
index 0000000..b84bc7a
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerAsyncTimeoutTest.java
@@ -0,0 +1,64 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import org.apache.camel.ExchangeTimedOutException;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class JettyHttpProducerAsyncTimeoutTest extends BaseJettyTest {
+
+    private String url = "jetty://http://0.0.0.0:" + getPort() + "/timeout?httpClient.timeout=2000";
+
+    @Test
+    public void testTimeout() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        getMockEndpoint("mock:result").expectedMessageCount(0);
+        getMockEndpoint("mock:error").expectedMessageCount(0);
+        getMockEndpoint("mock:timeout").expectedMessageCount(1);
+
+        template.sendBody("direct:start", null);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                onException(Exception.class).handled(true).to("mock:error");
+                onException(ExchangeTimedOutException.class).handled(true).to("mock:timeout");
+
+                from("direct:start").to(url).to("mock:result");
+
+                from(url).delay(5000).transform(constant("Bye World"));
+            }
+        };
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerAsynchronousTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerAsynchronousTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerAsynchronousTest.java
new file mode 100644
index 0000000..98ed6c5
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerAsynchronousTest.java
@@ -0,0 +1,97 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class JettyHttpProducerAsynchronousTest extends BaseJettyTest {
+
+    private static String thread1;
+    private static String thread2;
+
+    private String url = "jetty://http://0.0.0.0:" + getPort() + "/foo";
+
+    @Test
+    public void testAsynchronous() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        thread1 = "";
+        thread2 = "";
+
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+        mock.message(0).body().isEqualTo("Bye World");
+
+        Object body = null;
+        template.sendBody("direct:start", body);
+
+        assertMockEndpointsSatisfied();
+
+        assertNotSame("Should not use same threads", thread1, thread2);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start").process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        thread1 = Thread.currentThread().getName();
+                    }
+                }).to(url).process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        thread2 = Thread.currentThread().getName();
+                    }
+                }).to("mock:result");
+
+                from(url).process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        HttpServletResponse res = exchange.getIn().getBody(HttpServletResponse.class);
+                        res.setStatus(200);
+                        res.setHeader("customer", "gold");
+
+                        // write empty string to force flushing
+                        res.getWriter().write("");
+                        res.flushBuffer();
+
+                        Thread.sleep(2000);
+
+                        res.getWriter().write("Bye World");
+                        res.flushBuffer();
+                    }
+                });
+            }
+        };
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgePathWithSpacesAtEndTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgePathWithSpacesAtEndTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgePathWithSpacesAtEndTest.java
new file mode 100644
index 0000000..e33e2df
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgePathWithSpacesAtEndTest.java
@@ -0,0 +1,65 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.junit.Test;
+
+/**
+ * As {@link JettyHttpProducerBridgePathWithSpacesTest} but content path ends with a space
+ */
+public class JettyHttpProducerBridgePathWithSpacesAtEndTest extends BaseJettyTest {
+
+    private int port1;
+    private int port2;
+
+    @Test
+    public void testProxy() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        // give Jetty time to startup properly
+        Thread.sleep(2000);
+
+        String reply = template.requestBody("jetty:http://0.0.0.0:" + port1 + "/foo ", "World", String.class);
+        assertEquals("Bye World", reply);
+
+        // and with more spaces
+        String reply2 = template.requestBody("jetty:http://0.0.0.0:" + port1 + "/foo /bar baz", "Camel", String.class);
+        assertEquals("Bye Camel", reply2);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                port1 = getPort();
+                port2 = getNextPort();
+
+                from("jetty:http://0.0.0.0:" + port1 + "/foo ?matchOnUriPrefix=true")
+                    .to("jetty:http://0.0.0.0:" + port2 + "/proxy foo ?bridgeEndpoint=true&throwExceptionOnFailure=false");
+
+                from("jetty:http://0.0.0.0:" + port2 + "/proxy foo ?matchOnUriPrefix=true")
+                    .transform().simple("Bye ${body}");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgePathWithSpacesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgePathWithSpacesTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgePathWithSpacesTest.java
new file mode 100644
index 0000000..14033c6
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgePathWithSpacesTest.java
@@ -0,0 +1,61 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class JettyHttpProducerBridgePathWithSpacesTest extends BaseJettyTest {
+
+    private int port1;
+    private int port2;
+
+    @Test
+    public void testProxy() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        // give Jetty time to startup properly
+        Thread.sleep(2000);
+
+        String reply = template.requestBody("jetty:http://0.0.0.0:" + port1 + "/foo bar", "World", String.class);
+        assertEquals("Bye World", reply);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                port1 = getPort();
+                port2 = getNextPort();
+
+                from("jetty:http://0.0.0.0:" + port1 + "/foo bar?matchOnUriPrefix=true")
+                    .to("jetty:http://0.0.0.0:" + port2 + "/proxy bar?bridgeEndpoint=true&throwExceptionOnFailure=false");
+
+                from("jetty:http://0.0.0.0:" + port2 + "/proxy bar?matchOnUriPrefix=true")
+                    .transform().simple("Bye ${body}");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgeTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgeTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgeTest.java
new file mode 100644
index 0000000..569c668
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgeTest.java
@@ -0,0 +1,61 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class JettyHttpProducerBridgeTest extends BaseJettyTest {
+
+    private int port1;
+    private int port2;
+
+    @Test
+    public void testProxy() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        // give Jetty time to startup properly
+        Thread.sleep(2000);
+
+        String reply = template.requestBody("jetty:http://0.0.0.0:" + port1 + "/foo", "World", String.class);
+        assertEquals("Bye World", reply);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                port1 = getPort();
+                port2 = getNextPort();
+
+                from("jetty:http://0.0.0.0:" + port1 + "/foo")
+                    .to("jetty:http://0.0.0.0:" + port2 + "/bar?bridgeEndpoint=true&throwExceptionOnFailure=false");
+
+                from("jetty:http://0.0.0.0:" + port2 + "/bar")
+                    .transform().simple("Bye ${body}");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerConcurrentTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerConcurrentTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerConcurrentTest.java
new file mode 100644
index 0000000..7289539
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerConcurrentTest.java
@@ -0,0 +1,110 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.junit.Test;
+
+/**
+ * Jetty HTTP producer concurrent test.
+ *
+ * @version
+ */
+public class JettyHttpProducerConcurrentTest extends BaseJettyTest {
+
+    @Test
+    public void testNoConcurrentProducers() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        // give Jetty time to startup properly
+        Thread.sleep(2000);
+
+        doSendMessages(1, 1);
+    }
+
+    @Test
+    public void testConcurrentProducers() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        // give Jetty time to startup properly
+        Thread.sleep(2000);
+
+        doSendMessages(10, 5);
+    }
+
+    private void doSendMessages(int files, int poolSize) throws Exception {
+        getMockEndpoint("mock:result").expectedMessageCount(files);
+        getMockEndpoint("mock:result").assertNoDuplicates(body());
+
+        ExecutorService executor = Executors.newFixedThreadPool(poolSize);
+        // we access the responses Map below only inside the main thread,
+        // so no need for a thread-safe Map implementation
+        Map<Integer, Future<String>> responses = new HashMap<Integer, Future<String>>();
+        for (int i = 0; i < files; i++) {
+            final int index = i;
+            Future<String> out = executor.submit(new Callable<String>() {
+                public String call() throws Exception {
+                    return template.requestBody("jetty://http://localhost:{{port}}/echo", "" + index, String.class);
+                }
+            });
+            responses.put(index, out);
+        }
+
+        assertMockEndpointsSatisfied();
+
+        assertEquals(files, responses.size());
+
+        // get all responses
+        Set<String> unique = new HashSet<String>();
+        for (Future<String> future : responses.values()) {
+            unique.add(future.get());
+        }
+
+        // should be 'files' unique responses
+        assertEquals("Should be " + files + " unique responses", files, unique.size());
+        executor.shutdownNow();
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                // expose a echo service
+                from("jetty:http://localhost:{{port}}/echo")
+                        .convertBodyTo(String.class)
+                        .to("log:input")
+                        .transform(body().append(body())).to("mock:result");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerConnectionFailureTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerConnectionFailureTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerConnectionFailureTest.java
new file mode 100644
index 0000000..afadc21
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerConnectionFailureTest.java
@@ -0,0 +1,66 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import java.io.IOException;
+
+import org.apache.camel.CamelExchangeException;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+/**
+ * Unit test to verify that we can have URI options for external system (endpoint is lenient)
+ */
+public class JettyHttpProducerConnectionFailureTest extends BaseJettyTest {
+
+    private String serverUri = "jetty://http://localhost:{{port}}/myservice";
+
+    @Test
+    public void testHttpGetWithParamsViaURI() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(0);
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        // use another port with no connection
+        try {
+            template.requestBody("jetty://http://localhost:9999/myservice", null, Object.class);
+            fail("Should have thrown an exception");
+        } catch (Exception e) {
+            CamelExchangeException cause = assertIsInstanceOf(CamelExchangeException.class, e.getCause());
+            assertIsInstanceOf(IOException.class, cause.getCause());
+        }
+
+        assertMockEndpointsSatisfied();
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from(serverUri).to("mock:result");
+            }
+        };
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentBasedRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentBasedRouteTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentBasedRouteTest.java
new file mode 100644
index 0000000..53fd3a0
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentBasedRouteTest.java
@@ -0,0 +1,81 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+/**
+ * Unit test with a simple route test.
+ */
+public class JettyHttpProducerContentBasedRouteTest extends BaseJettyTest {
+
+    private String serverUri = "jetty://http://localhost:" + getPort() + "/myservice";
+
+    @Test
+    public void testSendOne() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        MockEndpoint mock = getMockEndpoint("mock:one");
+
+        mock.expectedHeaderReceived("one", "true");
+
+        template.requestBody(serverUri + "?one=true", null, Object.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testSendOther() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        MockEndpoint mock = getMockEndpoint("mock:other");
+
+        mock.expectedHeaderReceived("two", "true");
+
+        template.requestBody(serverUri + "?two=true", null, Object.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from(serverUri)
+                    .choice()
+                    .when().simple("${header.one}").to("mock:one")
+                    .otherwise()
+                    .to("mock:other");
+            }
+        };
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentTypeEncodingInQuoteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentTypeEncodingInQuoteTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentTypeEncodingInQuoteTest.java
new file mode 100644
index 0000000..57d803b
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentTypeEncodingInQuoteTest.java
@@ -0,0 +1,99 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class JettyHttpProducerContentTypeEncodingInQuoteTest extends BaseJettyTest {
+    
+    @Test
+    public void testHttpProducerEncodingInQuoteTest() throws Exception {
+        // these tests do not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMinimumMessageCount(1);
+
+        Exchange out = template.send("jetty:http://localhost:{{port}}/myapp/myservice", new Processor() {
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setBody("Hello World");
+                exchange.getIn().setHeader("Content-Type", "text/plain;charset=\"UTF-8\"");
+            }
+        });
+
+        assertMockEndpointsSatisfied();
+
+        assertEquals("OK", out.getOut().getBody(String.class));
+        // camel-jetty may remove quotes from charset
+        String res = out.getOut().getHeader("Content-Type").toString();
+        res = res.replace("\"UTF-8\"", "UTF-8");
+        assertEquals("text/plain;charset=UTF-8", res);
+    }
+
+    @Test
+    public void testHttpProducerEncodingInQuoteAndActionParameterTest() throws Exception {
+        // these tests do not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMinimumMessageCount(1);
+
+        Exchange out = template.send("jetty:http://localhost:{{port}}/myapp/myservice", new Processor() {
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setBody("Hello World");
+                exchange.getIn().setHeader("Content-Type", "text/plain;charset=\"UTF-8\";action=\"http://somewhere.com/foo\"");
+            }
+        });
+
+        assertMockEndpointsSatisfied();
+
+        assertEquals("OK", out.getOut().getBody(String.class));
+        // camel-jetty may remove quotes from charset
+        String res = out.getOut().getHeader("Content-Type").toString();
+        res = res.replace("\"UTF-8\"", "UTF-8");
+        assertEquals("text/plain;charset=UTF-8;action=\"http://somewhere.com/foo\"", res);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from("jetty:http://localhost:{{port}}/myapp/myservice")
+                    .to("mock:result")
+                    .transform(constant("OK"));
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamAsExchangeHeaderTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamAsExchangeHeaderTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamAsExchangeHeaderTest.java
new file mode 100644
index 0000000..480a276
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamAsExchangeHeaderTest.java
@@ -0,0 +1,98 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+/**
+ * Unit test to verify that we can have URI options for external system (endpoint is lenient)
+ */
+public class JettyHttpProducerGetWithParamAsExchangeHeaderTest extends BaseJettyTest {
+
+    private String serverUri = "jetty://http://localhost:" + getPort() + "/myservice";
+
+    @Test
+    public void testHttpGetWithParamsViaURI() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedHeaderReceived("one", "einz");
+        mock.expectedHeaderReceived("two", "twei");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        template.requestBody(serverUri + "?one=einz&two=twei", null, Object.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testHttpGetWithParamsViaHeader() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedHeaderReceived("one", "uno");
+        mock.expectedHeaderReceived("two", "dos");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        template.requestBodyAndHeader(serverUri, null, Exchange.HTTP_QUERY, "one=uno&two=dos");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testHttpPost() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Hello World");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "POST");
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        template.requestBody(serverUri, "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from(serverUri).to("mock:result");
+            }
+        };
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamTest.java
new file mode 100644
index 0000000..cc421c9
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamTest.java
@@ -0,0 +1,95 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.http.HttpMessage;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+/**
+ * Unit test to verify that we can have URI options for external system (endpoint is lenient)
+ */
+public class JettyHttpProducerGetWithParamTest extends BaseJettyTest {
+
+    private String serverUri = "jetty://http://localhost:" + getPort() + "/myservice";
+    private MyParamsProcessor processor = new MyParamsProcessor();
+
+    @Test
+    public void testHttpGetWithParamsViaURI() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Bye World");
+        mock.expectedHeaderReceived("one", "eins");
+        mock.expectedHeaderReceived("two", "zwei");
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        template.requestBody(serverUri + "?one=uno&two=dos", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testHttpGetWithParamsViaHeader() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Bye World");
+        mock.expectedHeaderReceived("one", "eins");
+        mock.expectedHeaderReceived("two", "zwei");
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        template.requestBodyAndHeader(serverUri, "Hello World", Exchange.HTTP_QUERY, "one=uno&two=dos");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from(serverUri).process(processor).to("mock:result");
+            }
+        };
+    }
+
+    private static class MyParamsProcessor implements Processor {
+        public void process(Exchange exchange) throws Exception {
+            HttpMessage message = (HttpMessage)exchange.getIn();
+            assertNotNull(message.getRequest());
+            assertEquals("uno", message.getRequest().getParameter("one"));
+            assertEquals("dos", message.getRequest().getParameter("two"));
+
+            exchange.getOut().setBody("Bye World");
+            exchange.getOut().setHeader("one", "eins");
+            exchange.getOut().setHeader("two", "zwei");
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGoogleAsynchronousTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGoogleAsynchronousTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGoogleAsynchronousTest.java
new file mode 100644
index 0000000..b3c4a98
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGoogleAsynchronousTest.java
@@ -0,0 +1,59 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class JettyHttpProducerGoogleAsynchronousTest extends CamelTestSupport {
+
+    @Test
+    @Ignore("ignore online tests")
+    public void testGoogleFrontPageAsync() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+        mock.message(0).body(String.class).contains("google");
+
+        template.sendBody("direct:start", null);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                    // to prevent redirect being thrown as an exception
+                    .to("jetty://http://www.google.com?throwExceptionOnFailure=false")
+                    .to("mock:result");
+            }
+        };
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGoogleTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGoogleTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGoogleTest.java
new file mode 100644
index 0000000..55f6b71
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGoogleTest.java
@@ -0,0 +1,52 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class JettyHttpProducerGoogleTest extends CamelTestSupport {
+
+    @Test
+    @Ignore("ignore online tests")
+    public void testGoogleFrontPage() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        String reply = template.requestBody("direct:start", null, String.class);
+        assertNotNull(reply);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // to prevent redirect being thrown as an exception
+                from("direct:start").to("jetty://http://www.google.com?throwExceptionOnFailure=false");
+            }
+        };
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerInvalidDestinationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerInvalidDestinationTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerInvalidDestinationTest.java
new file mode 100644
index 0000000..943b19d
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerInvalidDestinationTest.java
@@ -0,0 +1,36 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class JettyHttpProducerInvalidDestinationTest extends CamelTestSupport {
+    
+    @Test
+    public void testInvalidDestination() throws Exception {
+        final MyInputStream is = new MyInputStream("Content".getBytes());
+        try {
+            template.requestBody("jetty:http://localhost:50000/invalidDestination", is);
+            fail("Should have thrown exception");
+        } catch (Exception ex) {
+            // need to check if the input stream is closed
+            assertTrue("The input stream should be closed", is.isClosed());
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerJavaBodyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerJavaBodyTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerJavaBodyTest.java
new file mode 100644
index 0000000..9f17c31
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerJavaBodyTest.java
@@ -0,0 +1,126 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.http.HttpConstants;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class JettyHttpProducerJavaBodyTest extends BaseJettyTest {
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
+
+    @Test
+    public void testHttpSendJavaBodyAndReceiveString() throws Exception {
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("jetty:http://localhost:{{port}}/myapp/myservice")
+                    .process(new Processor() {
+                        public void process(Exchange exchange) throws Exception {
+                            MyCoolBean cool = exchange.getIn().getBody(MyCoolBean.class);
+                            assertNotNull(cool);
+
+                            assertEquals(123, cool.getId());
+                            assertEquals("Camel", cool.getName());
+
+                            // we send back plain test
+                            exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "text/plain");
+                            exchange.getOut().setBody("OK");
+                        }
+                    });
+            }
+        });
+        context.start();
+
+        MyCoolBean cool = new MyCoolBean(123, "Camel");
+
+        String reply = template.requestBodyAndHeader("jetty:http://localhost:{{port}}/myapp/myservice", cool,
+                Exchange.CONTENT_TYPE, HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT, String.class);
+
+        assertEquals("OK", reply);
+    }
+
+    @Test
+    public void testHttpSendJavaBodyAndReceiveJavaBody() throws Exception {
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("jetty:http://localhost:{{port}}/myapp/myservice")
+                    .process(new Processor() {
+                        public void process(Exchange exchange) throws Exception {
+                            MyCoolBean cool = exchange.getIn().getBody(MyCoolBean.class);
+                            assertNotNull(cool);
+
+                            assertEquals(123, cool.getId());
+                            assertEquals("Camel", cool.getName());
+
+                            MyCoolBean reply = new MyCoolBean(456, "Camel rocks");
+                            exchange.getOut().setBody(reply);
+                            exchange.getOut().setHeader(Exchange.CONTENT_TYPE, HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT);
+                        }
+                    });
+            }
+        });
+        context.start();
+
+        MyCoolBean cool = new MyCoolBean(123, "Camel");
+
+        MyCoolBean reply = template.requestBodyAndHeader("jetty:http://localhost:{{port}}/myapp/myservice", cool,
+                Exchange.CONTENT_TYPE, HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT, MyCoolBean.class);
+
+        assertEquals(456, reply.getId());
+        assertEquals("Camel rocks", reply.getName());
+    }
+
+    @Test
+    public void testHttpSendStringAndReceiveJavaBody() throws Exception {
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("jetty:http://localhost:{{port}}/myapp/myservice")
+                    .process(new Processor() {
+                        public void process(Exchange exchange) throws Exception {
+                            String body = exchange.getIn().getBody(String.class);
+                            assertNotNull(body);
+                            assertEquals("Hello World", body);
+
+                            MyCoolBean reply = new MyCoolBean(456, "Camel rocks");
+                            exchange.getOut().setBody(reply);
+                            exchange.getOut().setHeader(Exchange.CONTENT_TYPE, HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT);
+                        }
+                    });
+            }
+        });
+        context.start();
+
+        MyCoolBean reply = template.requestBody("http://localhost:{{port}}/myapp/myservice", "Hello World", MyCoolBean.class);
+
+        assertEquals(456, reply.getId());
+        assertEquals("Camel rocks", reply.getName());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerPutContentTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerPutContentTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerPutContentTest.java
new file mode 100644
index 0000000..9fcf814
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerPutContentTest.java
@@ -0,0 +1,81 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import java.io.File;
+import java.io.InputStream;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class JettyHttpProducerPutContentTest extends BaseJettyTest {
+    
+    @Test
+    public void testHttpProducerPutContentTest() throws Exception {
+        // these tests do not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMinimumMessageCount(1);
+        mock.message(0).body().isInstanceOf(InputStream.class);
+        mock.message(0).header("Content-Type").isEqualTo("image/jpeg");
+
+        Exchange out = template.send("jetty://http://localhost:{{port}}/myapp/myservice", new Processor() {
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setBody(new File("src/test/data/logo.jpeg"));
+                exchange.getIn().setHeader("Content-Type", "image/jpeg");
+                exchange.getIn().setHeader(Exchange.HTTP_METHOD, org.apache.camel.component.http.HttpMethods.PUT);
+            }
+        });
+
+        assertMockEndpointsSatisfied();
+
+        assertEquals("OK", out.getOut().getBody(String.class));
+        assertEquals("text/plain", out.getOut().getHeader("Content-Type"));
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from("jetty:http://localhost:{{port}}/myapp/myservice")
+                    .to("mock:result")
+                    .process(new Processor() {
+                        public void process(Exchange exchange) throws Exception {
+                            String body = exchange.getIn().getBody(String.class);
+                            assertNotNull("Body should not be null", body);
+                            assertTrue("CamelHttpMethod is not PUT", exchange.getIn().getHeader("CamelHttpMethod").equals("PUT"));
+                            assertTrue("Content-Type is not image/jpeg", exchange.getIn().getHeader("Content-Type").equals("image/jpeg"));
+                        }
+                    })
+                    .transform(constant("OK")).setHeader("Content-Type", constant("text/plain"));
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java
new file mode 100644
index 0000000..b9a4db7
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java
@@ -0,0 +1,95 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import java.util.Map;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class JettyHttpProducerQueryParamTest extends BaseJettyTest {
+
+    private String url = "jetty://http://0.0.0.0:" + getPort() + "/cheese";
+
+    @Test
+    public void testQueryParameters() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        Exchange exchange = template.request(url + "?quote=Camel%20rocks", null);
+        assertNotNull(exchange);
+
+        String body = exchange.getOut().getBody(String.class);
+        Map<?, ?> headers = exchange.getOut().getHeaders();
+
+        assertEquals("Bye World", body);
+        assertEquals("Carlsberg", headers.get("beer"));
+    }
+
+    @Test
+    public void testQueryParametersWithHeader() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        Exchange exchange = template.request(url, new Processor() {
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(Exchange.HTTP_QUERY, "quote=Camel rocks");
+            }
+        });
+        assertNotNull(exchange);
+
+        String body = exchange.getOut().getBody(String.class);
+        Map<?, ?> headers = exchange.getOut().getHeaders();
+
+        assertEquals("Bye World", body);
+        assertEquals("Carlsberg", headers.get("beer"));
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from(url).process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        String quote = exchange.getIn().getHeader("quote", String.class);
+                        assertEquals("Camel rocks", quote);
+
+                        exchange.getOut().setBody("Bye World");
+                        exchange.getOut().setHeader("beer", "Carlsberg");
+                    }
+                });
+            }
+        };
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerRedirectTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerRedirectTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerRedirectTest.java
new file mode 100644
index 0000000..74c4159
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerRedirectTest.java
@@ -0,0 +1,62 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.http.HttpOperationFailedException;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class JettyHttpProducerRedirectTest extends BaseJettyTest {
+
+    @Test
+    public void testHttpRedirect() throws Exception {
+        try {
+            template.requestBody("jetty:http://localhost:{{port}}/test", "Hello World", String.class);
+            fail("Should have thrown an exception");
+        } catch (RuntimeCamelException e) {
+            HttpOperationFailedException cause = assertThrowable(HttpOperationFailedException.class, e.getCause());
+            assertEquals(301, cause.getStatusCode());
+            assertEquals(true, cause.isRedirectError());
+            assertEquals(true, cause.hasRedirectLocation());
+            assertEquals("http://localhost:" + getPort() + "/test", cause.getUri());
+            assertEquals("http://localhost:" + getPort() + "/newtest", cause.getRedirectLocation());
+        }
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("jetty://http://localhost:{{port}}/test")
+                    .process(new Processor() {
+                        public void process(Exchange exchange) throws Exception {
+                            exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 301);
+                            exchange.getOut().setHeader("Location", "http://localhost:" + getPort() + "/newtest");
+                        }
+                    });
+            }
+        };
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSendEmptyHeaderTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSendEmptyHeaderTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSendEmptyHeaderTest.java
new file mode 100644
index 0000000..6bc0e17
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSendEmptyHeaderTest.java
@@ -0,0 +1,53 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class JettyHttpProducerSendEmptyHeaderTest extends BaseJettyTest {
+
+    @Test
+    public void testHttpProducerSendEmptyHeader() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+        String expectedValue = isJetty8() ? "" : null; 
+        mock.expectedHeaderReceived("foo", expectedValue);
+
+        template.sendBodyAndHeader("jetty:http://localhost:{{port}}/myapp/mytest", "Hello World", "foo", "");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                allowNullHeaders();
+                from("jetty:http://localhost:{{port}}/myapp/mytest")
+                    .convertBodyTo(String.class)
+                    .to("mock:result");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSendFileTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSendFileTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSendFileTest.java
new file mode 100644
index 0000000..017ef9c
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSendFileTest.java
@@ -0,0 +1,79 @@
+/**
+ * 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.jetty.jettyproducer;
+
+import java.io.File;
+import java.io.InputStream;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+/**
+ * @version
+ */
+public class JettyHttpProducerSendFileTest extends BaseJettyTest {
+
+    @Test
+    public void testSendImage() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        // give Jetty time to startup properly
+        Thread.sleep(1000);
+
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMinimumMessageCount(1);
+        mock.message(0).body().isInstanceOf(InputStream.class);
+        mock.message(0).header("Content-Type").isEqualTo("image/jpeg");
+
+        Exchange out = template.send("jetty://http://localhost:{{port}}/myapp/myservice", new Processor() {
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setBody(new File("src/test/data/logo.jpeg"));
+                exchange.getIn().setHeader("Content-Type", "image/jpeg");
+            }
+        });
+
+        assertMockEndpointsSatisfied();
+
+        assertEquals("OK", out.getOut().getBody(String.class));
+        assertEquals("text/plain", out.getOut().getHeader("Content-Type"));
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from("jetty:http://localhost:{{port}}/myapp/myservice")
+                    .to("mock:result")
+                    .process(new Processor() {
+                        public void process(Exchange exchange) throws Exception {
+                            String body = exchange.getIn().getBody(String.class);
+                            assertNotNull("Body should not be null", body);
+                        }
+                    })
+                    .transform(constant("OK")).setHeader("Content-Type", constant("text/plain"));
+            }
+        };
+    }
+
+}


Mime
View raw message