use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class SedaQueueFactoryTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
SimpleRegistry simpleRegistry = new SimpleRegistry();
simpleRegistry.put("arrayQueueFactory", arrayQueueFactory);
return new DefaultCamelContext(simpleRegistry);
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class StopRouteFromRouteTest method testStopRouteFromRoute.
// START SNIPPET: e1
public void testStopRouteFromRoute() throws Exception {
// create camel, add routes, and start camel
CamelContext context = new DefaultCamelContext();
context.addRoutes(createMyRoutes());
context.start();
assertTrue("Route myRoute should be started", context.getRouteStatus("myRoute").isStarted());
assertTrue("Route bar should be started", context.getRouteStatus("bar").isStarted());
// setup mock expectations for unit test
MockEndpoint start = context.getEndpoint("mock:start", MockEndpoint.class);
start.expectedMessageCount(1);
MockEndpoint done = context.getEndpoint("mock:done", MockEndpoint.class);
done.expectedMessageCount(1);
// send a message to the route
ProducerTemplate template = context.createProducerTemplate();
template.sendBody("direct:start", "Hello Camel");
// just wait a bit for the thread to stop the route
Thread.sleep(1500);
// the route should now be stopped
assertTrue("Route myRoute should be stopped", context.getRouteStatus("myRoute").isStopped());
assertTrue("Route bar should be started", context.getRouteStatus("bar").isStarted());
// stop camel
context.stop();
// unit test assertions
start.assertIsSatisfied();
done.assertIsSatisfied();
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class ManagedFromRestGetTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
SimpleRegistry registry = new SimpleRegistry();
registry.put("dummy-test", new DummyRestConsumerFactory());
return new DefaultCamelContext(registry);
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class ManagedRefProducerTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext context = new DefaultCamelContext((Registry) registry);
registry.put("foo", new MockEndpoint("mock://foo"));
return context;
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class ManagedDualCamelContextTest method createCamelContext.
protected CamelContext createCamelContext() throws Exception {
CamelContext context = new DefaultCamelContext();
context.addRoutes(createRouteBuilder());
return context;
}
Aggregations