use of org.apache.camel.management.event.ExchangeSendingEvent in project camel by apache.
the class EventNotifierExchangeSentTest method testExchangeWireTap.
public void testExchangeWireTap() throws Exception {
getMockEndpoint("mock:result").expectedMessageCount(1);
template.sendBody("direct:tap", "Hello World");
assertMockEndpointsSatisfied();
// give it time to complete
Thread.sleep(200);
assertEquals(6, events.size());
// we should find log:foo which we tapped
// which runs async so they can be in random order
boolean found = false;
boolean found2 = false;
for (EventObject event : events) {
if (event instanceof ExchangeSendingEvent) {
ExchangeSendingEvent sending = (ExchangeSendingEvent) event;
String uri = sending.getEndpoint().getEndpointUri();
if ("log://foo".equals(uri)) {
found = true;
}
} else if (event instanceof ExchangeSentEvent) {
ExchangeSentEvent sent = (ExchangeSentEvent) event;
String uri = sent.getEndpoint().getEndpointUri();
if ("log://foo".equals(uri)) {
found2 = true;
}
}
}
assertTrue("We should find log:foo being wire tapped", found);
assertTrue("We should find log:foo being wire tapped", found2);
}
Aggregations