Search in sources :

Example 36 with ExchangeImpl

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);
}
Also used : MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl) Before(org.junit.Before)

Example 37 with ExchangeImpl

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;
}
Also used : Exchange(org.apache.cxf.message.Exchange) MetadataMap(org.apache.cxf.jaxrs.impl.MetadataMap) Message(org.apache.cxf.message.Message) List(java.util.List) ArrayList(java.util.ArrayList) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl)

Example 38 with ExchangeImpl

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));
}
Also used : ServerProviderFactory(org.apache.cxf.jaxrs.provider.ServerProviderFactory) Endpoint(org.apache.cxf.endpoint.Endpoint) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl) MessageContextImpl(org.apache.cxf.jaxrs.ext.MessageContextImpl) Before(org.junit.Before)

Example 39 with ExchangeImpl

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;
}
Also used : Exchange(org.apache.cxf.message.Exchange) Message(org.apache.cxf.message.Message) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl)

Example 40 with ExchangeImpl

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));
}
Also used : Message(org.apache.cxf.message.Message) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl) Test(org.junit.Test)

Aggregations

ExchangeImpl (org.apache.cxf.message.ExchangeImpl)227 MessageImpl (org.apache.cxf.message.MessageImpl)189 Message (org.apache.cxf.message.Message)166 Exchange (org.apache.cxf.message.Exchange)159 Test (org.junit.Test)107 Endpoint (org.apache.cxf.endpoint.Endpoint)42 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)30 ByteArrayInputStream (java.io.ByteArrayInputStream)28 QName (javax.xml.namespace.QName)23 Bus (org.apache.cxf.Bus)23 HashMap (java.util.HashMap)22 List (java.util.List)22 SoapMessage (org.apache.cxf.binding.soap.SoapMessage)21 ByteArrayOutputStream (java.io.ByteArrayOutputStream)20 SOAPMessage (javax.xml.soap.SOAPMessage)16 LogEvent (org.apache.cxf.ext.logging.event.LogEvent)16 ArrayList (java.util.ArrayList)15 IOException (java.io.IOException)14 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)14 Conduit (org.apache.cxf.transport.Conduit)14