use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class BeanInvokeStaticTest method testB.
public void testB() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:a").bean(MyStaticClass.class, "doSomething").to("mock:a");
}
});
try {
context.start();
fail("Should have thrown exception");
} catch (FailedToCreateRouteException e) {
assertIsInstanceOf(RuntimeCamelException.class, e.getCause());
assertIsInstanceOf(MethodNotFoundException.class, e.getCause().getCause());
assertEquals("Static method with name: doSomething not found on class: org.apache.camel.component.bean.MyStaticClass", e.getCause().getCause().getMessage());
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class SameSedaQueueMultipleConsumersDifferenceTest method testAddConsumer.
public void testAddConsumer() throws Exception {
try {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("seda:foo").routeId("fail").to("mock:fail");
}
});
fail("Should have thrown exception");
} catch (FailedToCreateRouteException e) {
assertEquals("fail", e.getRouteId());
assertEquals("Cannot use existing queue seda://foo as the existing queue multiple consumers true does not match given multiple consumers false", e.getCause().getMessage());
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class PropertiesComponentTest method testPropertiesComponentPropertySuffixFallbackFalse.
public void testPropertiesComponentPropertySuffixFallbackFalse() throws Exception {
PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
pc.setPropertySuffix(".end");
pc.setFallbackToUnaugmentedProperty(false);
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").to("properties:cool.end");
}
});
try {
context.start();
fail("Should throw exception");
} catch (FailedToCreateRouteException e) {
ResolveEndpointFailedException cause = assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, cause.getCause());
assertEquals("Property with key [cool.end.end] not found in properties from text: {{cool.end}}", iae.getMessage());
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class PropertiesComponentTest method testPropertiesComponentCircularReference.
public void testPropertiesComponentCircularReference() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").to("properties:cool.a");
}
});
try {
context.start();
fail("Should throw exception");
} catch (FailedToCreateRouteException e) {
ResolveEndpointFailedException cause = assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, cause.getCause());
assertEquals("Circular reference detected with key [cool.a] from text: {{cool.a}}", iae.getMessage());
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class PropertiesComponentTest method testPropertiesComponentPropertyPrefixFallbackFalse.
public void testPropertiesComponentPropertyPrefixFallbackFalse() throws Exception {
PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
pc.setPropertyPrefix("cool.");
pc.setFallbackToUnaugmentedProperty(false);
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").to("properties:cool.end");
from("direct:foo").to("properties:mock:{{result}}");
}
});
try {
context.start();
fail("Should throw exception");
} catch (FailedToCreateRouteException e) {
ResolveEndpointFailedException cause = assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, cause.getCause());
assertEquals("Property with key [cool.cool.end] not found in properties from text: {{cool.end}}", iae.getMessage());
}
}
Aggregations