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/08/03 09:45:41 UTC

[1/3] git commit: CAMEL-6604: Fixed routing slip and dynamic router EIP to work with stream caching properly.

Updated Branches:
  refs/heads/camel-2.10.x 024ea5cc9 -> 10b3108a3
  refs/heads/camel-2.11.x 047001556 -> 2c6e0e501
  refs/heads/master 4e1b35666 -> 557514020


CAMEL-6604: Fixed routing slip and dynamic router EIP to work with stream caching properly.


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

Branch: refs/heads/master
Commit: 55751402055e01a774be3c9e3c1d440f6cfb5f1b
Parents: 4e1b356
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Aug 3 09:37:07 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Aug 3 09:37:20 2013 +0200

----------------------------------------------------------------------
 .../org/apache/camel/processor/RoutingSlip.java |  5 ++
 .../processor/StreamCachingRoutingSlipTest.java | 49 ++++++++++++++++++++
 2 files changed, 54 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/55751402/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java b/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
index cd4a864..bde0f42 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
@@ -36,6 +36,7 @@ import org.apache.camel.impl.ProducerCache;
 import org.apache.camel.support.ServiceSupport;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.apache.camel.util.ExchangeHelper;
+import org.apache.camel.util.MessageHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.ServiceHelper;
 import org.slf4j.Logger;
@@ -268,6 +269,10 @@ public class RoutingSlip extends ServiceSupport implements AsyncProcessor, Trace
         // exchange being routed.
         copy.setExchangeId(current.getExchangeId());
         copyOutToIn(copy, current);
+
+        // ensure stream caching is reset
+        MessageHelper.resetStreamCache(copy.getIn());
+
         return copy;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/55751402/camel-core/src/test/java/org/apache/camel/processor/StreamCachingRoutingSlipTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/StreamCachingRoutingSlipTest.java b/camel-core/src/test/java/org/apache/camel/processor/StreamCachingRoutingSlipTest.java
new file mode 100644
index 0000000..9a0909b
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/processor/StreamCachingRoutingSlipTest.java
@@ -0,0 +1,49 @@
+/**
+ * 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.processor;
+
+import java.io.ByteArrayInputStream;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+
+public class StreamCachingRoutingSlipTest extends ContextTestSupport {
+
+    public void testByteArrayInputStream() throws Exception {
+        getMockEndpoint("mock:foo").expectedBodiesReceived("<hello/>");
+        getMockEndpoint("mock:bar").expectedBodiesReceived("<hello/>");
+        getMockEndpoint("mock:baz").expectedBodiesReceived("<hello/>");
+
+        template.sendBodyAndHeader("direct:a", new ByteArrayInputStream("<hello/>".getBytes()), "mySlip", "mock:foo,mock:bar,mock:baz");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                context.setStreamCaching(true);
+
+                from("direct:a")
+                    .routingSlip(header("mySlip"));
+            }
+        };
+    }
+}
+


[3/3] git commit: CAMEL-6604: Fixed routing slip and dynamic router EIP to work with stream caching properly.

Posted by da...@apache.org.
CAMEL-6604: Fixed routing slip and dynamic router EIP to work with stream caching properly.


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

Branch: refs/heads/camel-2.10.x
Commit: 10b3108a3bb7cef239c936477d96fae43ddbe3d4
Parents: 024ea5c
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Aug 3 09:37:07 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Aug 3 09:38:59 2013 +0200

----------------------------------------------------------------------
 .../org/apache/camel/processor/RoutingSlip.java |  5 ++
 .../processor/StreamCachingRoutingSlipTest.java | 49 ++++++++++++++++++++
 2 files changed, 54 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/10b3108a/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java b/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
index 5a50f4e..dfb4ecd 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
@@ -36,6 +36,7 @@ import org.apache.camel.impl.ProducerCache;
 import org.apache.camel.support.ServiceSupport;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.apache.camel.util.ExchangeHelper;
+import org.apache.camel.util.MessageHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.ServiceHelper;
 import org.slf4j.Logger;
@@ -268,6 +269,10 @@ public class RoutingSlip extends ServiceSupport implements AsyncProcessor, Trace
         // exchange being routed.
         copy.setExchangeId(current.getExchangeId());
         copyOutToIn(copy, current);
+
+        // ensure stream caching is reset
+        MessageHelper.resetStreamCache(copy.getIn());
+
         return copy;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/10b3108a/camel-core/src/test/java/org/apache/camel/processor/StreamCachingRoutingSlipTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/StreamCachingRoutingSlipTest.java b/camel-core/src/test/java/org/apache/camel/processor/StreamCachingRoutingSlipTest.java
new file mode 100644
index 0000000..9a0909b
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/processor/StreamCachingRoutingSlipTest.java
@@ -0,0 +1,49 @@
+/**
+ * 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.processor;
+
+import java.io.ByteArrayInputStream;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+
+public class StreamCachingRoutingSlipTest extends ContextTestSupport {
+
+    public void testByteArrayInputStream() throws Exception {
+        getMockEndpoint("mock:foo").expectedBodiesReceived("<hello/>");
+        getMockEndpoint("mock:bar").expectedBodiesReceived("<hello/>");
+        getMockEndpoint("mock:baz").expectedBodiesReceived("<hello/>");
+
+        template.sendBodyAndHeader("direct:a", new ByteArrayInputStream("<hello/>".getBytes()), "mySlip", "mock:foo,mock:bar,mock:baz");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                context.setStreamCaching(true);
+
+                from("direct:a")
+                    .routingSlip(header("mySlip"));
+            }
+        };
+    }
+}
+


[2/3] git commit: CAMEL-6604: Fixed routing slip and dynamic router EIP to work with stream caching properly.

Posted by da...@apache.org.
CAMEL-6604: Fixed routing slip and dynamic router EIP to work with stream caching properly.


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

Branch: refs/heads/camel-2.11.x
Commit: 2c6e0e501252dc8d3beb4830ee9247ab0ef3d0f0
Parents: 0470015
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Aug 3 09:37:07 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Aug 3 09:38:15 2013 +0200

----------------------------------------------------------------------
 .../org/apache/camel/processor/RoutingSlip.java |  5 ++
 .../processor/StreamCachingRoutingSlipTest.java | 49 ++++++++++++++++++++
 2 files changed, 54 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2c6e0e50/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java b/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
index 5a50f4e..dfb4ecd 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
@@ -36,6 +36,7 @@ import org.apache.camel.impl.ProducerCache;
 import org.apache.camel.support.ServiceSupport;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.apache.camel.util.ExchangeHelper;
+import org.apache.camel.util.MessageHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.ServiceHelper;
 import org.slf4j.Logger;
@@ -268,6 +269,10 @@ public class RoutingSlip extends ServiceSupport implements AsyncProcessor, Trace
         // exchange being routed.
         copy.setExchangeId(current.getExchangeId());
         copyOutToIn(copy, current);
+
+        // ensure stream caching is reset
+        MessageHelper.resetStreamCache(copy.getIn());
+
         return copy;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/2c6e0e50/camel-core/src/test/java/org/apache/camel/processor/StreamCachingRoutingSlipTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/StreamCachingRoutingSlipTest.java b/camel-core/src/test/java/org/apache/camel/processor/StreamCachingRoutingSlipTest.java
new file mode 100644
index 0000000..9a0909b
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/processor/StreamCachingRoutingSlipTest.java
@@ -0,0 +1,49 @@
+/**
+ * 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.processor;
+
+import java.io.ByteArrayInputStream;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+
+public class StreamCachingRoutingSlipTest extends ContextTestSupport {
+
+    public void testByteArrayInputStream() throws Exception {
+        getMockEndpoint("mock:foo").expectedBodiesReceived("<hello/>");
+        getMockEndpoint("mock:bar").expectedBodiesReceived("<hello/>");
+        getMockEndpoint("mock:baz").expectedBodiesReceived("<hello/>");
+
+        template.sendBodyAndHeader("direct:a", new ByteArrayInputStream("<hello/>".getBytes()), "mySlip", "mock:foo,mock:bar,mock:baz");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                context.setStreamCaching(true);
+
+                from("direct:a")
+                    .routingSlip(header("mySlip"));
+            }
+        };
+    }
+}
+