return new ClassPathXmlApplicationContext("META-INF/spring/wireTap-stateNoLeaks-context.xml");
}
@Test
public void testOutMessageUnaffectedByTappedRoute() throws InterruptedException {
final Cheese cheese = new Cheese();
cheese.setAge(1);
// should receive same object that was sent
out.expectedBodiesReceived(cheese);
out.setExpectedMessageCount(1);
// since copy was sent to wire tap, age should remain unchanged
out.message(0).body().isEqualTo(cheese);
out.message(0).expression(simple("${body.age} == 1"));
tapped.setExpectedMessageCount(1);
tapped.message(0).expression(simple("${body.age} == 2"));
tapped.setResultWaitTime(1000);
template.sendBody(cheese);
assertMockEndpointsSatisfied();
final Cheese outCheese = out.getReceivedExchanges().get(0).getIn().getBody(Cheese.class);
final Cheese tappedCheese = tapped.getReceivedExchanges().get(0).getIn().getBody(Cheese.class);
LOG.info("cheese = {}; out = {}; tapped = {}", cheese, outCheese, tappedCheese);
LOG.info("cheese == out = {}", (cheese == outCheese));
LOG.info("cheese == tapped = {}", (cheese == tappedCheese));