Search in sources :

Example 1 with AddNumbersFault_Exception

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

the class AddNumberImpl method execute.

int execute(int number1, int number2) throws AddNumbersFault_Exception {
    if (number1 < 0 || number2 < 0) {
        AddNumbersFault fb = new AddNumbersFault();
        fb.setDetail("Negative numbers cant be added!");
        fb.setMessage("Numbers: " + number1 + ", " + number2);
        throw new AddNumbersFault_Exception(fb.getMessage(), fb);
    }
    return number1 + number2;
}
Also used : AddNumbersFault_Exception(org.apache.cxf.systest.ws.addr_feature.AddNumbersFault_Exception) AddNumbersFault(org.apache.cxf.systest.ws.addr_feature.AddNumbersFault)

Example 2 with AddNumbersFault_Exception

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

the class WSAFromWSDLTest method testAddNumbersFault3.

@Test
public void testAddNumbersFault3() throws Exception {
    ByteArrayOutputStream input = setupInLogging();
    ByteArrayOutputStream output = setupOutLogging();
    try (AddNumbersPortTypeProxy port = getPort()) {
        try {
            port.addNumbers3(-1, 2);
        } catch (AddNumbersFault_Exception ex) {
            assert true;
        } catch (Exception e) {
            e.printStackTrace();
            assert false;
        }
        String expectedOut = "3in";
        String expectedIn = "3fault";
        assertTrue(output.toString(), output.toString().indexOf(expectedOut) != -1);
        assertTrue(input.toString(), input.toString().indexOf(expectedIn) != -1);
    }
}
Also used : AddNumbersFault_Exception(org.apache.cxf.systest.ws.addr_feature.AddNumbersFault_Exception) ByteArrayOutputStream(java.io.ByteArrayOutputStream) AddNumbersPortTypeProxy(org.apache.cxf.systest.ws.addr_feature.AddNumbersService.AddNumbersPortTypeProxy) AddNumbersFault_Exception(org.apache.cxf.systest.ws.addr_feature.AddNumbersFault_Exception) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) Test(org.junit.Test)

Example 3 with AddNumbersFault_Exception

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

the class AddNumberImpl method execute.

int execute(int number1, int number2) throws AddNumbersFault_Exception {
    if (number1 < 0 || number2 < 0) {
        AddNumbersFault fb = new AddNumbersFault();
        fb.setDetail("Negative numbers cant be added!");
        fb.setMessage("Numbers: " + number1 + ", " + number2);
        throw new AddNumbersFault_Exception(fb.getMessage(), fb);
    }
    return number1 + number2;
}
Also used : AddNumbersFault_Exception(org.apache.cxf.systest.ws.addr_feature.AddNumbersFault_Exception) AddNumbersFault(org.apache.cxf.systest.ws.addr_feature.AddNumbersFault)

Example 4 with AddNumbersFault_Exception

use of org.apache.cxf.systest.ws.addr_feature.AddNumbersFault_Exception 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)

Example 5 with AddNumbersFault_Exception

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

the class AddNumberImpl method execute.

int execute(int number1, int number2) throws AddNumbersFault_Exception {
    if (number1 == 5092) {
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
        // ignore
        }
    }
    if (number1 < 0 || number2 < 0) {
        AddNumbersFault fb = new AddNumbersFault();
        fb.setDetail("Negative numbers cant be added!");
        fb.setMessage("Numbers: " + number1 + ", " + number2);
        throw new AddNumbersFault_Exception(fb.getMessage(), fb);
    }
    return number1 + number2;
}
Also used : AddNumbersFault_Exception(org.apache.cxf.systest.ws.addr_feature.AddNumbersFault_Exception) AddNumbersFault(org.apache.cxf.systest.ws.addr_feature.AddNumbersFault)

Aggregations

AddNumbersFault_Exception (org.apache.cxf.systest.ws.addr_feature.AddNumbersFault_Exception)6 AddNumbersFault (org.apache.cxf.systest.ws.addr_feature.AddNumbersFault)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)2 Test (org.junit.Test)2 AddNumbersPortType (org.apache.cxf.systest.ws.addr_feature.AddNumbersPortType)1 AddNumbersPortTypeProxy (org.apache.cxf.systest.ws.addr_feature.AddNumbersService.AddNumbersPortTypeProxy)1