Search in sources :

Example 1 with Navigate

use of org.apache.camel.Navigate in project camel by apache.

the class NavigateRouteTest method navigateRoute.

@SuppressWarnings("unchecked")
private void navigateRoute(Navigate<Processor> nav) {
    if (!nav.hasNext()) {
        return;
    }
    for (Processor child : nav.next()) {
        count++;
        if (child instanceof SendProcessor) {
            SendProcessor send = (SendProcessor) child;
            assertEquals("mock://result", send.getDestination().getEndpointUri());
        }
        if (child instanceof ConvertBodyProcessor) {
            ConvertBodyProcessor convert = (ConvertBodyProcessor) child;
            assertEquals(String.class, convert.getType());
        }
        // navigate children
        if (child instanceof Navigate) {
            navigateRoute((Navigate<Processor>) child);
        }
    }
}
Also used : Processor(org.apache.camel.Processor) Navigate(org.apache.camel.Navigate)

Example 2 with Navigate

use of org.apache.camel.Navigate in project camel by apache.

the class EventDrivenConsumerRoute method doFilter.

@SuppressWarnings("unchecked")
private void doFilter(String pattern, Navigate<Processor> nav, List<Processor> match) {
    List<Processor> list = nav.next();
    if (list != null) {
        for (Processor proc : list) {
            String id = null;
            if (proc instanceof IdAware) {
                id = ((IdAware) proc).getId();
            }
            if (EndpointHelper.matchPattern(id, pattern)) {
                match.add(proc);
            }
            if (proc instanceof Navigate) {
                Navigate<Processor> child = (Navigate<Processor>) proc;
                doFilter(pattern, child, match);
            }
        }
    }
}
Also used : Processor(org.apache.camel.Processor) IdAware(org.apache.camel.spi.IdAware) Navigate(org.apache.camel.Navigate)

Aggregations

Navigate (org.apache.camel.Navigate)2 Processor (org.apache.camel.Processor)2 IdAware (org.apache.camel.spi.IdAware)1