use of org.apache.cxf.phase.PhaseManager in project cxf by apache.
the class ColocOutInterceptorTest method testInvokeInboundChain.
@Test
public void testInvokeInboundChain() {
// Reset Exchange on msg
msg.setExchange(null);
Bus bus = setupBus();
colocOut.setBus(bus);
PhaseManager pm = new PhaseManagerImpl();
EasyMock.expect(bus.getExtension(PhaseManager.class)).andReturn(pm).times(2);
Endpoint ep = control.createMock(Endpoint.class);
Binding bd = control.createMock(Binding.class);
Service srv = control.createMock(Service.class);
ex.setInMessage(msg);
ex.put(Bus.class, bus);
ex.put(Endpoint.class, ep);
ex.put(Service.class, srv);
EasyMock.expect(ep.getBinding()).andReturn(bd);
EasyMock.expect(bd.createMessage()).andReturn(new MessageImpl());
EasyMock.expect(ep.getInInterceptors()).andReturn(new ArrayList<Interceptor<? extends Message>>()).atLeastOnce();
EasyMock.expect(ep.getService()).andReturn(srv).atLeastOnce();
EasyMock.expect(srv.getInInterceptors()).andReturn(new ArrayList<Interceptor<? extends Message>>()).atLeastOnce();
EasyMock.expect(bus.getInInterceptors()).andReturn(new ArrayList<Interceptor<? extends Message>>()).atLeastOnce();
control.replay();
colocOut.invokeInboundChain(ex, ep);
Message inMsg = ex.getInMessage();
assertNotSame(msg, inMsg);
assertTrue("Requestor role should be set to true.", (Boolean) inMsg.get(Message.REQUESTOR_ROLE));
assertTrue("Inbound Message should be set to true.", (Boolean) inMsg.get(Message.INBOUND_MESSAGE));
assertNotNull("Inbound Message should have interceptor chain set.", inMsg.getInterceptorChain());
assertTrue("Client Invoke state should be FINISHED", (Boolean) ex.get(ClientImpl.FINISHED));
control.verify();
}
Aggregations