Thanks for the help claus :) I read through the Javadocs and understood that start method is non blocking. If i have to use in a standalone application i have to use main function provided by camel.
http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html I inturn used the ProducerTemplate to keep the camelContext in running state with following code. @UseAdviceWith public class AMSTest extends CamelSpringTestSupport{ @Override protected AbstractApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext( "ams-context.xml"); } @Override public boolean isUseAdviceWith() { return true; } @Test public void testLAMS() throws Exception { context.getRouteDefinition("compare-request").adviceWith(context, new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { replaceFromWith("direct:start"); } }); context.start(); template.sendBody("direct:start",String.class); } } I bumped in to another issue from my actual code i had * replaceFromWith("file:/home/manish/cameldata/Compare?fileName=STARTCOMPARE"); * if i want to use the same replace statement from my original code i.e. * replaceFromWith("file:/home/manish/cameldata/Compare?fileName=STARTCOMPARE&doneFileName=LOADGSMPRICING"); * I am unable to use the ProducerTemplate for the same InputStream f = getClass().getResourceAsStream("LOADTRIGGER"); template.sendBody("file:/home/manish/cameldata/Compare?fileName=STARTCOMPARE&doneFileName=LOADTRIGGER",file); Can you please help me with this ? -- View this message in context: http://camel.465427.n5.nabble.com/Junit-Test-Failing-with-AdviceWith-tp5760732p5760823.html Sent from the Camel - Users mailing list archive at Nabble.com.