use of org.apache.camel.Route 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.Route in project camel by apache.
the class DefaultRouteStartupOrder method getServices.
public List<Service> getServices() {
List<Service> answer = new ArrayList<Service>();
Collection<Route> routes = routeService.getRoutes();
for (Route route : routes) {
answer.addAll(route.getServices());
}
return answer;
}
use of org.apache.camel.Route in project camel by apache.
the class RouteBuilderTest method testComplexExpressions.
public void testComplexExpressions() throws Exception {
// START SNIPPET: e7
RouteBuilder builder = new RouteBuilder() {
public void configure() {
errorHandler(deadLetterChannel("mock:error"));
from("direct:a").filter(header("foo").isEqualTo(123)).to("direct:b");
}
};
// END SNIPPET: e7
List<Route> routes = getRouteList(builder);
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());
}
}
use of org.apache.camel.Route in project camel by apache.
the class RouteBuilderTest method testCustomProcessorWithFilter.
public void testCustomProcessorWithFilter() throws Exception {
List<Route> routes = buildCustomProcessorWithFilter();
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());
}
}
use of org.apache.camel.Route 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");
}
}
Aggregations