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 2015/07/13 14:37:56 UTC

[05/10] camel git commit: CAMEL-4596: enrich supports dynamic uris.

CAMEL-4596: enrich supports dynamic uris.


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

Branch: refs/heads/master
Commit: 2d9189100481e7ad305c600f014a3bf0d467bc3a
Parents: 5fdf8bc
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Jul 13 11:35:42 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Jul 13 11:35:42 2015 +0200

----------------------------------------------------------------------
 .../processor/SpringEnrichExpressionTest.java   | 30 ++++++++++++
 .../SpringEnricherAggregateOnExceptionTest.xml  |  8 +++-
 .../spring/processor/enrichExpressionTest.xml   | 50 ++++++++++++++++++++
 .../apache/camel/spring/processor/enricher.xml  |  4 +-
 .../camel/spring/processor/enricherref.xml      |  4 +-
 5 files changed, 92 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2d918910/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringEnrichExpressionTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringEnrichExpressionTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringEnrichExpressionTest.java
new file mode 100644
index 0000000..cd32b67
--- /dev/null
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringEnrichExpressionTest.java
@@ -0,0 +1,30 @@
+/**
+ * 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.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.enricher.EnrichExpressionTest;
+
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+public class SpringEnrichExpressionTest extends EnrichExpressionTest {
+
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/enrichExpressionTest.xml");
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/2d918910/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringEnricherAggregateOnExceptionTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringEnricherAggregateOnExceptionTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringEnricherAggregateOnExceptionTest.xml
index 8084d3a..3be128e 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringEnricherAggregateOnExceptionTest.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringEnricherAggregateOnExceptionTest.xml
@@ -25,12 +25,16 @@
   <camelContext xmlns="http://camel.apache.org/schema/spring">
     <route>
       <from uri="direct:start"/>
-      <enrich uri="direct:foo" strategyRef="myAggregator" aggregateOnException="true"/>
+      <enrich strategyRef="myAggregator" aggregateOnException="true">
+        <constant>direct:foo</constant>
+      </enrich>
       <to uri="mock:result"/>
     </route>
     <route>
       <from uri="direct:start2"/>
-      <enrich uri="direct:foo" strategyRef="myAggregator" aggregateOnException="false"/>
+      <enrich strategyRef="myAggregator" aggregateOnException="false">
+        <constant>direct:foo</constant>
+      </enrich>
       <to uri="mock:result"/>
     </route>
     <route>

http://git-wip-us.apache.org/repos/asf/camel/blob/2d918910/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/enrichExpressionTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/enrichExpressionTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/enrichExpressionTest.xml
new file mode 100644
index 0000000..91b7f42
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/enrichExpressionTest.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <!-- START SNIPPET: e1 -->
+    <route>
+      <from uri="direct:start"/>
+      <enrich>
+        <header>source</header>
+      </enrich>
+      <to uri="mock:result"/>
+    </route>
+    <!-- END SNIPPET: e1 -->
+
+    <route>
+      <from uri="direct:foo"/>
+      <transform>
+        <constant>Hello World</constant>
+      </transform>
+    </route>
+    <route>
+      <from uri="direct:bar"/>
+      <transform>
+        <constant>Bye World</constant>
+      </transform>
+    </route>
+  </camelContext>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/2d918910/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/enricher.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/enricher.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/enricher.xml
index 6d03630..918f926 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/enricher.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/enricher.xml
@@ -26,7 +26,9 @@
   <camelContext xmlns="http://camel.apache.org/schema/spring">
     <route>
       <from uri="direct:start"/>
-      <enrich uri="direct:resource" strategyRef="sampleAggregator"/>
+      <enrich strategyRef="sampleAggregator">
+        <constant>direct:resource</constant>
+      </enrich>
       <to uri="mock:result"/>
     </route>
     <route>

http://git-wip-us.apache.org/repos/asf/camel/blob/2d918910/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/enricherref.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/enricherref.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/enricherref.xml
index 049d289..2825339 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/enricherref.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/enricherref.xml
@@ -30,7 +30,9 @@
 
         <route>
             <from uri="direct:start"/>
-            <enrich ref="cool" strategyRef="sampleAggregator"/>
+            <enrich strategyRef="sampleAggregator">
+              <simple>ref:cool</simple>
+            </enrich>
             <to uri="mock:result"/>
         </route>
         <route>