Return-Path: Delivered-To: apmail-camel-commits-archive@www.apache.org Received: (qmail 57986 invoked from network); 5 Feb 2010 14:48:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 Feb 2010 14:48:57 -0000 Received: (qmail 11473 invoked by uid 500); 5 Feb 2010 14:48:57 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 11428 invoked by uid 500); 5 Feb 2010 14:48:57 -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 11419 invoked by uid 99); 5 Feb 2010 14:48:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Feb 2010 14:48:57 +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; Fri, 05 Feb 2010 14:48:55 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3E525238890A; Fri, 5 Feb 2010 14:48:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r906955 - /camel/trunk/camel-core/src/test/java/org/apache/camel/processor/CustomRoutePolicyTest.java Date: Fri, 05 Feb 2010 14:48:34 -0000 To: commits@camel.apache.org From: davsclaus@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100205144834.3E525238890A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: davsclaus Date: Fri Feb 5 14:48:33 2010 New Revision: 906955 URL: http://svn.apache.org/viewvc?rev=906955&view=rev Log: Fixed test on other boxes Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/CustomRoutePolicyTest.java Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/CustomRoutePolicyTest.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/CustomRoutePolicyTest.java?rev=906955&r1=906954&r2=906955&view=diff ============================================================================== --- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/CustomRoutePolicyTest.java (original) +++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/CustomRoutePolicyTest.java Fri Feb 5 14:48:33 2010 @@ -32,17 +32,24 @@ private class MyCustomRoutePolicy extends RoutePolicySupport { + private volatile boolean stopped = false; + @Override public void onExchangeDone(Route route, Exchange exchange) { String body = exchange.getIn().getBody(String.class); if ("stop".equals(body)) { try { + stopped = true; stopConsumer(route.getConsumer()); } catch (Exception e) { handleException(e); } } } + + public boolean isStopped() { + return stopped; + } } public void testCustomPolicy() throws Exception { @@ -59,20 +66,9 @@ // we send stop command so we should only get 1 message template.sendBody("seda:foo", "stop"); - Thread.sleep(500); - - template.sendBody("seda:foo", "Bye World"); - assertMockEndpointsSatisfied(); - // we reset and prepare for the last message to arrive - mock.reset(); - mock.expectedBodiesReceived("Bye World"); - - // start the route consumer again - context.getRoutes().get(0).getConsumer().start(); - - assertMockEndpointsSatisfied(); + assertTrue("Should be stopped", policy.isStopped()); } @Override @@ -80,7 +76,7 @@ return new RouteBuilder() { @Override public void configure() throws Exception { - from("seda:foo").routePolicy(policy).to("mock:result"); + from("seda:foo").routeId("foo").routePolicy(policy).to("mock:result"); } }; }