use of org.apache.cxf.transport.servlet.ServletDestination in project cxf by apache.
the class UriInfoImplTest method mockMessage.
private Message mockMessage(String baseAddress, String pathInfo, String query, String fragment) {
Message m = new MessageImpl();
control.reset();
Exchange e = new ExchangeImpl();
m.setExchange(e);
ServletDestination d = control.createMock(ServletDestination.class);
e.setDestination(d);
EndpointInfo epr = new EndpointInfo();
epr.setAddress(baseAddress);
d.getEndpointInfo();
EasyMock.expectLastCall().andReturn(epr).anyTimes();
m.put(Message.REQUEST_URI, pathInfo);
m.put(Message.QUERY_STRING, query);
control.replay();
return m;
}
use of org.apache.cxf.transport.servlet.ServletDestination in project cxf by apache.
the class RequestPreprocessorTest method mockMessage.
private Message mockMessage(String baseAddress, String pathInfo, String query, String method, String methodHeader) {
Message m = new MessageImpl();
m.put("org.apache.cxf.http.case_insensitive_queries", false);
m.put("org.apache.cxf.endpoint.private", false);
Exchange e = new ExchangeImpl();
m.setExchange(e);
control.reset();
Endpoint endp = control.mock(Endpoint.class);
e.put(Endpoint.class, endp);
EasyMock.expect(endp.isEmpty()).andReturn(true).anyTimes();
EasyMock.expect(endp.get(ServerProviderFactory.class.getName())).andReturn(ServerProviderFactory.getInstance()).anyTimes();
ServletDestination d = control.createMock(ServletDestination.class);
e.setDestination(d);
EndpointInfo epr = new EndpointInfo();
epr.setAddress(baseAddress);
EasyMock.expect(d.getEndpointInfo()).andReturn(epr).anyTimes();
EasyMock.expect(endp.getEndpointInfo()).andReturn(epr).anyTimes();
m.put(Message.REQUEST_URI, pathInfo);
m.put(Message.QUERY_STRING, query);
m.put(Message.HTTP_REQUEST_METHOD, method);
Map<String, List<String>> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
if (methodHeader != null) {
headers.put("X-HTTP-Method-Override", Collections.singletonList(methodHeader));
}
m.put(Message.PROTOCOL_HEADERS, headers);
BindingInfo bi = control.createMock(BindingInfo.class);
epr.setBinding(bi);
EasyMock.expect(bi.getProperties()).andReturn(Collections.emptyMap()).anyTimes();
control.replay();
return m;
}
use of org.apache.cxf.transport.servlet.ServletDestination in project cxf by apache.
the class WadlGeneratorTest method mockMessage.
private Message mockMessage(String baseAddress, String pathInfo, String query, List<ClassResourceInfo> cris) throws Exception {
Message m = new MessageImpl();
Exchange e = new ExchangeImpl();
e.put(Service.class, new JAXRSServiceImpl(cris));
m.setExchange(e);
control.reset();
ServletDestination d = control.createMock(ServletDestination.class);
EndpointInfo epr = new EndpointInfo();
epr.setAddress(baseAddress);
d.getEndpointInfo();
EasyMock.expectLastCall().andReturn(epr).anyTimes();
Endpoint endpoint = new EndpointImpl(null, null, epr);
e.put(Endpoint.class, endpoint);
endpoint.put(ServerProviderFactory.class.getName(), ServerProviderFactory.getInstance());
e.setDestination(d);
BindingInfo bi = control.createMock(BindingInfo.class);
epr.setBinding(bi);
bi.getProperties();
EasyMock.expectLastCall().andReturn(Collections.emptyMap()).anyTimes();
m.put(Message.REQUEST_URI, pathInfo);
m.put(Message.QUERY_STRING, query);
m.put(Message.HTTP_REQUEST_METHOD, "GET");
control.replay();
return m;
}
use of org.apache.cxf.transport.servlet.ServletDestination in project cxf by apache.
the class WadlGeneratorJsonTest method mockMessage.
private Message mockMessage(String baseAddress, String pathInfo, String query, ClassResourceInfo cri) throws Exception {
Message m = new MessageImpl();
Exchange e = new ExchangeImpl();
e.put(Service.class, new JAXRSServiceImpl(Collections.singletonList(cri)));
m.setExchange(e);
control.reset();
ServletDestination d = control.createMock(ServletDestination.class);
EndpointInfo epr = new EndpointInfo();
epr.setAddress(baseAddress);
d.getEndpointInfo();
EasyMock.expectLastCall().andReturn(epr).anyTimes();
Endpoint endpoint = new EndpointImpl(null, null, epr);
e.put(Endpoint.class, endpoint);
e.setDestination(d);
BindingInfo bi = control.createMock(BindingInfo.class);
epr.setBinding(bi);
bi.getProperties();
EasyMock.expectLastCall().andReturn(Collections.emptyMap()).anyTimes();
m.put(Message.REQUEST_URI, pathInfo);
m.put(Message.QUERY_STRING, query);
m.put(Message.HTTP_REQUEST_METHOD, "GET");
control.replay();
return m;
}
Aggregations