use of javax.xml.ws.spi.http.HttpExchange in project cxf by apache.
the class JAXWSHttpSpiDestinationTest method testMessage.
@Test
public void testMessage() throws Exception {
HttpExchange exchange = setUpExchange();
control.replay();
JAXWSHttpSpiDestination destination = new JAXWSHttpSpiDestination(bus, new DestinationRegistryImpl(), endpoint);
destination.setMessageObserver(observer);
destination.doService(new HttpServletRequestAdapter(exchange), new HttpServletResponseAdapter(exchange));
control.verify();
}
use of javax.xml.ws.spi.http.HttpExchange in project cxf by apache.
the class JAXWSHttpSpiDestinationTest method setUpExchange.
private HttpExchange setUpExchange() throws Exception {
HttpExchange exchange = control.createMock(HttpExchange.class);
expect(exchange.getHttpContext()).andReturn(context).anyTimes();
expect(exchange.getQueryString()).andReturn(null);
expect(exchange.getPathInfo()).andReturn(null);
expect(exchange.getRequestURI()).andReturn(CONTEXT_PATH);
expect(exchange.getContextPath()).andReturn(CONTEXT_PATH);
Map<String, List<String>> reqHeaders = new HashMap<>();
reqHeaders.put("Content-Type", Collections.singletonList("text/xml"));
expect(exchange.getRequestHeaders()).andReturn(reqHeaders).anyTimes();
OutputStream responseBody = control.createMock(OutputStream.class);
responseBody.flush();
EasyMock.expectLastCall();
expect(exchange.getResponseBody()).andReturn(responseBody).anyTimes();
observer.onMessage(isA(Message.class));
EasyMock.expectLastCall();
return exchange;
}
Aggregations