vendredi 4 septembre 2015

Mocking a Camel Batch Consumer

I am writing unit tests to test that the routes I have defined in my Spring DSL actually do what i expect them to do

The route I am currently trying to test reads files from a directory and aggregates them.

I let the aggregator know when it is time for it to do its work by using the completionFromBatchConsumer="true" property on the Aggregator element in the DSL. This works fine when I am actually retrieving files from a file system.

In my unit test I want to trigger the route without going to the file system, so I have been experimenting by doing replaceFromWith("direct:start"); and setting that as the default template endpoint Uri. This works to an extent, but I never see my Aggregator get called - I'm assuming this is because it is never informed by the from endpoint that the batch has completed.

How can I get the aggregator to recognise that there is work to be done.

Aucun commentaire:

Enregistrer un commentaire