Updated Branches:
  refs/heads/master cba66ff78 -> 1685f8f6c

CAMEL-6659: Validate routes is configured properly when using 
onException,onCompletion,transacted etc as they must be top-level configured on 
the route, and not nested in the middle of the routes.


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

Branch: refs/heads/master
Commit: 7a1c8e84b1ab669fa5f0ceed0236ee1ffae971c6
Parents: cba66ff
Author: Claus Ibsen <[email protected]>
Authored: Thu Aug 22 12:06:39 2013 +0200
Committer: Claus Ibsen <[email protected]>
Committed: Thu Aug 22 12:19:26 2013 +0200

----------------------------------------------------------------------
 .../apache/camel/model/InterceptDefinition.java |  5 ++
 .../camel/model/InterceptFromDefinition.java    |  5 ++
 .../InterceptSendToEndpointDefinition.java      |  5 ++
 .../camel/model/OnCompletionDefinition.java     |  5 ++
 .../camel/model/OnExceptionDefinition.java      |  5 ++
 .../apache/camel/model/PolicyDefinition.java    |  6 ++
 .../apache/camel/model/ProcessorDefinition.java | 56 ++++++-------
 .../camel/model/RouteDefinitionHelper.java      | 30 ++++++-
 .../camel/model/TransactedDefinition.java       |  6 ++
 .../RouteTopLevelMisconfiguredTest.java         | 86 ++++++++++++++++++++
 .../SpringRouteTopLevelMisconfiguredTest.java   | 58 +++++++++++++
 ...uteTopLevelOnCompletionMisconfiguredTest.xml | 38 +++++++++
 ...outeTopLevelOnExceptionMisconfiguredTest.xml | 39 +++++++++
 ...RouteTopLevelTransactedMisconfiguredTest.xml | 36 ++++++++
 14 files changed, 348 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7a1c8e84/camel-core/src/main/java/org/apache/camel/model/InterceptDefinition.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/InterceptDefinition.java 
b/camel-core/src/main/java/org/apache/camel/model/InterceptDefinition.java
index ed0208a..b712e6d 100644
--- a/camel-core/src/main/java/org/apache/camel/model/InterceptDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/InterceptDefinition.java
@@ -67,6 +67,11 @@ public class InterceptDefinition extends 
OutputDefinition<InterceptDefinition> {
     }
 
     @Override
+    public boolean isTopLevelOnly() {
+        return true;
+    }
+
+    @Override
     public Processor createProcessor(final RouteContext routeContext) throws 
Exception {
         // create the output processor
         output = this.createChildProcessor(routeContext, true);

http://git-wip-us.apache.org/repos/asf/camel/blob/7a1c8e84/camel-core/src/main/java/org/apache/camel/model/InterceptFromDefinition.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/InterceptFromDefinition.java 
b/camel-core/src/main/java/org/apache/camel/model/InterceptFromDefinition.java
index 3e96513..39edf10 100644
--- 
a/camel-core/src/main/java/org/apache/camel/model/InterceptFromDefinition.java
+++ 
b/camel-core/src/main/java/org/apache/camel/model/InterceptFromDefinition.java
@@ -65,6 +65,11 @@ public class InterceptFromDefinition extends 
InterceptDefinition {
     }
 
     @Override
+    public boolean isTopLevelOnly() {
+        return true;
+    }
+
+    @Override
     @SuppressWarnings({"unchecked", "rawtypes"})
     public Processor createProcessor(RouteContext routeContext) throws 
Exception {
         // insert a set header definition so we can set the intercepted 
endpoint uri as a header

http://git-wip-us.apache.org/repos/asf/camel/blob/7a1c8e84/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
 
b/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
index 24fd043..9b8bdc3 100644
--- 
a/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
+++ 
b/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
@@ -80,6 +80,11 @@ public class InterceptSendToEndpointDefinition extends 
OutputDefinition<Intercep
     }
 
     @Override
+    public boolean isTopLevelOnly() {
+        return true;
+    }
+
+    @Override
     public Processor createProcessor(final RouteContext routeContext) throws 
Exception {
         // create the detour
         final Processor detour = this.createChildProcessor(routeContext, true);

http://git-wip-us.apache.org/repos/asf/camel/blob/7a1c8e84/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java 
b/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java
index e67f780..d850941 100644
--- 
a/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java
+++ 
b/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java
@@ -102,6 +102,11 @@ public class OnCompletionDefinition extends 
ProcessorDefinition<OnCompletionDefi
     }
 
     @Override
+    public boolean isTopLevelOnly() {
+        return true;
+    }
+
+    @Override
     public Processor createProcessor(RouteContext routeContext) throws 
Exception {
         // assign whether this was a route scoped onCompletion or not
         // we need to know this later when setting the parent, as only route 
scoped should have parent

http://git-wip-us.apache.org/repos/asf/camel/blob/7a1c8e84/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java 
b/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
index bff027f..787732c 100644
--- a/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
@@ -135,6 +135,11 @@ public class OnExceptionDefinition extends 
ProcessorDefinition<OnExceptionDefini
         return true;
     }
 
+    @Override
+    public boolean isTopLevelOnly() {
+        return true;
+    }
+
     /**
      * Allows an exception handler to create a new redelivery policy for this 
exception type
      *

http://git-wip-us.apache.org/repos/asf/camel/blob/7a1c8e84/camel-core/src/main/java/org/apache/camel/model/PolicyDefinition.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/PolicyDefinition.java 
b/camel-core/src/main/java/org/apache/camel/model/PolicyDefinition.java
index fb5ece0..b211d03 100644
--- a/camel-core/src/main/java/org/apache/camel/model/PolicyDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/PolicyDefinition.java
@@ -86,6 +86,12 @@ public class PolicyDefinition extends 
OutputDefinition<PolicyDefinition> {
         return false;
     }
 
+    @Override
+    public boolean isTopLevelOnly() {
+        // a policy is often top-level but you can have it in lower-levels as 
well
+        return false;
+    }
+
     public String getRef() {
         return ref;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/7a1c8e84/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java 
b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
index 9eaea62..45889c3 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
@@ -113,6 +113,16 @@ public abstract class ProcessorDefinition<Type extends 
ProcessorDefinition<Type>
     public abstract boolean isOutputSupported();
 
     /**
+     * Whether this definition can only be added as top-level directly on the 
route itself (such as onException,onCompletion,intercept, etc.)
+     * <p/>
+     * If trying to add a top-level only definition to a nested output would 
fail in the {@link #addOutput(ProcessorDefinition)}
+     * method.
+     */
+    public boolean isTopLevelOnly() {
+        return false;
+    }
+
+    /**
      * Whether this model is abstract or not.
      * <p/>
      * An abstract model is something that is used for configuring cross 
cutting concerns such as
@@ -183,6 +193,12 @@ public abstract class ProcessorDefinition<Type extends 
ProcessorDefinition<Type>
             return;
         }
 
+        // validate that top-level is only added on the route (eg top level)
+        boolean parentIsRoute = 
this.getClass().isAssignableFrom(RouteDefinition.class);
+        if (output.isTopLevelOnly() && !parentIsRoute) {
+            throw new IllegalArgumentException("The output must be added as 
top-level on the route. Try moving " + output + " to the top of route.");
+        }
+
         output.setParent(this);
         configureChild(output);
         getOutputs().add(output);
@@ -2357,17 +2373,10 @@ public abstract class ProcessorDefinition<Type extends 
ProcessorDefinition<Type>
      * @return the exception builder to configure
      */
     public OnExceptionDefinition onException(Class<? extends Throwable> 
exceptionType) {
-        // onException can only be added on the route-level and not nested in 
splitter/policy etc
-        // Camel 3.0 will fix this where we will have a RouteScopeDefinition 
where route scoped
-        // configuration must take place, and not from this generic 
ProcessorDefinition
-        if (this.getClass().isAssignableFrom(RouteDefinition.class)) {
-            OnExceptionDefinition answer = new 
OnExceptionDefinition(exceptionType);
-            answer.setRouteScoped(true);
-            addOutput(answer);
-            return answer;
-        } else {
-            throw new IllegalArgumentException("onException can only be added 
directly to the route. Try moving this onException to the top of the route: " + 
this);
-        }
+        OnExceptionDefinition answer = new 
OnExceptionDefinition(exceptionType);
+        answer.setRouteScoped(true);
+        addOutput(answer);
+        return answer;
     }
 
     /**
@@ -2378,17 +2387,10 @@ public abstract class ProcessorDefinition<Type extends 
ProcessorDefinition<Type>
      * @return the exception builder to configure
      */
     public OnExceptionDefinition onException(Class<? extends Throwable>... 
exceptions) {
-        // onException can only be added on the route-level and not nested in 
splitter/policy etc
-        // Camel 3.0 will fix this where we will have a RouteScopeDefinition 
where route scoped
-        // configuration must take place, and not from this generic 
ProcessorDefinition
-        if (this.getClass().isAssignableFrom(RouteDefinition.class)) {
-            OnExceptionDefinition answer = new 
OnExceptionDefinition(Arrays.asList(exceptions));
-            answer.setRouteScoped(true);
-            addOutput(answer);
-            return answer;
-        } else {
-            throw new IllegalArgumentException("onException can only be added 
directly to the route. Try moving this onException to the top of the route: " + 
this);
-        }
+        OnExceptionDefinition answer = new 
OnExceptionDefinition(Arrays.asList(exceptions));
+        answer.setRouteScoped(true);
+        addOutput(answer);
+        return answer;
     }
 
     /**
@@ -2425,9 +2427,8 @@ public abstract class ProcessorDefinition<Type extends 
ProcessorDefinition<Type>
      *
      * @return the policy builder to configure
      */
-    public PolicyDefinition transacted() {
-        PolicyDefinition answer = new PolicyDefinition();
-        answer.setType(TransactedPolicy.class);
+    public TransactedDefinition transacted() {
+        TransactedDefinition answer = new TransactedDefinition();
         addOutput(answer);
         return answer;
     }
@@ -2438,9 +2439,8 @@ public abstract class ProcessorDefinition<Type extends 
ProcessorDefinition<Type>
      * @param ref  reference to lookup a transacted policy in the registry
      * @return the policy builder to configure
      */
-    public PolicyDefinition transacted(String ref) {
-        PolicyDefinition answer = new PolicyDefinition();
-        answer.setType(TransactedPolicy.class);
+    public TransactedDefinition transacted(String ref) {
+        TransactedDefinition answer = new TransactedDefinition();
         answer.setRef(ref);
         addOutput(answer);
         return answer;

http://git-wip-us.apache.org/repos/asf/camel/blob/7a1c8e84/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java 
b/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
index f0e6862..5df829d 100644
--- a/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
@@ -94,7 +94,7 @@ public final class RouteDefinitionHelper {
     }
 
     public static void initParent(ProcessorDefinition parent) {
-        List<ProcessorDefinition> children = parent.getOutputs();
+        List<ProcessorDefinition<?>> children = parent.getOutputs();
         for (ProcessorDefinition child : children) {
             child.setParent(parent);
             if (child.getOutputs() != null && !child.getOutputs().isEmpty()) {
@@ -105,7 +105,7 @@ public final class RouteDefinitionHelper {
     }
 
     private static void initParentAndErrorHandlerBuilder(ProcessorDefinition 
parent) {
-        List<ProcessorDefinition> children = parent.getOutputs();
+        List<ProcessorDefinition<?>> children = parent.getOutputs();
         for (ProcessorDefinition child : children) {
             child.setParent(parent);
             if (child.getOutputs() != null && !child.getOutputs().isEmpty()) {
@@ -172,6 +172,8 @@ public final class RouteDefinitionHelper {
 
         // parent and error handler builder should be initialized first
         initParentAndErrorHandlerBuilder(context, route, abstracts, 
onExceptions);
+        // validate top-level violations
+        validateTopLevel(route.getOutputs());
         // then interceptors
         initInterceptors(context, route, abstracts, upper, intercepts, 
interceptFromDefinitions, interceptSendToEndpointDefinitions);
         // then on completion
@@ -213,6 +215,25 @@ public final class RouteDefinitionHelper {
         }
     }
 
+    /**
+     * Validates that top-level only definitions is not added in the wrong 
places, such as nested
+     * inside a splitter etc.
+     */
+    private static void validateTopLevel(List<ProcessorDefinition<?>> 
children) {
+        for (ProcessorDefinition child : children) {
+            // validate that top-level is only added on the route (eg top 
level)
+            RouteDefinition route = ProcessorDefinitionHelper.getRoute(child);
+            boolean parentIsRoute = route != null && child.getParent() == 
route;
+            if (child.isTopLevelOnly() && !parentIsRoute) {
+                throw new IllegalArgumentException("The output must be added 
as top-level on the route. Try moving " + child + " to the top of route.");
+            }
+            if (child.getOutputs() != null && !child.getOutputs().isEmpty()) {
+                validateTopLevel(child.getOutputs());
+            }
+        }
+    }
+
+
     private static void initParentAndErrorHandlerBuilder(ModelCamelContext 
context, RouteDefinition route,
                                                          
List<ProcessorDefinition<?>> abstracts, List<OnExceptionDefinition> 
onExceptions) {
 
@@ -233,12 +254,13 @@ public final class RouteDefinitionHelper {
         // set the parent and error handler builder on the global on exceptions
         if (onExceptions != null) {
             for (OnExceptionDefinition global : onExceptions) {
-                
//global.setErrorHandlerBuilder(context.getErrorHandlerBuilder());
                 initParentAndErrorHandlerBuilder(global);
             }
         }
     }
 
+
+
     private static void initOnExceptions(List<ProcessorDefinition<?>> 
abstracts, List<ProcessorDefinition<?>> upper,
                                          List<OnExceptionDefinition> 
onExceptions) {
         // add global on exceptions if any
@@ -442,7 +464,7 @@ public final class RouteDefinitionHelper {
             }
         }
 
-        List<ProcessorDefinition> children = processor.getOutputs();
+        List<ProcessorDefinition<?>> children = processor.getOutputs();
         if (children != null && !children.isEmpty()) {
             for (ProcessorDefinition child : children) {
                 forceAssignIds(context, child);

http://git-wip-us.apache.org/repos/asf/camel/blob/7a1c8e84/camel-core/src/main/java/org/apache/camel/model/TransactedDefinition.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/TransactedDefinition.java 
b/camel-core/src/main/java/org/apache/camel/model/TransactedDefinition.java
index 0c1b2b9..3b85b37 100644
--- a/camel-core/src/main/java/org/apache/camel/model/TransactedDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/TransactedDefinition.java
@@ -99,6 +99,12 @@ public class TransactedDefinition extends 
OutputDefinition<TransactedDefinition>
         return true;
     }
 
+    @Override
+    public boolean isTopLevelOnly() {
+        // transacted is top level as we only allow have it configured once 
per route
+        return true;
+    }
+
     public String getRef() {
         return ref;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/7a1c8e84/camel-core/src/test/java/org/apache/camel/processor/RouteTopLevelMisconfiguredTest.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/test/java/org/apache/camel/processor/RouteTopLevelMisconfiguredTest.java
 
b/camel-core/src/test/java/org/apache/camel/processor/RouteTopLevelMisconfiguredTest.java
new file mode 100644
index 0000000..cb02b4f
--- /dev/null
+++ 
b/camel-core/src/test/java/org/apache/camel/processor/RouteTopLevelMisconfiguredTest.java
@@ -0,0 +1,86 @@
+/**
+ * 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 org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+
+public class RouteTopLevelMisconfiguredTest extends ContextTestSupport {
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
+
+    public void testInvalidOnException() throws Exception {
+        try {
+            context.addRoutes(new RouteBuilder() {
+                @Override
+                public void configure() throws Exception {
+                    from("direct:start")
+                        .split(body())
+                            .onException(IllegalArgumentException.class)
+                                .to("mock:illegal")
+                            .end()
+                            .to("mock:split")
+                        .end();
+                }
+            });
+            fail("Should fail");
+        } catch (IllegalArgumentException e) {
+            assertTrue(e.getMessage().startsWith("The output must be added as 
top-level on the route."));
+        }
+    }
+
+    public void testInvalidOnCompletion() throws Exception {
+        try {
+            context.addRoutes(new RouteBuilder() {
+                @Override
+                public void configure() throws Exception {
+                    from("direct:start")
+                        .split(body())
+                            .onCompletion()
+                                .to("mock:done")
+                            .end()
+                            .to("mock:split")
+                        .end();
+                }
+            });
+            fail("Should fail");
+        } catch (IllegalArgumentException e) {
+            assertTrue(e.getMessage().startsWith("The output must be added as 
top-level on the route."));
+        }
+    }
+
+    public void testInvalidTransacted() throws Exception {
+        try {
+            context.addRoutes(new RouteBuilder() {
+                @Override
+                public void configure() throws Exception {
+                    from("direct:start")
+                        .split(body())
+                            .transacted()
+                            .to("mock:split")
+                        .end();
+                }
+            });
+            fail("Should fail");
+        } catch (IllegalArgumentException e) {
+            assertTrue(e.getMessage().startsWith("The output must be added as 
top-level on the route."));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/7a1c8e84/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteTopLevelMisconfiguredTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteTopLevelMisconfiguredTest.java
 
b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteTopLevelMisconfiguredTest.java
new file mode 100644
index 0000000..24eca8b
--- /dev/null
+++ 
b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRouteTopLevelMisconfiguredTest.java
@@ -0,0 +1,58 @@
+/**
+ * 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.ContextTestSupport;
+import org.apache.camel.FailedToCreateRouteException;
+
+import static 
org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+public class SpringRouteTopLevelMisconfiguredTest extends ContextTestSupport {
+
+    protected CamelContext createCamelContext() throws Exception {
+        try {
+            createSpringCamelContext(this, 
"org/apache/camel/spring/processor/SpringRouteTopLevelOnExceptionMisconfiguredTest.xml");
+            fail("Should have thrown exception");
+        } catch (Exception e) {
+            assertTrue(e.getCause().getMessage().startsWith("The output must 
be added as top-level on the route."));
+        }
+
+        try {
+            createSpringCamelContext(this, 
"org/apache/camel/spring/processor/SpringRouteTopLevelOnCompletionMisconfiguredTest.xml");
+            fail("Should have thrown exception");
+        } catch (Exception e) {
+            assertTrue(e.getCause().getMessage().startsWith("The output must 
be added as top-level on the route."));
+        }
+
+        try {
+            createSpringCamelContext(this, 
"org/apache/camel/spring/processor/SpringRouteTopLevelTransactedMisconfiguredTest.xml");
+            fail("Should have thrown exception");
+        } catch (Exception e) {
+            assertTrue(e.getCause().getMessage().startsWith("The output must 
be added as top-level on the route."));
+        }
+
+
+        // return a working context instead, to let this test pass
+        return createSpringCamelContext(this, 
"org/apache/camel/spring/processor/SpringTryProcessorHandledTest.xml");
+    }
+
+    public void testMisconfigured() {
+        // noop
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/7a1c8e84/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringRouteTopLevelOnCompletionMisconfiguredTest.xml
----------------------------------------------------------------------
diff --git 
a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringRouteTopLevelOnCompletionMisconfiguredTest.xml
 
b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringRouteTopLevelOnCompletionMisconfiguredTest.xml
new file mode 100644
index 0000000..e53915a
--- /dev/null
+++ 
b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringRouteTopLevelOnCompletionMisconfiguredTest.xml
@@ -0,0 +1,38 @@
+<?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";>
+    <route>
+      <from uri="direct:start"/>
+      <split>
+        <simple>body</simple>
+        <onCompletion>
+          <to uri="mock:done"/>
+        </onCompletion>
+        <to uri="mock:split"/>
+      </split>
+    </route>
+  </camelContext>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/7a1c8e84/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringRouteTopLevelOnExceptionMisconfiguredTest.xml
----------------------------------------------------------------------
diff --git 
a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringRouteTopLevelOnExceptionMisconfiguredTest.xml
 
b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringRouteTopLevelOnExceptionMisconfiguredTest.xml
new file mode 100644
index 0000000..d616cac
--- /dev/null
+++ 
b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringRouteTopLevelOnExceptionMisconfiguredTest.xml
@@ -0,0 +1,39 @@
+<?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";>
+    <route>
+      <from uri="direct:start"/>
+      <split>
+        <simple>body</simple>
+        <onException>
+          <exception>java.lang.IllegalArgumentException</exception>
+          <to uri="mock:illegal"/>
+        </onException>
+        <to uri="mock:split"/>
+      </split>
+    </route>
+  </camelContext>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/7a1c8e84/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringRouteTopLevelTransactedMisconfiguredTest.xml
----------------------------------------------------------------------
diff --git 
a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringRouteTopLevelTransactedMisconfiguredTest.xml
 
b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringRouteTopLevelTransactedMisconfiguredTest.xml
new file mode 100644
index 0000000..2eebf6c
--- /dev/null
+++ 
b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringRouteTopLevelTransactedMisconfiguredTest.xml
@@ -0,0 +1,36 @@
+<?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";>
+    <route>
+      <from uri="direct:start"/>
+      <split>
+        <simple>body</simple>
+        <transacted/>
+        <to uri="mock:split"/>
+      </split>
+    </route>
+  </camelContext>
+
+</beans>

Reply via email to