camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olaf <omgolafg...@gmail.com>
Subject Re: re-use route definition
Date Fri, 22 Nov 2013 15:55:55 GMT
Thanks for hint! 

What about composition of objects? Test doesn't work :(


    @Test()
    public void testRoute() throws Exception {
        template.sendBodyAndHeader("file:data", "foo bar",
Exchange.FILE_NAME, "foo.txt");
        Thread.sleep(3000);
        File target = new File("data/processed/foo.txt");
        assertTrue("not moved", target.exists());
        String content = context.getTypeConverter().convertTo(String.class,
target);
        assertEquals("foo bar", content);
}


######### main route

        @Override
        public void configure() throws Exception {
            from("file:data").to("file:data/output");
            //           
from("file:data/output").to("file:data/processed"); // moved to
ProcessedFileRoute class
            ProcessedFileRoute route = new ProcessedFileRoute();
            route.configure();
        }

public class ProcessedFileRoute extends RouteBuilder {
    public void configure() throws Exception {
        from("file:data/output").to("file:data/processed");
    }
}



--
View this message in context: http://camel.465427.n5.nabble.com/re-use-route-definition-tp5743696p5743698.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message