camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roman Kalukiewicz <>
Subject Re: programatically rewire routes
Date Mon, 27 Apr 2009 09:21:22 GMT
Another thing you can do is to substitute some endpoints in the
context like this (assuming you use ContextTestSupport):

    protected CamelContext createCamelContext() throws Exception {
        CamelContext camelContext = super.createCamelContext();
        camelContext.addEndpoint("jms:in.queue", new
        camelContext.addEndpoint("", new

        return camelContext;

Of course it works for endpoints only, but might be enough. You can
always attach processors to mock endpoint then, but the point is, that
you can test your business flow without explicitly using mock


2009/4/22 Peter Maas <>:
> 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

View raw message