2009/4/22 Peter Maas <pfmm...@gmail.com>:
> Hi,
>
> is it possible the programmatically replace parts of a route (for testing
> purposes) to temporarily add processor in the middle of the route for
> example? One case I (think) I need it for is for testing unexpected errors,
> I'd like to mimic this by 'injecting' a processor which throws a unchecked
> exception; the ErrorHandlerTest does do this but only with custom routes...

Two thoughts;

use conditional logic when building the route...

f = from("something");
if (testing) {
 f.to(someTestingEndpoint);
}
else {
  f.to(productionEndpoint);
}

this just involves assigning where you are in the Java DSL to a
variable - then using Java logical branching.


The other option is to just modify the AST

  List<RouteDefinition> routes = camelContext.getRouteDefinitions();
  RouteDefinition route = routes.get(0);
  // modify AST
  camelContext.startRoute(route);


-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Reply via email to