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/02/05 15:48:34 UTC
svn commit: r906955 -
/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/CustomRoutePolicyTest.java
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");
}
};
}