use of org.apache.cxf.phase.Phase in project cxf by apache.
the class PhaseManagerImpl method createOutPhases.
final void createOutPhases() {
outPhases = new SortedArraySet<>();
int i = 0;
outPhases.add(new Phase(Phase.SETUP, ++i * 1000));
outPhases.add(new Phase(Phase.PRE_LOGICAL, ++i * 1000));
outPhases.add(new Phase(Phase.USER_LOGICAL, ++i * 1000));
outPhases.add(new Phase(Phase.POST_LOGICAL, ++i * 1000));
outPhases.add(new Phase(Phase.PREPARE_SEND, ++i * 1000));
outPhases.add(new Phase(Phase.PRE_STREAM, ++i * 1000));
outPhases.add(new Phase(Phase.PRE_PROTOCOL, ++i * 1000));
outPhases.add(new Phase(Phase.PRE_PROTOCOL_FRONTEND, ++i * 1000));
outPhases.add(new Phase(Phase.WRITE, ++i * 1000));
outPhases.add(new Phase(Phase.PRE_MARSHAL, ++i * 1000));
outPhases.add(new Phase(Phase.MARSHAL, ++i * 1000));
outPhases.add(new Phase(Phase.POST_MARSHAL, ++i * 1000));
outPhases.add(new Phase(Phase.USER_PROTOCOL, ++i * 1000));
outPhases.add(new Phase(Phase.PROTOCOL, ++i * 1000));
outPhases.add(new Phase(Phase.POST_PROTOCOL, ++i * 1000));
outPhases.add(new Phase(Phase.USER_STREAM, ++i * 1000));
outPhases.add(new Phase(Phase.POST_STREAM, ++i * 1000));
outPhases.add(new Phase(Phase.SEND, ++i * 1000));
// Make sure ending interceptors are put in positions symmetric
// to their starting interceptors
outPhases.add(new Phase(Phase.SEND_ENDING, ++i * 1000));
outPhases.add(new Phase(Phase.POST_STREAM_ENDING, ++i * 1000));
outPhases.add(new Phase(Phase.USER_STREAM_ENDING, ++i * 1000));
outPhases.add(new Phase(Phase.POST_PROTOCOL_ENDING, ++i * 1000));
outPhases.add(new Phase(Phase.USER_PROTOCOL_ENDING, ++i * 1000));
outPhases.add(new Phase(Phase.MARSHAL_ENDING, ++i * 1000));
outPhases.add(new Phase(Phase.WRITE_ENDING, ++i * 1000));
outPhases.add(new Phase(Phase.PRE_PROTOCOL_ENDING, ++i * 1000));
outPhases.add(new Phase(Phase.PRE_STREAM_ENDING, ++i * 1000));
outPhases.add(new Phase(Phase.PREPARE_SEND_ENDING, ++i * 1000));
outPhases.add(new Phase(Phase.POST_LOGICAL_ENDING, ++i * 1000));
outPhases.add(new Phase(Phase.USER_LOGICAL_ENDING, ++i * 1000));
outPhases.add(new Phase(Phase.PRE_LOGICAL_ENDING, ++i * 1000));
outPhases.add(new Phase(Phase.SETUP_ENDING, ++i * 1000));
}
use of org.apache.cxf.phase.Phase in project cxf by apache.
the class PhaseManagerImpl method createInPhases.
final void createInPhases() {
int i = 0;
inPhases = new SortedArraySet<>();
inPhases.add(new Phase(Phase.RECEIVE, ++i * 1000));
inPhases.add(new Phase(Phase.PRE_STREAM, ++i * 1000));
inPhases.add(new Phase(Phase.USER_STREAM, ++i * 1000));
inPhases.add(new Phase(Phase.POST_STREAM, ++i * 1000));
inPhases.add(new Phase(Phase.READ, ++i * 1000));
inPhases.add(new Phase(Phase.PRE_PROTOCOL, ++i * 1000));
inPhases.add(new Phase(Phase.PRE_PROTOCOL_FRONTEND, ++i * 1000));
inPhases.add(new Phase(Phase.USER_PROTOCOL, ++i * 1000));
inPhases.add(new Phase(Phase.PROTOCOL, ++i * 1000));
inPhases.add(new Phase(Phase.POST_PROTOCOL, ++i * 1000));
inPhases.add(new Phase(Phase.PRE_UNMARSHAL, ++i * 1000));
inPhases.add(new Phase(Phase.UNMARSHAL, ++i * 1000));
inPhases.add(new Phase(Phase.POST_UNMARSHAL, ++i * 1000));
inPhases.add(new Phase(Phase.PRE_LOGICAL, ++i * 1000));
inPhases.add(new Phase(Phase.USER_LOGICAL, ++i * 1000));
inPhases.add(new Phase(Phase.POST_LOGICAL, ++i * 1000));
inPhases.add(new Phase(Phase.PRE_INVOKE, ++i * 1000));
inPhases.add(new Phase(Phase.INVOKE, ++i * 1000));
inPhases.add(new Phase(Phase.POST_INVOKE, ++i * 1000));
}
use of org.apache.cxf.phase.Phase in project cxf by apache.
the class OutgoingChainInterceptorTest method setUp.
@Before
public void setUp() throws Exception {
control = EasyMock.createNiceControl();
phases = new ArrayList<>();
phases.add(new Phase(Phase.SEND, 1000));
empty = new ArrayList<>();
bus = control.createMock(Bus.class);
PhaseManager pm = new PhaseManagerImpl();
EasyMock.expect(bus.getExtension(PhaseManager.class)).andReturn(pm).anyTimes();
service = control.createMock(Service.class);
endpoint = control.createMock(Endpoint.class);
binding = control.createMock(Binding.class);
EasyMock.expect(endpoint.getBinding()).andStubReturn(binding);
MessageImpl m = new MessageImpl();
EasyMock.expect(binding.createMessage()).andStubReturn(m);
EasyMock.expect(endpoint.getService()).andReturn(service).anyTimes();
EasyMock.expect(endpoint.getOutInterceptors()).andReturn(empty);
EasyMock.expect(service.getOutInterceptors()).andReturn(empty);
EasyMock.expect(bus.getOutInterceptors()).andReturn(empty);
bopInfo = control.createMock(BindingOperationInfo.class);
opInfo = control.createMock(OperationInfo.class);
mInfo = control.createMock(MessageInfo.class);
bmInfo = control.createMock(BindingMessageInfo.class);
EasyMock.expect(bopInfo.getOperationInfo()).andReturn(opInfo).times(3);
EasyMock.expect(opInfo.getOutput()).andReturn(mInfo);
EasyMock.expect(opInfo.isOneWay()).andReturn(false);
EasyMock.expect(bopInfo.getOutput()).andReturn(bmInfo);
control.replay();
}
use of org.apache.cxf.phase.Phase in project cxf by apache.
the class SpringBusFactoryTest method testPhases.
@Test
public void testPhases() {
Bus bus = new SpringBusFactory().createBus();
PhaseManager cxfPM = bus.getExtension(PhaseManager.class);
PhaseManager defaultPM = new PhaseManagerImpl();
SortedSet<Phase> cxfPhases = cxfPM.getInPhases();
SortedSet<Phase> defaultPhases = defaultPM.getInPhases();
assertEquals(defaultPhases.size(), cxfPhases.size());
assertEquals(cxfPhases, defaultPhases);
cxfPhases = cxfPM.getOutPhases();
defaultPhases = defaultPM.getOutPhases();
assertEquals(defaultPhases.size(), cxfPhases.size());
assertEquals(cxfPhases, defaultPhases);
}
use of org.apache.cxf.phase.Phase in project cxf by apache.
the class RedeliveryQueueImpl method getRedeliveryInterceptorChain.
private static InterceptorChain getRedeliveryInterceptorChain(Message m, String phase) {
Exchange exchange = m.getExchange();
Endpoint ep = exchange.getEndpoint();
Bus bus = exchange.getBus();
PhaseManager pm = bus.getExtension(PhaseManager.class);
SortedSet<Phase> phases = new TreeSet<>(pm.getInPhases());
for (Iterator<Phase> it = phases.iterator(); it.hasNext(); ) {
Phase p = it.next();
if (phase.equals(p.getName())) {
break;
}
it.remove();
}
PhaseInterceptorChain chain = new PhaseInterceptorChain(phases);
List<Interceptor<? extends Message>> il = ep.getInInterceptors();
addInterceptors(chain, il);
il = ep.getService().getInInterceptors();
addInterceptors(chain, il);
il = ep.getBinding().getInInterceptors();
addInterceptors(chain, il);
il = bus.getInInterceptors();
addInterceptors(chain, il);
if (ep.getService().getDataBinding() instanceof InterceptorProvider) {
il = ((InterceptorProvider) ep.getService().getDataBinding()).getInInterceptors();
addInterceptors(chain, il);
}
return chain;
}
Aggregations