camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: programatically rewire routes
Date Wed, 22 Apr 2009 13:22:07 GMT

You can use a mock endpoint in the route where you would like it to
throw an exception or not
and then use the mock api to attach an processor when an exchange arrives

from(a) - to(b) -> mock(m) -> to(d)

And in your unit test
MockEndpoint m ...
m.whenAnyExchangeArrives(new Processor()...
   throw new Exception("Damn");

On Wed, Apr 22, 2009 at 2:52 PM, Peter Maas <> wrote:
> 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...
> any ideas?
> Peter

Claus Ibsen
Apache Camel Committer

Open Source Integration:
Apache Camel Reference Card:

View raw message