camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Schneider <>
Subject Re: Integration testing a route before production
Date Sat, 06 Feb 2010 19:43:01 GMT
Hi Kevin,

basically you can use the spring integration test aproach.
So you use spring to start the context.

Another aproach is to use the camel testing support:

Then the next thing is to feed the data into the route.
If you want to keep your file endpoint you could copy files into the 
directory it listens to.

I normally use a producer (see For this aproach you need 
to start the route with a direct endpoint.

In any case I would use the mock endpoint to wait for the number of 
exchanges you expect to come. Additionally you can set a time limit. So 
you can check the time part of your performance.
I have no idea though how to test for memory consumption.

In any case it is a good idea to have a look into the tests of the camel 
components they show nicely how to test camel routes.



Am 06.02.2010 17:09, schrieb Kevin Jackson:
> Hi,
> I have a route configured in Spring and I would like to integration
> test (from file endpoint with production data to persistence in test
> db)
> For example:
> <camel:route id="integration-test">
>    <camel:from ref="file-consumer"/>
>    <camel:split streaming="true">
>      <camel:tokenize token="\n"/>
>      <camel:bean ref="Unmarshaller" method="unmarshall"/>
>      <camel:bean ref="Transformer" method="transform"/>
>      <camel:to uri="mock:result"/>
>    </camel:split>
> </camel:route>
> Now I want to run this route with production data and ensure that the
> sample of data I used in my unit tests is representative and that the
> production data doesn't cause my pojos to break in any weird ways.
> I'm also interested in seeing how much ram this single route will
> consume with realistic data before I add it to the live routes.
> # How do I trigger this route to run (in the context of an @Test
> decorated method)?
> # How do I make any meaningful assertions against the mock:result?
> Essentially I want to 'assertNoExceptions' and assertTrue(memoryUsed<
> 80Mb) (or any other arbitrary value.  If I wire up the db layer I can
> assert against the data in the tables, but that's a data centric
> approach and I think what I'm after is not easily defined by data.
> For example I can prove by induction that if the code works for 1
> valid input dataset then it will work for n valid input datasets, so
> I'm leaning more towards testing intangibles (performance
> [time|space], robustness of handling real workloads/data etc).
> Sorry I can't really explain why I feel I need to do this, just that I
> think it's necessary in this one particular case - does anyone have
> any suggestions for how to at least start up the route in a testing
> context?
> Thanks,
> Kev


Christian Schneider

View raw message