Search in sources :

Example 6 with RMManager

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

the class DeliveryAssuranceOnewayTest method testOnewayExactlyOnce.

private void testOnewayExactlyOnce(Executor executor) throws Exception {
    init("org/apache/cxf/systest/ws/rm/exactlyonce.xml", executor);
    greeterBus.getOutInterceptors().add(new MessageLossSimulator());
    RMManager manager = greeterBus.getExtension(RMManager.class);
    manager.getConfiguration().setBaseRetransmissionInterval(new Long(2000));
    String[] callArgs = new String[] { "one", "two", "three", "four" };
    for (int i = 0; i < callArgs.length; i++) {
        greeter.greetMeOneWay(callArgs[i]);
    }
    awaitMessages(callArgs.length, 1000, 60000);
    List<String> actualArgs = GreeterProvider.CALL_ARGS;
    assertEquals("Wrong message count", callArgs.length, actualArgs.size());
    for (int i = 0; i < callArgs.length; i++) {
        boolean match = false;
        for (int j = 0; j < actualArgs.size(); j++) {
            if (actualArgs.get(j).equals(callArgs[i])) {
                match = true;
                break;
            }
        }
        if (!match) {
            fail("No match for request " + callArgs[i]);
        }
    }
}
Also used : RMManager(org.apache.cxf.ws.rm.RMManager) Endpoint(javax.xml.ws.Endpoint)

Example 7 with RMManager

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

the class ManagedEndpointsTest method testManagedEndpointsOneway12.

@Test
public void testManagedEndpointsOneway12() throws Exception {
    prepareClient();
    RMManager clientManager = clientBus.getExtension(RMManager.class);
    RMManager serverManager = serverBus.getExtension(RMManager.class);
    InstrumentationManager serverIM = serverBus.getExtension(InstrumentationManager.class);
    MBeanServer mbs = serverIM.getMBeanServer();
    assertNotNull("MBeanServer must be available.", mbs);
    ObjectName clientManagerName = RMUtils.getManagedObjectName(clientManager);
    ObjectName serverManagerName = RMUtils.getManagedObjectName(serverManager);
    Object o;
    GreeterService gs = new GreeterService();
    final Greeter greeter = gs.getGreeterPort();
    updateAddressPort(greeter, ManagedEndpointsTest.PORT);
    LOG.fine("Created greeter client.");
    ClientProxy.getClient(greeter).getRequestContext().put(RMManager.WSRM_VERSION_PROPERTY, RM11Constants.NAMESPACE_URI);
    org.apache.cxf.endpoint.Endpoint ep = ClientProxy.getClient(greeter).getEndpoint();
    String epId = RMUtils.getEndpointIdentifier(ep, clientBus);
    // sent
    greeter.greetMeOneWay("one");
    o = mbs.invoke(clientManagerName, "getEndpointIdentifiers", null, null);
    verifyArray("Expected endpoint identifier", o, new String[] { epId }, true);
    o = mbs.invoke(serverManagerName, "getEndpointIdentifiers", null, null);
    verifyArray("Expected endpoint identifier", o, new String[] { epId }, true);
    ObjectName clientEndpointName = RMUtils.getManagedObjectName(clientManager, ep);
    // we need to find out serverEndpointName by using the query name
    ObjectName serverEndpointName = getEndpointName(mbs, serverManager);
    String sseqId = getSingleSourceSequenceId(mbs, clientEndpointName);
    o = mbs.invoke(clientEndpointName, "getCurrentSourceSequenceId", null, null);
    assertTrue("Expected sequence identifier", o instanceof String && sseqId.equals(o));
    o = mbs.invoke(serverEndpointName, "getDestinationSequenceIds", null, null);
    verifyArray("Expected sequence identifier", o, new String[] { sseqId }, false);
    String dseqId = getSingleDestinationSequenceId(mbs, clientEndpointName);
    testOperation(mbs, greeter, clientEndpointName, serverEndpointName, sseqId, dseqId);
    mbs.invoke(clientEndpointName, "closeSourceSequence", new Object[] { sseqId }, ONESTRING_SIGNATURE);
    o = mbs.invoke(clientEndpointName, "getSourceSequenceIds", new Object[] { true }, ONEBOOLEAN_SIGNATURE);
    verifyArray("Expected sequence identifier", o, new String[] { sseqId }, true);
    mbs.invoke(clientEndpointName, "terminateSourceSequence", new Object[] { sseqId }, ONESTRING_SIGNATURE);
    o = mbs.invoke(clientEndpointName, "getSourceSequenceIds", new Object[] { true }, ONEBOOLEAN_SIGNATURE);
    assertTrue("Source sequence terminated", o instanceof String[] && 0 == ((String[]) o).length);
    mbs.invoke(clientEndpointName, "terminateDestinationSequence", new Object[] { dseqId }, ONESTRING_SIGNATURE);
    o = mbs.invoke(clientEndpointName, "getDestinationSequenceIds", new Object[] {}, EMPTY_SIGNATURE);
    assertTrue("Destination sequence terminated", o instanceof String[] && 0 == ((String[]) o).length);
}
Also used : RMManager(org.apache.cxf.ws.rm.RMManager) Greeter(org.apache.cxf.greeter_control.Greeter) GreeterService(org.apache.cxf.greeter_control.GreeterService) InstrumentationManager(org.apache.cxf.management.InstrumentationManager) MBeanServer(javax.management.MBeanServer) ObjectName(javax.management.ObjectName) Test(org.junit.Test)

Example 8 with RMManager

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

the class ManagedEndpointsTest method testManagedEndpointsOneway.

@Test
public void testManagedEndpointsOneway() throws Exception {
    prepareClient();
    RMManager clientManager = clientBus.getExtension(RMManager.class);
    RMManager serverManager = serverBus.getExtension(RMManager.class);
    InstrumentationManager serverIM = serverBus.getExtension(InstrumentationManager.class);
    MBeanServer mbs = serverIM.getMBeanServer();
    assertNotNull("MBeanServer must be available.", mbs);
    ObjectName clientManagerName = RMUtils.getManagedObjectName(clientManager);
    ObjectName serverManagerName = RMUtils.getManagedObjectName(serverManager);
    Object o;
    GreeterService gs = new GreeterService();
    final Greeter greeter = gs.getGreeterPort();
    updateAddressPort(greeter, ManagedEndpointsTest.PORT);
    LOG.fine("Created greeter client.");
    org.apache.cxf.endpoint.Endpoint ep = ClientProxy.getClient(greeter).getEndpoint();
    String epId = RMUtils.getEndpointIdentifier(ep, clientBus);
    // sent
    greeter.greetMeOneWay("one");
    o = mbs.invoke(clientManagerName, "getEndpointIdentifiers", null, null);
    verifyArray("Expected endpoint identifier", o, new String[] { epId }, true);
    o = mbs.invoke(serverManagerName, "getEndpointIdentifiers", null, null);
    verifyArray("Expected endpoint identifier", o, new String[] { epId }, true);
    ObjectName clientEndpointName = RMUtils.getManagedObjectName(clientManager, ep);
    // we need to find out serverEndpointName by using the query name
    ObjectName serverEndpointName = getEndpointName(mbs, serverManager);
    String sseqId = getSingleSourceSequenceId(mbs, clientEndpointName);
    o = mbs.invoke(clientEndpointName, "getCurrentSourceSequenceId", null, null);
    assertTrue("Expected sequence identifier", o instanceof String && sseqId.equals(o));
    o = mbs.invoke(serverEndpointName, "getDestinationSequenceIds", null, null);
    verifyArray("Expected sequence identifier", o, new String[] { sseqId }, false);
    String dseqId = getSingleDestinationSequenceId(mbs, clientEndpointName);
    testOperation(mbs, greeter, clientEndpointName, serverEndpointName, sseqId, dseqId);
    mbs.invoke(clientEndpointName, "terminateSourceSequence", new Object[] { sseqId }, ONESTRING_SIGNATURE);
    o = mbs.invoke(clientEndpointName, "getSourceSequenceIds", new Object[] { true }, ONEBOOLEAN_SIGNATURE);
    assertTrue("Source sequence terminated", o instanceof String[] && 0 == ((String[]) o).length);
    mbs.invoke(clientEndpointName, "terminateDestinationSequence", new Object[] { dseqId }, ONESTRING_SIGNATURE);
    o = mbs.invoke(clientEndpointName, "getDestinationSequenceIds", new Object[] {}, EMPTY_SIGNATURE);
    assertTrue("Destination sequence terminated", o instanceof String[] && 0 == ((String[]) o).length);
}
Also used : RMManager(org.apache.cxf.ws.rm.RMManager) Greeter(org.apache.cxf.greeter_control.Greeter) GreeterService(org.apache.cxf.greeter_control.GreeterService) InstrumentationManager(org.apache.cxf.management.InstrumentationManager) MBeanServer(javax.management.MBeanServer) ObjectName(javax.management.ObjectName) Test(org.junit.Test)

Example 9 with RMManager

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

the class MessageCallbackOnewayTest method testOnewayAtLeastOnce.

private void testOnewayAtLeastOnce(Executor executor) throws Exception {
    init("org/apache/cxf/systest/ws/rm/atleastonce.xml", executor);
    greeterBus.getOutInterceptors().add(new MessageLossSimulator());
    RMManager manager = greeterBus.getExtension(RMManager.class);
    manager.getConfiguration().setBaseRetransmissionInterval(RETRANSMISSION_INTERVAL);
    String[] callArgs = new String[] { "one", "two", "three", "four" };
    for (int i = 0; i < callArgs.length; i++) {
        greeter.greetMeOneWay(callArgs[i]);
    }
    callback.waitDone(8, 3000, 60000);
    verifyCallbacks();
}
Also used : RMManager(org.apache.cxf.ws.rm.RMManager) Endpoint(javax.xml.ws.Endpoint)

Example 10 with RMManager

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

the class MessageCallbackOnewayTest method testOnewayExactlyOnce.

private void testOnewayExactlyOnce(Executor executor) throws Exception {
    init("org/apache/cxf/systest/ws/rm/exactlyonce.xml", executor);
    greeterBus.getOutInterceptors().add(new MessageLossSimulator());
    RMManager manager = greeterBus.getExtension(RMManager.class);
    manager.getConfiguration().setBaseRetransmissionInterval(RETRANSMISSION_INTERVAL);
    String[] callArgs = new String[] { "one", "two", "three", "four" };
    for (int i = 0; i < callArgs.length; i++) {
        greeter.greetMeOneWay(callArgs[i]);
    }
    callback.waitDone(8, 3000, 60000);
    verifyCallbacks();
}
Also used : RMManager(org.apache.cxf.ws.rm.RMManager) Endpoint(javax.xml.ws.Endpoint)

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