Search in sources :

Example 36 with MessageFlow

use of org.apache.cxf.systest.ws.util.MessageFlow in project cxf by apache.

the class SequenceTest method testTwowayNonAnonymousMaximumSequenceLength2.

// A maximum sequence length of 2 is configured for the client only (server allows 10).
// However, as we use the defaults regarding the including and acceptance
// for inbound sequence offers and correlate offered sequences that are
// included in a CreateSequence request and accepted with those that are
// created on behalf of such a request, the server also tries terminate its
// sequences.
@Test
public void testTwowayNonAnonymousMaximumSequenceLength2() throws Exception {
    init("org/apache/cxf/systest/ws/rm/seqlength10.xml", true);
    RMManager manager = greeterBus.getExtension(RMManager.class);
    assertEquals("Unexpected maximum sequence length.", 10, manager.getSourcePolicy().getSequenceTerminationPolicy().getMaxLength());
    manager.getSourcePolicy().getSequenceTerminationPolicy().setMaxLength(2);
    greeter.greetMe("one");
    greeter.greetMe("two");
    greeter.greetMe("three");
    awaitMessages(7, 6, 5000);
    MessageFlow mf = new MessageFlow(outRecorder.getOutboundMessages(), inRecorder.getInboundMessages(), Names200408.WSA_NAMESPACE_NAME, RM10Constants.NAMESPACE_URI);
    mf.verifyMessages(7, true);
    String[] expectedActions = new String[] { RM10Constants.CREATE_SEQUENCE_ACTION, GREETME_ACTION, GREETME_ACTION, RM10Constants.TERMINATE_SEQUENCE_ACTION, RM10Constants.SEQUENCE_ACKNOWLEDGMENT_ACTION, RM10Constants.CREATE_SEQUENCE_ACTION, GREETME_ACTION };
    mf.verifyActions(expectedActions, true);
    mf.verifyMessageNumbers(new String[] { null, "1", "2", null, null, null, "1" }, true);
    mf.verifyLastMessage(new boolean[] { false, false, true, false, false, false, false }, true);
    mf.verifyAcknowledgements(new boolean[] { false, false, true, false, true, false, false }, true);
    // 7 partial responses plus 2 full responses to CreateSequence requests
    // plus 3 full responses to greetMe requests plus server originiated
    // TerminateSequence request
    mf.verifyMessages(6, false);
    expectedActions = new String[] { RM10Constants.CREATE_SEQUENCE_RESPONSE_ACTION, GREETME_RESPONSE_ACTION, GREETME_RESPONSE_ACTION, RM10Constants.TERMINATE_SEQUENCE_ACTION, RM10Constants.CREATE_SEQUENCE_RESPONSE_ACTION, GREETME_RESPONSE_ACTION };
    mf.verifyActions(expectedActions, false);
    mf.verifyMessageNumbers(new String[] { null, "1", "2", null, null, "1" }, false);
    boolean[] expected = new boolean[6];
    expected[2] = true;
    mf.verifyLastMessage(expected, false);
    expected[1] = true;
    expected[5] = true;
    mf.verifyAcknowledgements(expected, false);
}
Also used : RMManager(org.apache.cxf.ws.rm.RMManager) MessageFlow(org.apache.cxf.systest.ws.util.MessageFlow) Test(org.junit.Test)

Aggregations

MessageFlow (org.apache.cxf.systest.ws.util.MessageFlow)36 Test (org.junit.Test)23 RMManager (org.apache.cxf.ws.rm.RMManager)8 Greeter (org.apache.cxf.greeter_control.Greeter)7 Closeable (java.io.Closeable)6 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)5 PingMeFault (org.apache.cxf.greeter_control.PingMeFault)5 InMessageRecorder (org.apache.cxf.testutil.recorders.InMessageRecorder)5 OutMessageRecorder (org.apache.cxf.testutil.recorders.OutMessageRecorder)5 Endpoint (javax.xml.ws.Endpoint)4 WebServiceException (javax.xml.ws.WebServiceException)4 BasicGreeterService (org.apache.cxf.greeter_control.BasicGreeterService)3 Message (org.apache.cxf.message.Message)3 AbstractPhaseInterceptor (org.apache.cxf.phase.AbstractPhaseInterceptor)3 MessageRecorder (org.apache.cxf.testutil.recorders.MessageRecorder)3 RMMessage (org.apache.cxf.ws.rm.persistence.RMMessage)3 Bus (org.apache.cxf.Bus)2 SoapFault (org.apache.cxf.binding.soap.SoapFault)2 RMProperties (org.apache.cxf.ws.rm.RMProperties)2 IOException (java.io.IOException)1