use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class DirectNoMultipleConsumersTest method testNoMultipleConsumersTest.
public void testNoMultipleConsumersTest() throws Exception {
CamelContext container = new DefaultCamelContext();
container.disableJMX();
container.addRoutes(new RouteBuilder() {
public void configure() throws Exception {
from("direct:in").to("mock:result");
from("direct:in").to("mock:result");
}
});
try {
container.start();
fail("Should have thrown an FailedToStartRouteException");
} catch (FailedToStartRouteException e) {
// expected
} finally {
container.stop();
}
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class TwoCamelContextDirectEndpointTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
camel1 = new DefaultCamelContext();
camel1.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").to("direct:foo");
from("direct:foo").to("mock:a");
}
});
camel1.start();
camel2 = new DefaultCamelContext();
camel2.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").to("direct:foo");
from("direct:foo").to("mock:b");
}
});
camel2.start();
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class AbstractDirectVmTestSupport method setUp.
@Override
@Before
protected void setUp() throws Exception {
super.setUp();
doPostSetup();
context2 = new DefaultCamelContext();
template2 = context2.createProducerTemplate();
ServiceHelper.startServices(template2, context2);
// add routes after CamelContext has been started
RouteBuilder routeBuilder = createRouteBuilderForSecondContext();
if (routeBuilder != null) {
context2.addRoutes(routeBuilder);
}
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class AbstractVmTestSupport method setUp.
@Override
@Before
protected void setUp() throws Exception {
super.setUp();
context2 = new DefaultCamelContext();
template2 = context2.createProducerTemplate();
ServiceHelper.startServices(template2, context2);
// add routes after CamelContext has been started
RouteBuilder routeBuilder = createRouteBuilderForSecondContext();
if (routeBuilder != null) {
context2.addRoutes(routeBuilder);
}
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class InvalidXsltFileTest method testInvalidStylesheet.
public void testInvalidStylesheet() throws Exception {
try {
RouteBuilder builder = createRouteBuilder();
CamelContext context = new DefaultCamelContext();
context.addRoutes(builder);
context.start();
fail("Should have thrown an exception due XSL compilation error");
} catch (FailedToCreateRouteException e) {
// expected
assertIsInstanceOf(TransformerConfigurationException.class, e.getCause());
}
}
Aggregations