You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/02/19 08:57:43 UTC

[1/4] camel git commit: CAMEL-10139: added unit tests for all/most REST DSL components, and seeing that only camel-undertow throws an HTTP status code 405 on some operations

Repository: camel
Updated Branches:
  refs/heads/master 8b880227f -> 79367a511


CAMEL-10139: added unit tests for all/most REST DSL components, and seeing that only camel-undertow throws an HTTP status code 405 on some operations


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

Branch: refs/heads/master
Commit: 419558f543fb76313c59d8b0e433b69fce9843e3
Parents: 8b88022
Author: Scott Cranton <sc...@cranton.com>
Authored: Sat Feb 18 16:06:54 2017 -0500
Committer: Scott Cranton <sc...@cranton.com>
Committed: Sat Feb 18 16:06:54 2017 -0500

----------------------------------------------------------------------
 .../org/apache/camel/coap/CoAPRestVerbTest.java | 117 +++++++++++++++++
 .../component/jetty/rest/RestJettyVerbTest.java |  89 +++++++++++++
 .../netty/http/rest/RestNettyHttpVerbTest.java  |  89 +++++++++++++
 .../netty4/http/rest/RestNettyHttpVerbTest.java |  89 +++++++++++++
 .../component/restlet/RestRestletVerbTest.java  |  88 +++++++++++++
 .../servlet/rest/RestServletVerbTest.java       | 127 +++++++++++++++++++
 .../sparkrest/RestCamelSparkVerbTest.java       |  88 +++++++++++++
 .../undertow/rest/RestUndertowVerbTest.java     |  89 +++++++++++++
 8 files changed, 776 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/419558f5/components/camel-coap/src/test/java/org/apache/camel/coap/CoAPRestVerbTest.java
----------------------------------------------------------------------
diff --git a/components/camel-coap/src/test/java/org/apache/camel/coap/CoAPRestVerbTest.java b/components/camel-coap/src/test/java/org/apache/camel/coap/CoAPRestVerbTest.java
new file mode 100644
index 0000000..af9668b
--- /dev/null
+++ b/components/camel-coap/src/test/java/org/apache/camel/coap/CoAPRestVerbTest.java
@@ -0,0 +1,117 @@
+/**
+ * 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.coap;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.eclipse.californium.core.CoapClient;
+import org.eclipse.californium.core.CoapResponse;
+import org.eclipse.californium.core.coap.MediaTypeRegistry;
+import org.eclipse.californium.core.network.config.NetworkConfig;
+import org.junit.Test;
+
+public class CoAPRestVerbTest extends CamelTestSupport {
+    static int coapport = AvailablePortFinder.getNextAvailable();
+
+    @Test
+    public void testGetAll() throws Exception {
+        NetworkConfig.createStandardWithoutFile();
+
+        CoapClient client = new CoapClient("coap://localhost:" + coapport + "/users");
+        client.setTimeout(1000000);
+        CoapResponse rsp = client.get();
+
+        assertEquals("[{ \"id\":\"1\", \"name\":\"Scott\" },{ \"id\":\"2\", \"name\":\"Claus\" }]", rsp.getResponseText());
+    }
+
+    @Test
+    public void testGetOne() throws Exception {
+        NetworkConfig.createStandardWithoutFile();
+
+        CoapClient client = new CoapClient("coap://localhost:" + coapport + "/users/1");
+        client.setTimeout(1000000);
+        CoapResponse rsp = client.get();
+
+        assertEquals("{ \"id\":\"1\", \"name\":\"Scott\" }", rsp.getResponseText());
+    }
+
+    @Test
+    public void testPost() throws Exception {
+        NetworkConfig.createStandardWithoutFile();
+
+        final String body = "{ \"id\":\"1\", \"name\":\"Scott\" }";
+
+        MockEndpoint mock = getMockEndpoint("mock:create");
+        mock.expectedBodiesReceived(body);
+
+        CoapClient client = new CoapClient("coap://localhost:" + coapport + "/users");
+        client.setTimeout(1000000);
+        CoapResponse rsp = client.post(body, MediaTypeRegistry.APPLICATION_JSON);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testPut() throws Exception {
+        NetworkConfig.createStandardWithoutFile();
+
+        final String body = "{ \"id\":\"1\", \"name\":\"Scott\" }";
+
+        MockEndpoint mock = getMockEndpoint("mock:update");
+        mock.expectedBodiesReceived(body);
+        mock.expectedHeaderReceived("id", "1");
+
+        CoapClient client = new CoapClient("coap://localhost:" + coapport + "/users/1");
+        client.setTimeout(1000000);
+        CoapResponse rsp = client.put(body, MediaTypeRegistry.APPLICATION_JSON);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testDelete() throws Exception {
+        NetworkConfig.createStandardWithoutFile();
+
+        MockEndpoint mock = getMockEndpoint("mock:delete");
+        mock.expectedHeaderReceived("id", "1");
+
+        CoapClient client = new CoapClient("coap://localhost:" + coapport + "/users/1");
+        client.setTimeout(1000000);
+        CoapResponse rsp = client.delete();
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                restConfiguration().component("coap").host("localhost").port(coapport);
+
+                rest()
+                    .get("/users").route().transform().constant("[{ \"id\":\"1\", \"name\":\"Scott\" },{ \"id\":\"2\", \"name\":\"Claus\" }]").endRest()
+                    .get("/users/{id}").route().transform().simple("{ \"id\":\"${header.id}\", \"name\":\"Scott\" }").endRest()
+                    .post("/users").to("mock:create")
+                    .put("/users/{id}").to("mock:update")
+                    .delete("/users/{id}").to("mock:delete");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/419558f5/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyVerbTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyVerbTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyVerbTest.java
new file mode 100644
index 0000000..da01d49
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyVerbTest.java
@@ -0,0 +1,89 @@
+/**
+ * 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.rest;
+
+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;
+
+public class RestJettyVerbTest extends BaseJettyTest {
+
+    @Test
+    public void testGetAll() throws Exception {
+        String out = template.requestBodyAndHeader("http://localhost:" + getPort() + "/users", null, Exchange.HTTP_METHOD, "GET", String.class);
+        assertEquals("[{ \"id\":\"1\", \"name\":\"Scott\" },{ \"id\":\"2\", \"name\":\"Claus\" }]", out);
+    }
+
+    @Test
+    public void testGetOne() throws Exception {
+        String out = template.requestBodyAndHeader("http://localhost:" + getPort() + "/users/1", null, Exchange.HTTP_METHOD, "GET", String.class);
+        assertEquals("{ \"id\":\"1\", \"name\":\"Scott\" }", out);
+    }
+
+    @Test
+    public void testPost() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:create");
+        mock.expectedBodiesReceived("{ \"id\":\"1\", \"name\":\"Scott\" }");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "POST");
+
+        template.requestBodyAndHeader("http://localhost:" + getPort() + "/users", "{ \"id\":\"1\", \"name\":\"Scott\" }", Exchange.HTTP_METHOD, "POST", String.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testPut() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:update");
+        mock.expectedBodiesReceived("{ \"id\":\"1\", \"name\":\"Scott\" }");
+        mock.expectedHeaderReceived("id", "1");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "PUT");
+
+        template.requestBodyAndHeader("http://localhost:" + getPort() + "/users/1", "{ \"id\":\"1\", \"name\":\"Scott\" }", Exchange.HTTP_METHOD, "PUT", String.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testDelete() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:delete");
+        mock.expectedHeaderReceived("id", "1");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "DELETE");
+
+        template.requestBodyAndHeader("http://localhost:" + getPort() + "/users/1", null, Exchange.HTTP_METHOD, "DELETE", String.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                restConfiguration().component("jetty").host("localhost").port(getPort());
+
+                rest()
+                    .get("/users").route().transform().constant("[{ \"id\":\"1\", \"name\":\"Scott\" },{ \"id\":\"2\", \"name\":\"Claus\" }]").endRest()
+                    .get("/users/{id}").route().transform().simple("{ \"id\":\"${header.id}\", \"name\":\"Scott\" }").endRest()
+                    .post("/users").to("mock:create")
+                    .put("/users/{id}").to("mock:update")
+                    .delete("/users/{id}").to("mock:delete");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/419558f5/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/rest/RestNettyHttpVerbTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/rest/RestNettyHttpVerbTest.java b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/rest/RestNettyHttpVerbTest.java
new file mode 100644
index 0000000..e247350
--- /dev/null
+++ b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/rest/RestNettyHttpVerbTest.java
@@ -0,0 +1,89 @@
+/**
+ * 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.netty.http.rest;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.netty.http.BaseNettyTest;
+import org.junit.Test;
+
+public class RestNettyHttpVerbTest extends BaseNettyTest {
+
+    @Test
+    public void testGetAll() throws Exception {
+        String out = template.requestBodyAndHeader("http://localhost:" + getPort() + "/users", null, Exchange.HTTP_METHOD, "GET", String.class);
+        assertEquals("[{ \"id\":\"1\", \"name\":\"Scott\" },{ \"id\":\"2\", \"name\":\"Claus\" }]", out);
+    }
+
+    @Test
+    public void testGetOne() throws Exception {
+        String out = template.requestBodyAndHeader("http://localhost:" + getPort() + "/users/1", null, Exchange.HTTP_METHOD, "GET", String.class);
+        assertEquals("{ \"id\":\"1\", \"name\":\"Scott\" }", out);
+    }
+
+    @Test
+    public void testPost() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:create");
+        mock.expectedBodiesReceived("{ \"id\":\"1\", \"name\":\"Scott\" }");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "POST");
+
+        template.requestBodyAndHeader("http://localhost:" + getPort() + "/users", "{ \"id\":\"1\", \"name\":\"Scott\" }", Exchange.HTTP_METHOD, "POST", String.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testPut() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:update");
+        mock.expectedBodiesReceived("{ \"id\":\"1\", \"name\":\"Scott\" }");
+        mock.expectedHeaderReceived("id", "1");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "PUT");
+
+        template.requestBodyAndHeader("http://localhost:" + getPort() + "/users/1", "{ \"id\":\"1\", \"name\":\"Scott\" }", Exchange.HTTP_METHOD, "PUT", String.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testDelete() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:delete");
+        mock.expectedHeaderReceived("id", "1");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "DELETE");
+
+        template.requestBodyAndHeader("http://localhost:" + getPort() + "/users/1", null, Exchange.HTTP_METHOD, "DELETE", String.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                restConfiguration().component("netty-http").host("localhost").port(getPort());
+
+                rest()
+                    .get("/users").route().transform().constant("[{ \"id\":\"1\", \"name\":\"Scott\" },{ \"id\":\"2\", \"name\":\"Claus\" }]").endRest()
+                    .get("/users/{id}").route().transform().simple("{ \"id\":\"${header.id}\", \"name\":\"Scott\" }").endRest()
+                    .post("/users").to("mock:create")
+                    .put("/users/{id}").to("mock:update")
+                    .delete("/users/{id}").to("mock:delete");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/419558f5/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpVerbTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpVerbTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpVerbTest.java
new file mode 100644
index 0000000..70b4d5d
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpVerbTest.java
@@ -0,0 +1,89 @@
+/**
+ * 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.netty4.http.rest;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.netty4.http.BaseNettyTest;
+import org.junit.Test;
+
+public class RestNettyHttpVerbTest extends BaseNettyTest {
+
+    @Test
+    public void testGetAll() throws Exception {
+        String out = template.requestBodyAndHeader("http://localhost:" + getPort() + "/users", null, Exchange.HTTP_METHOD, "GET", String.class);
+        assertEquals("[{ \"id\":\"1\", \"name\":\"Scott\" },{ \"id\":\"2\", \"name\":\"Claus\" }]", out);
+    }
+
+    @Test
+    public void testGetOne() throws Exception {
+        String out = template.requestBodyAndHeader("http://localhost:" + getPort() + "/users/1", null, Exchange.HTTP_METHOD, "GET", String.class);
+        assertEquals("{ \"id\":\"1\", \"name\":\"Scott\" }", out);
+    }
+
+    @Test
+    public void testPost() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:create");
+        mock.expectedBodiesReceived("{ \"id\":\"1\", \"name\":\"Scott\" }");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "POST");
+
+        template.requestBodyAndHeader("http://localhost:" + getPort() + "/users", "{ \"id\":\"1\", \"name\":\"Scott\" }", Exchange.HTTP_METHOD, "POST", String.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testPut() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:update");
+        mock.expectedBodiesReceived("{ \"id\":\"1\", \"name\":\"Scott\" }");
+        mock.expectedHeaderReceived("id", "1");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "PUT");
+
+        template.requestBodyAndHeader("http://localhost:" + getPort() + "/users/1", "{ \"id\":\"1\", \"name\":\"Scott\" }", Exchange.HTTP_METHOD, "PUT", String.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testDelete() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:delete");
+        mock.expectedHeaderReceived("id", "1");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "DELETE");
+
+        template.requestBodyAndHeader("http://localhost:" + getPort() + "/users/1", null, Exchange.HTTP_METHOD, "DELETE", String.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                restConfiguration().component("netty4-http").host("localhost").port(getPort());
+
+                rest()
+                    .get("/users").route().transform().constant("[{ \"id\":\"1\", \"name\":\"Scott\" },{ \"id\":\"2\", \"name\":\"Claus\" }]").endRest()
+                    .get("/users/{id}").route().transform().simple("{ \"id\":\"${header.id}\", \"name\":\"Scott\" }").endRest()
+                    .post("/users").to("mock:create")
+                    .put("/users/{id}").to("mock:update")
+                    .delete("/users/{id}").to("mock:delete");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/419558f5/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletVerbTest.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletVerbTest.java b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletVerbTest.java
new file mode 100644
index 0000000..13cdf67
--- /dev/null
+++ b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletVerbTest.java
@@ -0,0 +1,88 @@
+/**
+ * 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.restlet;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+public class RestRestletVerbTest extends RestletTestSupport {
+
+    @Test
+    public void testGetAll() throws Exception {
+        String out = template.requestBodyAndHeader("http://localhost:" + portNum + "/users", null, Exchange.HTTP_METHOD, "GET", String.class);
+        assertEquals("[{ \"id\":\"1\", \"name\":\"Scott\" },{ \"id\":\"2\", \"name\":\"Claus\" }]", out);
+    }
+
+    @Test
+    public void testGetOne() throws Exception {
+        String out = template.requestBodyAndHeader("http://localhost:" + portNum + "/users/1", null, Exchange.HTTP_METHOD, "GET", String.class);
+        assertEquals("{ \"id\":\"1\", \"name\":\"Scott\" }", out);
+    }
+
+    @Test
+    public void testPost() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:create");
+        mock.expectedBodiesReceived("{ \"id\":\"1\", \"name\":\"Scott\" }");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "POST");
+
+        template.requestBodyAndHeader("http://localhost:" + portNum + "/users", "{ \"id\":\"1\", \"name\":\"Scott\" }", Exchange.HTTP_METHOD, "POST", String.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testPut() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:update");
+        mock.expectedBodiesReceived("{ \"id\":\"1\", \"name\":\"Scott\" }");
+        mock.expectedHeaderReceived("id", "1");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "PUT");
+
+        template.requestBodyAndHeader("http://localhost:" + portNum + "/users/1", "{ \"id\":\"1\", \"name\":\"Scott\" }", Exchange.HTTP_METHOD, "PUT", String.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testDelete() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:delete");
+        mock.expectedHeaderReceived("id", "1");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "DELETE");
+
+        template.requestBodyAndHeader("http://localhost:" + portNum + "/users/1", null, Exchange.HTTP_METHOD, "DELETE", String.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                restConfiguration().component("restlet").host("localhost").port(portNum);
+
+                rest()
+                    .get("/users").route().transform().constant("[{ \"id\":\"1\", \"name\":\"Scott\" },{ \"id\":\"2\", \"name\":\"Claus\" }]").endRest()
+                    .get("/users/{id}").route().transform().simple("{ \"id\":\"${header.id}\", \"name\":\"Scott\" }").endRest()
+                    .post("/users").to("mock:create")
+                    .put("/users/{id}").to("mock:update")
+                    .delete("/users/{id}").to("mock:delete");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/419558f5/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/rest/RestServletVerbTest.java
----------------------------------------------------------------------
diff --git a/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/rest/RestServletVerbTest.java b/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/rest/RestServletVerbTest.java
new file mode 100644
index 0000000..07bb052
--- /dev/null
+++ b/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/rest/RestServletVerbTest.java
@@ -0,0 +1,127 @@
+/**
+ * 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.servlet.rest;
+
+import com.meterware.httpunit.*;
+import com.meterware.servletunit.ServletUnitClient;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.servlet.ServletCamelRouterTestSupport;
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+
+public class RestServletVerbTest extends ServletCamelRouterTestSupport {
+
+    @Test
+    public void testGetAll() throws Exception {
+        WebRequest req = new GetMethodWebRequest(CONTEXT_URL + "/services/users");
+        ServletUnitClient client = newClient();
+        client.setExceptionsThrownOnErrorStatus(false);
+        WebResponse response = client.getResponse(req);
+
+        assertEquals(200, response.getResponseCode());
+        assertEquals("[{ \"id\":\"1\", \"name\":\"Scott\" },{ \"id\":\"2\", \"name\":\"Claus\" }]", response.getText());
+    }
+
+    @Test
+    public void testGetOne() throws Exception {
+        WebRequest req = new GetMethodWebRequest(CONTEXT_URL + "/services/users/1");
+        ServletUnitClient client = newClient();
+        client.setExceptionsThrownOnErrorStatus(false);
+        WebResponse response = client.getResponse(req);
+
+        assertEquals(200, response.getResponseCode());
+        assertEquals("{ \"id\":\"1\", \"name\":\"Scott\" }", response.getText());
+    }
+
+    @Test
+    public void testPost() throws Exception {
+        final String body = "{ \"id\":\"1\", \"name\":\"Scott\" }";
+
+        MockEndpoint mock = getMockEndpoint("mock:create");
+        mock.expectedBodiesReceived(body);
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "POST");
+
+        WebRequest req = new PostMethodWebRequest(CONTEXT_URL + "/services/users", new ByteArrayInputStream(body.getBytes()), "application/json");
+        ServletUnitClient client = newClient();
+        client.setExceptionsThrownOnErrorStatus(false);
+        WebResponse response = client.getResponse(req);
+
+        assertEquals(200, response.getResponseCode());
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testPut() throws Exception {
+        final String body = "{ \"id\":\"1\", \"name\":\"Scott\" }";
+
+        MockEndpoint mock = getMockEndpoint("mock:update");
+        mock.expectedBodiesReceived(body);
+        mock.expectedHeaderReceived("id", "1");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "PUT");
+
+        WebRequest req = new PutMethodWebRequest(CONTEXT_URL + "/services/users/1", new ByteArrayInputStream(body.getBytes()), "application/json");
+        ServletUnitClient client = newClient();
+        client.setExceptionsThrownOnErrorStatus(false);
+        WebResponse response = client.getResponse(req);
+
+        assertEquals(200, response.getResponseCode());
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testDelete() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:delete");
+        mock.expectedHeaderReceived("id", "1");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "DELETE");
+
+        WebRequest req = new HeaderOnlyWebRequest(CONTEXT_URL + "/services/users/1") {
+            @Override
+            public String getMethod() {
+                return "DELETE";
+            }
+        };
+        ServletUnitClient client = newClient();
+        client.setExceptionsThrownOnErrorStatus(false);
+        WebResponse response = client.getResponse(req);
+
+        assertEquals(200, response.getResponseCode());
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                restConfiguration().component("servlet");
+
+                rest()
+                    .get("/users").route().transform().constant("[{ \"id\":\"1\", \"name\":\"Scott\" },{ \"id\":\"2\", \"name\":\"Claus\" }]").endRest()
+                    .get("/users/{id}").route().transform().simple("{ \"id\":\"${header.id}\", \"name\":\"Scott\" }").endRest()
+                    .post("/users").to("mock:create")
+                    .put("/users/{id}").to("mock:update")
+                    .delete("/users/{id}").to("mock:delete");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/419558f5/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestCamelSparkVerbTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestCamelSparkVerbTest.java b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestCamelSparkVerbTest.java
new file mode 100644
index 0000000..fea189d
--- /dev/null
+++ b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestCamelSparkVerbTest.java
@@ -0,0 +1,88 @@
+/**
+ * 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.sparkrest;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+public class RestCamelSparkVerbTest extends BaseSparkTest {
+
+    @Test
+    public void testGetAll() throws Exception {
+        String out = template.requestBodyAndHeader("http://localhost:" + getPort() + "/users", null, Exchange.HTTP_METHOD, "GET", String.class);
+        assertEquals("[{ \"id\":\"1\", \"name\":\"Scott\" },{ \"id\":\"2\", \"name\":\"Claus\" }]", out);
+    }
+
+    @Test
+    public void testGetOne() throws Exception {
+        String out = template.requestBodyAndHeader("http://localhost:" + getPort() + "/users/1", null, Exchange.HTTP_METHOD, "GET", String.class);
+        assertEquals("{ \"id\":\"1\", \"name\":\"Scott\" }", out);
+    }
+
+    @Test
+    public void testPost() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:create");
+        mock.expectedBodiesReceived("{ \"id\":\"1\", \"name\":\"Scott\" }");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "POST");
+
+        template.requestBodyAndHeader("http://localhost:" + getPort() + "/users", "{ \"id\":\"1\", \"name\":\"Scott\" }", Exchange.HTTP_METHOD, "POST", String.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testPut() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:update");
+        mock.expectedBodiesReceived("{ \"id\":\"1\", \"name\":\"Scott\" }");
+        mock.expectedHeaderReceived("id", "1");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "PUT");
+
+        template.requestBodyAndHeader("http://localhost:" + getPort() + "/users/1", "{ \"id\":\"1\", \"name\":\"Scott\" }", Exchange.HTTP_METHOD, "PUT", String.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testDelete() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:delete");
+        mock.expectedHeaderReceived("id", "1");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "DELETE");
+
+        template.requestBodyAndHeader("http://localhost:" + getPort() + "/users/1", null, Exchange.HTTP_METHOD, "DELETE", String.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                restConfiguration().component("spark-rest").host("localhost").port(getPort());
+
+                rest()
+                    .get("/users").route().transform().constant("[{ \"id\":\"1\", \"name\":\"Scott\" },{ \"id\":\"2\", \"name\":\"Claus\" }]").endRest()
+                    .get("/users/{id}").route().transform().simple("{ \"id\":\"${header.id}\", \"name\":\"Scott\" }").endRest()
+                    .post("/users").to("mock:create")
+                    .put("/users/{id}").to("mock:update")
+                    .delete("/users/{id}").to("mock:delete");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/419558f5/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowVerbTest.java
----------------------------------------------------------------------
diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowVerbTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowVerbTest.java
new file mode 100644
index 0000000..9297122
--- /dev/null
+++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowVerbTest.java
@@ -0,0 +1,89 @@
+/**
+ * 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.undertow.rest;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.undertow.BaseUndertowTest;
+import org.junit.Test;
+
+public class RestUndertowVerbTest extends BaseUndertowTest {
+
+    @Test
+    public void testGetAll() throws Exception {
+        String out = template.requestBodyAndHeader("http://localhost:" + getPort() + "/users", null, Exchange.HTTP_METHOD, "GET", String.class);
+        assertEquals("[{ \"id\":\"1\", \"name\":\"Scott\" },{ \"id\":\"2\", \"name\":\"Claus\" }]", out);
+    }
+
+    @Test
+    public void testGetOne() throws Exception {
+        String out = template.requestBodyAndHeader("http://localhost:" + getPort() + "/users/1", null, Exchange.HTTP_METHOD, "GET", String.class);
+        assertEquals("{ \"id\":\"1\", \"name\":\"Scott\" }", out);
+    }
+
+    @Test
+    public void testPost() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:create");
+        mock.expectedBodiesReceived("{ \"id\":\"1\", \"name\":\"Scott\" }");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "POST");
+
+        template.requestBodyAndHeader("http://localhost:" + getPort() + "/users", "{ \"id\":\"1\", \"name\":\"Scott\" }", Exchange.HTTP_METHOD, "POST", String.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testPut() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:update");
+        mock.expectedBodiesReceived("{ \"id\":\"1\", \"name\":\"Scott\" }");
+        mock.expectedHeaderReceived("id", "1");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "PUT");
+
+        template.requestBodyAndHeader("http://localhost:" + getPort() + "/users/1", "{ \"id\":\"1\", \"name\":\"Scott\" }", Exchange.HTTP_METHOD, "PUT", String.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testDelete() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:delete");
+        mock.expectedHeaderReceived("id", "1");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "DELETE");
+
+        template.requestBodyAndHeader("http://localhost:" + getPort() + "/users/1", null, Exchange.HTTP_METHOD, "DELETE", String.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                restConfiguration().component("undertow").host("localhost").port(getPort());
+
+                rest()
+                    .get("/users").route().transform().constant("[{ \"id\":\"1\", \"name\":\"Scott\" },{ \"id\":\"2\", \"name\":\"Claus\" }]").endRest()
+                    .get("/users/{id}").route().transform().simple("{ \"id\":\"${header.id}\", \"name\":\"Scott\" }").endRest()
+                    .post("/users").to("mock:create")
+                    .put("/users/{id}").to("mock:update")
+                    .delete("/users/{id}").to("mock:delete");
+            }
+        };
+    }
+}


[2/4] camel git commit: Seems to fix path handler issue, but causes an issue where 2nd + unit test fails with a BindException: Address already in use.

Posted by da...@apache.org.
Seems to fix path handler issue, but causes an issue where 2nd + unit test fails with a BindException: Address already in use.


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

Branch: refs/heads/master
Commit: b6ee9c46ff21cb5514479e2be05405b76f91d542
Parents: 419558f
Author: Scott Cranton <sc...@cranton.com>
Authored: Sat Feb 18 18:02:44 2017 -0500
Committer: Scott Cranton <sc...@cranton.com>
Committed: Sat Feb 18 18:02:44 2017 -0500

----------------------------------------------------------------------
 .../camel/component/undertow/handlers/CamelRootHandler.java       | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b6ee9c46/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelRootHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelRootHandler.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelRootHandler.java
index ef079c3..ef7e290 100644
--- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelRootHandler.java
+++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelRootHandler.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.undertow.handlers;
 import io.undertow.server.HttpHandler;
 import io.undertow.server.HttpServerExchange;
 import io.undertow.util.PathTemplate;
+import io.undertow.util.URLUtils;
 
 /**
  * Custom root handler to enable hot swapping individual handlers assigned for each path template and/or HTTP method.
@@ -35,7 +36,7 @@ public class CamelRootHandler implements HttpHandler {
     }
 
     public synchronized void add(String path, String[] methods, boolean prefixMatch, HttpHandler handler) {
-        String basePath = getBasePath(path);
+        String basePath = URLUtils.normalizeSlashes(getBasePath(path));
         HttpHandler basePathHandler = pathHandler.getHandler(basePath);
 
         CamelMethodHandler targetHandler;


[4/4] camel git commit: Fixed CS

Posted by da...@apache.org.
Fixed CS


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

Branch: refs/heads/master
Commit: 79367a511b2c44e3ac49b97e3d966a8b7b555455
Parents: 3603272
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Feb 19 09:57:48 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Feb 19 09:57:48 2017 +0100

----------------------------------------------------------------------
 .../org/apache/camel/component/azure/blob/BlobBlock.java |  6 +++---
 .../component/azure/blob/BlobServiceRequestOptions.java  |  6 +++---
 .../camel/component/azure/blob/BlobServiceUtil.java      |  6 +++---
 .../camel/component/paxlogging/PaxLoggingEndpoint.java   |  3 ++-
 .../component/servlet/rest/RestServletVerbTest.java      | 11 ++++++++---
 components/camel-xmlbeans/pom.xml                        |  2 +-
 6 files changed, 20 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/79367a51/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobBlock.java
----------------------------------------------------------------------
diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobBlock.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobBlock.java
index f85093f..dcf8aa1 100644
--- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobBlock.java
+++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobBlock.java
@@ -5,9 +5,9 @@
  * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *      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.

http://git-wip-us.apache.org/repos/asf/camel/blob/79367a51/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceRequestOptions.java
----------------------------------------------------------------------
diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceRequestOptions.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceRequestOptions.java
index 5f48dc6..3d1342e 100644
--- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceRequestOptions.java
+++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceRequestOptions.java
@@ -5,9 +5,9 @@
  * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *      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.

http://git-wip-us.apache.org/repos/asf/camel/blob/79367a51/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceUtil.java
----------------------------------------------------------------------
diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceUtil.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceUtil.java
index c4a4363..dcf6dc3 100644
--- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceUtil.java
+++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceUtil.java
@@ -5,9 +5,9 @@
  * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *      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.

http://git-wip-us.apache.org/repos/asf/camel/blob/79367a51/components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingEndpoint.java b/components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingEndpoint.java
index d448bb8..33156d0 100644
--- a/components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingEndpoint.java
+++ b/components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingEndpoint.java
@@ -28,7 +28,8 @@ import org.apache.camel.spi.UriPath;
 /**
  * The paxlogging component can be used in an OSGi environment to receive PaxLogging events and process them.
  */
-@UriEndpoint(firstVersion = "2.6.0", scheme = "paxlogging", title = "OSGi PAX Logging", syntax = "paxlogging:appender", consumerOnly = true, consumerClass = PaxLoggingConsumer.class, label = "monitoring")
+@UriEndpoint(firstVersion = "2.6.0", scheme = "paxlogging", title = "OSGi PAX Logging", syntax = "paxlogging:appender",
+    consumerOnly = true, consumerClass = PaxLoggingConsumer.class, label = "monitoring")
 public class PaxLoggingEndpoint extends DefaultEndpoint {
 
     @UriPath @Metadata(required = "true")

http://git-wip-us.apache.org/repos/asf/camel/blob/79367a51/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/rest/RestServletVerbTest.java
----------------------------------------------------------------------
diff --git a/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/rest/RestServletVerbTest.java b/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/rest/RestServletVerbTest.java
index 07bb052..3307841 100644
--- a/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/rest/RestServletVerbTest.java
+++ b/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/rest/RestServletVerbTest.java
@@ -16,7 +16,14 @@
  */
 package org.apache.camel.component.servlet.rest;
 
-import com.meterware.httpunit.*;
+import java.io.ByteArrayInputStream;
+
+import com.meterware.httpunit.GetMethodWebRequest;
+import com.meterware.httpunit.HeaderOnlyWebRequest;
+import com.meterware.httpunit.PostMethodWebRequest;
+import com.meterware.httpunit.PutMethodWebRequest;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
 import com.meterware.servletunit.ServletUnitClient;
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
@@ -24,8 +31,6 @@ import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.component.servlet.ServletCamelRouterTestSupport;
 import org.junit.Test;
 
-import java.io.ByteArrayInputStream;
-
 public class RestServletVerbTest extends ServletCamelRouterTestSupport {
 
     @Test

http://git-wip-us.apache.org/repos/asf/camel/blob/79367a51/components/camel-xmlbeans/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-xmlbeans/pom.xml b/components/camel-xmlbeans/pom.xml
index e12c410..c03bb2f 100644
--- a/components/camel-xmlbeans/pom.xml
+++ b/components/camel-xmlbeans/pom.xml
@@ -28,7 +28,7 @@
 
   <artifactId>camel-xmlbeans</artifactId>
   <packaging>jar</packaging>
-  <name>Camel :: XMLBeans</name>
+  <name>Camel :: XMLBeans (deprecated)</name>
   <description>Camel XMLBeans support</description>
 
   <properties>


[3/4] camel git commit: Consistently normalizing paths as Undertow expects both during startup and shutdown

Posted by da...@apache.org.
Consistently normalizing paths as Undertow expects both during startup and shutdown


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

Branch: refs/heads/master
Commit: 36032729b785bd17ca478db6ff21fd66f7d81ad0
Parents: b6ee9c4
Author: Scott Cranton <sc...@cranton.com>
Authored: Sat Feb 18 18:19:00 2017 -0500
Committer: Scott Cranton <sc...@cranton.com>
Committed: Sat Feb 18 18:19:00 2017 -0500

----------------------------------------------------------------------
 .../camel/component/undertow/handlers/CamelRootHandler.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/36032729/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelRootHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelRootHandler.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelRootHandler.java
index ef7e290..fe7c484 100644
--- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelRootHandler.java
+++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelRootHandler.java
@@ -36,7 +36,7 @@ public class CamelRootHandler implements HttpHandler {
     }
 
     public synchronized void add(String path, String[] methods, boolean prefixMatch, HttpHandler handler) {
-        String basePath = URLUtils.normalizeSlashes(getBasePath(path));
+        String basePath = getBasePath(path);
         HttpHandler basePathHandler = pathHandler.getHandler(basePath);
 
         CamelMethodHandler targetHandler;
@@ -166,8 +166,8 @@ public class CamelRootHandler implements HttpHandler {
 
     private String getBasePath(String path) {
         if (path.contains("{")) {
-            return PathTemplate.create(path).getBase();
+            path = PathTemplate.create(path).getBase();
         }
-        return path;
+        return URLUtils.normalizeSlashes(path);
     }
 }