use of org.apache.camel.impl.EventDrivenConsumerRoute in project camel by apache.
the class AbstractTransactionTest method getConditionalExceptionProcessor.
/**
* By default routes should be wrapped in the {@link DeadLetterChannel} so
* lets unwrap that and return the actual processor
*/
protected ConditionalExceptionProcessor getConditionalExceptionProcessor(Route route) {
// the following is very specific (and brittle) and is not generally
// useful outside these transaction tests (nor intended to be).
EventDrivenConsumerRoute consumerRoute = assertIsInstanceOf(EventDrivenConsumerRoute.class, route);
Processor processor = findProcessorByClass(consumerRoute.getProcessor(), ConditionalExceptionProcessor.class);
return assertIsInstanceOf(ConditionalExceptionProcessor.class, processor);
}
use of org.apache.camel.impl.EventDrivenConsumerRoute in project camel by apache.
the class DefaultErrorHandlerTest method testRoute.
public void testRoute() {
Route route = context.getRoutes().get(0);
EventDrivenConsumerRoute consumerRoute = assertIsInstanceOf(EventDrivenConsumerRoute.class, route);
Processor processor = unwrap(consumerRoute.getProcessor());
Pipeline pipeline = assertIsInstanceOf(Pipeline.class, processor);
// there should be a default error handler in front of each processor in this pipeline
for (Processor child : pipeline.getProcessors()) {
Channel channel = assertIsInstanceOf(Channel.class, child);
assertNotNull("There should be an error handler", channel.getErrorHandler());
assertIsInstanceOf(DefaultErrorHandler.class, channel.getErrorHandler());
}
}
use of org.apache.camel.impl.EventDrivenConsumerRoute in project camel by apache.
the class StreamResequencerTest method doTestStreamResequencerType.
protected void doTestStreamResequencerType() throws Exception {
List<Route> list = getRouteList(createRouteBuilder());
assertEquals("Number of routes created: " + list, 1, list.size());
Route route = list.get(0);
EventDrivenConsumerRoute consumerRoute = assertIsInstanceOf(EventDrivenConsumerRoute.class, route);
Channel channel = unwrapChannel(consumerRoute.getProcessor());
assertIsInstanceOf(DefaultErrorHandler.class, channel.getErrorHandler());
assertIsInstanceOf(StreamResequencer.class, channel.getNextProcessor());
}
use of org.apache.camel.impl.EventDrivenConsumerRoute in project camel by apache.
the class RouteBuilderTest method testRouteWithInterceptor.
public void testRouteWithInterceptor() throws Exception {
List<Route> routes = buildRouteWithInterceptor();
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);
Pipeline line = assertIsInstanceOf(Pipeline.class, unwrap(consumer.getProcessor()));
assertEquals(3, line.getProcessors().size());
// last should be our seda
List<Processor> processors = new ArrayList<Processor>(line.getProcessors());
Processor sendTo = assertIsInstanceOf(SendProcessor.class, unwrapChannel(processors.get(2)).getNextProcessor());
assertSendTo(sendTo, "direct://d");
}
}
use of org.apache.camel.impl.EventDrivenConsumerRoute in project camel by apache.
the class RouteBuilderTest method testSimpleRouteWithChoice.
public void testSimpleRouteWithChoice() throws Exception {
List<Route> routes = buildSimpleRouteWithChoice();
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());
ChoiceProcessor choiceProcessor = assertIsInstanceOf(ChoiceProcessor.class, channel.getNextProcessor());
List<FilterProcessor> filters = choiceProcessor.getFilters();
assertEquals("Should be two when clauses", 2, filters.size());
Processor filter1 = filters.get(0);
assertSendTo(unwrapChannel(((FilterProcessor) filter1).getProcessor()).getNextProcessor(), "direct://b");
Processor filter2 = filters.get(1);
assertSendTo(unwrapChannel(((FilterProcessor) filter2).getProcessor()).getNextProcessor(), "direct://c");
assertSendTo(unwrapChannel(choiceProcessor.getOtherwise()).getNextProcessor(), "direct://d");
}
}
Aggregations