Repository: camel
Updated Branches:
  refs/heads/camel-2.14.x dd8cf3d42 -> 28f1079e2


Added a test based on user forum issue


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

Branch: refs/heads/camel-2.14.x
Commit: 28f1079e2be766a9db73b174eadc074f8c2df699
Parents: dd8cf3d
Author: Claus Ibsen <davscl...@apache.org>
Authored: Thu Jan 8 18:56:56 2015 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Thu Jan 8 18:57:35 2015 +0100

----------------------------------------------------------------------
 .../AdviceWithTasksOnExceptionTest.java         | 61 ++++++++++++++++++++
 1 file changed, 61 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/28f1079e/camel-core/src/test/java/org/apache/camel/processor/interceptor/AdviceWithTasksOnExceptionTest.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/test/java/org/apache/camel/processor/interceptor/AdviceWithTasksOnExceptionTest.java
 
b/camel-core/src/test/java/org/apache/camel/processor/interceptor/AdviceWithTasksOnExceptionTest.java
new file mode 100644
index 0000000..b539f01
--- /dev/null
+++ 
b/camel-core/src/test/java/org/apache/camel/processor/interceptor/AdviceWithTasksOnExceptionTest.java
@@ -0,0 +1,61 @@
+/**
+ * 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.interceptor;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.AdviceWithRouteBuilder;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * Advice with tests onException
+ */
+public class AdviceWithTasksOnExceptionTest extends ContextTestSupport {
+
+    public void testBeforeWithOnException() throws Exception {
+        context.getRouteDefinitions().get(0).adviceWith(context, new 
AdviceWithRouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // weave the node in the route which has id = bar
+                // and insert the following route path before the adviced node
+                weaveById("bar").before().to("mock:a").transform(constant("Bye 
World"));
+            }
+        });
+
+        getMockEndpoint("mock:foo").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:a").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:bar").expectedBodiesReceived("Bye World");
+        getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                        
.onException(Exception.class).handled(true).to("mock:error").end()
+                        .to("mock:foo")
+                        .to("mock:bar").id("bar")
+                        .to("mock:result");
+            }
+        };
+    }
+}
\ No newline at end of file

Reply via email to