camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: testing: intercept route and process() *after* its completion?
Date Thu, 14 Jun 2012 04:01:36 GMT
On Thu, Jun 14, 2012 at 2:54 AM, twelve17 <> wrote:

> Hello,
> I've been diving into Camel testing lately, which, I'm not gonna lie, has
> been quite fun.  Thanks to the Camel book for assistance. :)
> I did run into one hangup in which I am not sure what the best
> pattern/practice is.
> For my integration testing, I am using adviceWith() to "inject" processing
> into an existing route.  The routebuilder class looks something like:
>  @Override
>  public void configure() throws Exception {
>     interceptSendToEndpoint("bean:someEndpointToBeTested").process(new
> DoSomeAssertionProcessor());
> }
> The code above runs the processor before the intercepted endpoint.   What I
> would like to do is call a processor *after* the intercepted bean is
> completed, so I can verify that the data it produced matches some expected
> data set.  For the moment, I am using the above pattern to intercept the
> endpoint that follows the actual one I want to test, which seems a little
> fragile to me.
> I tried using "interceptFrom", but it does not get triggered, which makes
> me
> believe it is only triggered if you are intercepting an input route, versus
> matching an output route as if it were "from", from the perspective of when
> the pipeline moves to the following route.
> Am I making any sense here? :)
> Any help would be appreciated.
I read this as you want to do some kind of AOP around the sending a message
to a given endpoint?
We could possible make that a bit easier from testing point of view.

What you can do with the advice with, and code you posted above is to
- enable the skip sending to endpoint option
- do assertion before
- send manually to the endpoint
- do assertion afterwards

> Thanks,
> Alex
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Twitter: davsclaus, fusenews
Author of Camel in Action:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message