use of org.apache.camel.Channel 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.Channel in project camel by apache.
the class RouteBuilderTest method testSimpleRouteWithHeaderPredicate.
public void testSimpleRouteWithHeaderPredicate() throws Exception {
List<Route> routes = buildSimpleRouteWithHeaderPredicate();
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());
FilterProcessor filterProcessor = assertIsInstanceOf(FilterProcessor.class, channel.getNextProcessor());
SendProcessor sendProcessor = assertIsInstanceOf(SendProcessor.class, unwrapChannel(filterProcessor).getNextProcessor());
assertEquals("Endpoint URI", "direct://b", sendProcessor.getDestination().getEndpointUri());
}
}
use of org.apache.camel.Channel 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);
}
}
use of org.apache.camel.Channel in project camel by apache.
the class RouteBuilderTest method testIdempotentConsumer.
public void testIdempotentConsumer() throws Exception {
List<Route> routes = buildIdempotentConsumer();
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());
IdempotentConsumer idempotentConsumer = assertIsInstanceOf(IdempotentConsumer.class, channel.getNextProcessor());
assertEquals("messageIdExpression", "header(myMessageId)", idempotentConsumer.getMessageIdExpression().toString());
assertIsInstanceOf(MemoryIdempotentRepository.class, idempotentConsumer.getIdempotentRepository());
SendProcessor sendProcessor = assertIsInstanceOf(SendProcessor.class, unwrapChannel(idempotentConsumer.getProcessor()).getNextProcessor());
assertEquals("Endpoint URI", "direct://b", sendProcessor.getDestination().getEndpointUri());
}
}
use of org.apache.camel.Channel in project camel by apache.
the class RouteBuilderTest method testSplitter.
public void testSplitter() throws Exception {
List<Route> routes = buildSplitter();
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());
assertIsInstanceOf(Splitter.class, channel.getNextProcessor());
}
}
Aggregations