use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class ClassComponentInvalidConfigurationTest method testClassNotFound.
public void testClassNotFound() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").to("class:org.apache.camel.component.bean.XXX").to("mock:result");
}
});
try {
context.start();
fail("Should have thrown exception");
} catch (FailedToCreateRouteException e) {
ResolveEndpointFailedException cause = assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
ClassNotFoundException not = assertIsInstanceOf(ClassNotFoundException.class, cause.getCause());
assertEquals("org.apache.camel.component.bean.XXX", not.getMessage());
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class MethodCallBeanRefMethodNotFoundTest method testMethodCallBeanRefMethodNotFound.
public void testMethodCallBeanRefMethodNotFound() 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("foo", "bye").to("mock:b");
}
});
try {
context.start();
fail("Should have thrown exception");
} catch (FailedToCreateRouteException e) {
assertEquals("b", e.getRouteId());
MethodNotFoundException cause = assertIsInstanceOf(MethodNotFoundException.class, e.getCause().getCause());
assertEquals("bye", cause.getMethodName());
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class CircuitBreakerLoadBalancerInvalidTest method testInvalid.
public void testInvalid() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").loadBalance().circuitBreaker(2, 5000, IOException.class).to("mock:a").to("mock:b");
}
});
try {
context.start();
fail("should fail");
} catch (FailedToCreateRouteException e) {
assertEquals("To many outputs configured on CircuitBreakerLoadBalancer: 2 > 1", e.getCause().getMessage());
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class StartingRoutesErrorReportedTest method testInvalidBean.
public void testInvalidBean() throws Exception {
try {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").routeId("route3").to("mock:foo").bean("");
}
});
context.start();
fail("Should have thrown exception");
} catch (FailedToCreateRouteException e) {
assertTrue(e.getMessage().startsWith("Failed to create route route3 at: >>> Bean[ref:] <<< in route:" + " Route(route3)[[From[direct:start]] -> [To[mock:foo], Bean[re... because of"));
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class AggregateUnknownExecutorServiceRefTest method testAggregateUnknownExecutorServiceRef.
public void testAggregateUnknownExecutorServiceRef() throws Exception {
try {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").aggregate(header("id"), new BodyInAggregatingStrategy()).completionSize(3).executorServiceRef("myUnknownProfile").to("log:foo").to("mock:aggregated");
}
});
context.start();
fail("Should have thrown exception");
} catch (FailedToCreateRouteException e) {
IllegalArgumentException cause = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
assertTrue(cause.getMessage().contains("myUnknownProfile"));
}
}
Aggregations