Search in sources :

Example 6 with Phase

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));
}
Also used : Phase(org.apache.cxf.phase.Phase)

Example 7 with Phase

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));
}
Also used : Phase(org.apache.cxf.phase.Phase)

Example 8 with Phase

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();
}
Also used : Binding(org.apache.cxf.binding.Binding) OperationInfo(org.apache.cxf.service.model.OperationInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) Bus(org.apache.cxf.Bus) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) Phase(org.apache.cxf.phase.Phase) PhaseManager(org.apache.cxf.phase.PhaseManager) Service(org.apache.cxf.service.Service) MessageInfo(org.apache.cxf.service.model.MessageInfo) BindingMessageInfo(org.apache.cxf.service.model.BindingMessageInfo) BindingMessageInfo(org.apache.cxf.service.model.BindingMessageInfo) Endpoint(org.apache.cxf.endpoint.Endpoint) PhaseManagerImpl(org.apache.cxf.bus.managers.PhaseManagerImpl) MessageImpl(org.apache.cxf.message.MessageImpl) Before(org.junit.Before)

Example 9 with Phase

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);
}
Also used : Bus(org.apache.cxf.Bus) Phase(org.apache.cxf.phase.Phase) PhaseManager(org.apache.cxf.phase.PhaseManager) PhaseManagerImpl(org.apache.cxf.bus.managers.PhaseManagerImpl) Test(org.junit.Test)

Example 10 with Phase

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;
}
Also used : Bus(org.apache.cxf.Bus) PhaseInterceptorChain(org.apache.cxf.phase.PhaseInterceptorChain) Phase(org.apache.cxf.phase.Phase) PhaseManager(org.apache.cxf.phase.PhaseManager) Message(org.apache.cxf.message.Message) SoapMessage(org.apache.cxf.binding.soap.SoapMessage) InterceptorProvider(org.apache.cxf.interceptor.InterceptorProvider) Exchange(org.apache.cxf.message.Exchange) Endpoint(org.apache.cxf.endpoint.Endpoint) TreeSet(java.util.TreeSet) RMCaptureInInterceptor(org.apache.cxf.ws.rm.RMCaptureInInterceptor) Interceptor(org.apache.cxf.interceptor.Interceptor)

Aggregations

Phase (org.apache.cxf.phase.Phase)21 TreeSet (java.util.TreeSet)10 Message (org.apache.cxf.message.Message)10 Test (org.junit.Test)8 PhaseManagerImpl (org.apache.cxf.bus.managers.PhaseManagerImpl)6 Endpoint (org.apache.cxf.endpoint.Endpoint)6 Interceptor (org.apache.cxf.interceptor.Interceptor)6 Exchange (org.apache.cxf.message.Exchange)6 PhaseInterceptorChain (org.apache.cxf.phase.PhaseInterceptorChain)6 Bus (org.apache.cxf.Bus)5 InterceptorChain (org.apache.cxf.interceptor.InterceptorChain)5 PhaseManager (org.apache.cxf.phase.PhaseManager)5 ArrayList (java.util.ArrayList)4 ExchangeImpl (org.apache.cxf.message.ExchangeImpl)4 Before (org.junit.Before)4 SoapMessage (org.apache.cxf.binding.soap.SoapMessage)3 Service (org.apache.cxf.service.Service)3 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)3 MustUnderstandInterceptor (org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor)2 SAAJInInterceptor (org.apache.cxf.binding.soap.saaj.SAAJInInterceptor)2