camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r728870 - in /activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx: AbstractTransactionTest.java QueueToQueueTransactionWithoutDefineTransactionManagerTest.java
Date Tue, 23 Dec 2008 04:52:38 GMT
Author: ningjiang
Date: Mon Dec 22 20:52:38 2008
New Revision: 728870

URL: http://svn.apache.org/viewvc?rev=728870&view=rev
Log:
CAMEL-372 Solided the unit tests

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

Modified: activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java?rev=728870&r1=728869&r2=728870&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java
(original)
+++ activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java
Mon Dec 22 20:52:38 2008
@@ -75,10 +75,10 @@
     protected void assertResult() throws InterruptedException {
 
         template.sendBody("activemq:queue:foo", "blah");
-        Thread.sleep(3000L);
+        Thread.sleep(3000L);        
         assertTrue("Expected only 2 calls to process() (1 failure, 1 success) but encountered
"
                    + getConditionalExceptionProcessor().getCount() + "."
-                   , getConditionalExceptionProcessor().getCount() <= 2);
+                   , getConditionalExceptionProcessor().getCount() == 2);
     }
 
     protected ConditionalExceptionProcessor getConditionalExceptionProcessor() {

Modified: activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueTransactionWithoutDefineTransactionManagerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueTransactionWithoutDefineTransactionManagerTest.java?rev=728870&r1=728869&r2=728870&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueTransactionWithoutDefineTransactionManagerTest.java
(original)
+++ activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueTransactionWithoutDefineTransactionManagerTest.java
Mon Dec 22 20:52:38 2008
@@ -17,6 +17,7 @@
 package org.apache.camel.component.jms.tx;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.spring.SpringRouteBuilder;
 import org.apache.log4j.Logger;
 import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
@@ -30,19 +31,48 @@
         return createSpringCamelContext(this, "org/apache/camel/component/jms/tx/ActiveMQWithoutTransactionManager.xml");
     }
 
-    public void testRollbackUsingXmlQueueToQueue() throws Exception {
+    public void xtestRollbackUsingXmlQueueToQueue() throws Exception {
 
         // configure routes and add to camel context
         context.addRoutes(new SpringRouteBuilder() {
 
             @Override
             public void configure() throws Exception {
-               
-                from("activemq:queue:foo").process(new ConditionalExceptionProcessor())
-                    .to("activemq:queue:bar");
+                errorHandler(noErrorHandler());
+                from("activemq:queue:foo?transacted=true").process(new ConditionalExceptionProcessor())
+                    .to("activemq:queue:bar?transacted=true");
+                from("activemq:queue:bar?transacted=true").to("mock:endpoint");
+                
             }
         });
-
+        MockEndpoint endpoint = (MockEndpoint) context.getEndpoint("mock:endpoint");
+        endpoint.expectedMessageCount(1);
+        endpoint.expectedBodiesReceived("blah");
         assertResult();
+        endpoint.assertIsSatisfied();
     }
+    
+    public void testNoTransactionRollbackUsingXmlQueueToQueue() throws Exception {
+
+        // configure routes and add to camel context
+        context.addRoutes(new SpringRouteBuilder() {
+
+            @Override
+            public void configure() throws Exception {
+                errorHandler(noErrorHandler());
+                from("activemq:queue:foo?transacted=false").process(new ConditionalExceptionProcessor())
+                    .to("activemq:queue:bar?transacted=false");
+                
+                
+            }
+        });
+        
+        template.sendBody("activemq:queue:foo", "blah");
+        Thread.sleep(3000L);        
+        assertTrue("Expected only 1 calls to process() (1 failure) but encountered "
+                   + getConditionalExceptionProcessor().getCount() + "."
+                   , getConditionalExceptionProcessor().getCount() == 1);
+        
+    }    
+    
 }



Mime
View raw message