use of org.apache.cxf.service.model.ServiceInfo in project cxf by apache.
the class ProxyTest method testCreateSequenceResponse.
@Test
public void testCreateSequenceResponse() throws NoSuchMethodException, RMException {
Method m = Proxy.class.getDeclaredMethod("invoke", new Class[] { OperationInfo.class, ProtocolVariation.class, Object[].class, Map.class });
Proxy proxy = EasyMock.createMockBuilder(Proxy.class).addMockedMethod(m).createMock(control);
proxy.setReliableEndpoint(rme);
Endpoint endpoint = control.createMock(Endpoint.class);
EasyMock.expect(rme.getEndpoint(ProtocolVariation.RM10WSA200408)).andReturn(endpoint).anyTimes();
EndpointInfo epi = control.createMock(EndpointInfo.class);
EasyMock.expect(endpoint.getEndpointInfo()).andReturn(epi).anyTimes();
ServiceInfo si = control.createMock(ServiceInfo.class);
EasyMock.expect(epi.getService()).andReturn(si).anyTimes();
InterfaceInfo ii = control.createMock(InterfaceInfo.class);
EasyMock.expect(si.getInterface()).andReturn(ii).anyTimes();
OperationInfo oi = control.createMock(OperationInfo.class);
EasyMock.expect(ii.getOperation(RM10Constants.CREATE_SEQUENCE_RESPONSE_ONEWAY_QNAME)).andReturn(oi).anyTimes();
org.apache.cxf.ws.rm.v200702.CreateSequenceResponseType csr = control.createMock(org.apache.cxf.ws.rm.v200702.CreateSequenceResponseType.class);
expectInvoke(proxy, oi, null);
control.replay();
proxy.createSequenceResponse(csr, ProtocolVariation.RM10WSA200408);
}
use of org.apache.cxf.service.model.ServiceInfo in project cxf by apache.
the class ProxyTest method testLastMessage.
@Test
public void testLastMessage() throws NoSuchMethodException, RMException {
Method m = Proxy.class.getDeclaredMethod("invoke", new Class[] { OperationInfo.class, ProtocolVariation.class, Object[].class, Map.class, Level.class });
Proxy proxy = EasyMock.createMockBuilder(Proxy.class).addMockedMethod(m).createMock(control);
proxy.setReliableEndpoint(rme);
SourceSequence ss = control.createMock(SourceSequence.class);
EasyMock.expect(ss.getProtocol()).andReturn(ProtocolVariation.RM10WSA200408).anyTimes();
EasyMock.expect(ss.getTarget()).andReturn(null).anyTimes();
control.replay();
proxy.lastMessage(ss);
control.verify();
control.reset();
org.apache.cxf.ws.addressing.EndpointReferenceType target = RMUtils.createAnonymousReference();
EasyMock.expect(ss.getTarget()).andReturn(target).anyTimes();
control.replay();
proxy.lastMessage(ss);
control.verify();
control.reset();
target = RMUtils.createReference("http://localhost:9000/greeterPort");
EasyMock.expect(ss.getTarget()).andReturn(target).anyTimes();
EasyMock.expect(ss.getProtocol()).andReturn(ProtocolVariation.RM10WSA200408).anyTimes();
Endpoint endpoint = control.createMock(Endpoint.class);
EasyMock.expect(rme.getEndpoint(ProtocolVariation.RM10WSA200408)).andReturn(endpoint).anyTimes();
EndpointInfo epi = control.createMock(EndpointInfo.class);
EasyMock.expect(endpoint.getEndpointInfo()).andReturn(epi).anyTimes();
ServiceInfo si = control.createMock(ServiceInfo.class);
EasyMock.expect(epi.getService()).andReturn(si).anyTimes();
InterfaceInfo ii = control.createMock(InterfaceInfo.class);
EasyMock.expect(si.getInterface()).andReturn(ii).anyTimes();
OperationInfo oi = control.createMock(OperationInfo.class);
EasyMock.expect(ii.getOperation(RM10Constants.CLOSE_SEQUENCE_QNAME)).andReturn(oi).anyTimes();
expectInvokeWithContext(proxy, oi, null);
control.replay();
proxy.lastMessage(ss);
}
use of org.apache.cxf.service.model.ServiceInfo in project cxf by apache.
the class RMEndpointTest method testGetUsingAddressing.
@Test
public void testGetUsingAddressing() {
EndpointInfo ei = null;
control.replay();
assertNull(rme.getUsingAddressing(ei));
control.verify();
control.reset();
ExtensibilityElement ua = control.createMock(ExtensibilityElement.class);
ei = control.createMock(EndpointInfo.class);
List<ExtensibilityElement> noExts = new ArrayList<>();
List<ExtensibilityElement> exts = new ArrayList<>();
exts.add(ua);
EasyMock.expect(ei.getExtensors(ExtensibilityElement.class)).andReturn(noExts);
BindingInfo bi = control.createMock(BindingInfo.class);
EasyMock.expect(ei.getBinding()).andReturn(bi).times(2);
EasyMock.expect(bi.getExtensors(ExtensibilityElement.class)).andReturn(noExts);
ServiceInfo si = control.createMock(ServiceInfo.class);
EasyMock.expect(ei.getService()).andReturn(si).times(2);
EasyMock.expect(si.getExtensors(ExtensibilityElement.class)).andReturn(exts);
EasyMock.expect(ua.getElementType()).andReturn(Names.WSAW_USING_ADDRESSING_QNAME);
control.replay();
assertSame(ua, rme.getUsingAddressing(ei));
}
use of org.apache.cxf.service.model.ServiceInfo in project cxf by apache.
the class ServiceWSDLBuilder method build.
/**
* Create the WSDL Definition object and return it. This function respects the
* setting of {@link #setUseSchemaImports(boolean)}.
* @param imports A set of schema imports to either reference as imports or read and
* then inline.
* @return the WSDL definition
* @throws WSDLException
*/
public Definition build(Map<String, SchemaInfo> imports) throws WSDLException {
Definition definition = null;
try {
definition = services.get(0).getProperty(WSDLServiceBuilder.WSDL_DEFINITION, Definition.class);
} catch (ClassCastException e) {
// ignore
}
if (definition == null) {
ServiceInfo si = services.get(0);
definition = newDefinition(si.getName(), si.getTargetNamespace());
addNamespace(WSDLConstants.CONVENTIONAL_TNS_PREFIX, si.getTargetNamespace(), definition);
addExtensibilityElements(definition, definition, getWSDL11Extensors(si.getDescription()));
Collection<PortType> portTypes = new HashSet<>();
for (ServiceInfo service : services) {
Definition portTypeDef = definition;
Definition orig = definition;
if (!isSameTNS(service)) {
portTypeDef = newDefinition(service.getInterface().getName(), service.getInterface().getName().getNamespaceURI());
Import wsdlImport = definition.createImport();
String tns = service.getInterface().getName().getNamespaceURI();
wsdlImport.setDefinition(portTypeDef);
wsdlImport.setNamespaceURI(tns);
wsdlImport.setLocationURI(service.getInterface().getName().getLocalPart() + ".wsdl");
definition.addImport(wsdlImport);
addNamespace(getPrefix(tns), tns, definition);
}
portTypes.add(buildPortType(service.getInterface(), portTypeDef));
if (service.getSchemas() != null && service.getSchemas().size() > 0) {
if (!useSchemaImports) {
buildTypes(service.getSchemas(), imports, portTypeDef);
} else {
buildTypesWithSchemaImports(service.getSchemas(), imports, portTypeDef);
}
}
definition = orig;
}
for (ServiceInfo service : services) {
buildBinding(definition, service.getBindings(), portTypes);
buildService(service, definition);
}
}
return definition;
}
use of org.apache.cxf.service.model.ServiceInfo in project cxf by apache.
the class ReflectionServiceFactoryBean method createEndpoints.
protected void createEndpoints() {
Service service = getService();
BindingFactoryManager bfm = getBus().getExtension(BindingFactoryManager.class);
for (ServiceInfo inf : service.getServiceInfos()) {
for (EndpointInfo ei : inf.getEndpoints()) {
for (BindingOperationInfo boi : ei.getBinding().getOperations()) {
updateBindingOperation(boi);
}
try {
bfm.getBindingFactory(ei.getBinding().getBindingId());
} catch (BusException e1) {
continue;
}
try {
Endpoint ep = createEndpoint(ei);
service.getEndpoints().put(ei.getName(), ep);
} catch (EndpointException e) {
throw new ServiceConstructionException(e);
}
}
}
}
Aggregations