camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomasz Pasierb <>
Subject replace endpoint uri in error handler for testing purposes
Date Fri, 12 Apr 2013 10:06:39 GMT

I'm trying to test a route that has a error handler installed and I cannot find a way to replace
an enpoint (in the error handler) for which I do not have a component in my unit test.

I chose a strategy to test an existing (final) route and modify it (using weaving) in the
unit test in a way that allows me to test a given feature/functionality.

The contents of the route builder's configure method are like the following (that's of course
just a simplification of my code).

public void configure() throws Exception {


and my test is as follows:

public void regularForeignTransferToBeWrittenToDB() throws Exception {
        .adviceWith(camelContext, new AdviceWithRouteBuilder() {
              public void configure() throws Exception {

              // producer.sendBodyAndHeaders(input, headers);   send some input

              // make some assertions

It works fine if I comment out the invocation of "errorHandler" method.

I'd rather not have the "oaq" component - I'd like to replace it on the fly in my test method.
If I have to I'll install a mock compenent for "oaq" namespace.

Is there a way to "weave" changes into the error handler or a way of replacing the error handler's
enpoint uri before the route is actually created in such a scenario?


View raw message