Search in sources :

Example 1 with GreeterService

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

the class SequenceTimeoutTest 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
    }
    ConnectionHelper.setKeepAliveConnection(greeter, true);
}
Also used : GreeterService(org.apache.cxf.greeter_control.GreeterService)

Example 2 with GreeterService

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

the class ClientServerGreeterBaseNoWsdlTest 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)

Example 3 with GreeterService

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

the class ClientServerGreeterNoWsdlTest 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)

Example 4 with GreeterService

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

the class TrivialSOAPHandlerTest method testInvocation.

@Test
public void testInvocation() throws Exception {
    GreeterService service = new GreeterService();
    assertNotNull(service);
    try {
        Greeter greeter = service.getGreeterPort();
        setAddress(greeter, address);
        String greeting = greeter.greetMe("Bonjour");
        assertNotNull("no response received from service", greeting);
        assertEquals("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)

Example 5 with GreeterService

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

the class InterceptorFaultTest method setupGreeter.

private void setupGreeter(String cfgResource, boolean useDecoupledEndpoint) throws NumberFormatException, MalformedURLException {
    SpringBusFactory bf = new SpringBusFactory();
    controlBus = bf.createBus();
    BusFactory.setDefaultBus(controlBus);
    ControlService cs = new ControlService();
    control = cs.getControlPort();
    updateAddressPort(control, PORT);
    assertTrue("Failed to start greeter", control.startGreeter(cfgResource));
    greeterBus = bf.createBus(cfgResource);
    BusFactory.setDefaultBus(greeterBus);
    LOG.fine("Initialised greeter bus with configuration: " + cfgResource);
    if (null == comparator) {
        comparator = new PhaseComparator();
    }
    if (null == inPhases) {
        inPhases = new ArrayList<>();
        inPhases.addAll(greeterBus.getExtension(PhaseManager.class).getInPhases());
        Collections.sort(inPhases, comparator);
    }
    if (null == postUnMarshalPhase) {
        postUnMarshalPhase = getPhase(Phase.POST_UNMARSHAL);
    }
    GreeterService gs = new GreeterService();
    greeter = gs.getGreeterPort();
    updateAddressPort(greeter, PORT);
    LOG.fine("Created greeter client.");
    if (!useDecoupledEndpoint) {
        return;
    }
    // programatically configure decoupled endpoint that is guaranteed to
    // be unique across all test cases
    decoupledEndpointPort++;
    decoupledEndpoint = "http://localhost:" + allocatePort("decoupled-" + decoupledEndpointPort) + "/decoupled_endpoint";
    Client c = ClientProxy.getClient(greeter);
    HTTPConduit hc = (HTTPConduit) (c.getConduit());
    HTTPClientPolicy cp = hc.getClient();
    cp.setDecoupledEndpoint(decoupledEndpoint);
    LOG.fine("Using decoupled endpoint: " + cp.getDecoupledEndpoint());
}
Also used : PhaseComparator(org.apache.cxf.phase.PhaseComparator) HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) ControlService(org.apache.cxf.greeter_control.ControlService) HTTPClientPolicy(org.apache.cxf.transports.http.configuration.HTTPClientPolicy) GreeterService(org.apache.cxf.greeter_control.GreeterService) Client(org.apache.cxf.endpoint.Client)

Aggregations

GreeterService (org.apache.cxf.greeter_control.GreeterService)43 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