use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class BeanRefNotFoundTest method testBeanRefNotFound.
public void testBeanRefNotFound() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:a").routeId("a").bean("foo").to("mock:a");
from("direct:b").routeId("b").bean("bar").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());
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class BeanRefMethodNotFoundTest method testBeanRefMethodNotFound.
public void testBeanRefMethodNotFound() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:a").routeId("a").bean("foo", "hello").to("mock:a");
from("direct:b").routeId("b").bean("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 OptionalPropertiesDslInvalidSyntaxTest method testPlaceholderDslKeyNotFoundTest.
public void testPlaceholderDslKeyNotFoundTest() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").multicast().placeholder("stopOnException", "xxx").to("mock:a").throwException(new IllegalAccessException("Damn")).to("mock:b");
}
});
try {
context.start();
fail("Should have thrown exception");
} catch (FailedToCreateRouteException e) {
IllegalArgumentException cause = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
assertEquals("Property with key [xxx] not found in properties from text: {{xxx}}", cause.getMessage());
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class OptionalPropertiesDslInvalidSyntaxTest method testPlaceholderDslSetterNotFoundTest.
public void testPlaceholderDslSetterNotFoundTest() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").multicast().placeholder("xxx", "stop").to("mock:a").throwException(new IllegalAccessException("Damn")).to("mock:b");
}
});
try {
context.start();
fail("Should have thrown exception");
} catch (FailedToCreateRouteException e) {
IllegalArgumentException cause = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
assertEquals("No setter to set property: xxx to: true on: Multicast[[To[mock:a], ThrowException[java.lang.IllegalAccessException], To[mock:b]]]", cause.getMessage());
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class PropertiesComponentOnlyUseDefaultValuesTest method testAllMissing.
public void testAllMissing() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").to("{{foo:mock:foo}}").to("{{bar}}");
}
});
try {
context.start();
fail("Should have thrown exception");
} catch (FailedToCreateRouteException e) {
// expected
}
}
Aggregations