use of org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImpl in project cxf by apache.
the class WSAFromJavaTest method testAddNumbersFault.
@Test
public void testAddNumbersFault() throws Exception {
ByteArrayOutputStream input = setupInLogging();
ByteArrayOutputStream output = setupOutLogging();
AddNumberImpl port = getPort();
try {
port.addNumbers(-1, 2);
} catch (AddNumbersException_Exception e) {
assert true;
} catch (Exception e) {
e.printStackTrace();
assert false;
}
assertTrue(output.toString().indexOf("http://cxf.apache.org/input") != -1);
String expectedFault = "http://server.addr_fromjava.ws.systest.cxf.apache.org/AddNumberImpl/" + "addNumbers/Fault/AddNumbersException";
assertTrue(input.toString(), input.toString().indexOf(expectedFault) != -1);
}
use of org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImpl in project cxf by apache.
the class WSAFromJavaTest method testAddNumbers3Fault.
@Test
public void testAddNumbers3Fault() throws Exception {
ByteArrayOutputStream input = setupInLogging();
ByteArrayOutputStream output = setupOutLogging();
AddNumberImpl port = getPort();
try {
port.addNumbers3(-1, 2);
} catch (AddNumbersException_Exception e) {
assert true;
} catch (Exception e) {
e.printStackTrace();
assert false;
}
assertTrue(output.toString(), output.toString().indexOf("http://cxf.apache.org/input") != -1);
assertTrue(input.toString(), input.toString().indexOf("http://cxf.apache.org/fault3") != -1);
}
use of org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImpl in project cxf by apache.
the class WSAFromJavaTest method testUnmatchedActions.
@Test
public void testUnmatchedActions() throws Exception {
AddNumberImpl port = getPort();
BindingProvider bp = (BindingProvider) port;
java.util.Map<String, Object> requestContext = bp.getRequestContext();
requestContext.put(BindingProvider.SOAPACTION_URI_PROPERTY, "http://cxf.apache.org/input4");
try {
// CXF-2035
port.addNumbers3(-1, -1);
} catch (Exception e) {
assertTrue(e.getMessage().contains("Unexpected wrapper"));
}
}
use of org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImpl in project cxf by apache.
the class WSAFromJavaTest method testAddNumbersJaxWsContext.
@Test
public void testAddNumbersJaxWsContext() throws Exception {
ByteArrayOutputStream output = setupOutLogging();
AddNumberImpl port = getPort();
BindingProvider bp = (BindingProvider) port;
java.util.Map<String, Object> requestContext = bp.getRequestContext();
requestContext.put(BindingProvider.SOAPACTION_URI_PROPERTY, "cxf");
try {
assertEquals(3, port.addNumbers(1, 2));
fail("Should have thrown an ActionNotSupported exception");
} catch (SOAPFaultException ex) {
// expected
}
assertLogContains(output.toString(), "//wsa:Action", "cxf");
assertTrue(output.toString(), output.toString().indexOf("SOAPAction=\"cxf\"") != -1);
}
use of org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImpl in project cxf by apache.
the class WSAFromJavaTest method testNoRelatesToHeader.
@Test
public void testNoRelatesToHeader() throws Exception {
new LoggingFeature().initialize(this.getBus());
AddNumberImpl port = getPort();
Client c = ClientProxy.getClient(port);
c.getInInterceptors().add(new RemoveRelatesToHeaderInterceptor());
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);
}
Aggregations