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 2010/03/29 12:38:13 UTC
svn commit: r928696 - in /camel/trunk:
camel-core/src/main/java/org/apache/camel/model/
components/camel-spring/src/test/java/org/apache/camel/spring/issues/
components/camel-spring/src/test/resources/org/apache/camel/spring/issues/
Author: davsclaus
Date: Mon Mar 29 10:38:13 2010
New Revision: 928696
URL: http://svn.apache.org/viewvc?rev=928696&view=rev
Log:
CAMEL-2577: Fixed doTry .. doCatch .. doFinally and having exceptions being thrown from deep nested nodes.
Added:
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringCatchNestedFailTest.java (with props)
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringFinallyNestedFailTest.java (with props)
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTryCatchFinallyAndErrorHandlerTest.java (with props)
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTryNestedFailTest.java (contents, props changed)
- copied, changed from r928423, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTryCatchWithSplitIssueTest.java
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringCatchNestedFailTest.xml (with props)
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringFinallyNestedFailTest.xml (with props)
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryCatchFinallyAndErrorHandlerTest.xml (with props)
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryNestedFailTest.xml (contents, props changed)
- copied, changed from r928423, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryCatchWithSplitIssueTest.xml
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java?rev=928696&r1=928695&r2=928696&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java Mon Mar 29 10:38:13 2010
@@ -202,6 +202,11 @@ public abstract class ProcessorDefinitio
// set the error handler, must be done after init as we can set the error handler as first in the chain
if (defn instanceof TryDefinition || defn instanceof CatchDefinition || defn instanceof FinallyDefinition) {
// do not use error handler for try .. catch .. finally blocks as it will handle errors itself
+ } else if (ProcessorDefinitionHelper.isParentOfType(TryDefinition.class, defn, true) ||
+ ProcessorDefinitionHelper.isParentOfType(CatchDefinition.class, defn, true) ||
+ ProcessorDefinitionHelper.isParentOfType(FinallyDefinition.class, defn, true)) {
+ // do not use error handler for try .. catch .. finally blocks as it will handle errors itself
+ // by checking that any of our parent(s) is not a try .. catch or finally type
} else if (defn instanceof MulticastDefinition || defn instanceof RecipientListDefinition) {
// do not use error handler for multicast or recipient list based as it offers fine grained error handlers for its outputs
} else {
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java?rev=928696&r1=928695&r2=928696&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java Mon Mar 29 10:38:13 2010
@@ -82,6 +82,29 @@ public final class ProcessorDefinitionHe
}
/**
+ * Is the given node parent(s) of the given type
+ * @param parentType the parent type
+ * @param node the current node
+ * @param recursive whether or not to check grand parent(s) as well
+ * @return <tt>true</tt> if parent(s) is of given type, <tt>false</tt> otherwise
+ */
+ public static boolean isParentOfType(Class<?> parentType, ProcessorDefinition<?> node, boolean recursive) {
+ if (node == null || node.getParent() == null) {
+ return false;
+ }
+
+ if (parentType.isAssignableFrom(node.getParent().getClass())) {
+ return true;
+ } else if (recursive) {
+ // recursive up the tree of parents
+ return isParentOfType(parentType, node.getParent(), true);
+ } else {
+ // no match
+ return false;
+ }
+ }
+
+ /**
* Gets the route definition the given node belongs to.
*
* @param node the node
Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringCatchNestedFailTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringCatchNestedFailTest.java?rev=928696&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringCatchNestedFailTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringCatchNestedFailTest.java Mon Mar 29 10:38:13 2010
@@ -0,0 +1,79 @@
+/**
+ * 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.issues;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ContextTestSupport;
+
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+/**
+ * @version $Revision$
+ */
+public class SpringCatchNestedFailTest extends ContextTestSupport {
+
+ protected CamelContext createCamelContext() throws Exception {
+ return createSpringCamelContext(this, "org/apache/camel/spring/issues/SpringCatchNestedFailTest.xml");
+ }
+
+ public void testOk() throws Exception {
+ getMockEndpoint("mock:bar").expectedMessageCount(1);
+ getMockEndpoint("mock:donkey").expectedMessageCount(0);
+ getMockEndpoint("mock:catch").expectedMessageCount(0);
+ getMockEndpoint("mock:kong").expectedMessageCount(0);
+ getMockEndpoint("mock:catchEnd").expectedMessageCount(0);
+ getMockEndpoint("mock:end").expectedMessageCount(1);
+
+ template.sendBody("direct:start", "Hello Camel");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ public void testFail() throws Exception {
+ getMockEndpoint("mock:bar").expectedMessageCount(0);
+ getMockEndpoint("mock:donkey").expectedMessageCount(1);
+ getMockEndpoint("mock:catch").expectedMessageCount(1);
+ getMockEndpoint("mock:kong").expectedMessageCount(0);
+ getMockEndpoint("mock:catchEnd").expectedMessageCount(1);
+ getMockEndpoint("mock:end").expectedMessageCount(1);
+
+ template.sendBody("direct:start", "Hello Donkey");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ public void testFailAgain() throws Exception {
+ getMockEndpoint("mock:bar").expectedMessageCount(0);
+ getMockEndpoint("mock:donkey").expectedMessageCount(1);
+ getMockEndpoint("mock:catch").expectedMessageCount(1);
+ getMockEndpoint("mock:kong").expectedMessageCount(1);
+ getMockEndpoint("mock:catchEnd").expectedMessageCount(0);
+ getMockEndpoint("mock:end").expectedMessageCount(0);
+
+ try {
+ template.sendBody("direct:start", "Donkey Kong");
+ fail("Should have thrown exception");
+ } catch (CamelExecutionException e) {
+ assertIsInstanceOf(IllegalStateException.class, e.getCause());
+ assertEquals("Damn Kong", e.getCause().getMessage());
+ }
+
+ assertMockEndpointsSatisfied();
+ }
+
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringCatchNestedFailTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringCatchNestedFailTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringFinallyNestedFailTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringFinallyNestedFailTest.java?rev=928696&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringFinallyNestedFailTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringFinallyNestedFailTest.java Mon Mar 29 10:38:13 2010
@@ -0,0 +1,82 @@
+/**
+ * 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.issues;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ContextTestSupport;
+
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+/**
+ * @version $Revision$
+ */
+public class SpringFinallyNestedFailTest extends ContextTestSupport {
+
+ protected CamelContext createCamelContext() throws Exception {
+ return createSpringCamelContext(this, "org/apache/camel/spring/issues/SpringFinallyNestedFailTest.xml");
+ }
+
+ public void testOk() throws Exception {
+ getMockEndpoint("mock:bar").expectedMessageCount(1);
+ getMockEndpoint("mock:donkey").expectedMessageCount(0);
+ getMockEndpoint("mock:catch").expectedMessageCount(0);
+ getMockEndpoint("mock:kong").expectedMessageCount(0);
+ getMockEndpoint("mock:finally").expectedMessageCount(1);
+ getMockEndpoint("mock:finallyEnd").expectedMessageCount(1);
+ getMockEndpoint("mock:end").expectedMessageCount(1);
+
+ template.sendBody("direct:start", "Hello Camel");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ public void testFail() throws Exception {
+ getMockEndpoint("mock:bar").expectedMessageCount(0);
+ getMockEndpoint("mock:donkey").expectedMessageCount(1);
+ getMockEndpoint("mock:catch").expectedMessageCount(1);
+ getMockEndpoint("mock:kong").expectedMessageCount(0);
+ getMockEndpoint("mock:finally").expectedMessageCount(1);
+ getMockEndpoint("mock:finallyEnd").expectedMessageCount(1);
+ getMockEndpoint("mock:end").expectedMessageCount(1);
+
+ template.sendBody("direct:start", "Hello Donkey");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ public void testFailAgain() throws Exception {
+ getMockEndpoint("mock:bar").expectedMessageCount(0);
+ getMockEndpoint("mock:donkey").expectedMessageCount(1);
+ getMockEndpoint("mock:catch").expectedMessageCount(1);
+ getMockEndpoint("mock:kong").expectedMessageCount(1);
+ getMockEndpoint("mock:finally").expectedMessageCount(1);
+ getMockEndpoint("mock:finallyEnd").expectedMessageCount(0);
+ getMockEndpoint("mock:end").expectedMessageCount(0);
+
+ try {
+ template.sendBody("direct:start", "Donkey Kong");
+ fail("Should have thrown exception");
+ } catch (CamelExecutionException e) {
+ assertIsInstanceOf(IllegalStateException.class, e.getCause());
+ assertEquals("Damn Kong", e.getCause().getMessage());
+ }
+
+ assertMockEndpointsSatisfied();
+ }
+
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringFinallyNestedFailTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringFinallyNestedFailTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTryCatchFinallyAndErrorHandlerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTryCatchFinallyAndErrorHandlerTest.java?rev=928696&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTryCatchFinallyAndErrorHandlerTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTryCatchFinallyAndErrorHandlerTest.java Mon Mar 29 10:38:13 2010
@@ -0,0 +1,78 @@
+/**
+ * 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.issues;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ContextTestSupport;
+
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+/**
+ * @version $Revision$
+ */
+public class SpringTryCatchFinallyAndErrorHandlerTest extends ContextTestSupport {
+
+ protected CamelContext createCamelContext() throws Exception {
+ return createSpringCamelContext(this, "org/apache/camel/spring/issues/SpringTryCatchFinallyAndErrorHandlerTest.xml");
+ }
+
+ public void testOk() throws Exception {
+ getMockEndpoint("mock:bar").expectedMessageCount(1);
+ getMockEndpoint("mock:donkey").expectedMessageCount(0);
+ getMockEndpoint("mock:catch").expectedMessageCount(0);
+ getMockEndpoint("mock:finally").expectedMessageCount(1);
+ getMockEndpoint("mock:kong").expectedMessageCount(0);
+ getMockEndpoint("mock:other").expectedMessageCount(1);
+ getMockEndpoint("mock:end").expectedMessageCount(1);
+ getMockEndpoint("mock:dead").expectedMessageCount(0);
+
+ template.sendBody("direct:start", "Hello Camel");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ public void testFail() throws Exception {
+ getMockEndpoint("mock:bar").expectedMessageCount(0);
+ getMockEndpoint("mock:donkey").expectedMessageCount(1);
+ getMockEndpoint("mock:catch").expectedMessageCount(1);
+ getMockEndpoint("mock:finally").expectedMessageCount(1);
+ getMockEndpoint("mock:kong").expectedMessageCount(0);
+ getMockEndpoint("mock:other").expectedMessageCount(1);
+ getMockEndpoint("mock:end").expectedMessageCount(1);
+ getMockEndpoint("mock:dead").expectedMessageCount(0);
+
+ template.sendBody("direct:start", "Hello Donkey");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ public void testFailAgain() throws Exception {
+ getMockEndpoint("mock:bar").expectedMessageCount(0);
+ getMockEndpoint("mock:donkey").expectedMessageCount(1);
+ getMockEndpoint("mock:catch").expectedMessageCount(1);
+ getMockEndpoint("mock:finally").expectedMessageCount(1);
+ getMockEndpoint("mock:kong").expectedMessageCount(1);
+ getMockEndpoint("mock:other").expectedMessageCount(0);
+ getMockEndpoint("mock:end").expectedMessageCount(0);
+ getMockEndpoint("mock:dead").expectedMessageCount(1);
+
+ template.sendBody("direct:start", "Donkey Kong");
+
+ assertMockEndpointsSatisfied();
+ }
+
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTryCatchFinallyAndErrorHandlerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTryCatchFinallyAndErrorHandlerTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Copied: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTryNestedFailTest.java (from r928423, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTryCatchWithSplitIssueTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTryNestedFailTest.java?p2=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTryNestedFailTest.java&p1=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTryCatchWithSplitIssueTest.java&r1=928423&r2=928696&rev=928696&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTryCatchWithSplitIssueTest.java (original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTryNestedFailTest.java Mon Mar 29 10:38:13 2010
@@ -17,16 +17,39 @@
package org.apache.camel.spring.issues;
import org.apache.camel.CamelContext;
-import org.apache.camel.issues.TryCatchWithSplitIssueTest;
+import org.apache.camel.ContextTestSupport;
+
import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
/**
* @version $Revision$
*/
-public class SpringTryCatchWithSplitIssueTest extends TryCatchWithSplitIssueTest {
+public class SpringTryNestedFailTest extends ContextTestSupport {
protected CamelContext createCamelContext() throws Exception {
- return createSpringCamelContext(this, "org/apache/camel/spring/issues/SpringTryCatchWithSplitIssueTest.xml");
+ return createSpringCamelContext(this, "org/apache/camel/spring/issues/SpringTryNestedFailTest.xml");
+ }
+
+ public void testOk() throws Exception {
+ getMockEndpoint("mock:bar").expectedMessageCount(1);
+ getMockEndpoint("mock:donkey").expectedMessageCount(0);
+ getMockEndpoint("mock:catch").expectedMessageCount(0);
+ getMockEndpoint("mock:end").expectedMessageCount(1);
+
+ template.sendBody("direct:start", "Hello Camel");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ public void testFail() throws Exception {
+ getMockEndpoint("mock:bar").expectedMessageCount(0);
+ getMockEndpoint("mock:donkey").expectedMessageCount(1);
+ getMockEndpoint("mock:catch").expectedMessageCount(1);
+ getMockEndpoint("mock:end").expectedMessageCount(1);
+
+ template.sendBody("direct:start", "Hello Donkey");
+
+ assertMockEndpointsSatisfied();
}
-}
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTryNestedFailTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTryNestedFailTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringCatchNestedFailTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringCatchNestedFailTest.xml?rev=928696&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringCatchNestedFailTest.xml (added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringCatchNestedFailTest.xml Mon Mar 29 10:38:13 2010
@@ -0,0 +1,58 @@
+<?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-2.5.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <bean id="myFail" class="java.lang.IllegalArgumentException">
+ <constructor-arg index="0" value="Damn"/>
+ </bean>
+
+ <bean id="myFailAgain" class="java.lang.IllegalStateException">
+ <constructor-arg index="0" value="Damn Kong"/>
+ </bean>
+
+ <camelContext trace="true" id="camel" xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <doTry>
+ <filter>
+ <simple>${body} contains 'Donkey'</simple>
+ <to uri="mock:donkey"/>
+ <throwException ref="myFail"/>
+ </filter>
+ <to uri="mock:bar"/>
+ <doCatch>
+ <exception>java.lang.IllegalArgumentException</exception>
+ <to uri="mock:catch"/>
+ <filter>
+ <simple>${body} contains 'Kong'</simple>
+ <to uri="mock:kong"/>
+ <throwException ref="myFailAgain"/>
+ </filter>
+ <to uri="mock:catchEnd"/>
+ </doCatch>
+ </doTry>
+ <to uri="mock:end"/>
+ </route>
+ </camelContext>
+
+</beans>
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringCatchNestedFailTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringCatchNestedFailTest.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringCatchNestedFailTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringFinallyNestedFailTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringFinallyNestedFailTest.xml?rev=928696&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringFinallyNestedFailTest.xml (added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringFinallyNestedFailTest.xml Mon Mar 29 10:38:13 2010
@@ -0,0 +1,61 @@
+<?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-2.5.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <bean id="myFail" class="java.lang.IllegalArgumentException">
+ <constructor-arg index="0" value="Damn"/>
+ </bean>
+
+ <bean id="myFailAgain" class="java.lang.IllegalStateException">
+ <constructor-arg index="0" value="Damn Kong"/>
+ </bean>
+
+ <camelContext trace="true" id="camel" xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <doTry>
+ <filter>
+ <simple>${body} contains 'Donkey'</simple>
+ <to uri="mock:donkey"/>
+ <throwException ref="myFail"/>
+ </filter>
+ <to uri="mock:bar"/>
+ <doCatch>
+ <exception>java.lang.IllegalArgumentException</exception>
+ <to uri="mock:catch"/>
+ </doCatch>
+ <doFinally>
+ <to uri="mock:finally"/>
+ <filter>
+ <simple>${body} contains 'Kong'</simple>
+ <to uri="mock:kong"/>
+ <throwException ref="myFailAgain"/>
+ </filter>
+ <to uri="mock:finallyEnd"/>
+ </doFinally>
+ </doTry>
+ <to uri="mock:end"/>
+ </route>
+ </camelContext>
+
+</beans>
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringFinallyNestedFailTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringFinallyNestedFailTest.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringFinallyNestedFailTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryCatchFinallyAndErrorHandlerTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryCatchFinallyAndErrorHandlerTest.xml?rev=928696&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryCatchFinallyAndErrorHandlerTest.xml (added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryCatchFinallyAndErrorHandlerTest.xml Mon Mar 29 10:38:13 2010
@@ -0,0 +1,69 @@
+<?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-2.5.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <bean id="myFail" class="java.lang.IllegalArgumentException">
+ <constructor-arg index="0" value="Damn"/>
+ </bean>
+
+ <bean id="myFailAgain" class="java.lang.IllegalStateException">
+ <constructor-arg index="0" value="Damn Kong"/>
+ </bean>
+
+ <camelContext trace="true" id="camel" xmlns="http://camel.apache.org/schema/spring">
+
+ <errorHandler type="DeadLetterChannel" id="dlc" deadLetterUri="mock:dead"/>
+
+ <route errorHandlerRef="dlc">
+ <from uri="direct:start"/>
+ <doTry>
+ <filter>
+ <simple>${body} contains 'Donkey'</simple>
+ <to uri="mock:donkey"/>
+ <throwException ref="myFail"/>
+ </filter>
+ <to uri="mock:bar"/>
+ <doCatch>
+ <exception>java.lang.IllegalArgumentException</exception>
+ <to uri="mock:catch"/>
+ </doCatch>
+ <doFinally>
+ <to uri="mock:finally"/>
+ </doFinally>
+ </doTry>
+ <!-- outside try .. catch .. finally the error handler kick in again -->
+ <choice>
+ <when>
+ <simple>${body} contains 'Kong'</simple>
+ <to uri="mock:kong"/>
+ <throwException ref="myFailAgain"/>
+ </when>
+ <otherwise>
+ <to uri="mock:other"/>
+ </otherwise>
+ </choice>
+ <to uri="mock:end"/>
+ </route>
+ </camelContext>
+
+</beans>
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryCatchFinallyAndErrorHandlerTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryCatchFinallyAndErrorHandlerTest.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryCatchFinallyAndErrorHandlerTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Copied: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryNestedFailTest.xml (from r928423, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryCatchWithSplitIssueTest.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryNestedFailTest.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryNestedFailTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryCatchWithSplitIssueTest.xml&r1=928423&r2=928696&rev=928696&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryCatchWithSplitIssueTest.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryNestedFailTest.xml Mon Mar 29 10:38:13 2010
@@ -22,21 +22,26 @@
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">
- <bean id="error" class="org.apache.camel.issues.TryCatchWithSplitIssueTest$GenerateError"/>
+ <bean id="myFail" class="java.lang.IllegalArgumentException">
+ <constructor-arg index="0" value="Damn"/>
+ </bean>
- <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+ <camelContext trace="true" id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:start"/>
- <split><tokenize token="@"/>
- <doTry>
- <to uri="bean:error"/>
- <to uri="mock:result"/>
- <doCatch>
- <exception>java.lang.Exception</exception>
- <to uri="mock:error"/>
- </doCatch>
- </doTry>
- </split>
+ <doTry>
+ <filter>
+ <simple>${body} contains 'Donkey'</simple>
+ <to uri="mock:donkey"/>
+ <throwException ref="myFail"/>
+ </filter>
+ <to uri="mock:bar"/>
+ <doCatch>
+ <exception>java.lang.IllegalArgumentException</exception>
+ <to uri="mock:catch"/>
+ </doCatch>
+ </doTry>
+ <to uri="mock:end"/>
</route>
</camelContext>
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryNestedFailTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryNestedFailTest.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringTryNestedFailTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml