Search in sources :

Example 21 with MessageFlow

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

the class AbstractServerPersistenceTest method verifyMissingResponse.

void verifyMissingResponse(Response<GreetMeResponse>[] responses) throws Exception {
    awaitMessages(5, 3, 25000);
    int nDone = 0;
    for (int i = 0; i < 3; i++) {
        if (responses[i].isDone()) {
            nDone++;
        }
    }
    assertEquals("Unexpected number of responses already received.", 2, nDone);
    MessageFlow mf = new MessageFlow(out.getOutboundMessages(), in.getInboundMessages(), Names200408.WSA_NAMESPACE_NAME, RM10Constants.NAMESPACE_URI);
    String[] expectedActions = new String[] { RM10Constants.CREATE_SEQUENCE_ACTION, GREETME_ACTION, GREETME_ACTION, GREETME_ACTION, RM10Constants.SEQUENCE_ACKNOWLEDGMENT_ACTION };
    mf.verifyActions(expectedActions, true);
    // mf.verifyMessageNumbers(new String[] {null, "1", "2", "3"}, true);
    // mf.verifyAcknowledgements(new boolean[] {false, false, true, false}, true);
    // mf.verifyPartialResponses(5);
    // mf.purgePartialResponses();
    expectedActions = new String[] { RM10Constants.CREATE_SEQUENCE_RESPONSE_ACTION, GREETME_RESPONSE_ACTION, GREETME_RESPONSE_ACTION };
    mf.verifyActions(expectedActions, false);
// mf.verifyMessageNumbers(new String[] {null, "1", "3"}, false);
// mf.verifyAcknowledgements(new boolean[] {false, true, true}, false);
}
Also used : MessageFlow(org.apache.cxf.systest.ws.util.MessageFlow) Endpoint(javax.xml.ws.Endpoint)

Example 22 with MessageFlow

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

the class AbstractServerPersistenceTest method verifyServerRecovery.

void verifyServerRecovery(Response<GreetMeResponse>[] responses) throws Exception {
    // wait until all messages have received their responses
    int nDone = 0;
    long waited = 0;
    while (waited < 30) {
        nDone = 0;
        for (int i = 0; i < responses.length - 1; i++) {
            if (responses[i].isDone()) {
                nDone++;
            }
        }
        if (nDone == 3) {
            break;
        }
        Thread.sleep(500);
        waited++;
    }
    assertEquals("Not all responses have been received.", 3, nDone);
    synchronized (this) {
        MessageFlow mf = new MessageFlow(out.getOutboundMessages(), in.getInboundMessages(), Names200408.WSA_NAMESPACE_NAME, RM10Constants.NAMESPACE_URI);
        int nOut = out.getOutboundMessages().size();
        int nIn = in.getInboundMessages().size();
        assertEquals("Unexpected outbound message(s)", 0, nOut);
        assertTrue(nIn >= 1);
        String[] expectedActions = new String[nIn];
        for (int i = 0; i < nIn; i++) {
            expectedActions[i] = GREETME_RESPONSE_ACTION;
        }
        mf.verifyActions(expectedActions, false);
    }
}
Also used : MessageFlow(org.apache.cxf.systest.ws.util.MessageFlow) Endpoint(javax.xml.ws.Endpoint)

Example 23 with MessageFlow

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

the class AbstractServerPersistenceTest method verifyAcknowledgementRange.

void verifyAcknowledgementRange(long lower, long higher) throws Exception {
    MessageFlow mf = new MessageFlow(out.getOutboundMessages(), in.getInboundMessages(), Names200408.WSA_NAMESPACE_NAME, RM10Constants.NAMESPACE_URI);
    mf.verifyAcknowledgementRange(lower, higher);
}
Also used : MessageFlow(org.apache.cxf.systest.ws.util.MessageFlow)

Example 24 with MessageFlow

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

the class ProtocolVariationsTest method verifyTerminateSequence.

private void verifyTerminateSequence(String wsaUri, RMConstants consts) throws Exception {
    MessageFlow mf = new MessageFlow(outRecorder.getOutboundMessages(), inRecorder.getInboundMessages(), wsaUri, consts.getWSRMNamespace());
    if (RM11Constants.NAMESPACE_URI.equals(consts.getWSRMNamespace())) {
        awaitMessages(4, 4);
        mf.verifyMessages(4, true);
        String[] expectedActions = new String[] { consts.getCreateSequenceAction(), GREETME_ONEWAY_ACTION, consts.getCloseSequenceAction(), consts.getTerminateSequenceAction() };
        mf.verifyActions(expectedActions, true);
        mf.verifyMessageNumbers(new String[] { null, "1", null, null }, true);
        // no LastMessage
        mf.verifyLastMessage(new boolean[] { false, false, false, false }, true);
        // CrSR, ACK, ClSR, TSR
        mf.verifyMessages(4, false);
        expectedActions = new String[] { consts.getCreateSequenceResponseAction(), consts.getSequenceAckAction(), RM11Constants.INSTANCE.getCloseSequenceResponseAction(), RM11Constants.INSTANCE.getTerminateSequenceResponseAction() };
        mf.verifyActions(expectedActions, false);
        mf.verifyAcknowledgements(new boolean[] { false, true, false, false }, false);
    } else {
        awaitMessages(3, 2);
        mf.verifyMessages(3, true);
        String[] expectedActions = new String[] { consts.getCreateSequenceAction(), GREETME_ONEWAY_ACTION, consts.getTerminateSequenceAction() };
        mf.verifyActions(expectedActions, true);
        mf.verifyMessageNumbers(new String[] { null, "1", null }, true);
        // uses LastMessage
        mf.verifyLastMessage(new boolean[] { false, true, false }, true);
        // CrSR, ACK, PR
        mf.verifyMessages(2, false);
        expectedActions = new String[] { consts.getCreateSequenceResponseAction(), consts.getSequenceAckAction() };
        mf.verifyActions(expectedActions, false);
        mf.verifyAcknowledgements(new boolean[] { false, true }, false);
    }
}
Also used : MessageFlow(org.apache.cxf.systest.ws.util.MessageFlow)

Example 25 with MessageFlow

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

the class ProtocolVariationsTest method verifyTwowayNonAnonymous.

private void verifyTwowayNonAnonymous(String wsaUri, RMConstants consts) throws Exception {
    // CreateSequence and three greetMe messages
    awaitMessages(4, 4);
    MessageFlow mf = new MessageFlow(outRecorder.getOutboundMessages(), inRecorder.getInboundMessages(), wsaUri, consts.getWSRMNamespace());
    mf.verifyMessages(4, true);
    String[] expectedActions = new String[] { consts.getCreateSequenceAction(), GREETME_ACTION, GREETME_ACTION, GREETME_ACTION };
    mf.verifyActions(expectedActions, true);
    mf.verifyMessageNumbers(new String[] { null, "1", "2", "3" }, true);
    mf.verifyLastMessage(new boolean[] { false, false, false, false }, true);
    mf.verifyAcknowledgements(new boolean[] { false, false, true, true }, true);
    // createSequenceResponse plus 3 greetMeResponse messages
    // the first response should not include an acknowledgement, the other three should
    mf.verifyMessages(4, false);
    expectedActions = new String[] { consts.getCreateSequenceResponseAction(), GREETME_RESPONSE_ACTION, GREETME_RESPONSE_ACTION, GREETME_RESPONSE_ACTION };
    mf.verifyActions(expectedActions, false);
    mf.verifyMessageNumbers(new String[] { null, "1", "2", "3" }, false);
    mf.verifyLastMessage(new boolean[4], false);
    mf.verifyAcknowledgements(new boolean[] { false, true, true, true }, false);
}
Also used : MessageFlow(org.apache.cxf.systest.ws.util.MessageFlow)

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