Search in sources :

Example 16 with ProcessorDefinition

use of org.apache.camel.model.ProcessorDefinition in project camel by apache.

the class PropertiesRouteFromTest method testPropertiesRouteFrom.

public void testPropertiesRouteFrom() throws Exception {
    ProcessorDefinition out = context.getRouteDefinition("foo").getOutputs().get(0);
    assertEquals("{{cool.end}}", ((SendDefinition) out).getUri());
    String uri = context.getRouteDefinition("foo").getInputs().get(0).getUri();
    assertEquals("{{cool.start}}", uri);
    // use a routes definition to dump the routes
    String xml = ModelHelper.dumpModelAsXml(context, context.getRouteDefinition("foo"));
    assertTrue(xml.contains("<from uri=\"{{cool.start}}\"/>"));
    assertTrue(xml.contains("<to id=\"to1\" uri=\"{{cool.end}}\"/>"));
}
Also used : ProcessorDefinition(org.apache.camel.model.ProcessorDefinition)

Example 17 with ProcessorDefinition

use of org.apache.camel.model.ProcessorDefinition in project ddf by codice.

the class ContentDirectoryMonitorTest method verifyRoute.

private void verifyRoute(RouteDefinition routeDefinition, String monitoredDirectory, String processingMechanism) {
    List<FromDefinition> fromDefinitions = routeDefinition.getInputs();
    assertThat(fromDefinitions.size(), is(1));
    String uri = fromDefinitions.get(0).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));
    List<ProcessorDefinition<?>> processorDefinitions = routeDefinition.getOutputs();
    if (ContentDirectoryMonitor.IN_PLACE.equals(processingMechanism)) {
        assertThat(processorDefinitions.size(), is(2));
    } else {
        assertThat(processorDefinitions.size(), is(1));
    }
}
Also used : FromDefinition(org.apache.camel.model.FromDefinition) ProcessorDefinition(org.apache.camel.model.ProcessorDefinition) Matchers.containsString(org.hamcrest.Matchers.containsString)

Aggregations

ProcessorDefinition (org.apache.camel.model.ProcessorDefinition)17 RouteDefinition (org.apache.camel.model.RouteDefinition)5 Endpoint (org.apache.camel.Endpoint)4 HashMap (java.util.HashMap)3 Processor (org.apache.camel.Processor)3 MalformedObjectNameException (javax.management.MalformedObjectNameException)2 NamedNode (org.apache.camel.NamedNode)2 PerformanceCounter (org.apache.camel.api.management.PerformanceCounter)2 FromDefinition (org.apache.camel.model.FromDefinition)2 SendDefinition (org.apache.camel.model.SendDefinition)2 KeyValueHolder (org.apache.camel.util.KeyValueHolder)2 IOException (java.io.IOException)1 Method (java.lang.reflect.Method)1 URISyntaxException (java.net.URISyntaxException)1 EventObject (java.util.EventObject)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1