use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class StartingRoutesErrorReportedTest method testInvalidFrom.
public void testInvalidFrom() throws Exception {
try {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start?foo=bar").routeId("route1").to("mock:result");
}
});
context.start();
fail();
} catch (FailedToCreateRouteException e) {
assertTrue(e.getMessage().startsWith("Failed to create route route1: Route(route1)[[From[direct:start?foo=bar]] -> [To[mock:resul... because of"));
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class WeightedRandomLoadBalanceTest method testUnmatchedRatiosToProcessors.
public void testUnmatchedRatiosToProcessors() throws Exception {
try {
context.addRoutes(new RouteBuilder() {
public void configure() {
// START SNIPPET: example
from("direct:start").loadBalance().weighted(false, "2,3").to("mock:x", "mock:y", "mock:z");
// END SNIPPET: example
}
});
context.start();
fail("Should have thrown exception");
} catch (FailedToCreateRouteException e) {
IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
assertEquals("Loadbalacing with 3 should match number of distributions 2", iae.getMessage());
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class WeightedRoundRobinLoadBalanceTest method testUnmatchedRatiosToProcessors.
public void testUnmatchedRatiosToProcessors() throws Exception {
try {
context.addRoutes(new RouteBuilder() {
public void configure() {
// START SNIPPET: example
from("direct:start").loadBalance().weighted(true, "2,3").to("mock:x", "mock:y", "mock:z");
// END SNIPPET: example
}
});
context.start();
fail("Should have thrown exception");
} catch (FailedToCreateRouteException e) {
IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
assertEquals("Loadbalacing with 3 should match number of distributions 2", iae.getMessage());
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class BeanWithMethodHeaderTest method testMethodNotExistsOnInstance.
public void testMethodNotExistsOnInstance() throws Exception {
final MyBean myBean = new MyBean();
try {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:typo").bean(myBean, "ups").to("mock:result");
}
});
fail("Should throw an exception");
} catch (FailedToCreateRouteException e) {
MethodNotFoundException mnfe = assertIsInstanceOf(MethodNotFoundException.class, e.getCause().getCause());
assertEquals("ups", mnfe.getMethodName());
assertSame(myBean, mnfe.getBean());
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class MethodCallBeanRefNotFoundTest method testMethodCallBeanRefNotFound.
public void testMethodCallBeanRefNotFound() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:a").routeId("a").split().method("foo", "hello").to("mock:a");
from("direct:b").routeId("b").split().method("bar", "hello").to("mock:b");
}
});
try {
context.start();
fail("Should have thrown exception");
} catch (FailedToCreateRouteException e) {
assertEquals("b", e.getRouteId());
NoSuchBeanException cause = assertIsInstanceOf(NoSuchBeanException.class, e.getCause());
assertEquals("bar", cause.getName());
}
}
Aggregations