camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r964339 - /camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailDefaultDelayForMailConsumeTest.java
Date Thu, 15 Jul 2010 08:31:08 GMT
Author: davsclaus
Date: Thu Jul 15 08:31:07 2010
New Revision: 964339

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

Modified:
    camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailDefaultDelayForMailConsumeTest.java

Modified: camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailDefaultDelayForMailConsumeTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailDefaultDelayForMailConsumeTest.java?rev=964339&r1=964338&r2=964339&view=diff
==============================================================================
--- camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailDefaultDelayForMailConsumeTest.java
(original)
+++ camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailDefaultDelayForMailConsumeTest.java
Thu Jul 15 08:31:07 2010
@@ -19,6 +19,7 @@ package org.apache.camel.component.mail;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.util.StopWatch;
 import org.junit.Test;
 
 /**
@@ -28,21 +29,27 @@ public class MailDefaultDelayForMailCons
 
     @Test
     public void testConsuming() throws Exception {
-        template.sendBody("smtp://bond@localhost", "Hello London");
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedBodiesReceived("Hello London");
-        // first poll should happend immediately
+
+        template.sendBody("smtp://bond@localhost", "Hello London");
+
+        // first poll should happen immediately
         mock.setResultWaitTime(2000L);
         mock.assertIsSatisfied();
 
-        long start = System.currentTimeMillis();
         mock.reset();
-        template.sendBody("smtp://bond@localhost", "Hello Paris");
         mock.expectedBodiesReceived("Hello Paris");
-        // poll next mail and that is should be done within the default delay (overrule to
5 sec) + 2 sec slack
         mock.setResultWaitTime(5000L + 2000L);
+
+        StopWatch watch = new StopWatch();
+
+        template.sendBody("smtp://bond@localhost", "Hello Paris");
+
+        // poll next mail and that is should be done within the default delay (overrule to
5 sec) + 2 sec slack
         mock.assertIsSatisfied();
-        long delta = System.currentTimeMillis() - start;
+
+        long delta = watch.stop();
         assertTrue("Camel should not default poll the mailbox to often", delta > 5000
- 1000L);
     }
 



Mime
View raw message