use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class PropertiesComponentOnlyUseDefaultValuesTest method testOneMissing.
public void testOneMissing() 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
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class PropertiesComponentDefaultTest method testNotIgnoreMissingPropertySystemPropertyOnClasspath.
public void testNotIgnoreMissingPropertySystemPropertyOnClasspath() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").to("properties:bar.end?locations=${my.home}/unknown.properties,org/apache/camel/component/properties/bar.properties" + "&ignoreMissingLocation=false");
}
});
try {
context.start();
fail("Should have thrown exception");
} catch (FailedToCreateRouteException e) {
assertEquals("Cannot find JVM system property with key: my.home", e.getCause().getCause().getMessage());
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class PropertiesComponentDefaultTest method testPropertiesComponentDefaultNoFileFound.
public void testPropertiesComponentDefaultNoFileFound() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").to("properties:bar.end?locations=org/apache/camel/component/properties/unknown.properties");
}
});
try {
context.start();
fail("Should throw exception");
} catch (FailedToCreateRouteException e) {
ResolveEndpointFailedException cause = assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
FileNotFoundException fnfe = assertIsInstanceOf(FileNotFoundException.class, cause.getCause());
assertEquals("Properties file org/apache/camel/component/properties/unknown.properties not found in classpath", fnfe.getMessage());
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class XsltRouteXsltWithErrorTest method testXsltWithError.
public void testXsltWithError() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").to("xslt:org/apache/camel/component/xslt/transform-with-error.xsl");
}
});
try {
context.start();
fail("Should have thrown exception");
} catch (FailedToCreateRouteException e) {
TransformerConfigurationException cause = ObjectHelper.getException(TransformerConfigurationException.class, e);
assertNotNull(cause);
// not sure if XSLT errors may be i18n and not english always so just check for the spelling mistake of select -> slect
assertTrue(cause.getMessage().contains("slect"));
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class FromHasNoOutputRouteTest method testFromHasNoOutputRoute.
public void testFromHasNoOutputRoute() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
// has no output which is a mis configuration
from("direct:start");
}
});
try {
context.start();
fail("Should throw exception");
} catch (FailedToCreateRouteException e) {
assertEquals("route1", e.getRouteId());
IllegalArgumentException cause = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
assertEquals("Route route1 has no output processors. You need to add outputs to the route such as to(\"log:foo\").", cause.getMessage());
}
}
Aggregations