Search in sources :

Example 31 with Destination

use of org.apache.cxf.transport.Destination in project cxf by apache.

the class MAPAggregatorTest method testGetReplyToUsingBaseAddress.

@Test
public void testGetReplyToUsingBaseAddress() throws Exception {
    Message message = new MessageImpl();
    Exchange exchange = new ExchangeImpl();
    message.setExchange(exchange);
    final String localReplyTo = "/SoapContext/decoupled";
    final String decoupledEndpointBase = "http://localhost:8181/cxf";
    final String replyTo = decoupledEndpointBase + localReplyTo;
    ServiceInfo s = new ServiceInfo();
    Service svc = new ServiceImpl(s);
    EndpointInfo ei = new EndpointInfo();
    InterfaceInfo ii = s.createInterface(new QName("FooInterface"));
    s.setInterface(ii);
    ii.addOperation(new QName("fooOp"));
    SoapBindingInfo b = new SoapBindingInfo(s, "http://schemas.xmlsoap.org/soap/", Soap11.getInstance());
    b.setTransportURI("http://schemas.xmlsoap.org/soap/http");
    ei.setBinding(b);
    ei.setAddress("http://nowhere.com/bar/foo");
    ei.setName(new QName("http://nowhere.com/port", "foo"));
    Bus bus = new ExtensionManagerBus();
    DestinationFactoryManager dfm = control.createMock(DestinationFactoryManager.class);
    DestinationFactory df = control.createMock(DestinationFactory.class);
    Destination d = control.createMock(Destination.class);
    bus.setExtension(dfm, DestinationFactoryManager.class);
    EasyMock.expect(dfm.getDestinationFactoryForUri(localReplyTo)).andReturn(df);
    EasyMock.expect(df.getDestination(EasyMock.anyObject(EndpointInfo.class), EasyMock.anyObject(Bus.class))).andReturn(d);
    EasyMock.expect(d.getAddress()).andReturn(EndpointReferenceUtils.getEndpointReference(localReplyTo));
    Endpoint ep = new EndpointImpl(bus, svc, ei);
    exchange.put(Endpoint.class, ep);
    exchange.put(Bus.class, bus);
    exchange.setOutMessage(message);
    setUpMessageProperty(message, REQUESTOR_ROLE, Boolean.TRUE);
    message.getContextualProperty(WSAContextUtils.REPLYTO_PROPERTY);
    message.put(WSAContextUtils.REPLYTO_PROPERTY, localReplyTo);
    message.put(WSAContextUtils.DECOUPLED_ENDPOINT_BASE_PROPERTY, decoupledEndpointBase);
    AddressingProperties maps = new AddressingProperties();
    AttributedURIType id = ContextUtils.getAttributedURI("urn:uuid:12345");
    maps.setMessageID(id);
    maps.setAction(ContextUtils.getAttributedURI(""));
    setUpMessageProperty(message, CLIENT_ADDRESSING_PROPERTIES, maps);
    control.replay();
    aggregator.mediate(message, false);
    AddressingProperties props = (AddressingProperties) message.get(JAXWSAConstants.ADDRESSING_PROPERTIES_OUTBOUND);
    assertEquals(replyTo, props.getReplyTo().getAddress().getValue());
    control.verify();
}
Also used : Bus(org.apache.cxf.Bus) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) DestinationFactory(org.apache.cxf.transport.DestinationFactory) Destination(org.apache.cxf.transport.Destination) Message(org.apache.cxf.message.Message) DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager) ServiceImpl(org.apache.cxf.service.ServiceImpl) QName(javax.xml.namespace.QName) EndpointImpl(org.apache.cxf.endpoint.EndpointImpl) AttributedURIType(org.apache.cxf.ws.addressing.AttributedURIType) Service(org.apache.cxf.service.Service) Exchange(org.apache.cxf.message.Exchange) ServiceInfo(org.apache.cxf.service.model.ServiceInfo) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Endpoint(org.apache.cxf.endpoint.Endpoint) SoapBindingInfo(org.apache.cxf.binding.soap.model.SoapBindingInfo) AddressingProperties(org.apache.cxf.ws.addressing.AddressingProperties) InterfaceInfo(org.apache.cxf.service.model.InterfaceInfo) MessageImpl(org.apache.cxf.message.MessageImpl) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) ExchangeImpl(org.apache.cxf.message.ExchangeImpl) Test(org.junit.Test)

Example 32 with Destination

use of org.apache.cxf.transport.Destination in project cxf by apache.

the class ConnectionFactoryFeature method initialize.

@Override
public void initialize(Server server, Bus bus) {
    Destination destination = server.getDestination();
    if (destination instanceof JMSDestination) {
        JMSDestination jmsDestination = (JMSDestination) destination;
        jmsDestination.getJmsConfig().setConnectionFactory(connectionFactory);
    }
    super.initialize(server, bus);
}
Also used : Destination(org.apache.cxf.transport.Destination)

Example 33 with Destination

use of org.apache.cxf.transport.Destination in project cxf by apache.

the class JMSConfigFeature method initialize.

@Override
public void initialize(Server server, Bus bus) {
    checkJmsConfig();
    Destination destination = server.getDestination();
    if (!(destination instanceof JMSDestination)) {
        throw new ConfigurationException(new Message("JMSCONFIGFEATURE_ONLY_JMS", LOG));
    }
    JMSDestination jmsDestination = (JMSDestination) destination;
    jmsDestination.setJmsConfig(jmsConfig);
    super.initialize(server, bus);
}
Also used : Destination(org.apache.cxf.transport.Destination) Message(org.apache.cxf.common.i18n.Message) ConfigurationException(org.apache.cxf.configuration.ConfigurationException)

Example 34 with Destination

use of org.apache.cxf.transport.Destination in project cxf by apache.

the class PolicyEngineTest method testSetEffectiveServerFaultPolicy.

@Test
public void testSetEffectiveServerFaultPolicy() throws Exception {
    engine = new PolicyEngineImpl();
    EndpointInfo ei = createMockEndpointInfo();
    BindingFaultInfo bfi = new BindingFaultInfo(null, null);
    EffectivePolicy epi = control.createMock(EffectivePolicy.class);
    engine.setEffectiveServerFaultPolicy(ei, bfi, epi);
    assertSame(epi, engine.getEffectiveServerFaultPolicy(ei, null, bfi, (Destination) null, msg));
}
Also used : EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Destination(org.apache.cxf.transport.Destination) BindingFaultInfo(org.apache.cxf.service.model.BindingFaultInfo) Test(org.junit.Test)

Example 35 with Destination

use of org.apache.cxf.transport.Destination in project cxf by apache.

the class PolicyEngineTest method testSetEffectiveServerResponsePolicy.

@Test
public void testSetEffectiveServerResponsePolicy() throws Exception {
    engine = new PolicyEngineImpl();
    EndpointInfo ei = createMockEndpointInfo();
    BindingOperationInfo boi = createMockBindingOperationInfo();
    EffectivePolicy effectivePolicy = control.createMock(EffectivePolicy.class);
    control.replay();
    engine.setEffectiveServerResponsePolicy(ei, boi, effectivePolicy);
    assertSame(effectivePolicy, engine.getEffectiveServerResponsePolicy(ei, boi, (Destination) null, null, msg));
    control.verify();
}
Also used : EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Destination(org.apache.cxf.transport.Destination) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) Test(org.junit.Test)

Aggregations

Destination (org.apache.cxf.transport.Destination)41 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)25 Test (org.junit.Test)14 Message (org.apache.cxf.message.Message)13 QName (javax.xml.namespace.QName)12 Bus (org.apache.cxf.Bus)12 Exchange (org.apache.cxf.message.Exchange)12 Conduit (org.apache.cxf.transport.Conduit)11 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)8 AbstractHTTPDestination (org.apache.cxf.transport.http.AbstractHTTPDestination)8 Endpoint (org.apache.cxf.endpoint.Endpoint)7 DestinationFactory (org.apache.cxf.transport.DestinationFactory)7 DestinationFactoryManager (org.apache.cxf.transport.DestinationFactoryManager)7 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)6 HTTPTransportFactory (org.apache.cxf.transport.http.HTTPTransportFactory)6 MessageObserver (org.apache.cxf.transport.MessageObserver)5 IOException (java.io.IOException)4 Fault (org.apache.cxf.interceptor.Fault)4 ConduitInitiator (org.apache.cxf.transport.ConduitInitiator)4 Policy (org.apache.neethi.Policy)4