Return-Path: Delivered-To: apmail-camel-commits-archive@www.apache.org Received: (qmail 33742 invoked from network); 15 Jul 2010 08:32:36 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 15 Jul 2010 08:32:36 -0000 Received: (qmail 20355 invoked by uid 500); 15 Jul 2010 08:32:36 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 20308 invoked by uid 500); 15 Jul 2010 08:32:34 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 20301 invoked by uid 99); 15 Jul 2010 08:32:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Jul 2010 08:32:33 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Jul 2010 08:32:31 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 1CCA52388999; Thu, 15 Jul 2010 08:31:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@camel.apache.org From: davsclaus@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100715083108.1CCA52388999@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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); }