/**
* Tests basic wiring of a source to a target, including handlers and interceptors
*/
public void testInvokeWithInterceptors() throws Exception {
Operation operation = contract.getOperations().get("hello");
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.setTargetInvoker(invoker);
Message response = source.getHeadInterceptor().invoke(msg);
assertTrue(response.isFault());
assertTrue(response.getBody() instanceof IllegalArgumentException);
assertEquals(1, sourceInterceptor.getCount());
assertEquals(1, targetInterceptor.getCount());