camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r906908 - /camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListIssueTest.java
Date Fri, 05 Feb 2010 11:54:27 GMT
Author: davsclaus
Date: Fri Feb  5 11:54:27 2010
New Revision: 906908

URL: http://svn.apache.org/viewvc?rev=906908&view=rev
Log:
Fixed test on other boxes

Modified:
    camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListIssueTest.java

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListIssueTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListIssueTest.java?rev=906908&r1=906907&r2=906908&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListIssueTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListIssueTest.java
Fri Feb  5 11:54:27 2010
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.issues;
 
+import java.util.concurrent.atomic.AtomicInteger;
+
 import org.apache.camel.Body;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Consumer;
@@ -35,7 +37,7 @@
  */
 public class RetryRouteScopedUntilRecipientListIssueTest extends ContextTestSupport {
 
-    protected static volatile int invoked;
+    protected static AtomicInteger invoked = new AtomicInteger();
 
     @Override
     protected JndiRegistry createRegistry() throws Exception {
@@ -98,7 +100,7 @@
     }
 
     public void testRetryUntilRecipientListOkOnly() throws Exception {
-        invoked = 0;
+        invoked.set(0);
 
         getMockEndpoint("mock:result").expectedMessageCount(1);
         getMockEndpoint("mock:foo").expectedMessageCount(1);
@@ -109,11 +111,11 @@
 
         context.stop();
 
-        assertEquals(0, invoked);
+        assertEquals(0, invoked.get());
     }
 
     public void testRetryUntilRecipientListFailOnly() throws Exception {
-        invoked = 0;
+        invoked.set(0);
 
         getMockEndpoint("mock:result").expectedMessageCount(0);
         getMockEndpoint("mock:foo").expectedMessageCount(0);
@@ -124,11 +126,11 @@
 
         context.stop();
 
-        assertEquals(3, invoked);
+        assertEquals(3, invoked.get());
     }
 
     public void testRetryUntilRecipientListFailAndOk() throws Exception {
-        invoked = 0;
+        invoked.set(0);
 
         getMockEndpoint("mock:result").expectedMessageCount(0);
         getMockEndpoint("mock:foo").expectedMinimumMessageCount(0);
@@ -139,11 +141,11 @@
 
         context.stop();
 
-        assertEquals(3, invoked);
+        assertEquals(3, invoked.get());
     }
 
     public void testRetryUntilRecipientListOkAndFail() throws Exception {
-        invoked = 0;
+        invoked.set(0);
 
         getMockEndpoint("mock:result").expectedMessageCount(0);
         getMockEndpoint("mock:foo").expectedMinimumMessageCount(0);
@@ -154,11 +156,11 @@
 
         context.stop();
 
-        assertEquals(3, invoked);
+        assertEquals(3, invoked.get());
     }
 
     public void testRetryUntilRecipientNotFail() throws Exception {
-        invoked = 0;
+        invoked.set(0);
 
         getMockEndpoint("mock:result").expectedMessageCount(1);
         getMockEndpoint("mock:foo").expectedMessageCount(0);
@@ -169,11 +171,11 @@
 
         context.stop();
 
-        assertEquals(0, invoked);
+        assertEquals(0, invoked.get());
     }
 
     public void testRetryUntilRecipientFailAndNotFail() throws Exception {
-        invoked = 0;
+        invoked.set(0);
 
         getMockEndpoint("mock:result").expectedMessageCount(0);
         getMockEndpoint("mock:foo").expectedMinimumMessageCount(0);
@@ -184,11 +186,11 @@
 
         context.stop();
 
-        assertEquals(3, invoked);
+        assertEquals(3, invoked.get());
     }
 
     public void testRetryUntilRecipientNotFailAndFail() throws Exception {
-        invoked = 0;
+        invoked.set(0);
 
         getMockEndpoint("mock:result").expectedMessageCount(0);
         getMockEndpoint("mock:foo").expectedMinimumMessageCount(0);
@@ -199,7 +201,7 @@
 
         context.stop();
 
-        assertEquals(3, invoked);
+        assertEquals(3, invoked.get());
     }
 
 
@@ -226,7 +228,7 @@
         // using bean binding we can bind the information from the exchange to the types
we have in our method signature
         public boolean retryUntil(@Header(Exchange.REDELIVERY_COUNTER) Integer counter, @Body
String body, @ExchangeException Exception causedBy) {
             // NOTE: counter is the redelivery attempt, will start from 1
-            invoked++;
+            invoked.incrementAndGet();
 
             // we can of course do what ever we want to determine the result but this is
a unit test so we end after 3 attempts
             return counter < 3;



Mime
View raw message