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:
- Read a file from a certain folder
- Apply some deserialization of some sort into a java structure
- Invoke a stored procedure or another based on some values included in the java structuure
- Send the processing results to some third party consumer
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