EasyMock.expect(targetChain.getHeadInterceptor()).andReturn(headInterceptor);
targetChain.prepare();
EasyMock.replay(targetChain);
Map<Operation<?>, InboundInvocationChain> targetChains = new HashMap<Operation<?>, InboundInvocationChain>();
targetChains.put(operation, targetChain);
InboundWire targetWire = EasyMock.createMock(InboundWire.class);
EasyMock.expect(targetWire.getServiceContract()).andReturn(contract).anyTimes();
EasyMock.expect(targetWire.getInvocationChains()).andReturn(targetChains);
targetWire.getSourceCallbackInvocationChains("source");
EasyMock.expectLastCall().andReturn(Collections.emptyMap());
// create the target
AtomicComponent target = EasyMock.createMock(AtomicComponent.class);
EasyMock.expect(target.getScope()).andReturn(Scope.MODULE);
EasyMock.expect(target.isSystem()).andReturn(false).atLeastOnce();
target.getInboundWire(EasyMock.eq("FooService"));
EasyMock.expectLastCall().andReturn(targetWire).atLeastOnce();
target.createTargetInvoker(EasyMock.eq("FooService"), EasyMock.eq(operation));
EasyMock.expectLastCall().andReturn(null);
EasyMock.replay(target);
EasyMock.expect(targetWire.getContainer()).andReturn(target);
EasyMock.replay(targetWire);
// create the parent composite
CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
EasyMock.expect(parent.getChild("target")).andReturn(target);
EasyMock.replay(parent);
// create the inbound wire and chain for the source service
InboundInvocationChain inboundChain = EasyMock.createMock(InboundInvocationChain.class);
EasyMock.expect(inboundChain.getOperation()).andReturn(operation).atLeastOnce();
inboundChain.addInterceptor(EasyMock.isA(SynchronousBridgingInterceptor.class));
inboundChain.setTargetInvoker(null);
EasyMock.replay(inboundChain);
Map<Operation<?>, InboundInvocationChain> inboundChains = new HashMap<Operation<?>, InboundInvocationChain>();
inboundChains.put(operation, inboundChain);
InboundWire inboundWire = EasyMock.createMock(InboundWire.class);
EasyMock.expect(inboundWire.getServiceContract()).andReturn(contract).anyTimes();
EasyMock.expect(inboundWire.getInvocationChains()).andReturn(inboundChains).atLeastOnce();
EasyMock.replay(inboundWire);
// create the outbound wire and chain for the source service
OutboundInvocationChain outboundChain = EasyMock.createMock(OutboundInvocationChain.class);
EasyMock.expect(outboundChain.getHeadInterceptor()).andReturn(headInterceptor);