use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class Mina2EncodingTest method testInvalidEncoding.
@Test
public void testInvalidEncoding() throws Exception {
final String uri = String.format("mina2:tcp://localhost:%1$s?textline=true&encoding=XXX&sync=false", getPort());
try {
context.addRoutes(new RouteBuilder() {
public void configure() {
from(uri).to("mock:result");
}
});
fail("Should have thrown a ResolveEndpointFailedException due invalid encoding parameter");
} catch (FailedToCreateRouteException e) {
IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
assertEquals("The encoding: XXX is not supported", iae.getMessage());
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class ProtobufMarshalAndUnmarshallTest method testMarshalAndUnmarshalWithDSL3.
@Test
public void testMarshalAndUnmarshalWithDSL3() throws Exception {
try {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:unmarshalC").unmarshal().protobuf(new CamelException("wrong instance")).to("mock:reverse");
}
});
fail("Expect the exception here");
} catch (Exception ex) {
assertTrue("Expect FailedToCreateRouteException", ex instanceof FailedToCreateRouteException);
assertTrue("Get a wrong reason", ex.getCause() instanceof IllegalArgumentException);
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class QuartzNameCollisionTest method testDupeName.
@Test
public void testDupeName() throws Exception {
camel1 = new DefaultCamelContext();
camel1.setName("camel-1");
camel1.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("quartz2://myGroup/myTimerName?cron=0/1+*+*+*+*+?").to("log:one", "mock:one");
}
});
camel1.start();
try {
camel1.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("quartz2://myGroup/myTimerName?cron=0/2+*+*+*+*+?").to("log:two", "mock:two");
}
});
Assert.fail("Should have thrown an exception");
} catch (FailedToCreateRouteException e) {
String reason = e.getMessage();
Assert.assertEquals(reason.indexOf("Trigger key myGroup.myTimerName is already in use") >= 0, true);
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class HttpClientRouteTest method testCreateSerlvetEndpointProducer.
@Test
public void testCreateSerlvetEndpointProducer() throws Exception {
if (!startCamelContext) {
// don't test it with web.xml configure
return;
}
try {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").to("servlet:///testworld");
}
});
fail("Excepts exception here");
} catch (FailedToCreateRouteException ex) {
assertTrue("Get a wrong exception.", ex.getCause() instanceof FailedToCreateProducerException);
assertTrue("Get a wrong cause of exception.", ex.getCause().getCause() instanceof UnsupportedOperationException);
}
}
use of org.apache.camel.FailedToCreateRouteException in project camel by apache.
the class JavaDslTransactedNoTXManagerTest method testTransactedNoTXManager.
public void testTransactedNoTXManager() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").transacted().to("mock:result");
}
});
try {
context.start();
fail("Should have thrown an exception");
} catch (FailedToCreateRouteException e) {
NoSuchBeanException cause = assertIsInstanceOf(NoSuchBeanException.class, e.getCause());
assertEquals("No bean could be found in the registry of type: PlatformTransactionManager", cause.getMessage());
}
}
Aggregations