use of org.apache.camel.Channel in project camel by apache.
the class ContextErrorHandlerTest method testOverloadingTheDefaultErrorHandler.
public void testOverloadingTheDefaultErrorHandler() throws Exception {
RouteBuilder builder = new RouteBuilder() {
public void configure() {
errorHandler(loggingErrorHandler("FOO.BAR"));
from("seda:a").to("seda:b");
}
};
List<Route> list = getRouteListWithCurrentContext(builder);
assertEquals("Number routes created" + list, 1, list.size());
for (Route route : list) {
Endpoint key = route.getEndpoint();
assertEquals("From endpoint", "seda://a", key.getEndpointUri());
EventDrivenConsumerRoute consumerRoute = assertIsInstanceOf(EventDrivenConsumerRoute.class, route);
Processor processor = consumerRoute.getProcessor();
Channel channel = unwrapChannel(processor);
assertIsInstanceOf(LoggingErrorHandler.class, channel.getErrorHandler());
SendProcessor sendProcessor = assertIsInstanceOf(SendProcessor.class, channel.getNextProcessor());
log.debug("Found sendProcessor: " + sendProcessor);
}
}
Aggregations