Search in sources :

Example 1 with AddNumbersPortType

use of org.apache.cxf.systest.ws.addr_feature.AddNumbersPortType in project cxf by apache.

the class WSADisableTest method testDisableServerEnableClientRequired.

// CXF-3060
@Test
public void testDisableServerEnableClientRequired() throws Exception {
    AddNumbersPortType port = getService().getAddNumbersPort(new AddressingFeature(true, true));
    ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + PORT + "/jaxws/add");
    try {
        port.addNumbers(1, 2);
        fail("Expected missing WSA header exception");
    } catch (Exception e) {
        assertTrue("expected WebServiceException", e instanceof WebServiceException);
        String expected = "A required header representing a Message Addressing" + " Property is not present";
        assertTrue("Caught unexpected exception : " + e.getMessage(), e.getMessage().indexOf(expected) > -1);
    }
}
Also used : AddNumbersPortType(org.apache.cxf.systest.ws.addr_feature.AddNumbersPortType) AddressingFeature(javax.xml.ws.soap.AddressingFeature) WebServiceException(javax.xml.ws.WebServiceException) WebServiceException(javax.xml.ws.WebServiceException) Test(org.junit.Test)

Example 2 with AddNumbersPortType

use of org.apache.cxf.systest.ws.addr_feature.AddNumbersPortType in project cxf by apache.

the class WSADisableTest method testDisableAll.

@Test
public void testDisableAll() throws Exception {
    ByteArrayOutputStream input = setupInLogging();
    ByteArrayOutputStream output = setupOutLogging();
    AddNumbersPortType port = getService().getAddNumbersPort(new AddressingFeature(false));
    ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + PORT + "/jaxws/add");
    assertEquals(3, port.addNumbers(1, 2));
    String expectedOut = "http://www.w3.org/2005/08/addressing";
    String expectedIn = "http://www.w3.org/2005/08/addressing";
    assertTrue(output.toString().indexOf(expectedOut) == -1);
    assertTrue(input.toString().indexOf(expectedIn) == -1);
}
Also used : AddNumbersPortType(org.apache.cxf.systest.ws.addr_feature.AddNumbersPortType) AddressingFeature(javax.xml.ws.soap.AddressingFeature) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Example 3 with AddNumbersPortType

use of org.apache.cxf.systest.ws.addr_feature.AddNumbersPortType in project cxf by apache.

the class WSADisableTest method testDisableServerSide.

@Test
public void testDisableServerSide() throws Exception {
    ByteArrayOutputStream input = setupInLogging();
    ByteArrayOutputStream output = setupOutLogging();
    AddNumbersPortType port = getService().getAddNumbersPort();
    ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + PORT + "/jaxws/add");
    assertEquals(3, port.addNumbers(1, 2));
    String expectedOut = "http://apache.org/cxf/systest/ws/addr_feature/AddNumbersPortType/addNumbersRequest";
    String expectedIn = "http://www.w3.org/2005/08/addressing";
    assertLogContains(output.toString(), "//wsa:Action", expectedOut);
    assertTrue(input.toString().indexOf(expectedIn) == -1);
}
Also used : AddNumbersPortType(org.apache.cxf.systest.ws.addr_feature.AddNumbersPortType) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Example 4 with AddNumbersPortType

use of org.apache.cxf.systest.ws.addr_feature.AddNumbersPortType in project cxf by apache.

the class WSAFromWSDLTest method testAddNumbers.

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

Example 5 with AddNumbersPortType

use of org.apache.cxf.systest.ws.addr_feature.AddNumbersPortType in project cxf by apache.

the class WSAFromWSDLTest method testAddNumbersFault.

@Test
public void testAddNumbersFault() throws Exception {
    ByteArrayOutputStream input = setupInLogging();
    ByteArrayOutputStream output = setupOutLogging();
    AddNumbersPortType port = getPort();
    try {
        port.addNumbers(-1, 2);
    } catch (AddNumbersFault_Exception ex) {
        assert true;
    } catch (Exception e) {
        e.printStackTrace();
        assert false;
    }
    String expectedOut = BASE_URI + "addNumbersRequest";
    String expectedIn = BASE_URI + "addNumbers/Fault/addNumbersFault";
    assertTrue(output.toString().indexOf(expectedOut) != -1);
    assertTrue(input.toString().indexOf(expectedIn) != -1);
}
Also used : AddNumbersPortType(org.apache.cxf.systest.ws.addr_feature.AddNumbersPortType) AddNumbersFault_Exception(org.apache.cxf.systest.ws.addr_feature.AddNumbersFault_Exception) ByteArrayOutputStream(java.io.ByteArrayOutputStream) AddNumbersFault_Exception(org.apache.cxf.systest.ws.addr_feature.AddNumbersFault_Exception) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) Test(org.junit.Test)

Aggregations

AddNumbersPortType (org.apache.cxf.systest.ws.addr_feature.AddNumbersPortType)10 Test (org.junit.Test)10 ByteArrayOutputStream (java.io.ByteArrayOutputStream)8 IOException (java.io.IOException)2 ExecutionException (java.util.concurrent.ExecutionException)2 AddressingFeature (javax.xml.ws.soap.AddressingFeature)2 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)2 AddNumbersResponse (org.apache.cxf.systest.ws.addr_feature.AddNumbersResponse)2 MAPCodec (org.apache.cxf.ws.addressing.soap.MAPCodec)2 AsyncHandler (javax.xml.ws.AsyncHandler)1 Response (javax.xml.ws.Response)1 WebServiceException (javax.xml.ws.WebServiceException)1 Client (org.apache.cxf.endpoint.Client)1 Interceptor (org.apache.cxf.interceptor.Interceptor)1 Message (org.apache.cxf.message.Message)1 AddNumbersFault_Exception (org.apache.cxf.systest.ws.addr_feature.AddNumbersFault_Exception)1 HTTPConduit (org.apache.cxf.transport.http.HTTPConduit)1