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 2012/02/01 09:02:23 UTC

svn commit: r1238990 - in /camel/branches/camel-2.9.x: ./ components/camel-jaxb/ components/camel-jaxb/src/test/ components/camel-jms/ components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionIsTransactedRedeliveredTest.java

Author: davsclaus
Date: Wed Feb  1 08:02:23 2012
New Revision: 1238990

URL: http://svn.apache.org/viewvc?rev=1238990&view=rev
Log:
CAMEL-4961: Improved test

Modified:
    camel/branches/camel-2.9.x/   (props changed)
    camel/branches/camel-2.9.x/components/camel-jaxb/   (props changed)
    camel/branches/camel-2.9.x/components/camel-jaxb/src/test/   (props changed)
    camel/branches/camel-2.9.x/components/camel-jms/   (props changed)
    camel/branches/camel-2.9.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionIsTransactedRedeliveredTest.java

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb  1 08:02:23 2012
@@ -1 +1 @@
-/camel/trunk:1235643,1236639,1236667,1237666,1237807,1238225,1238229,1238387,1238463,1238477,1238503,1238937
+/camel/trunk:1235643,1236639,1236667,1237666,1237807,1238225,1238229,1238387,1238463,1238477,1238503,1238937,1238988

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Propchange: camel/branches/camel-2.9.x/components/camel-jaxb/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb  1 08:02:23 2012
@@ -1 +1 @@
-/camel/trunk/components/camel-jaxb:1235643,1236403-1236663,1236667,1237148,1237666,1237807,1238225,1238229,1238387,1238463,1238477,1238503
+/camel/trunk/components/camel-jaxb:1235643,1236403-1236663,1236667,1237148,1237666,1237807,1238225,1238229,1238387,1238463,1238477,1238503,1238988

Propchange: camel/branches/camel-2.9.x/components/camel-jaxb/src/test/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb  1 08:02:23 2012
@@ -1 +1 @@
-/camel/trunk/components/camel-jaxb/src/test:1235643,1236403-1236663,1236667,1237148,1237230,1237666,1237807,1238225,1238229,1238387,1238463,1238477,1238503
+/camel/trunk/components/camel-jaxb/src/test:1235643,1236403-1236663,1236667,1237148,1237230,1237666,1237807,1238225,1238229,1238387,1238463,1238477,1238503,1238988

Propchange: camel/branches/camel-2.9.x/components/camel-jms/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb  1 08:02:23 2012
@@ -1 +1 @@
-/camel/trunk/components/camel-jms:1235643,1236639,1236667,1237666,1237807,1238060,1238225,1238229,1238387,1238463,1238477,1238503
+/camel/trunk/components/camel-jms:1235643,1236639,1236667,1237666,1237807,1238060,1238225,1238229,1238387,1238463,1238477,1238503,1238988

Modified: camel/branches/camel-2.9.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionIsTransactedRedeliveredTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionIsTransactedRedeliveredTest.java?rev=1238990&r1=1238989&r2=1238990&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionIsTransactedRedeliveredTest.java (original)
+++ camel/branches/camel-2.9.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionIsTransactedRedeliveredTest.java Wed Feb  1 08:02:23 2012
@@ -18,6 +18,7 @@ package org.apache.camel.component.jms.t
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
+import org.apache.camel.builder.AdviceWithRouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelSpringTestSupport;
 import org.junit.Test;
@@ -33,8 +34,31 @@ public class JMSTransactionIsTransactedR
                 "/org/apache/camel/component/jms/tx/JMSTransactionIsTransactedRedeliveredTest.xml");
     }
 
+    @Override
+    protected int getExpectedRouteCount() {
+        // have to return 0 because we enable advice with
+        return 0;
+    }
+
+    @Override
+    public boolean isUseAdviceWith() {
+        return true;
+    }
+
     @Test
     public void testTransactionSuccess() throws Exception {
+        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                onException(AssertionError.class).to("log:error", "mock:error");
+            }
+        });
+        context.start();
+
+        // there should be no assertion errors
+        MockEndpoint error = getMockEndpoint("mock:error");
+        error.expectedMessageCount(0);
+
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMessageCount(1);
         mock.expectedBodiesReceived("Bye World");
@@ -44,6 +68,7 @@ public class JMSTransactionIsTransactedR
         template.sendBody("activemq:queue:okay", "Hello World");
 
         mock.assertIsSatisfied();
+        error.assertIsSatisfied();
     }
 
     public static class MyProcessor implements Processor {