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 2011/06/05 14:57:49 UTC
svn commit: r1132393 - in /camel/trunk:
camel-core/src/test/java/org/apache/camel/issues/
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: Sun Jun 5 12:57:49 2011
New Revision: 1132393
URL: http://svn.apache.org/viewvc?rev=1132393&view=rev
Log:
CAMEL-4022: Added spring XML unit test.
Added:
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringExceptionCamel4022Test.java
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringExceptionCamel4022Test.xml
- copied, changed from r1132390, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/ProduceSplitMethodCallIssueTest.xml
Modified:
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/ExceptionCamel4022Test.java
Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/issues/ExceptionCamel4022Test.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/ExceptionCamel4022Test.java?rev=1132393&r1=1132392&r2=1132393&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/issues/ExceptionCamel4022Test.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/issues/ExceptionCamel4022Test.java Sun Jun 5 12:57:49 2011
@@ -46,13 +46,16 @@ public class ExceptionCamel4022Test exte
assertMockEndpointsSatisfied();
}
+ public static class MyExceptionThrower implements Processor {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ throw new IllegalArgumentException("Forced by unit test");
+ }
+ }
+
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
- final Processor exceptionThrower = new Processor() {
- public void process(Exchange exchange) throws Exception {
- throw new IllegalArgumentException("Forced by unit test");
- }
- };
+ final Processor exceptionThrower = new MyExceptionThrower();
return new RouteBuilder() {
public void configure() {
Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringExceptionCamel4022Test.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringExceptionCamel4022Test.java?rev=1132393&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringExceptionCamel4022Test.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringExceptionCamel4022Test.java Sun Jun 5 12:57:49 2011
@@ -0,0 +1,33 @@
+/**
+ * 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.issues.ExceptionCamel4022Test;
+
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+/**
+ *
+ */
+public class SpringExceptionCamel4022Test extends ExceptionCamel4022Test {
+
+ protected CamelContext createCamelContext() throws Exception {
+ return createSpringCamelContext(this, "org/apache/camel/spring/issues/SpringExceptionCamel4022Test.xml");
+ }
+
+}
Copied: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringExceptionCamel4022Test.xml (from r1132390, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/ProduceSplitMethodCallIssueTest.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringExceptionCamel4022Test.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringExceptionCamel4022Test.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/ProduceSplitMethodCallIssueTest.xml&r1=1132390&r2=1132393&rev=1132393&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/ProduceSplitMethodCallIssueTest.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringExceptionCamel4022Test.xml Sun Jun 5 12:57:49 2011
@@ -22,18 +22,35 @@
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">
- <bean id="cool" class="org.apache.camel.spring.issues.CoolService"/>
+ <bean id="MyExceptionThrower" class="org.apache.camel.issues.ExceptionCamel4022Test$MyExceptionThrower"/>
- <camelContext trace="true" xmlns="http://camel.apache.org/schema/spring">
- <route>
- <from uri="direct:start"/>
- <to uri="log:foo"/>
- <split>
- <method bean="cool" method="split"/>
- <transform><simple>Hello ${body}</simple></transform>
- <to uri="mock:split"/>
- </split>
- </route>
- </camelContext>
+ <camelContext errorHandlerRef="dlc" xmlns="http://camel.apache.org/schema/spring">
+
+ <errorHandler id="dlc" deadLetterUri="mock:dlc" type="DeadLetterChannel">
+ <redeliveryPolicy maximumRedeliveries="3" redeliveryDelay="0"/>
+ </errorHandler>
+
+ <onException>
+ <exception>java.lang.IllegalArgumentException</exception>
+ <process ref="MyExceptionThrower"/>
+ <to uri="mock:onexception"/>
+ </onException>
+
+ <route>
+ <from uri="direct:start"/>
+ <to uri="direct:intermediate"/>
+ <to uri="mock:result2"/>
+ </route>
+
+ <route>
+ <from uri="direct:intermediate"/>
+ <setBody>
+ <constant><some-value/></constant>
+ </setBody>
+ <process ref="MyExceptionThrower"/>
+ <to uri="mock:intermediate"/>
+ </route>
+
+ </camelContext>
</beans>