use of org.apache.hello_world_soap_http.types.GreetMeResponse in project cxf by apache.
the class BareOutInterceptorTest method testWriteOutbound.
@Test
public void testWriteOutbound() throws Exception {
GreetMeResponse greetMe = new GreetMeResponse();
greetMe.setResponseType("responseType");
message.setContent(List.class, Arrays.asList(greetMe));
interceptor.handleMessage(message);
writer.close();
assertNull(message.getContent(Exception.class));
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
// System.err.println(baos.toString());
XMLStreamReader xr = StaxUtils.createXMLStreamReader(bais);
DepthXMLStreamReader reader = new DepthXMLStreamReader(xr);
StaxUtils.toNextElement(reader);
assertEquals(new QName("http://apache.org/hello_world_soap_http/types", "greetMeResponse"), reader.getName());
StaxUtils.nextEvent(reader);
StaxUtils.toNextElement(reader);
assertEquals(new QName("http://apache.org/hello_world_soap_http/types", "responseType"), reader.getName());
}
use of org.apache.hello_world_soap_http.types.GreetMeResponse in project cxf by apache.
the class XMLStreamDataReaderTest method testReadWrapperReturn.
@Test
public void testReadWrapperReturn() throws Exception {
JAXBDataBinding db = getDataBinding(GreetMeResponse.class);
reader = getTestReader("../resources/GreetMeDocLiteralResp.xml");
assertNotNull(reader);
DataReader<XMLStreamReader> dr = db.createReader(XMLStreamReader.class);
assertNotNull(dr);
Object retValue = dr.read(reader);
assertNotNull(retValue);
assertTrue(retValue instanceof GreetMeResponse);
assertEquals("TestSOAPOutputPMessage", ((GreetMeResponse) retValue).getResponseType());
}
use of org.apache.hello_world_soap_http.types.GreetMeResponse in project cxf by apache.
the class DispatchClientServerTest method testJAXBObjectPAYLOADWithFeature.
@Test
public void testJAXBObjectPAYLOADWithFeature() throws Exception {
createBus("org/apache/cxf/systest/dispatch/client-config.xml");
BusFactory.setThreadDefaultBus(bus);
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(wsdl);
String bindingId = "http://schemas.xmlsoap.org/wsdl/soap/";
String endpointUrl = "http://localhost:" + greeterPort + "/SOAPDispatchService/SoapDispatchPort";
Service service = Service.create(wsdl, SERVICE_NAME);
service.addPort(PORT_NAME, bindingId, endpointUrl);
assertNotNull(service);
JAXBContext jc = JAXBContext.newInstance("org.apache.hello_world_soap_http.types");
Dispatch<Object> disp = service.createDispatch(PORT_NAME, jc, Service.Mode.PAYLOAD);
disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + greeterPort + "/SOAPDispatchService/SoapDispatchPort");
String expected = "Hello Jeeves";
GreetMe greetMe = new GreetMe();
greetMe.setRequestType("Jeeves");
Object response = disp.invoke(greetMe);
assertNotNull(response);
String responseValue = ((GreetMeResponse) response).getResponseType();
assertEquals("Expected string, " + expected, expected, responseValue);
assertEquals("Feature should be applied", 1, TestDispatchFeature.getCount());
assertEquals("Feature based interceptors should be added", 1, TestDispatchFeature.getCount());
assertEquals("Feature based In interceptors has be added to in chain.", 1, TestDispatchFeature.getInInterceptorCount());
assertEquals("Feature based interceptors has to be added to out chain.", 1, TestDispatchFeature.getOutInterceptorCount());
bus.shutdown(true);
}
use of org.apache.hello_world_soap_http.types.GreetMeResponse in project cxf by apache.
the class AsyncHTTPConduitTest method testCallAsync.
@Test
public void testCallAsync() throws Exception {
updateAddressPort(g, PORT);
GreetMeResponse resp = (GreetMeResponse) g.greetMeAsync(request, new AsyncHandler<GreetMeResponse>() {
public void handleResponse(Response<GreetMeResponse> res) {
try {
res.get().getResponseType();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
}
}).get();
assertEquals("Hello " + request, resp.getResponseType());
g.greetMeLaterAsync(1000, new AsyncHandler<GreetMeLaterResponse>() {
public void handleResponse(Response<GreetMeLaterResponse> res) {
}
}).get();
}
use of org.apache.hello_world_soap_http.types.GreetMeResponse in project cxf by apache.
the class AsyncHTTPConduitTest method testCallAsyncCallbackInvokedOnlyOnce.
@Test
public void testCallAsyncCallbackInvokedOnlyOnce() throws Exception {
// This test is especially targeted for RHEL 6.8
updateAddressPort(g, PORT_INV);
int repeat = 100;
final AtomicInteger count = new AtomicInteger(0);
for (int i = 0; i < repeat; i++) {
try {
g.greetMeAsync(request, new AsyncHandler<GreetMeResponse>() {
public void handleResponse(Response<GreetMeResponse> res) {
count.incrementAndGet();
}
}).get();
} catch (Exception e) {
}
}
Thread.sleep(1000);
assertEquals("Callback should be invoked only once per request", repeat, count.intValue());
}
Aggregations