Search in sources :

Example 6 with AddNumberImpl

use of org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImpl in project cxf by apache.

the class WSAFromJavaTest method testFaultFromNonAddressService.

@Test
public void testFaultFromNonAddressService() throws Exception {
    new LoggingFeature().initialize(this.getBus());
    AddNumberImpl port = getPort();
    java.util.Map<String, Object> requestContext = ((BindingProvider) port).getRequestContext();
    requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + PORT + "/AddNumberImplPort-noaddr");
    long start = System.currentTimeMillis();
    port.addNumbers(1, 2);
    try {
        port.addNumbers3(-1, -1);
    } catch (Exception ex) {
    // ignore, expected
    }
    long end = System.currentTimeMillis();
    assertTrue((end - start) < 50000);
}
Also used : AddNumberImpl(org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImpl) LoggingFeature(org.apache.cxf.ext.logging.LoggingFeature) BindingProvider(javax.xml.ws.BindingProvider) AddNumbersException_Exception(org.apache.cxf.systest.ws.addr_fromjava.client.AddNumbersException_Exception) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) Test(org.junit.Test)

Example 7 with AddNumberImpl

use of org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImpl in project cxf by apache.

the class WSAFromJavaTest method getPort.

private AddNumberImpl getPort() throws Exception {
    URL wsdl = getClass().getResource("/wsdl_systest_wsspec/add_numbers-fromjava.wsdl");
    assertNotNull("WSDL is null", wsdl);
    AddNumberImplService service = new AddNumberImplService(wsdl);
    assertNotNull("Service is null ", service);
    AddNumberImpl port = service.getAddNumberImplPort();
    updateAddressPort(port, PORT);
    return port;
}
Also used : AddNumberImpl(org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImpl) AddNumberImplService(org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImplService) URL(java.net.URL)

Example 8 with AddNumberImpl

use of org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImpl in project cxf by apache.

the class WSAFromJavaTest method testAddNumbers2.

@Test
public void testAddNumbers2() throws Exception {
    ByteArrayOutputStream input = setupInLogging();
    ByteArrayOutputStream output = setupOutLogging();
    AddNumberImpl port = getPort();
    assertEquals(3, port.addNumbers2(1, 2));
    String base = "http://server.addr_fromjava.ws.systest.cxf.apache.org/AddNumberImpl";
    String expectedOut = base + "/addNumbers2";
    assertTrue(output.toString().indexOf(expectedOut) != -1);
    String expectedIn = base + "/addNumbers2Response";
    assertTrue(input.toString().indexOf(expectedIn) != -1);
}
Also used : AddNumberImpl(org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImpl) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Example 9 with AddNumberImpl

use of org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImpl in project cxf by apache.

the class WSAFromJavaTest method testAddNumbers.

@Test
public void testAddNumbers() throws Exception {
    ByteArrayOutputStream input = setupInLogging();
    ByteArrayOutputStream output = setupOutLogging();
    AddNumberImpl port = getPort();
    assertEquals(3, port.addNumbers(1, 2));
    String expectedOut = "http://cxf.apache.org/input";
    assertTrue(output.toString().indexOf(expectedOut) != -1);
    String expectedIn = "http://cxf.apache.org/output";
    assertTrue(input.toString().indexOf(expectedIn) != -1);
}
Also used : AddNumberImpl(org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImpl) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Aggregations

AddNumberImpl (org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImpl)9 Test (org.junit.Test)8 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 AddNumbersException_Exception (org.apache.cxf.systest.ws.addr_fromjava.client.AddNumbersException_Exception)5 BindingProvider (javax.xml.ws.BindingProvider)3 LoggingFeature (org.apache.cxf.ext.logging.LoggingFeature)2 URL (java.net.URL)1 Client (org.apache.cxf.endpoint.Client)1 AddNumberImplService (org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImplService)1