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;
}
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);
}
}
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;
}
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);
}
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;
}
Aggregations