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