Search in sources :

Example 11 with GreeterService

use of org.apache.cxf.greeter_control.GreeterService in project cxf by apache.

the class DecoupledClientServerOnewayTest method testDecoupledOneway.

@Test
public void testDecoupledOneway() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    bus = bf.createBus("/org/apache/cxf/systest/ws/rm/exactlyonce-inorder-decoupled.xml");
    BusFactory.setDefaultBus(bus);
    LoggingInInterceptor in = new LoggingInInterceptor();
    in.setPrettyLogging(true);
    bus.getInInterceptors().add(in);
    bus.getInFaultInterceptors().add(in);
    LoggingOutInterceptor out = new LoggingOutInterceptor();
    out.setPrettyLogging(true);
    bus.getOutInterceptors().add(out);
    bus.getOutFaultInterceptors().add(out);
    GreeterService gs = new GreeterService();
    final Greeter greeter = gs.getGreeterPort();
    updateAddressPort(greeter, PORT);
    ((BindingProvider) greeter).getRequestContext().put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.TRUE);
    LOG.fine("Created greeter client.");
    ConnectionHelper.setKeepAliveConnection(greeter, true);
    greeter.greetMeOneWay("oneway");
}
Also used : SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) Greeter(org.apache.cxf.greeter_control.Greeter) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) GreeterService(org.apache.cxf.greeter_control.GreeterService) Test(org.junit.Test)

Example 12 with GreeterService

use of org.apache.cxf.greeter_control.GreeterService in project cxf by apache.

the class DeliveryAssuranceOnewayTest method initProxy.

private void initProxy(Executor executor) {
    GreeterService gs = new GreeterService();
    if (null != executor) {
        gs.setExecutor(executor);
    }
    greeter = gs.getGreeterPort();
    try {
        updateAddressPort(greeter, PORT);
    } catch (Exception e) {
    // ignore
    }
    LOG.fine("Created greeter client.");
    ConnectionHelper.setKeepAliveConnection(greeter, false);
}
Also used : GreeterService(org.apache.cxf.greeter_control.GreeterService)

Example 13 with GreeterService

use of org.apache.cxf.greeter_control.GreeterService 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 14 with GreeterService

use of org.apache.cxf.greeter_control.GreeterService 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 15 with GreeterService

use of org.apache.cxf.greeter_control.GreeterService in project cxf by apache.

the class ProtocolVariationsTest method initProxy.

private void initProxy(boolean useDecoupledEndpoint, Executor executor) {
    GreeterService gs = new GreeterService();
    if (null != executor) {
        gs.setExecutor(executor);
    }
    greeter = gs.getGreeterPort();
    try {
        updateAddressPort(greeter, PORT);
    } catch (Exception e) {
    // ignore
    }
    LOG.fine("Created greeter client.");
    ConnectionHelper.setKeepAliveConnection(greeter, true);
    if (useDecoupledEndpoint) {
        initDecoupledEndpoint(ClientProxy.getClient(greeter));
    }
}
Also used : GreeterService(org.apache.cxf.greeter_control.GreeterService) RMException(org.apache.cxf.ws.rm.RMException)

Aggregations

GreeterService (org.apache.cxf.greeter_control.GreeterService)42 Greeter (org.apache.cxf.greeter_control.Greeter)28 Test (org.junit.Test)28 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)15 UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)10 BindingProvider (javax.xml.ws.BindingProvider)10 RMManager (org.apache.cxf.ws.rm.RMManager)10 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)7 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)7 ControlService (org.apache.cxf.greeter_control.ControlService)4 MBeanServer (javax.management.MBeanServer)3 ObjectName (javax.management.ObjectName)3 InstrumentationManager (org.apache.cxf.management.InstrumentationManager)3 IOException (java.io.IOException)2 List (java.util.List)2 TransformerException (javax.xml.transform.TransformerException)2 DOMSource (javax.xml.transform.dom.DOMSource)2 WebServiceException (javax.xml.ws.WebServiceException)2 Bus (org.apache.cxf.Bus)2 Client (org.apache.cxf.endpoint.Client)2