Search in sources :

Example 36 with GreeterService

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

the class RobustServiceAtMostOnceTest method testRobustAtMostOnceWithSlowProcessing.

@Test
public void testRobustAtMostOnceWithSlowProcessing() throws Exception {
    LOG.fine("Creating greeter client");
    SpringBusFactory bf = new SpringBusFactory();
    bus = bf.createBus("/org/apache/cxf/systest/ws/rm/seqlength1.xml");
    // set the client retry interval much shorter than the slow processing delay
    RMManager manager = bus.getExtension(RMManager.class);
    manager.getConfiguration().setBaseRetransmissionInterval(new Long(3000));
    BusFactory.setDefaultBus(bus);
    GreeterService gs = new GreeterService();
    greeter = gs.getGreeterPort();
    updateAddressPort(greeter, PORT);
    LOG.fine("Invoking greeter");
    greeter.greetMeOneWay("one");
    Thread.sleep(10000);
    assertEquals("invoked too many times", 1, serverGreeter.getCount());
    assertTrue("still in retransmission", manager.getRetransmissionQueue().isEmpty());
}
Also used : SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) RMManager(org.apache.cxf.ws.rm.RMManager) GreeterService(org.apache.cxf.greeter_control.GreeterService) Test(org.junit.Test)

Example 37 with GreeterService

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

the class SequenceTest 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) TransformerException(javax.xml.transform.TransformerException) IOException(java.io.IOException) WebServiceException(javax.xml.ws.WebServiceException)

Example 38 with GreeterService

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

the class SequenceTest method initDispatch.

private void initDispatch(boolean useDecoupledEndpoint) {
    GreeterService gs = new GreeterService();
    dispatch = gs.createDispatch(GreeterService.GreeterPort, DOMSource.class, Service.Mode.MESSAGE);
    try {
        updateAddressPort(dispatch, PORT);
    } catch (Exception e) {
    // ignore
    }
    dispatch.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.FALSE);
    if (useDecoupledEndpoint) {
        initDecoupledEndpoint(((DispatchImpl<?>) dispatch).getClient());
    }
}
Also used : DOMSource(javax.xml.transform.dom.DOMSource) GreeterService(org.apache.cxf.greeter_control.GreeterService) TransformerException(javax.xml.transform.TransformerException) IOException(java.io.IOException) WebServiceException(javax.xml.ws.WebServiceException)

Example 39 with GreeterService

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

the class ServiceInvocationAckBase method setupGreeter.

protected void setupGreeter(String cfgResource) throws NumberFormatException, MalformedURLException {
    SpringBusFactory bf = new SpringBusFactory();
    controlBus = bf.createBus();
    BusFactory.setDefaultBus(controlBus);
    ControlService cs = new ControlService();
    control = cs.getControlPort();
    updateAddressPort(control, getPort());
    assertTrue("Failed to start greeter", control.startGreeter(cfgResource));
    System.setProperty("db.name", getPrefix());
    greeterBus = bf.createBus(cfgResource);
    BusFactory.setDefaultBus(greeterBus);
    System.clearProperty("db.name");
    LOG.fine("Initialised greeter bus with configuration: " + cfgResource);
    GreeterService gs = new GreeterService();
    greeter = gs.getGreeterPort();
    updateAddressPort(greeter, getPort());
    LOG.fine("Created greeter client.");
}
Also used : SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) ControlService(org.apache.cxf.greeter_control.ControlService) GreeterService(org.apache.cxf.greeter_control.GreeterService)

Example 40 with GreeterService

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

the class ClientServerGreeterBaseTest method testInvocation.

@Test
public void testInvocation() throws Exception {
    GreeterService service = new GreeterService();
    assertNotNull(service);
    try {
        Greeter greeter = service.getGreeterPort();
        updateAddressPort(greeter, PORT);
        String greeting = greeter.greetMe("Bonjour");
        assertNotNull("no response received from service", greeting);
        assertEquals("Hello Bonjour", greeting);
    } catch (UndeclaredThrowableException ex) {
        throw (Exception) ex.getCause();
    }
}
Also used : Greeter(org.apache.cxf.greeter_control.Greeter) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException) GreeterService(org.apache.cxf.greeter_control.GreeterService) Test(org.junit.Test)

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