vendredi 4 septembre 2015

Camel File Input Unit Testing

I find that my File Component in the from is not getting the event when run from the unit tests. I can confirm that the paths are all correct.

HEre is my route:

from("file:" + omnitureCsvDirectory() + "?move=" + omnitureCsvFinishedDirectory() + "_" + dayIdentifier())
            .log("Processing {id}")
            .routeId(routeName())
            .unmarshal(csvConfig())
            .split(body())
            .streaming()
            .threads(parallelWorkers())
            .to("stream:out");

Here is my unit test:

@Test
public void testIsUseAdviceWith() throws Exception {
// Create the file in the desired location first.    
 Files.write(Paths.get(Config.omnitureCsvDirectory() + File.separator + "input.csv"), "name,city\nsai,london".getBytes());
    context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {

        @Override
        public void configure() throws Exception {
            // I'll add more mock routes later.

        }
    });
    context.start();

    System.out.println(Files.list(Paths.get(Config.omnitureCsvFinishedDirectory())).collect(toList()));
    context.stop();
}

Aucun commentaire:

Enregistrer un commentaire