本文整理汇总了Java中org.apache.camel.Route.getEndpoint方法的典型用法代码示例。如果您正苦于以下问题:Java Route.getEndpoint方法的具体用法?Java Route.getEndpoint怎么用?Java Route.getEndpoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.camel.Route
的用法示例。
在下文中一共展示了Route.getEndpoint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canSetLinkParameters
import org.apache.camel.Route; //导入方法依赖的package包/类
@Test
public void canSetLinkParameters() throws Exception {
String a = "foo";
String b = "HOURS";
context = camelContext("ardulink://testlink?a=" + a + "&b=" + b,
MOCK_URI);
Route route = getFirst(context.getRoutes()).getOrThrow(
"Context %s has no routes", context);
ArdulinkEndpoint endpoint = (ArdulinkEndpoint) route.getEndpoint();
TestLink link = (TestLink) extractDelegated(endpoint.getLink());
TestLinkConfig config = link.getConfig();
assertThat(config.getA(), is(a));
assertThat(config.getB(), is(TimeUnit.valueOf(b)));
}
示例2: testConfigureDeadLetterChannel
import org.apache.camel.Route; //导入方法依赖的package包/类
public void testConfigureDeadLetterChannel() throws Exception {
// START SNIPPET: e3
RouteBuilder builder = new RouteBuilder() {
public void configure() {
// using dead letter channel with a seda queue for errors
errorHandler(deadLetterChannel("seda:errors"));
// here is our route
from("seda:a").to("seda:b");
}
};
// END SNIPPET: e3
List<Route> list = getRouteList(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);
Channel channel = unwrapChannel(consumerRoute.getProcessor());
assertIsInstanceOf(SendProcessor.class, channel.getNextProcessor());
}
}
示例3: testLoggingErrorHandler
import org.apache.camel.Route; //导入方法依赖的package包/类
public void testLoggingErrorHandler() throws Exception {
// START SNIPPET: e5
RouteBuilder builder = new RouteBuilder() {
public void configure() {
from("seda:a").errorHandler(loggingErrorHandler("FOO.BAR")).filter(body().isInstanceOf(String.class)).to("seda:b");
}
};
// END SNIPPET: e5
List<Route> routes = getRouteList(builder);
assertEquals("Number routes created", 1, routes.size());
for (Route route : routes) {
Endpoint key = route.getEndpoint();
assertEquals("From endpoint", "seda://a", key.getEndpointUri());
EventDrivenConsumerRoute consumerRoute = assertIsInstanceOf(EventDrivenConsumerRoute.class, route);
Channel channel = unwrapChannel(consumerRoute.getProcessor());
assertIsInstanceOf(LoggingErrorHandler.class, channel.getErrorHandler());
assertIsInstanceOf(FilterProcessor.class, channel.getNextProcessor());
}
}
示例4: testSimpleRouteWithHeaderPredicate
import org.apache.camel.Route; //导入方法依赖的package包/类
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());
}
}
示例5: testSimpleRouteWithChoice
import org.apache.camel.Route; //导入方法依赖的package包/类
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");
}
}
示例6: testWireTap
import org.apache.camel.Route; //导入方法依赖的package包/类
public void testWireTap() throws Exception {
List<Route> routes = buildWireTap();
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());
MulticastProcessor multicastProcessor = assertIsInstanceOf(MulticastProcessor.class, channel.getNextProcessor());
List<Processor> endpoints = new ArrayList<Processor>(multicastProcessor.getProcessors());
assertEquals("Should have 2 endpoints", 2, endpoints.size());
assertSendToProcessor(unwrapChannel(endpoints.get(0)).getNextProcessor(), "direct://tap");
assertSendToProcessor(unwrapChannel(endpoints.get(1)).getNextProcessor(), "direct://b");
}
}
示例7: testRouteWithInterceptor
import org.apache.camel.Route; //导入方法依赖的package包/类
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");
}
}
示例8: testComplexExpressions
import org.apache.camel.Route; //导入方法依赖的package包/类
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());
}
}
示例9: testXMLRouteLoading
import org.apache.camel.Route; //导入方法依赖的package包/类
public void testXMLRouteLoading() throws Exception {
applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/spring/camelContextFactoryBean.xml");
CamelContext context = applicationContext.getBean("camel2", CamelContext.class);
assertNotNull("No context found!", context);
List<Route> routes = context.getRoutes();
LOG.debug("Found routes: " + routes);
assertNotNull("Should have found some routes", routes);
assertEquals("One Route should be found", 1, routes.size());
for (Route route : routes) {
Endpoint key = route.getEndpoint();
EventDrivenConsumerRoute consumerRoute = assertIsInstanceOf(EventDrivenConsumerRoute.class, route);
Processor processor = consumerRoute.getProcessor();
assertNotNull(processor);
assertEndpointUri(key, "seda://test.c");
}
}
示例10: testSplitter
import org.apache.camel.Route; //导入方法依赖的package包/类
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());
}
}
示例11: testIdempotentConsumer
import org.apache.camel.Route; //导入方法依赖的package包/类
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());
}
}
示例12: testOverloadingTheDefaultErrorHandler
import org.apache.camel.Route; //导入方法依赖的package包/类
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);
}
}
示例13: getObjectNameForRoute
import org.apache.camel.Route; //导入方法依赖的package包/类
public ObjectName getObjectNameForRoute(Route route) throws MalformedObjectNameException {
Endpoint ep = route.getEndpoint();
String id = route.getId();
StringBuilder buffer = new StringBuilder();
buffer.append(domainName).append(":");
buffer.append(KEY_CONTEXT + "=").append(getContextId(ep.getCamelContext())).append(",");
buffer.append(KEY_TYPE + "=" + TYPE_ROUTE + ",");
buffer.append(KEY_NAME + "=").append(ObjectName.quote(id));
return createObjectName(buffer);
}
示例14: testOverloadingTheDefaultErrorHandler
import org.apache.camel.Route; //导入方法依赖的package包/类
public void testOverloadingTheDefaultErrorHandler() throws Exception {
// START SNIPPET: e1
RouteBuilder builder = new RouteBuilder() {
public void configure() {
// use logging error handler
errorHandler(loggingErrorHandler("com.mycompany.foo"));
// here is our regular route
from("seda:a").to("seda:b");
}
};
// END SNIPPET: e1
List<Route> list = getRouteList(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);
Channel channel = unwrapChannel(consumerRoute.getProcessor());
assertIsInstanceOf(LoggingErrorHandler.class, channel.getErrorHandler());
Processor processor = unwrap(channel.getNextProcessor());
assertIsInstanceOf(SendProcessor.class, processor);
}
}
示例15: testSimpleRoute
import org.apache.camel.Route; //导入方法依赖的package包/类
public void testSimpleRoute() throws Exception {
List<Route> routes = buildSimpleRoute();
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());
SendProcessor sendProcessor = assertIsInstanceOf(SendProcessor.class, channel.getNextProcessor());
assertEquals("Endpoint URI", "direct://b", sendProcessor.getDestination().getEndpointUri());
}
}