camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bvah...@apache.org
Subject svn commit: r1436619 - /camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java
Date Mon, 21 Jan 2013 21:09:01 GMT
Author: bvahdat
Date: Mon Jan 21 21:09:01 2013
New Revision: 1436619

URL: http://svn.apache.org/viewvc?rev=1436619&view=rev
Log:
CAMEL-5983: the intention should be correctly to make use of the "direct:requiredAndNewRollback"
endpoint by the last test to show that the first transaction will commit and the second one
will rollback as the book name contains "Donkey". This's now properly corrected.

Modified:
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java

Modified: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java?rev=1436619&r1=1436618&r2=1436619&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java
(original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java
Mon Jan 21 21:09:01 2013
@@ -113,13 +113,21 @@ public class MixedPropagationTransactedT
         assertEquals("Number of books", 1, count);
     }
 
-    public void testRequiredAndNew() throws Exception {
-        template.sendBody("direct:requiredAndNew", "Tiger in Action");
+    public void testRequiredAndNewRollback() throws Exception {
+        try {
+            template.sendBody("direct:requiredAndNewRollback", "Tiger in Action");
+        } catch (RuntimeCamelException e) {
+            // expeced as we fail
+            assertIsInstanceOf(RuntimeCamelException.class, e.getCause());
+            assertTrue(e.getCause().getCause() instanceof IllegalArgumentException);
+            assertEquals("We don't have Donkeys, only Camels", e.getCause().getCause().getMessage());
+        }
 
         int count = jdbc.queryForInt("select count(*) from books");
-        assertEquals(2, jdbc.queryForInt("select count(*) from books where title = ?", "Tiger
in Action"));
+        assertEquals(1, jdbc.queryForInt("select count(*) from books where title = ?", "Tiger
in Action"));
         assertEquals(0, jdbc.queryForInt("select count(*) from books where title = ?", "Donkey
in Action"));
-        assertEquals("Number of books", 3, count);
+        // the tiger in action should be committed, but our 2nd route should rollback
+        assertEquals("Number of books", 2, count);
     }
 
     protected RouteBuilder createRouteBuilder() throws Exception {



Mime
View raw message