use of org.apache.cxf.message.ExchangeImpl in project cxf by apache.
the class ColocOutInterceptorTest method setUp.
@Before
public void setUp() throws Exception {
colocOut = new ColocOutInterceptor();
msg = new MessageImpl();
ex = new ExchangeImpl();
msg.setExchange(ex);
}
use of org.apache.cxf.message.ExchangeImpl in project cxf by apache.
the class ProviderFactoryTest method prepareMessage.
private Message prepareMessage(String contentType, String acceptType) {
Message message = new MessageImpl();
Map<String, List<String>> headers = new MetadataMap<>();
message.put(Message.PROTOCOL_HEADERS, headers);
Exchange exchange = new ExchangeImpl();
exchange.setInMessage(message);
if (acceptType != null) {
headers.put("Accept", Collections.singletonList(acceptType));
exchange.setOutMessage(new MessageImpl());
} else {
headers.put("Content-Type", Collections.singletonList(contentType));
}
message.put("Content-Type", contentType);
message.setExchange(exchange);
return message;
}
use of org.apache.cxf.message.ExchangeImpl in project cxf by apache.
the class SpringViewResolverProviderTest method setUp.
@Before
public void setUp() {
this.viewResolver = new SpringViewResolverProvider(viewResolverMock, localeResolverMock);
ExchangeImpl exchange = new ExchangeImpl();
Endpoint endpoint = new MockEndpoint();
endpoint.put(ServerProviderFactory.class.getName(), ServerProviderFactory.getInstance());
exchange.put(Endpoint.class, endpoint);
exchange.put(ServerProviderFactory.class.getName(), ServerProviderFactory.getInstance());
MessageImpl message = new MessageImpl();
message.setExchange(exchange);
message.put(AbstractHTTPDestination.HTTP_REQUEST, requestMock);
message.put(AbstractHTTPDestination.HTTP_RESPONSE, responseMock);
message.put(AbstractHTTPDestination.HTTP_CONTEXT, servletContextMock);
viewResolver.setMessageContext(new MessageContextImpl(message));
}
use of org.apache.cxf.message.ExchangeImpl 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.ExchangeImpl in project cxf by apache.
the class HttpUtilsTest method testUpdatePath.
@Test
public void testUpdatePath() {
Message m = new MessageImpl();
m.setExchange(new ExchangeImpl());
m.put(Message.ENDPOINT_ADDRESS, "http://localhost/");
HttpUtils.updatePath(m, "/bar");
assertEquals("/bar", m.get(Message.REQUEST_URI));
HttpUtils.updatePath(m, "bar");
assertEquals("/bar", m.get(Message.REQUEST_URI));
HttpUtils.updatePath(m, "bar/");
assertEquals("/bar/", m.get(Message.REQUEST_URI));
m.put(Message.ENDPOINT_ADDRESS, "http://localhost");
HttpUtils.updatePath(m, "bar/");
assertEquals("/bar/", m.get(Message.REQUEST_URI));
}
Aggregations