Hi Team I want to unit test a route for which i used the AdviceWith function replaceFromWith("Direct:Start"); with which i unit tested the route. I got success on that.
But the issue is I replaced the FROM URI which is itself very complicated , Given Below : *<from uri="file:{{inbound_home}}?include=.*Camel.dat&move={{data_home}}/${file:onlyname.noext}_${date:now:yyyyMMdd-HHmmss}.TXT&moveFailed={{data_home}}/errorfile/${file:onlyname.noext}_${date:now:yyyyMMdd-HHmmss}.TXT&doneFileName=CAMELTRIGGER"/>* I want to unit test the FROM URI , i used the weaveByType(ToDefinition.class).selectFirst().replace().to("mock:out"); This replaced the TO URI with MOCK:OUT But i am unable to keep the route in start mode. How can i use the Producer Template or Is there any other method by which i can test this , without making any changes to my CamelContext.xml Given below is the code : Public class CamelAdviceWith extends CamelSpringTestSupport{ @Override protected AbstractApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("Camelcontext.xml"); } @Override public boolean isUseAdviceWith() { return true; } @Test public void testAdviceWith() throws Exception { context.getRouteDefinition("gsm-inbound").adviceWith(context, new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { weaveByType(ToDefinition.class).selectFirst().replace().to("mock:out"); } }); context.start(); // template.sendBody(?????????????); --- Commented Code, What should i use here.. context.stop(); } } -- View this message in context: http://camel.465427.n5.nabble.com/Unit-Test-the-FROM-URI-of-a-route-tp5761028.html Sent from the Camel - Users mailing list archive at Nabble.com.