Search in sources :

Example 1 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<Phase>();
    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 2 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<Phase>();
    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 3 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());
    assertTrue(cxfPhases.equals(defaultPhases));
    cxfPhases = cxfPM.getOutPhases();
    defaultPhases = defaultPM.getOutPhases();
    assertEquals(defaultPhases.size(), cxfPhases.size());
    assertTrue(cxfPhases.equals(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 4 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<Interceptor<? extends Message>>();
    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) Message(org.apache.cxf.message.Message) 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 5 with Phase

use of org.apache.cxf.phase.Phase in project cxf by apache.

the class TestBase method setUp.

@Before
public void setUp() throws Exception {
    SortedSet<Phase> phases = new TreeSet<Phase>();
    Phase phase1 = new Phase("phase1", 1);
    Phase phase2 = new Phase("phase2", 2);
    Phase phase3 = new Phase("phase3", 3);
    Phase phase4 = new Phase(Phase.WRITE_ENDING, 4);
    phases.add(phase1);
    phases.add(phase2);
    phases.add(phase3);
    phases.add(phase4);
    phases.add(new Phase(Phase.POST_LOGICAL, 5));
    phases.add(new Phase(Phase.INVOKE, 6));
    chain = new PhaseInterceptorChain(phases);
    soapMessage = TestUtil.createEmptySoapMessage(Soap11.getInstance(), chain);
}
Also used : PhaseInterceptorChain(org.apache.cxf.phase.PhaseInterceptorChain) Phase(org.apache.cxf.phase.Phase) TreeSet(java.util.TreeSet) Before(org.junit.Before)

Aggregations

Phase (org.apache.cxf.phase.Phase)21 Message (org.apache.cxf.message.Message)11 TreeSet (java.util.TreeSet)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