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);
}
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);
}
}
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);
}
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);
}
}
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);
}
Aggregations