http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentTypeEncodingInQuoteTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentTypeEncodingInQuoteTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentTypeEncodingInQuoteTest.java deleted file mode 100644 index 57d803b..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentTypeEncodingInQuoteTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * 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/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamAsExchangeHeaderTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamAsExchangeHeaderTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamAsExchangeHeaderTest.java deleted file mode 100644 index 480a276..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamAsExchangeHeaderTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * 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/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamTest.java deleted file mode 100644 index cc421c9..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamTest.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * 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/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGoogleAsynchronousTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGoogleAsynchronousTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGoogleAsynchronousTest.java deleted file mode 100644 index b3c4a98..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGoogleAsynchronousTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * 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/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGoogleTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGoogleTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGoogleTest.java deleted file mode 100644 index 55f6b71..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGoogleTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * 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/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerInvalidDestinationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerInvalidDestinationTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerInvalidDestinationTest.java deleted file mode 100644 index 943b19d..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerInvalidDestinationTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerJavaBodyTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerJavaBodyTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerJavaBodyTest.java deleted file mode 100644 index 9f17c31..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerJavaBodyTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * 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/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerPutContentTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerPutContentTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerPutContentTest.java deleted file mode 100644 index 9fcf814..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerPutContentTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * 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/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java deleted file mode 100644 index b9a4db7..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * 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/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerRedirectTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerRedirectTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerRedirectTest.java deleted file mode 100644 index 74c4159..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerRedirectTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * 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/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSendEmptyHeaderTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSendEmptyHeaderTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSendEmptyHeaderTest.java deleted file mode 100644 index 6bc0e17..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSendEmptyHeaderTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 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/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSendFileTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSendFileTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSendFileTest.java deleted file mode 100644 index 017ef9c..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSendFileTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * 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")); - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSimulate404ErrorTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSimulate404ErrorTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSimulate404ErrorTest.java deleted file mode 100644 index 72a3edd..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSimulate404ErrorTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * 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 JettyHttpProducerSimulate404ErrorTest extends BaseJettyTest { - - private String url = "jetty://http://0.0.0.0:" + getPort() + "/bar"; - - @Test - public void test404() throws Exception { - // these tests does not run well on Windows - if (isPlatform("windows")) { - return; - } - - // give Jetty time to startup properly - Thread.sleep(1000); - - try { - template.sendBody(url, null); - fail("Should have thrown exception"); - } catch (Exception e) { - HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause()); - assertEquals(404, cause.getStatusCode()); - assertEquals("http://0.0.0.0:" + getPort() + "/bar", cause.getUri()); - assertEquals("Page not found", cause.getResponseBody()); - assertNotNull(cause.getResponseHeaders()); - } - } - - @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 { - Thread.sleep(1000); - - exchange.getOut().setBody("Page not found"); - exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 404); - } - }); - } - }; - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSlowResponseTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSlowResponseTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSlowResponseTest.java deleted file mode 100644 index c4cfd99..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSlowResponseTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * 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 JettyHttpProducerSlowResponseTest extends BaseJettyTest { - - private String url = "jetty://http://0.0.0.0:" + getPort() + "/foo"; - - @Test - public void testSlowReply() 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.expectedMessageCount(1); - - Exchange exchange = template.request(url, null); - - assertMockEndpointsSatisfied(); - - assertNotNull(exchange); - - String reply = exchange.getOut().getBody(String.class); - assertEquals("Bye World", reply); - - assertEquals(5, exchange.getOut().getHeaders().size()); - } - - @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 { - 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(1000); - - res.getWriter().write("Bye World"); - res.flushBuffer(); - } - }).to("mock:result"); - } - }; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSuspendResumeTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSuspendResumeTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSuspendResumeTest.java deleted file mode 100644 index 0aa9e44..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSuspendResumeTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * 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.http.HttpConsumer; -import org.apache.camel.component.http.HttpOperationFailedException; -import org.apache.camel.component.jetty.BaseJettyTest; -import org.junit.Test; - -/** - * @version - */ -public class JettyHttpProducerSuspendResumeTest extends BaseJettyTest { - - private String serverUri = "jetty://http://localhost:" + getPort() + "/cool"; - - @Test - public void testJettySuspendResume() throws Exception { - // these tests does not run well on Windows - if (isPlatform("windows")) { - return; - } - - context.getShutdownStrategy().setTimeout(50); - - String reply = template.requestBody(serverUri, "World", String.class); - assertEquals("Bye World", reply); - - // now suspend jetty - HttpConsumer consumer = (HttpConsumer) context.getRoute("route1").getConsumer(); - assertNotNull(consumer); - - // suspend - consumer.suspend(); - - try { - template.requestBody(serverUri, "Moon", String.class); - fail("Should throw exception"); - } catch (Exception e) { - HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause()); - assertEquals(503, cause.getStatusCode()); - } - - // resume - consumer.resume(); - - // and send request which should be processed - reply = template.requestBody(serverUri, "Moon", String.class); - assertEquals("Bye Moon", reply); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from(serverUri).id("route1") - .transform(body().prepend("Bye ")); - } - }; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSuspendTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSuspendTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSuspendTest.java deleted file mode 100644 index dc67337..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSuspendTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * 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.http.HttpConsumer; -import org.apache.camel.component.http.HttpOperationFailedException; -import org.apache.camel.component.jetty.BaseJettyTest; -import org.junit.Test; - -/** - * @version - */ -public class JettyHttpProducerSuspendTest extends BaseJettyTest { - - private String serverUri = "jetty://http://localhost:" + getPort() + "/cool"; - - @Test - public void testJettySuspend() throws Exception { - // these tests does not run well on Windows - if (isPlatform("windows")) { - return; - } - - context.getShutdownStrategy().setTimeout(50); - - String reply = template.requestBody(serverUri, "World", String.class); - assertEquals("Bye World", reply); - - // now suspend jetty - HttpConsumer consumer = (HttpConsumer) context.getRoute("route1").getConsumer(); - assertNotNull(consumer); - - // suspend - consumer.suspend(); - - try { - template.requestBody(serverUri, "Moon", String.class); - fail("Should throw exception"); - } catch (Exception e) { - HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause()); - assertEquals(503, cause.getStatusCode()); - } - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from(serverUri).id("route1") - .transform(body().prepend("Bye ")); - } - }; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSuspendWhileInProgressTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSuspendWhileInProgressTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSuspendWhileInProgressTest.java deleted file mode 100644 index 3edec66..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSuspendWhileInProgressTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * 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.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; - -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.Ignore; -import org.junit.Test; - -/** - * @version - */ -@Ignore -public class JettyHttpProducerSuspendWhileInProgressTest extends BaseJettyTest { - - private String serverUri = "jetty://http://localhost:" + getPort() + "/cool"; - - @Test - public void testJettySuspendWhileInProgress() throws Exception { - // these tests does not run well on AIX or Windows - if (isPlatform("aix") || isPlatform("windows")) { - return; - } - - context.getShutdownStrategy().setTimeout(50); - - // send a request/reply and have future handle so we can shutdown while in progress - Future<String> reply = template.asyncRequestBodyAndHeader(serverUri, null, "name", "Camel", String.class); - - // shutdown camel while in progress, wait 2 sec so the first req has been received in Camel route - Executors.newSingleThreadExecutor().execute(new Runnable() { - public void run() { - try { - Thread.sleep(2000); - context.stop(); - } catch (Exception e) { - // ignore - } - } - }); - - // wait a bit more before sending next - Thread.sleep(5000); - - // now send a new req/reply - Future<String> reply2 = template.asyncRequestBodyAndHeader(serverUri, null, "name", "Tiger", String.class); - - // the first should wait to have its reply returned - assertEquals("Bye Camel", reply.get(20, TimeUnit.SECONDS)); - - // the 2nd should have a 503 returned as we are shutting down - try { - reply2.get(20, TimeUnit.SECONDS); - fail("Should throw exception"); - } catch (Exception e) { - RuntimeCamelException rce = assertIsInstanceOf(RuntimeCamelException.class, e.getCause()); - HttpOperationFailedException hofe = assertIsInstanceOf(HttpOperationFailedException.class, rce.getCause()); - assertEquals(503, hofe.getStatusCode()); - } - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - public void configure() throws Exception { - from(serverUri) - .log("Got data will wait 10 sec with reply") - .delay(10000) - .transform(simple("Bye ${header.name}")); - } - }; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSynchronousFalseTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSynchronousFalseTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSynchronousFalseTest.java deleted file mode 100644 index 551fcec..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSynchronousFalseTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * 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 JettyHttpProducerSynchronousFalseTest extends BaseJettyTest { - - private static String beforeThreadName; - private static String afterThreadName; - private String url = "jetty://http://0.0.0.0:" + getPort() + "/sync?synchronous=false"; - - @Test - public void testSynchronous() 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(1); - - template.sendBody("direct:start", null); - - assertMockEndpointsSatisfied(); - - assertFalse("Should use different threads", beforeThreadName.equalsIgnoreCase(afterThreadName)); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("direct:start") - .to("log:before") - .process(new Processor() { - public void process(Exchange exchange) throws Exception { - beforeThreadName = Thread.currentThread().getName(); - } - }) - .to(url) - .process(new Processor() { - public void process(Exchange exchange) throws Exception { - afterThreadName = Thread.currentThread().getName(); - } - }) - .to("log:after") - .to("mock:result"); - - from(url).transform(constant("Bye World")); - } - }; - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSynchronousTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSynchronousTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSynchronousTest.java deleted file mode 100644 index c7d45df..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSynchronousTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * 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 JettyHttpProducerSynchronousTest extends BaseJettyTest { - - private static String beforeThreadName; - private static String afterThreadName; - private String url = "jetty://http://0.0.0.0:" + getPort() + "/sync?synchronous=true"; - - @Test - public void testSynchronous() 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(1); - - template.sendBody("direct:start", null); - - assertMockEndpointsSatisfied(); - - assertTrue("Should use same threads", beforeThreadName.equalsIgnoreCase(afterThreadName)); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("direct:start") - .to("log:before") - .process(new Processor() { - public void process(Exchange exchange) throws Exception { - beforeThreadName = Thread.currentThread().getName(); - } - }) - .to(url) - .process(new Processor() { - public void process(Exchange exchange) throws Exception { - afterThreadName = Thread.currentThread().getName(); - } - }) - .to("log:after") - .to("mock:result"); - - from(url).transform(constant("Bye World")); - } - }; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerTimeoutTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerTimeoutTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerTimeoutTest.java deleted file mode 100644 index 0192953..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerTimeoutTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * 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.ExchangeTimedOutException; -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 JettyHttpProducerTimeoutTest 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); - final MyInputStream is = new MyInputStream("Content".getBytes()); - - Exchange reply = template.request(url, new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody(is); - } - }); - Exception e = reply.getException(); - assertNotNull("Should have thrown an exception", e); - ExchangeTimedOutException cause = assertThrowable(ExchangeTimedOutException.class, e); - assertEquals(2000, cause.getTimeout()); - assertTrue("The input stream should be closed", is.isClosed()); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from(url).delay(5000).transform(constant("Bye World")); - } - }; - } - - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerTransferExceptionTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerTransferExceptionTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerTransferExceptionTest.java deleted file mode 100644 index 1c59c4f..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerTransferExceptionTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * 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.CamelExecutionException; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.jetty.BaseJettyTest; -import org.junit.Test; - -/** - * @version - */ -public class JettyHttpProducerTransferExceptionTest extends BaseJettyTest { - - @Test - public void testTransferException() throws Exception { - try { - template.requestBody("jetty:http://localhost:{{port}}/myapp/myservice?transferException=true", ""); - fail("Should have thrown exception"); - } catch (CamelExecutionException e) { - IllegalArgumentException cause = assertThrowable(IllegalArgumentException.class, e.getCause()); - assertEquals("Damn", cause.getMessage()); - } - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("jetty:http://localhost:{{port}}/myapp/myservice?transferException=true") - .throwException(new IllegalArgumentException("Damn")); - } - }; - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpsProducerRouteSetupWithSystemPropsTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpsProducerRouteSetupWithSystemPropsTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpsProducerRouteSetupWithSystemPropsTest.java deleted file mode 100644 index d6ca246..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpsProducerRouteSetupWithSystemPropsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * 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.net.URL; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.builder.RouteBuilder; -import org.junit.Before; - -public class JettyHttpsProducerRouteSetupWithSystemPropsTest extends JettyProducerHttpsRouteTest { - - @Override - @Before - public void setUp() throws Exception { - // these tests does not run well on Windows - if (isPlatform("windows")) { - return; - } - - // give Jetty time to startup properly - Thread.sleep(1000); - - // ensure jsse clients can validate the self signed dummy localhost cert, - // use the server keystore as the trust store for these tests - URL trustStoreUrl = this.getClass().getClassLoader().getResource("jsse/localhost.ks"); - setSystemProp("javax.net.ssl.trustStore", trustStoreUrl.getPath()); - - // setup SSL using system properties - setSystemProp("org.eclipse.jetty.ssl.keystore", trustStoreUrl.getPath()); - setSystemProp("org.eclipse.jetty.ssl.keypassword", pwd); - setSystemProp("org.eclipse.jetty.ssl.password", pwd); - - super.setUp(); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - public void configure() { - from("jetty:https://localhost:" + port1 + "/test").to("mock:a"); - - Processor proc = new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getOut().setBody("<b>Hello World</b>"); - } - }; - from("jetty:https://localhost:" + port1 + "/hello").process(proc); - - from("jetty:https://localhost:" + port2 + "/test").to("mock:b"); - } - }; - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpsProducerSslContextInUriTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpsProducerSslContextInUriTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpsProducerSslContextInUriTest.java deleted file mode 100644 index 7236389..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpsProducerSslContextInUriTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 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 java.net.URISyntaxException; -import java.net.URL; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.jetty.JettyHttpComponent; -import org.apache.camel.impl.JndiRegistry; -import org.apache.camel.util.jsse.KeyManagersParameters; -import org.apache.camel.util.jsse.KeyStoreParameters; -import org.apache.camel.util.jsse.SSLContextParameters; - -public class JettyHttpsProducerSslContextInUriTest extends JettyProducerHttpsRouteTest { - - @Override - protected JndiRegistry createRegistry() throws Exception { - KeyStoreParameters ksp = new KeyStoreParameters(); - ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost.ks").toString()); - ksp.setPassword(pwd); - - KeyManagersParameters kmp = new KeyManagersParameters(); - kmp.setKeyPassword(pwd); - kmp.setKeyStore(ksp); - - //TrustManagersParameters tmp = new TrustManagersParameters(); - //tmp.setKeyStore(ksp); - - SSLContextParameters sslContextParameters = new SSLContextParameters(); - sslContextParameters.setKeyManagers(kmp); - //sslContextParameters.setTrustManagers(tmp); - - JndiRegistry registry = super.createRegistry(); - registry.bind("sslContextParameters", sslContextParameters); - - return registry; - } - - protected void invokeHttpEndpoint() throws IOException { - template.sendBodyAndHeader(getHttpProducerScheme() + "localhost:" + port1 + "/test?sslContextParametersRef=sslContextParameters", expectedBody, "Content-Type", - "application/xml"); - template.sendBodyAndHeader(getHttpProducerScheme() + "localhost:" + port2 + "/test?sslContextParametersRef=sslContextParameters", expectedBody, "Content-Type", - "application/xml"); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - public void configure() throws URISyntaxException { - JettyHttpComponent componentJetty = (JettyHttpComponent) context.getComponent("jetty"); - componentJetty.setSslPassword(pwd); - componentJetty.setSslKeyPassword(pwd); - URL keyStoreUrl = this.getClass().getClassLoader().getResource("jsse/localhost.ks"); - componentJetty.setKeystore(keyStoreUrl.toURI().getPath()); - - from("jetty:https://localhost:" + port1 + "/test?sslContextParametersRef=sslContextParameters").to("mock:a"); - - Processor proc = new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getOut().setBody("<b>Hello World</b>"); - } - }; - from("jetty:https://localhost:" + port1 + "/hello?sslContextParametersRef=sslContextParameters").process(proc); - - from("jetty:https://localhost:" + port2 + "/test?sslContextParametersRef=sslContextParameters").to("mock:b"); - } - }; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/0d96e56d/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyProducerHandle404Test.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyProducerHandle404Test.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyProducerHandle404Test.java deleted file mode 100644 index 870eff9..0000000 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyProducerHandle404Test.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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.component.jetty.JettyHandle404Test; - -/** - * Based on end user on forum how to get the 404 error code in his enrich aggregator - * - * @version - */ -public class JettyProducerHandle404Test extends JettyHandle404Test { - - public String getProducerUrl() { - return "jetty://http://localhost:{{port}}/myserver?user=Camel"; - } - -}