Search in sources :

Example 41 with RMManager

use of org.apache.cxf.ws.rm.RMManager 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)

Example 42 with RMManager

use of org.apache.cxf.ws.rm.RMManager in project cxf by apache.

the class ServiceInvocationAckBase method testRobustInvocationHandling.

@Test
public void testRobustInvocationHandling() throws Exception {
    setupGreeter();
    control.setRobustInOnlyMode(true);
    FaultLocation location = new org.apache.cxf.greeter_control.types.ObjectFactory().createFaultLocation();
    location.setPhase(Phase.INVOKE);
    location.setBefore(ServiceInvokerInterceptor.class.getName());
    RMManager manager = greeterBus.getExtension(RMManager.class);
    // the message is acked and the invocation takes place
    greeter.greetMeOneWay("one");
    waitForEmpty(manager.getRetransmissionQueue());
    control.setFaultLocation(location);
    // the invocation fails but the message is acked because the delivery succeeds
    greeter.greetMeOneWay("two");
    waitForNotEmpty(manager.getRetransmissionQueue());
    location.setPhase(null);
    control.setFaultLocation(location);
    // the retransmission succeeds and the invocation succeeds, the message is acked
    waitForEmpty(manager.getRetransmissionQueue());
}
Also used : RMManager(org.apache.cxf.ws.rm.RMManager) FaultLocation(org.apache.cxf.greeter_control.types.FaultLocation) ServiceInvokerInterceptor(org.apache.cxf.interceptor.ServiceInvokerInterceptor) Test(org.junit.Test)

Example 43 with RMManager

use of org.apache.cxf.ws.rm.RMManager in project cxf by apache.

the class ServiceInvocationAckBase method testDefaultInvocationHandling.

@Test
public void testDefaultInvocationHandling() throws Exception {
    setupGreeter();
    control.setRobustInOnlyMode(false);
    FaultLocation location = new org.apache.cxf.greeter_control.types.ObjectFactory().createFaultLocation();
    location.setPhase(Phase.INVOKE);
    location.setBefore(ServiceInvokerInterceptor.class.getName());
    RMManager manager = greeterBus.getExtension(RMManager.class);
    // the message is acked and the invocation takes place
    greeter.greetMeOneWay("one");
    waitForEmpty(manager.getRetransmissionQueue());
    control.setFaultLocation(location);
    // the invocation fails but the message is acked because the delivery succeeds
    greeter.greetMeOneWay("two");
    waitForEmpty(manager.getRetransmissionQueue());
}
Also used : RMManager(org.apache.cxf.ws.rm.RMManager) FaultLocation(org.apache.cxf.greeter_control.types.FaultLocation) ServiceInvokerInterceptor(org.apache.cxf.interceptor.ServiceInvokerInterceptor) Test(org.junit.Test)

Aggregations

RMManager (org.apache.cxf.ws.rm.RMManager)43 Test (org.junit.Test)26 Endpoint (javax.xml.ws.Endpoint)12 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)12 GreeterService (org.apache.cxf.greeter_control.GreeterService)10 Greeter (org.apache.cxf.greeter_control.Greeter)9 MessageFlow (org.apache.cxf.systest.ws.util.MessageFlow)8 Bus (org.apache.cxf.Bus)7 Client (org.apache.cxf.endpoint.Client)4 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)4 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)4 MBeanServer (javax.management.MBeanServer)3 ObjectName (javax.management.ObjectName)3 WebServiceException (javax.xml.ws.WebServiceException)3 InstrumentationManager (org.apache.cxf.management.InstrumentationManager)3 Message (org.apache.cxf.message.Message)3 RMProperties (org.apache.cxf.ws.rm.RMProperties)3 RMMessage (org.apache.cxf.ws.rm.persistence.RMMessage)3 SQLException (java.sql.SQLException)2 SoapFault (org.apache.cxf.binding.soap.SoapFault)2