I recently joined a project in which lots of autosys jobs are replaced with camel routes. most of the processing flows follow the same pattern:
The easiest way to implement the stored procedure invoke was to use the sql-stored
component. Let's just say I have this route:
from("file://d:/temp/in/?include=myFile*.csv")
.process("myHeaderSetter")
.choice()
.when(header("myheader")).to("sql-stored:proc_1()?dataSource=#dataSource")
.otherwise().to("sql-stored:proc_2()?dataSource=#dataSource")
.end()
.to("reportGenerator")
.to("file://d:temp/out/?fileName=report.txt");
Each processor is very well unit tested but we want to make sure that the route logic goes as we expect. The stored procedures can take a while to execute and running the real route is not an option part of the unit testing so I need a way to test that the stored procedures are invoked without actually getting them to run.
So what would be a good approach to unit test a route like above.
Thank you in advance for your inputs
Take a look at advice-with (http://camel.apache.org/advicewith.html) when testing as you can use it to replace parts of your routes with other bits such as routing to mocks instead of the sql