camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] git commit: Added unit test based on user forum issue
Date Tue, 05 Nov 2013 11:00:31 GMT
Added unit 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/badc9f62
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/badc9f62
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/badc9f62

Branch: refs/heads/camel-2.12.x
Commit: badc9f628125d8b76d48d333a2221bf2f0ae9c45
Parents: 83ef2f7
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Nov 5 11:29:34 2013 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Nov 5 12:01:05 2013 +0100

----------------------------------------------------------------------
 ...ExceptionAndRollbackUsingTransactedTest.java | 32 ++++++++
 ...pedOnExceptionAndRollbackUsingTransacted.xml | 79 ++++++++++++++++++++
 2 files changed, 111 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/badc9f62/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/SpringTransactionalClientDataWithRouteScopedOnExceptionAndRollbackUsingTransactedTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/SpringTransactionalClientDataWithRouteScopedOnExceptionAndRollbackUsingTransactedTest.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/SpringTransactionalClientDataWithRouteScopedOnExceptionAndRollbackUsingTransactedTest.java
new file mode 100644
index 0000000..9a9a4d6
--- /dev/null
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/SpringTransactionalClientDataWithRouteScopedOnExceptionAndRollbackUsingTransactedTest.java
@@ -0,0 +1,32 @@
+/**
+ * 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.interceptor;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * Easier transaction configuration as we do not have to setup a transaction error handler
+ */
+public class SpringTransactionalClientDataWithRouteScopedOnExceptionAndRollbackUsingTransactedTest
extends SpringTransactionalClientDataWithOnExceptionAndRollbackUsingTransactedTest {
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext(
+            "/org/apache/camel/spring/interceptor/springTransactionalClientDataWithRouteScopedOnExceptionAndRollbackUsingTransacted.xml");
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/badc9f62/components/camel-spring/src/test/resources/org/apache/camel/spring/interceptor/springTransactionalClientDataWithRouteScopedOnExceptionAndRollbackUsingTransacted.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/interceptor/springTransactionalClientDataWithRouteScopedOnExceptionAndRollbackUsingTransacted.xml
b/components/camel-spring/src/test/resources/org/apache/camel/spring/interceptor/springTransactionalClientDataWithRouteScopedOnExceptionAndRollbackUsingTransacted.xml
new file mode 100644
index 0000000..b7986db
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/interceptor/springTransactionalClientDataWithRouteScopedOnExceptionAndRollbackUsingTransacted.xml
@@ -0,0 +1,79 @@
+<?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">
+
+  <import resource="transactionalClientDataSource.xml"/>
+
+  <!-- START SNIPPET: e1 -->
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+
+    <route>
+      <from uri="direct:okay"/>
+      <transacted/>
+      <onException>
+        <exception>java.lang.IllegalArgumentException</exception>
+        <handled>
+          <constant>true</constant>
+        </handled>
+        <to uri="mock:error"/>
+        <transform>
+          <constant>Sorry</constant>
+        </transform>
+        <rollback markRollbackOnly="true"/>
+      </onException>
+      <setBody>
+        <constant>Tiger in Action</constant>
+      </setBody>
+      <bean ref="bookService"/>
+      <setBody>
+        <constant>Elephant in Action</constant>
+      </setBody>
+      <bean ref="bookService"/>
+    </route>
+
+    <route>
+      <from uri="direct:fail"/>
+      <transacted/>
+      <onException>
+        <exception>java.lang.IllegalArgumentException</exception>
+        <handled>
+          <constant>true</constant>
+        </handled>
+        <to uri="mock:error"/>
+        <transform>
+          <constant>Sorry</constant>
+        </transform>
+        <rollback markRollbackOnly="true"/>
+      </onException>
+      <setBody>
+        <constant>Tiger in Action</constant>
+      </setBody>
+      <bean ref="bookService"/>
+      <setBody>
+        <constant>Donkey in Action</constant>
+      </setBody>
+      <bean ref="bookService"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: e1 -->
+
+</beans>


Mime
View raw message