public void testThatShowsEndpointResolutionIsNotConsistent() throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
CamelContext context = new DefaultCamelContext();
// lets add some routes
context.addRoutes(new RouteBuilder() {
public void configure() {
from("seda:test.a").to("seda:test.b");
from("seda:test.b").process(new Processor() {
public void process(Exchange e) {
log.debug("Received exchange: " + e.getIn());
latch.countDown();
}
});
}
});
context.start();
// now lets fire in a message
Endpoint<Exchange> endpoint = context.getEndpoint("seda:test.a");
Exchange exchange = endpoint.createExchange();
exchange.getIn().setHeader("cheese", 123);
Producer<Exchange> producer = endpoint.createProducer();
producer.process(exchange);
// now lets sleep for a while
boolean received = latch.await(5, TimeUnit.SECONDS);
assertTrue("Did not receive the message!", received);
context.stop();
}