use of org.apache.cxf.service.model.ServiceInfo in project cxf by apache.
the class ColocOutInterceptorTest method verifyIsColocatedWithDifferentOperation.
private void verifyIsColocatedWithDifferentOperation() {
// 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);
ServiceInfo ssi = control.createMock(ServiceInfo.class);
EndpointInfo sei = control.createMock(EndpointInfo.class);
TestBindingInfo rbi = new TestBindingInfo(ssi, "testBinding");
Endpoint rep = control.createMock(Endpoint.class);
Service res = control.createMock(Service.class);
EndpointInfo rei = control.createMock(EndpointInfo.class);
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(new QName("E", "F"));
// Causes ConcurrentModification intermittently
// QName op = new QName("E", "F");
// EasyMock.expect(rbi.getOperation(op).andReturn(null);
control.replay();
Server val = colocOut.isColocated(list, sep, sboi);
assertEquals("Is not a colocated call", null, val);
assertEquals("BindingOperation.getOperation was not called", 1, rbi.getOpCount());
control.reset();
}
use of org.apache.cxf.service.model.ServiceInfo in project cxf by apache.
the class StaxDataBinding method initialize.
public void initialize(Service service) {
for (ServiceInfo serviceInfo : service.getServiceInfos()) {
SchemaCollection schemaCollection = serviceInfo.getXmlSchemaCollection();
if (schemaCollection.getXmlSchemas().length > 1) {
// Schemas are already populated.
continue;
}
new ServiceModelVisitor(serviceInfo) {
@Override
public void begin(MessagePartInfo part) {
if (part.getTypeQName() != null || part.getElementQName() != null) {
return;
}
part.setTypeQName(Constants.XSD_ANYTYPE);
}
}.walk();
}
}
use of org.apache.cxf.service.model.ServiceInfo 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.ServiceInfo in project cxf by apache.
the class SoapBindingFactory method addMessageFromBinding.
protected void addMessageFromBinding(ExtensibilityElement ext, BindingOperationInfo bop, boolean isInput) {
SoapHeader header = SOAPBindingUtil.getSoapHeader(ext);
ServiceInfo serviceInfo = bop.getBinding().getService();
if (header != null && header.getMessage() == null) {
throw new RuntimeException("Problem with WSDL: soap:header element" + " for operation " + bop.getName() + " under binding " + bop.getBinding().getName() + " does not contain a valid message attribute.");
}
if (header != null && serviceInfo.getMessage(header.getMessage()) == null) {
Definition def = (Definition) serviceInfo.getProperty(WSDLServiceBuilder.WSDL_DEFINITION);
SchemaCollection schemas = serviceInfo.getXmlSchemaCollection();
if (def != null && schemas != null) {
QName qn = header.getMessage();
javax.wsdl.Message msg = findMessage(qn, def);
if (msg != null) {
addOutOfBandParts(bop, msg, schemas, isInput, header.getPart());
serviceInfo.refresh();
} else {
throw new RuntimeException("Problem with WSDL: soap:header element" + " for operation " + bop.getName() + " is referring to an undefined wsdl:message element: " + qn);
}
}
}
}
use of org.apache.cxf.service.model.ServiceInfo in project cxf by apache.
the class CorbaConduitTest method testBuildRequest.
@Test
public void testBuildRequest() throws Exception {
CorbaConduit conduit = setupCorbaConduit(false);
CorbaMessage message = control.createMock(CorbaMessage.class);
Exchange exchange = control.createMock(Exchange.class);
EasyMock.expect(message.getExchange());
EasyMock.expectLastCall().andReturn(exchange);
ServiceInfo service = control.createMock(ServiceInfo.class);
EasyMock.expect(exchange.get(ServiceInfo.class)).andReturn(service);
List<CorbaTypeMap> list = control.createMock(List.class);
CorbaTypeMap typeMap = control.createMock(CorbaTypeMap.class);
EasyMock.expect(service.getExtensors(CorbaTypeMap.class)).andReturn(list);
OperationType opType = control.createMock(OperationType.class);
conduit.getArguments(message);
EasyMock.expectLastCall().andReturn(null);
conduit.getReturn(message);
EasyMock.expectLastCall().andReturn(null);
conduit.getExceptionList(conduit.getOperationExceptions(opType, typeMap), message, opType);
EasyMock.expectLastCall().andReturn(null);
conduit.getRequest(message, "Hello", null, null, null);
EasyMock.expectLastCall();
}
Aggregations