You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2013/07/24 15:46:25 UTC
[1/5] git commit: Added test based on user issue
Updated Branches:
refs/heads/camel-2.10.x 58d46a701 -> f6ed747b2
refs/heads/camel-2.11.x 53696fcc8 -> 5b6f3ce8c
refs/heads/master 0bee1b227 -> 4adb1e749
Added test based on user issue
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8b298b49
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8b298b49
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8b298b49
Branch: refs/heads/master
Commit: 8b298b4935855d58c7591c87af259291b1c1f883
Parents: 0bee1b2
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jul 24 15:39:11 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Jul 24 15:39:11 2013 +0200
----------------------------------------------------------------------
.../http/NettyHttpProducerWithHeaderTest.java | 69 ++++++++++++++++++++
1 file changed, 69 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/8b298b49/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerWithHeaderTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerWithHeaderTest.java b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerWithHeaderTest.java
new file mode 100644
index 0000000..8452663
--- /dev/null
+++ b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerWithHeaderTest.java
@@ -0,0 +1,69 @@
+/**
+ * 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;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class NettyHttpProducerWithHeaderTest extends BaseNettyTest {
+
+ @Test
+ public void testHttpSimple() throws Exception {
+ getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
+
+ String out = template.requestBody("netty-http:http://localhost:{{port}}/foo", null, String.class);
+ assertEquals("Bye World", out);
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Test
+ public void testHttpSimpleHeader() throws Exception {
+ getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
+
+ String out = template.requestBodyAndHeader("netty-http:http://localhost:{{port}}/foo", null, Exchange.HTTP_METHOD, "GET", String.class);
+ assertEquals("Bye World", out);
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Test
+ public void testHttpSimpleHeaderAndBody() throws Exception {
+ // even if we have a body we force it to be GET
+ getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
+ getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
+
+ String out = template.requestBodyAndHeader("netty-http:http://localhost:{{port}}/foo", "Hello World", Exchange.HTTP_METHOD, "GET", String.class);
+ assertEquals("Bye World", out);
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("netty-http:http://0.0.0.0:{{port}}/foo")
+ .to("mock:input")
+ .transform().constant("Bye World");
+ }
+ };
+ }
+
+}
[5/5] git commit: CAMEL-6572: Fixed validator component to load
reosurces from classpath with relative paths in OSGi.
Posted by da...@apache.org.
CAMEL-6572: Fixed validator component to load reosurces from classpath with relative paths in OSGi.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f6ed747b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f6ed747b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f6ed747b
Branch: refs/heads/camel-2.10.x
Commit: f6ed747b2fa3f1a9501c91678e457adde302bec0
Parents: 58d46a7
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jul 24 15:43:36 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Jul 24 15:45:46 2013 +0200
----------------------------------------------------------------------
.../java/org/apache/camel/util/ResourceHelper.java | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/f6ed747b/camel-core/src/main/java/org/apache/camel/util/ResourceHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/ResourceHelper.java b/camel-core/src/main/java/org/apache/camel/util/ResourceHelper.java
index a7717af..b301abe 100644
--- a/camel-core/src/main/java/org/apache/camel/util/ResourceHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/ResourceHelper.java
@@ -101,7 +101,8 @@ public final class ResourceHelper {
}
// load from classpath by default
- InputStream is = classResolver.loadResourceAsStream(uri);
+ String resolvedName = resolveUriPath(uri);
+ InputStream is = classResolver.loadResourceAsStream(resolvedName);
if (is == null) {
throw new FileNotFoundException("Cannot find resource in classpath for URI: " + uri);
} else {
@@ -175,4 +176,18 @@ public final class ResourceHelper {
return uri;
}
}
+
+ /**
+ * Helper operation used to remove relative path notation from
+ * resources. Most critical for resources on the Classpath
+ * as resource loaders will not resolve the relative paths correctly.
+ *
+ * @param name the name of the resource to load
+ * @return the modified or unmodified string if there were no changes
+ */
+ private static String resolveUriPath(String name) {
+ // compact the path and use / as separator as that's used for loading resources on the classpath
+ return FileUtil.compactPath(name, '/');
+ }
+
}
[2/5] git commit: CAMEL-6572: Fixed validator component to load
reosurces from classpath with relative paths in OSGi.
Posted by da...@apache.org.
CAMEL-6572: Fixed validator component to load reosurces from classpath with relative paths in OSGi.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/353abe0e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/353abe0e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/353abe0e
Branch: refs/heads/master
Commit: 353abe0ec7dde5491c15c3bc46e9da0daf546222
Parents: 8b298b4
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jul 24 15:43:36 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Jul 24 15:43:36 2013 +0200
----------------------------------------------------------------------
.../java/org/apache/camel/util/ResourceHelper.java | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/353abe0e/camel-core/src/main/java/org/apache/camel/util/ResourceHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/ResourceHelper.java b/camel-core/src/main/java/org/apache/camel/util/ResourceHelper.java
index a7717af..b301abe 100644
--- a/camel-core/src/main/java/org/apache/camel/util/ResourceHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/ResourceHelper.java
@@ -101,7 +101,8 @@ public final class ResourceHelper {
}
// load from classpath by default
- InputStream is = classResolver.loadResourceAsStream(uri);
+ String resolvedName = resolveUriPath(uri);
+ InputStream is = classResolver.loadResourceAsStream(resolvedName);
if (is == null) {
throw new FileNotFoundException("Cannot find resource in classpath for URI: " + uri);
} else {
@@ -175,4 +176,18 @@ public final class ResourceHelper {
return uri;
}
}
+
+ /**
+ * Helper operation used to remove relative path notation from
+ * resources. Most critical for resources on the Classpath
+ * as resource loaders will not resolve the relative paths correctly.
+ *
+ * @param name the name of the resource to load
+ * @return the modified or unmodified string if there were no changes
+ */
+ private static String resolveUriPath(String name) {
+ // compact the path and use / as separator as that's used for loading resources on the classpath
+ return FileUtil.compactPath(name, '/');
+ }
+
}
[4/5] git commit: CAMEL-6572: Fixed validator component to load
reosurces from classpath with relative paths in OSGi.
Posted by da...@apache.org.
CAMEL-6572: Fixed validator component to load reosurces from classpath with relative paths in OSGi.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5b6f3ce8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5b6f3ce8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5b6f3ce8
Branch: refs/heads/camel-2.11.x
Commit: 5b6f3ce8cf041cbf4ad96f00ed480b47238559d8
Parents: 53696fc
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jul 24 15:43:36 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Jul 24 15:45:14 2013 +0200
----------------------------------------------------------------------
.../java/org/apache/camel/util/ResourceHelper.java | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/5b6f3ce8/camel-core/src/main/java/org/apache/camel/util/ResourceHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/ResourceHelper.java b/camel-core/src/main/java/org/apache/camel/util/ResourceHelper.java
index a7717af..b301abe 100644
--- a/camel-core/src/main/java/org/apache/camel/util/ResourceHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/ResourceHelper.java
@@ -101,7 +101,8 @@ public final class ResourceHelper {
}
// load from classpath by default
- InputStream is = classResolver.loadResourceAsStream(uri);
+ String resolvedName = resolveUriPath(uri);
+ InputStream is = classResolver.loadResourceAsStream(resolvedName);
if (is == null) {
throw new FileNotFoundException("Cannot find resource in classpath for URI: " + uri);
} else {
@@ -175,4 +176,18 @@ public final class ResourceHelper {
return uri;
}
}
+
+ /**
+ * Helper operation used to remove relative path notation from
+ * resources. Most critical for resources on the Classpath
+ * as resource loaders will not resolve the relative paths correctly.
+ *
+ * @param name the name of the resource to load
+ * @return the modified or unmodified string if there were no changes
+ */
+ private static String resolveUriPath(String name) {
+ // compact the path and use / as separator as that's used for loading resources on the classpath
+ return FileUtil.compactPath(name, '/');
+ }
+
}
[3/5] git commit: Added test based on user issue
Posted by da...@apache.org.
Added test based on user issue
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4adb1e74
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4adb1e74
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4adb1e74
Branch: refs/heads/master
Commit: 4adb1e7491ec57e968f533017b8c8d6fcb1e018b
Parents: 353abe0
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jul 24 15:44:49 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Jul 24 15:44:49 2013 +0200
----------------------------------------------------------------------
.../http/NettyHttpProducerWithHeaderTest.java | 23 ++++++--------------
1 file changed, 7 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/4adb1e74/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerWithHeaderTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerWithHeaderTest.java b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerWithHeaderTest.java
index 8452663..3362cb1 100644
--- a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerWithHeaderTest.java
+++ b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerWithHeaderTest.java
@@ -23,32 +23,23 @@ import org.junit.Test;
public class NettyHttpProducerWithHeaderTest extends BaseNettyTest {
@Test
- public void testHttpSimple() throws Exception {
+ public void testHttpSimpleGet() throws Exception {
getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
+ getMockEndpoint("mock:input").expectedHeaderReceived("myTraceId", "mockCorrelationID");
- String out = template.requestBody("netty-http:http://localhost:{{port}}/foo", null, String.class);
+ String out = template.requestBodyAndHeader("netty-http:http://localhost:{{port}}/foo", null, "myTraceId", "mockCorrelationID", String.class);
assertEquals("Bye World", out);
assertMockEndpointsSatisfied();
}
@Test
- public void testHttpSimpleHeader() throws Exception {
- getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
-
- String out = template.requestBodyAndHeader("netty-http:http://localhost:{{port}}/foo", null, Exchange.HTTP_METHOD, "GET", String.class);
- assertEquals("Bye World", out);
-
- assertMockEndpointsSatisfied();
- }
-
- @Test
- public void testHttpSimpleHeaderAndBody() throws Exception {
- // even if we have a body we force it to be GET
+ public void testHttpSimplePost() throws Exception {
+ getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_METHOD, "POST");
+ getMockEndpoint("mock:input").expectedHeaderReceived("myTraceId", "mockCorrelationID");
getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
- getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
- String out = template.requestBodyAndHeader("netty-http:http://localhost:{{port}}/foo", "Hello World", Exchange.HTTP_METHOD, "GET", String.class);
+ String out = template.requestBodyAndHeader("netty-http:http://localhost:{{port}}/foo", "Hello World", "myTraceId", "mockCorrelationID", String.class);
assertEquals("Bye World", out);
assertMockEndpointsSatisfied();