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