Claus, Ok, that worked - thanks a lot.
BTW, the unit test is for testing custom RoutePolicy. The route in the test looks like: from("seda:foo").routeId("foo").noAutoStartup().routePolicy(policy) .loop(10).copy().delay(1000) .log("*** loop ${property.CamelLoopIndex}") .to("mock:foo"); The RoutePolicy suspends the route, then resume it after a period of time - it performs this suspend/resume cycle in a loop. I notice that this route, using the loop() method only does the 10 iterations and does not start from the top again after being resumed, which I guess I should have expected. Is there a way to restart the route from the top upon resuming? Or do you recommend any other "busy work" kind of route to use for RoutePolicy testing? Thanks, Chris On Sat, Mar 23, 2013 at 4:02 AM, Claus Ibsen <claus.ib...@gmail.com> wrote: > Hi > > Just set the shutdown timeout to 1 milli second (or 1 sec) etc. And > just call stop on CamelContext. > > And if you extend the CamelTestSupport classes for your unit tests. > There may be a method you can override and return 1 to indiciate 1 sec > timeout. > > > > On Fri, Mar 22, 2013 at 5:23 PM, Chris Wolf <cwolf.a...@gmail.com> wrote: >> I am implementing some unit tests and if things go wrong I just want >> to shutdown ASAP without regard for inconsistent >> states, etc. There's no easy hook in DefaultShutDownStrategy to do >> that because you need to know the route >> startup order, so I ended up with this convoluted code (that I kick >> off in a separate thread). It doesn't work, BTW. >> >> DefaultRouteStartupOrder rsuo = null; >> int startOrder = 0; >> List<RouteStartupOrder> suo = new >> ArrayList<RouteStartupOrder>(); >> List<Route> routes = context.getRoutes(); >> for (Route route : routes) { >> List<Service> services = route.getServices(); >> for (Service service : services) { >> if (service instanceof RouteService) { >> rsuo = new >> DefaultRouteStartupOrder(startOrder, route, (RouteService) service); >> suo.add(rsuo); >> } >> } >> startOrder++; >> } >> ShutdownStrategy sds = context.getShutdownStrategy(); >> sds.shutdownForced(context, suo); >> >> I know there must be an easier way, but I haven't found such. Any ideas? >> >> Thanks, >> >> Chris > > > > -- > Claus Ibsen > ----------------- > Red Hat, Inc. > FuseSource is now part of Red Hat > Email: cib...@redhat.com > Web: http://fusesource.com > Twitter: davsclaus > Blog: http://davsclaus.com > Author of Camel in Action: http://www.manning.com/ibsen