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 2010/05/18 07:24:51 UTC

svn commit: r945503 - in /camel/trunk/camel-core/src/test/java/org/apache/camel/component: seda/SedaInOutChainedTimeoutTest.java timer/TimerWithTimeOptionTest.java vm/VmInOutChainedTimeoutTest.java

Author: davsclaus
Date: Tue May 18 05:24:51 2010
New Revision: 945503

URL: http://svn.apache.org/viewvc?rev=945503&view=rev
Log:
Fixed tests

Modified:
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/seda/SedaInOutChainedTimeoutTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerWithTimeOptionTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/vm/VmInOutChainedTimeoutTest.java

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/seda/SedaInOutChainedTimeoutTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/seda/SedaInOutChainedTimeoutTest.java?rev=945503&r1=945502&r2=945503&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/seda/SedaInOutChainedTimeoutTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/seda/SedaInOutChainedTimeoutTest.java Tue May 18 05:24:51 2010
@@ -39,7 +39,7 @@ public class SedaInOutChainedTimeoutTest
         }
         long delta = watch.stop();
 
-        assertTrue("Should be faster than 3000 millis, was: " + delta, delta < 3000);
+        assertTrue("Should be faster than 4000 millis, was: " + delta, delta < 4000);
     }
 
     @Override

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerWithTimeOptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerWithTimeOptionTest.java?rev=945503&r1=945502&r2=945503&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerWithTimeOptionTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerWithTimeOptionTest.java Tue May 18 05:24:51 2010
@@ -50,7 +50,8 @@ public class TimerWithTimeOptionTest ext
         context.start();
 
         MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMessageCount(1);
+        // period is default 1000 so we can get more messages
+        mock.expectedMinimumMessageCount(1);
 
         assertMockEndpointsSatisfied();
     }
@@ -90,7 +91,8 @@ public class TimerWithTimeOptionTest ext
         context.start();
 
         MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMessageCount(1);
+        // period is default 1000 so we can get more messages
+        mock.expectedMinimumMessageCount(1);
 
         assertMockEndpointsSatisfied();
     }
@@ -110,6 +112,27 @@ public class TimerWithTimeOptionTest ext
         context.start();
 
         MockEndpoint mock = getMockEndpoint("mock:result");
+        // period is default 1000 so we can get more messages
+        mock.expectedMinimumMessageCount(1);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    public void testFiredInFutureWithoutTPatternNoPeriod() throws Exception {
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                Date future = new Date(new Date().getTime() + 2000);
+
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                String time = sdf.format(future);
+
+                fromF("timer://foo?period=0&time=%s", time).to("mock:result");
+            }
+        });
+        context.start();
+
+        MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMessageCount(1);
 
         assertMockEndpointsSatisfied();
@@ -130,6 +153,27 @@ public class TimerWithTimeOptionTest ext
         context.start();
 
         MockEndpoint mock = getMockEndpoint("mock:result");
+        // period is default 1000 so we can get more messages
+        mock.expectedMinimumMessageCount(1);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    public void testFiredInFutureCustomPatternNoPeriod() throws Exception {
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                Date future = new Date(new Date().getTime() + 2000);
+
+                SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
+                String time = sdf.format(future);
+
+                fromF("timer://foo?period=0&time=%s&pattern=dd-MM-yyyy HH:mm:ss", time).to("mock:result");
+            }
+        });
+        context.start();
+
+        MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMessageCount(1);
 
         assertMockEndpointsSatisfied();

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/vm/VmInOutChainedTimeoutTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/vm/VmInOutChainedTimeoutTest.java?rev=945503&r1=945502&r2=945503&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/vm/VmInOutChainedTimeoutTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/vm/VmInOutChainedTimeoutTest.java Tue May 18 05:24:51 2010
@@ -39,7 +39,7 @@ public class VmInOutChainedTimeoutTest e
         }
         long delta = watch.stop();
 
-        assertTrue("Should be faster than 3000 millis, was: " + delta, delta < 3000);
+        assertTrue("Should be faster than 4000 millis, was: " + delta, delta < 4000);
 
         Thread.sleep(2000);
     }