Search in sources :

Example 16 with FromDefinition

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)));
}
Also used : FromDefinition(org.apache.camel.model.FromDefinition) ProcessorDefinition(org.apache.camel.model.ProcessorDefinition)

Aggregations

FromDefinition (org.apache.camel.model.FromDefinition)16 RouteDefinition (org.apache.camel.model.RouteDefinition)10 ModelCamelContext (org.apache.camel.model.ModelCamelContext)4 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ChoiceDefinition (org.apache.camel.model.ChoiceDefinition)2 InterceptFromDefinition (org.apache.camel.model.InterceptFromDefinition)2 LogDefinition (org.apache.camel.model.LogDefinition)2 ProcessorDefinition (org.apache.camel.model.ProcessorDefinition)2 WhenDefinition (org.apache.camel.model.WhenDefinition)2 RestDefinition (org.apache.camel.model.rest.RestDefinition)2 RestConfiguration (org.apache.camel.spi.RestConfiguration)2 FabricService (io.fabric8.api.FabricService)1 Profile (io.fabric8.api.Profile)1 IOException (java.io.IOException)1 URI (java.net.URI)1 LinkedHashMap (java.util.LinkedHashMap)1 TreeMap (java.util.TreeMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1