use of org.apache.camel.CamelExecutionException in project camel by apache.
the class BeanOverloadedMethodFQNTest method testOrderNoFQNUnknown.
public void testOrderNoFQNUnknown() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").bean(MyBean.class, "order(Unknown)").to("mock:result");
}
});
context.start();
try {
template.sendBody("direct:start", new MyOrder());
fail("Should have thrown an exception");
} catch (CamelExecutionException e) {
NoTypeConversionAvailableException cause = assertIsInstanceOf(NoTypeConversionAvailableException.class, e.getCause().getCause());
assertEquals("Unknown", cause.getValue());
}
}
use of org.apache.camel.CamelExecutionException in project camel by apache.
the class BeanOverloadedMethodTest method testHelloOverloadedAmbiguousStringStringString.
public void testHelloOverloadedAmbiguousStringStringString() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").bean(MyBean.class, "hello(String,String,String)").to("mock:result");
}
});
context.start();
try {
template.sendBodyAndHeader("direct:start", "Claus", "country", "Denmark");
fail("Should have thrown an exception");
} catch (CamelExecutionException e) {
AmbiguousMethodCallException cause = assertIsInstanceOf(AmbiguousMethodCallException.class, e.getCause());
assertEquals(2, cause.getMethods().size());
}
}
use of org.apache.camel.CamelExecutionException in project camel by apache.
the class BeanOverloadedMethodTest method testHelloOverloadedIntString.
public void testHelloOverloadedIntString() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").bean(MyBean.class, "hello(int,String)").to("mock:result");
}
});
context.start();
try {
template.sendBodyAndHeader("direct:start", "Claus", "country", "Denmark");
fail("Should have thrown an exception");
} catch (CamelExecutionException e) {
AmbiguousMethodCallException cause = assertIsInstanceOf(AmbiguousMethodCallException.class, e.getCause());
assertEquals(2, cause.getMethods().size());
}
}
use of org.apache.camel.CamelExecutionException in project camel by apache.
the class SedaInOutChainedTimeoutTest method testSedaInOutChainedTimeout.
public void testSedaInOutChainedTimeout() throws Exception {
// time timeout after 2 sec should trigger a immediately reply
StopWatch watch = new StopWatch();
try {
template.requestBody("seda:a?timeout=5000", "Hello World");
fail("Should have thrown an exception");
} catch (CamelExecutionException e) {
ExchangeTimedOutException cause = assertIsInstanceOf(ExchangeTimedOutException.class, e.getCause());
assertEquals(2000, cause.getTimeout());
}
long delta = watch.stop();
assertTrue("Should be faster than 4000 millis, was: " + delta, delta < 4000);
}
use of org.apache.camel.CamelExecutionException in project camel by apache.
the class SedaNoConsumerTest method testFailIfNoConsumer.
@Test
public void testFailIfNoConsumer() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").to("seda:foo?failIfNoConsumers=true");
}
});
context.start();
try {
template.sendBody("direct:start", "Hello World");
fail("Should throw an exception");
} catch (CamelExecutionException e) {
assertIsInstanceOf(SedaConsumerNotAvailableException.class, e.getCause());
}
}
Aggregations