use of org.apache.camel.processor.Pipeline in project camel by apache.
the class RouteBuilderTest method testThreads.
public void testThreads() throws Exception {
List<Route> routes = buildThreads();
log.debug("Created routes: " + routes);
assertEquals("Number routes created", 1, routes.size());
for (Route route : routes) {
Endpoint key = route.getEndpoint();
assertEquals("From endpoint", "direct://a", key.getEndpointUri());
EventDrivenConsumerRoute consumer = assertIsInstanceOf(EventDrivenConsumerRoute.class, route);
Channel channel = unwrapChannel(consumer.getProcessor());
Pipeline line = assertIsInstanceOf(Pipeline.class, channel.getNextProcessor());
Iterator<?> it = line.getProcessors().iterator();
assertIsInstanceOf(ThreadsProcessor.class, it.next());
// output should be wrapped in a pipeline
Pipeline threadsLine = assertIsInstanceOf(Pipeline.class, it.next());
Iterator<Processor> it2 = threadsLine.getProcessors().iterator();
assertIsInstanceOf(SendProcessor.class, unwrapChannel(it2.next()).getNextProcessor());
assertIsInstanceOf(SendProcessor.class, unwrapChannel(it2.next()).getNextProcessor());
}
}
use of org.apache.camel.processor.Pipeline in project camel by apache.
the class RouteBuilderTest method testRouteDynamicReceipentList.
public void testRouteDynamicReceipentList() throws Exception {
List<Route> routes = buildDynamicRecipientList();
log.debug("Created routes: " + routes);
assertEquals("Number routes created", 1, routes.size());
for (Route route : routes) {
Endpoint key = route.getEndpoint();
assertEquals("From endpoint", "direct://a", key.getEndpointUri());
EventDrivenConsumerRoute consumer = assertIsInstanceOf(EventDrivenConsumerRoute.class, route);
Channel channel = unwrapChannel(consumer.getProcessor());
Pipeline line = assertIsInstanceOf(Pipeline.class, channel.getNextProcessor());
Iterator<?> it = line.getProcessors().iterator();
// EvaluateExpressionProcessor should be wrapped in error handler
Object first = it.next();
first = assertIsInstanceOf(DeadLetterChannel.class, first).getOutput();
assertIsInstanceOf(EvaluateExpressionProcessor.class, first);
// and the second should NOT be wrapped in error handler
Object second = it.next();
assertIsInstanceOf(RecipientList.class, second);
}
}
Aggregations