use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.
the class ColocOutInterceptorTest method verifyIsColocatedWithCompatibleOperation.
private void verifyIsColocatedWithCompatibleOperation() {
colocOut = new TestColocOutInterceptor1();
// Funtion Param
Server s1 = control.createMock(Server.class);
List<Server> list = new ArrayList<>();
list.add(s1);
Endpoint sep = control.createMock(Endpoint.class);
BindingOperationInfo sboi = control.createMock(BindingOperationInfo.class);
// Local var
Service ses = control.createMock(Service.class);
EndpointInfo sei = control.createMock(EndpointInfo.class);
BindingInfo rbi = control.createMock(BindingInfo.class);
Endpoint rep = control.createMock(Endpoint.class);
Service res = control.createMock(Service.class);
EndpointInfo rei = control.createMock(EndpointInfo.class);
BindingOperationInfo rboi = control.createMock(BindingOperationInfo.class);
QName op = new QName("E", "F");
QName intf = new QName("G", "H");
QName inmi = new QName("M", "in");
QName outmi = new QName("M", "out");
ServiceInfo ssi = new ServiceInfo();
InterfaceInfo sii = new InterfaceInfo(ssi, intf);
sii.addOperation(op);
OperationInfo soi = sii.getOperation(op);
MessageInfo mii = new MessageInfo(soi, MessageInfo.Type.INPUT, inmi);
MessagePartInfo mpi = mii.addMessagePart("parameters");
mpi.setTypeClass(Source.class);
MessageInfo mio = new MessageInfo(soi, MessageInfo.Type.OUTPUT, outmi);
mpi = mio.addMessagePart("parameters");
mpi.setTypeClass(Source.class);
soi.setInput("in", mii);
soi.setOutput("out", mio);
ServiceInfo rsi = new ServiceInfo();
InterfaceInfo rii = new InterfaceInfo(rsi, intf);
rii.addOperation(op);
OperationInfo roi = rii.getOperation(op);
mii = new MessageInfo(roi, MessageInfo.Type.INPUT, inmi);
mpi = mii.addMessagePart("parameters");
mpi.setTypeClass(Object.class);
mio = new MessageInfo(roi, MessageInfo.Type.OUTPUT, outmi);
mpi = mio.addMessagePart("parameters");
mpi.setTypeClass(Object.class);
roi.setInput("in", mii);
roi.setOutput("out", mio);
EasyMock.expect(sep.getService()).andReturn(ses);
EasyMock.expect(sep.getEndpointInfo()).andReturn(sei);
EasyMock.expect(s1.getEndpoint()).andReturn(rep);
EasyMock.expect(rep.getService()).andReturn(res);
EasyMock.expect(rep.getEndpointInfo()).andReturn(rei);
EasyMock.expect(ses.getName()).andReturn(new QName("A", "B"));
EasyMock.expect(res.getName()).andReturn(new QName("A", "B"));
EasyMock.expect(rei.getName()).andReturn(new QName("C", "D"));
EasyMock.expect(sei.getName()).andReturn(new QName("C", "D"));
EasyMock.expect(rei.getBinding()).andReturn(rbi);
EasyMock.expect(sboi.getName()).andReturn(op);
EasyMock.expect(sboi.getOperationInfo()).andReturn(soi);
EasyMock.expect(rboi.getName()).andReturn(op);
EasyMock.expect(rboi.getOperationInfo()).andReturn(roi);
EasyMock.expect(rbi.getOperation(op)).andReturn(rboi);
control.replay();
Server val = colocOut.isColocated(list, sep, sboi);
assertEquals("Expecting a colocated call", s1, val);
control.reset();
}
use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.
the class JAXRSBindingFactory method createBindingInfo.
/*
* The concept of Binding can not be applied to JAX-RS. Here we use
* Binding merely to make this JAX-RS impl compatible with CXF framework
*/
public BindingInfo createBindingInfo(Service service, String namespace, Object obj) {
BindingInfo info = new BindingInfo(null, JAXRSBindingFactory.JAXRS_BINDING_ID);
info.setName(new QName(JAXRSBindingFactory.JAXRS_BINDING_ID, "binding"));
return info;
}
use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.
the class ClientImpl method findEndpoint.
private EndpointInfo findEndpoint(Service svc, QName port) {
if (port != null) {
EndpointInfo epfo = svc.getEndpointInfo(port);
if (epfo == null) {
throw new IllegalArgumentException("The service " + svc.getName() + " does not have an endpoint " + port + ".");
}
return epfo;
}
for (ServiceInfo svcfo : svc.getServiceInfos()) {
for (EndpointInfo e : svcfo.getEndpoints()) {
BindingInfo bfo = e.getBinding();
String bid = bfo.getBindingId();
if ("http://schemas.xmlsoap.org/wsdl/soap/".equals(bid) || "http://schemas.xmlsoap.org/wsdl/soap12/".equals(bid)) {
for (Object o : bfo.getExtensors().get()) {
try {
String s = (String) o.getClass().getMethod("getTransportURI").invoke(o);
if (s != null && s.endsWith("http")) {
return e;
}
} catch (Throwable t) {
// ignore
}
}
}
}
}
throw new UnsupportedOperationException("Only document-style SOAP 1.1 and 1.2 http are supported " + "for auto-selection of endpoint; none were found.");
}
use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.
the class CorbaBindingFactoryTest method testCreateBinding.
@Test
public void testCreateBinding() throws Exception {
IMocksControl control = EasyMock.createNiceControl();
BindingInfo bindingInfo = control.createMock(BindingInfo.class);
CorbaBinding binding = (CorbaBinding) factory.createBinding(bindingInfo);
assertNotNull(binding);
assertTrue(CorbaBinding.class.isInstance(binding));
List<Interceptor<? extends Message>> inInterceptors = binding.getInInterceptors();
assertNotNull(inInterceptors);
List<Interceptor<? extends Message>> outInterceptors = binding.getOutInterceptors();
assertNotNull(outInterceptors);
assertEquals(2, inInterceptors.size());
assertEquals(2, outInterceptors.size());
}
use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.
the class SoapTransportFactory method getDestination.
public Destination getDestination(EndpointInfo ei, Bus bus) throws IOException {
String address = ei.getAddress();
BindingInfo bi = ei.getBinding();
String transId = ei.getTransportId();
if (bi instanceof SoapBindingInfo) {
transId = ((SoapBindingInfo) bi).getTransportURI();
if (transId == null) {
transId = ei.getTransportId();
}
}
DestinationFactory destinationFactory;
try {
DestinationFactoryManager mgr = bus.getExtension(DestinationFactoryManager.class);
if (StringUtils.isEmpty(address) || address.startsWith("http") || address.startsWith("jms") || address.startsWith("soap.udp") || address.startsWith("/")) {
destinationFactory = mgr.getDestinationFactory(mapTransportURI(transId, address));
} else {
destinationFactory = mgr.getDestinationFactoryForUri(address);
}
if (destinationFactory == null) {
throw new IOException("Could not find destination factory for transport " + transId);
}
return destinationFactory.getDestination(ei, bus);
} catch (BusException e) {
IOException ex = new IOException("Could not find destination factory for transport " + transId);
ex.initCause(e);
throw ex;
}
}
Aggregations