use of org.apache.camel.impl.engine.DefaultRuntimeEndpointRegistry in project camel-karaf by apache.
the class ContextListCommandTest method testEndpointStats.
@Test
public void testEndpointStats() throws Exception {
CamelContext context = new DefaultCamelContext();
context.setRuntimeEndpointRegistry(new DefaultRuntimeEndpointRegistry());
context.setNameStrategy(new ExplicitCamelContextNameStrategy("foobar"));
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").to("mock:result");
}
});
context.start();
context.createProducerTemplate().sendBody("direct:start", "Hello World");
CamelController controller = new DummyCamelController(context);
OutputStream os = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(os);
EndpointStatisticCommand command = new EndpointStatisticCommand("foobar", false, null);
command.execute(controller, ps, null);
String out = os.toString();
assertNotNull(out);
LOG.info("\n\n{}\n", out);
assertTrue(out.contains("direct://start"));
assertTrue(out.contains("mock://result"));
context.stop();
}
Aggregations