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();
}
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);
}
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);
}
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));
}
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();
}
Aggregations