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 2014/06/27 18:29:22 UTC
[5/8] git commit: CAMEL-7354: camel-spark component.
CAMEL-7354: camel-spark component.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3ff10728
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3ff10728
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3ff10728
Branch: refs/heads/master
Commit: 3ff10728825cff4a5483f865ebf6a681a89719dc
Parents: 321ab93
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Jun 27 16:17:27 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jun 27 16:17:27 2014 +0200
----------------------------------------------------------------------
.../component/spark/DefaultSparkBinding.java | 8 ++++
.../component/spark/CamelSparkSplatTest.java | 45 ++++++++++++++++++++
2 files changed, 53 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/3ff10728/components/camel-spark/src/main/java/org/apache/camel/component/spark/DefaultSparkBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/DefaultSparkBinding.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/DefaultSparkBinding.java
index 4f1251a..f40b449 100644
--- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/DefaultSparkBinding.java
+++ b/components/camel-spark/src/main/java/org/apache/camel/component/spark/DefaultSparkBinding.java
@@ -88,6 +88,14 @@ public class DefaultSparkBinding implements SparkBinding {
SparkHelper.appendHeader(headers, key, decoded);
}
}
+
+ String[] splat = request.splat();
+ String key = "splat";
+ if (headerFilterStrategy != null
+ && !headerFilterStrategy.applyFilterToExternalHeaders(key, splat, exchange)) {
+ SparkHelper.appendHeader(headers, key, splat);
+ }
+
}
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/3ff10728/components/camel-spark/src/test/java/org/apache/camel/component/spark/CamelSparkSplatTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/test/java/org/apache/camel/component/spark/CamelSparkSplatTest.java b/components/camel-spark/src/test/java/org/apache/camel/component/spark/CamelSparkSplatTest.java
new file mode 100644
index 0000000..d6cfd27
--- /dev/null
+++ b/components/camel-spark/src/test/java/org/apache/camel/component/spark/CamelSparkSplatTest.java
@@ -0,0 +1,45 @@
+/**
+ * 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.spark;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class CamelSparkSplatTest extends BaseSparkTest {
+
+ @Test
+ public void testSparkGet() throws Exception {
+ getMockEndpoint("mock:foo").expectedMessageCount(1);
+
+ String out = template.requestBody("http://0.0.0.0:" + getPort() + "/hello/camel/to/world", null, String.class);
+ assertEquals("Bye big world from camel", out);
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("spark:get:/hello/*/to/*")
+ .to("mock:foo")
+ .transform().simple("Bye big ${header.splat[1]} from ${header.splat[0]}");
+ }
+ };
+ }
+}