0

I have a simple Apache Camel RouteBuilder class that roughly looks like:

from("an FTP server")
        // log stuff
        .to("direct:split");

from("direct:split")
        // split CSV and aggregate the messages into separate files
        .to("direct:save");

from("direct:save")
        // save the files to a different FTP server
        .end();

In tests that I'm going to write though, I want to use pretty much test the direct:split endpoint only -- I'll load the CSV and save the new CSVs locally, and then write tests to compare the output with what I'd expect the output to be. Would I just rewrite the RouteBuilder in my tests? Or would I somehow pull in the direct:split endpoint, and then just specify different starting and ending locations?

Steve Harrington
  • 942
  • 1
  • 7
  • 18
g_raham
  • 55
  • 6

1 Answers1

0

You could make some "sub" routes such as:

  from("direct:split")
        // make two subroutes
        .to("direct:splitSubRouteOne")
        .to("direct:splitSubRouteTwo");

    from("direct:splitSubRouteOne")
        // split CSV and aggregate the messages into separate files
        // etc 
     ;    

   from("direct:splitSubRouteTwo")
        .to("direct:save");

Then you can test just the portion that you want (presumably) by sending to "direct:splitSubRouteOne" which will test that piece, but not the second piece.

Steve Harrington
  • 942
  • 1
  • 7
  • 18