use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class BeanLanguageInvalidOGNLTest method testBeanLanguageInvalidOGNL.
public void testBeanLanguageInvalidOGNL() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").transform().method(MyReallyCoolBean.class, "getOther[xx");
}
});
try {
context.start();
fail("Should have thrown exception");
} catch (FailedToCreateRouteException e) {
RuntimeCamelException rce = assertIsInstanceOf(RuntimeCamelException.class, e.getCause());
MethodNotFoundException mnfe = assertIsInstanceOf(MethodNotFoundException.class, rce.getCause());
assertEquals("getOther[xx", mnfe.getMethodName());
ExpressionIllegalSyntaxException cause = assertIsInstanceOf(ExpressionIllegalSyntaxException.class, mnfe.getCause());
assertEquals("Illegal syntax: getOther[xx", cause.getMessage());
assertEquals("getOther[xx", cause.getExpression());
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class ThreadsZeroInCoreAndMaxPoolTest method testThreadsCoreBeZero.
public void testThreadsCoreBeZero() throws Exception {
try {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").threads(-1, 2).to("mock:result");
}
});
fail("Expect FailedToCreateRouteException exception here");
} catch (FailedToCreateRouteException ex) {
assertTrue(ex.getCause() instanceof IllegalArgumentException);
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class ThrottlerInvalidConfiguredTest method testInvalid.
public void testInvalid() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
// null is invalid
from("seda:a").throttle(null).to("mock:result");
}
});
try {
context.start();
fail("Should have thrown exception");
} catch (FailedToCreateRouteException e) {
IllegalArgumentException cause = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
assertTrue(cause.getMessage().startsWith("MaxRequestsPerPeriod expression must be provided"));
}
context.stop();
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class ThreadsCoreAndMaxPoolInvalidTest method testInvalidSyntax.
public void testInvalidSyntax() throws Exception {
try {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").threads(5, 2).to("mock:result");
}
});
fail("Should have thrown an exception");
} catch (FailedToCreateRouteException e) {
IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
assertEquals("MaxPoolSize must be >= corePoolSize, was 2 >= 5", iae.getMessage());
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class HttpsTwoDifferentSslContextParametersGetTest method httpsTwoDifferentSSLContextNotSupported.
@Test
public void httpsTwoDifferentSSLContextNotSupported() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:foo").to("https4://127.0.0.1:" + localServer.getLocalPort() + "/mail?x509HostnameVerifier=x509HostnameVerifier&sslContextParametersRef=sslContextParameters");
from("direct:bar").to("https4://127.0.0.1:" + localServer.getLocalPort() + "/mail?x509HostnameVerifier=x509HostnameVerifier&sslContextParametersRef=sslContextParameters2");
}
});
try {
context.start();
fail("Should have thrown exception");
} catch (FailedToCreateRouteException e) {
IllegalArgumentException iae = (IllegalArgumentException) e.getCause().getCause();
assertNotNull(iae);
assertTrue(iae.getMessage().startsWith("Only same instance of SSLContextParameters is supported."));
}
}
Aggregations