/**
* Tests basic wiring of a source to a target, including handlers and interceptors
*/
public void testInvokeWithInterceptors() throws Exception {
OutboundInvocationChain source = new OutboundInvocationChainImpl(operation);
MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
source.addInterceptor(sourceInterceptor);
InboundInvocationChain target = new InboundInvocationChainImpl(operation);
MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
target.addInterceptor(targetInterceptor);
target.addInterceptor(new InvokerInterceptor());
// connect the source to the target
source.setTargetInterceptor(target.getHeadInterceptor());
source.prepare();
target.prepare();
MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
source.setTargetInvoker(invoker);
Message msg = new MessageImpl();
msg.setBody("foo");
msg.setTargetInvoker(invoker);
Message response = source.getHeadInterceptor().invoke(msg);
assertEquals("foo", response.getBody());
assertEquals(1, sourceInterceptor.getCount());
assertEquals(1, targetInterceptor.getCount());
}