use of org.apache.cxf.message.Exchange in project cxf by apache.
the class ExceptionUtilsTest method createMessage.
private Message createMessage() {
Message m = new MessageImpl();
Exchange e = new ExchangeImpl();
m.setExchange(e);
e.setInMessage(m);
e.put("org.apache.cxf.jaxrs.provider.ServerProviderFactory", ServerProviderFactory.getInstance());
return m;
}
use of org.apache.cxf.message.Exchange in project cxf by apache.
the class HttpUtilsTest method doTestGetBaseAddress.
private void doTestGetBaseAddress(String baseURI, String expected) {
Message m = new MessageImpl();
Exchange exchange = new ExchangeImpl();
m.setExchange(exchange);
Destination dest = EasyMock.createMock(Destination.class);
exchange.setDestination(dest);
m.put(Message.BASE_PATH, baseURI);
String address = HttpUtils.getBaseAddress(m);
assertEquals(expected, address);
}
use of org.apache.cxf.message.Exchange in project cxf by apache.
the class JAXRSUtilsTest method createMessage2.
private Message createMessage2() {
ProviderFactory factory = ServerProviderFactory.getInstance();
Message m = new MessageImpl();
m.put("org.apache.cxf.http.case_insensitive_queries", false);
Exchange e = new ExchangeImpl();
m.setExchange(e);
e.setInMessage(m);
Endpoint endpoint = EasyMock.createMock(Endpoint.class);
endpoint.getEndpointInfo();
EasyMock.expectLastCall().andReturn(null).anyTimes();
endpoint.get("org.apache.cxf.jaxrs.comparator");
EasyMock.expectLastCall().andReturn(null);
endpoint.size();
EasyMock.expectLastCall().andReturn(0).anyTimes();
endpoint.isEmpty();
EasyMock.expectLastCall().andReturn(true).anyTimes();
endpoint.get(ServerProviderFactory.class.getName());
EasyMock.expectLastCall().andReturn(factory).anyTimes();
EasyMock.replay(endpoint);
e.put(Endpoint.class, endpoint);
return m;
}
use of org.apache.cxf.message.Exchange in project cxf by apache.
the class JAXRSUtilsTest method invokeCustomerMethod.
private void invokeCustomerMethod(ClassResourceInfo cri, Customer customer, Server server) throws Exception {
OperationResourceInfo ori = cri.getMethodDispatcher().getOperationResourceInfo(Customer.class.getMethod("test", new Class[] {}));
JAXRSInvoker invoker = new JAXRSInvoker();
Exchange exc = new ExchangeImpl();
exc.put(Endpoint.class, server.getEndpoint());
Message inMessage = new MessageImpl();
exc.setInMessage(inMessage);
exc.put(OperationResourceInfo.class, ori);
invoker.invoke(exc, Collections.emptyList(), customer);
}
use of org.apache.cxf.message.Exchange in project cxf by apache.
the class OperationResourceInfoTest method createMessage.
private Message createMessage() {
Message m = new MessageImpl();
Exchange e = new ExchangeImpl();
m.setExchange(e);
e.setInMessage(m);
Endpoint endpoint = EasyMock.createMock(Endpoint.class);
endpoint.get("org.apache.cxf.jaxrs.comparator");
EasyMock.expectLastCall().andReturn(null);
EasyMock.replay(endpoint);
e.put(Endpoint.class, endpoint);
return m;
}
Aggregations