camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1238988 - /camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionIsTransactedRedeliveredTest.java
Date Wed, 01 Feb 2012 07:58:29 GMT
Author: davsclaus
Date: Wed Feb  1 07:58:28 2012
New Revision: 1238988

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

Modified:
    camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionIsTransactedRedeliveredTest.java

Modified: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionIsTransactedRedeliveredTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionIsTransactedRedeliveredTest.java?rev=1238988&r1=1238987&r2=1238988&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionIsTransactedRedeliveredTest.java
(original)
+++ camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionIsTransactedRedeliveredTest.java
Wed Feb  1 07:58:28 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 {



Mime
View raw message