Hi Dunnlow,
I would split the route for production into two routes. One from file to
direct and one from direct to the beans and the rest.
So you can feed the xml into the direct route using the production
config. You will not test the file endpoint config this way but the rest
should work fine.
A nice thing you can do to feed files to the route is like this:
is = new FileInputStream("path");
producer.sendBody(is);
The camel type converters will read the file and send it to your beans.
One other thing for testing is to not forget to also do real unit tests.
If your fromXML method looks like this:
MyEvent fromXml(Document doc);
Then simply create the converter class with new and feed fixed xml from
a string into it. So you can test your own code without all the camel
magic. These tests then also run much faster. The camel esting should
only be the second round when the unit tests work fine.
Christian
Am 05.08.2011 01:43, schrieb dunnlow:
I'm new to Camel (and relatively new to Spring). I've got a route with a
bean up and running but I want to perform some unit testing. I'm trying to
figure out how to "feed" my test with XML that is contained in a file.
My working app has a bean with a method to load XML into the header
parameters and a method to create SQL from the header parameters:
This route works for me in my application:
<camel:route>
<camel:from uri="file:/archive/inbox/>
<camel:bean ref="myEventBean" method="fromXML"/>
<camel:bean ref="myEventBean" method="toJdbc"/>
<camel:to uri="jdbc:dataSource"/>
</camel:route>
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
http://www.talend.com