May be context.getTypeConverter().convertTo(String.class,
this.getClass().getResourceAsStream("/src/data/someXmlFile.xml"));Apache commons-io provides also some useful methods for this [1]. [1] http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java?view=markup Best, Christian On Sat, Nov 3, 2012 at 3:31 PM, eitland <[email protected]> wrote: > > I think I have seen an elegant way to use a file as input for a unit test > in > apache camel but my google skills are failing me. > > What I want is instead of: > > String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + > <snip>...long real life xml that quickly fills up test files.</snip>"; > template.sendBody("direct:create", xml); > > What I think I have seen is something like: > > template.sendBody("direct:create", > someCamelMetod("/src/data/someXmlFile.xml")); > > Anybody knows where/if this is documented? > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Use-a-file-as-input-to-unit-tests-tp5722069.html > Sent from the Camel - Users mailing list archive at Nabble.com. > --
