use of org.apache.camel.model.RouteDefinition in project camel by apache.
the class XmlConfigTestSupport method assertValidContext.
protected void assertValidContext(CamelContext context) {
assertNotNull("No context found!", context);
List<RouteDefinition> routes = ((ModelCamelContext) context).getRouteDefinitions();
LOG.debug("Found routes: " + routes);
assertEquals("One Route should be found", 1, routes.size());
for (RouteDefinition route : routes) {
List<FromDefinition> inputs = route.getInputs();
assertEquals("Number of inputs", 1, inputs.size());
FromDefinition fromType = inputs.get(0);
assertEquals("from URI", "seda:test.a", fromType.getUri());
List<?> outputs = route.getOutputs();
assertEquals("Number of outputs", 1, outputs.size());
}
}
use of org.apache.camel.model.RouteDefinition in project camel by apache.
the class AdviceWithInterceptSendToEndpointWithLoadbalancerTest method testSimpleMultipleAdvice.
@Test
public void testSimpleMultipleAdvice() throws Exception {
RouteDefinition route = context.getRouteDefinitions().get(0);
route.adviceWith(context, new RouteBuilder() {
public void configure() throws Exception {
interceptSendToEndpoint("seda:end1").skipSendToOriginalEndpoint().to("mock:end");
}
});
context.start();
getMockEndpoint("mock:end").expectedMessageCount(1);
template.sendBody("direct:start", "Hello World");
assertMockEndpointsSatisfied();
}
use of org.apache.camel.model.RouteDefinition in project camel by apache.
the class HystrixHierarchicalConfigurationTest method testConfiguration.
@Test
public void testConfiguration() throws Exception {
RouteDefinition routeDefinition = camelContext.getRouteDefinition("hystrix-route");
HystrixDefinition hystrixDefinition = findHystrixDefinition(routeDefinition);
Assert.assertNotNull(hystrixDefinition);
HystrixProcessorFactory factory = new HystrixProcessorFactory();
HystrixConfigurationDefinition config = factory.buildHystrixConfiguration(camelContext, hystrixDefinition);
Assert.assertEquals("local-conf-group-key", config.getGroupKey());
Assert.assertEquals("global-thread-key", config.getThreadPoolKey());
Assert.assertEquals(new Integer(5), config.getCorePoolSize());
}
use of org.apache.camel.model.RouteDefinition in project camel by apache.
the class SpringScheduledRoutePolicyTest method startRouteWithPolicy.
@SuppressWarnings("unchecked")
private CamelContext startRouteWithPolicy(String policyBeanName) throws Exception {
CamelContext context = new DefaultCamelContext();
List<RouteDefinition> routes = (List<RouteDefinition>) applicationContext.getBean("testRouteContext");
RoutePolicy policy = applicationContext.getBean(policyBeanName, RoutePolicy.class);
assertTrue(getTestType() == TestType.SIMPLE ? policy instanceof SimpleScheduledRoutePolicy : policy instanceof CronScheduledRoutePolicy);
routes.get(0).routePolicy(policy);
((ModelCamelContext) context).addRouteDefinitions(routes);
context.start();
return context;
}
use of org.apache.camel.model.RouteDefinition in project camel by apache.
the class RouteboxDispatcher method getInnerContextConsumerList.
protected List<URI> getInnerContextConsumerList(CamelContext context) throws URISyntaxException {
List<URI> consumerList = new ArrayList<URI>();
List<RouteDefinition> routeDefinitions = context.getRouteDefinitions();
for (RouteDefinition routeDefinition : routeDefinitions) {
List<FromDefinition> inputs = routeDefinition.getInputs();
for (FromDefinition input : inputs) {
consumerList.add(new URI(input.getUri()));
}
}
return consumerList;
}
Aggregations