use of org.apache.camel.model.FromDefinition in project ddf by codice.
the class ContentDirectoryMonitorTest method verifyRoute.
private void verifyRoute(RouteDefinition routeDefinition, String monitoredDirectory, String processingMechanism) {
FromDefinition fromDefinition = routeDefinition.getInput();
assertThat(fromDefinition, is(notNullValue()));
String uri = fromDefinition.getUri();
String expectedUri = "file:" + monitoredDirectory + "?recursive=true&moveFailed=.errors&readLockMinLength=1&readLock=changed&readLockTimeout=2000&readLockCheckInterval=1000";
if (ContentDirectoryMonitor.DELETE.equals(processingMechanism)) {
expectedUri += "&delete=true";
} else if (ContentDirectoryMonitor.MOVE.equals(processingMechanism)) {
expectedUri += "&move=.ingested";
} else if (ContentDirectoryMonitor.IN_PLACE.equals(processingMechanism)) {
expectedUri = "durable:" + monitoredDirectory;
}
assertThat(uri, equalTo(expectedUri));
Iterator<ProcessorDefinition<?>> processors = routeDefinition.getOutputs().iterator();
assertThat(processors.next(), is(instanceOf(ThreadsDefinition.class)));
assertThat(processors.next(), is(instanceOf(ProcessorDefinition.class)));
if (ContentDirectoryMonitor.IN_PLACE.equals(processingMechanism)) {
assertThat(processors.next(), is(instanceOf(ChoiceDefinition.class)));
}
assertThat(processors.next(), is(instanceOf(ToDefinition.class)));
}
Aggregations