use of org.apache.cxf.service.model.InterfaceInfo 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.InterfaceInfo in project cxf by apache.
the class RMManagerTest method testRecoverReliableClientEndpointWithAttachment.
@Test
public void testRecoverReliableClientEndpointWithAttachment() throws NoSuchMethodException, IOException {
Method method = RMManager.class.getDeclaredMethod("createReliableEndpoint", new Class[] { Endpoint.class });
manager = control.createMock(RMManager.class, new Method[] { method });
manager.setReliableEndpointsMap(new HashMap<Endpoint, RMEndpoint>());
Endpoint endpoint = control.createMock(Endpoint.class);
EndpointInfo ei = control.createMock(EndpointInfo.class);
ServiceInfo si = control.createMock(ServiceInfo.class);
BindingInfo bi = control.createMock(BindingInfo.class);
InterfaceInfo ii = control.createMock(InterfaceInfo.class);
setUpEndpointForRecovery(endpoint, ei, si, bi, ii);
Conduit conduit = control.createMock(Conduit.class);
SourceSequence ss = control.createMock(SourceSequence.class);
DestinationSequence ds = control.createMock(DestinationSequence.class);
RMMessage m1 = new RMMessage();
InputStream fis = getClass().getResourceAsStream("persistence/SerializedRMMessage.txt");
CachedOutputStream cos = new CachedOutputStream();
IOUtils.copyAndCloseInput(fis, cos);
cos.flush();
m1.setContent(cos);
m1.setTo("toAddress");
m1.setMessageNumber(new Long(10));
m1.setContentType(MULTIPART_TYPE);
Capture<Message> mc = Capture.newInstance();
setUpRecoverReliableEndpointWithAttachment(endpoint, conduit, ss, ds, m1, mc);
control.replay();
manager.recoverReliableEndpoint(endpoint, conduit);
control.verify();
Message msg = mc.getValue();
assertNotNull(msg);
assertNotNull(msg.getExchange());
assertSame(msg, msg.getExchange().getOutMessage());
CachedOutputStream cos1 = (CachedOutputStream) msg.get(RMMessageConstants.SAVED_CONTENT);
assertStartsWith(cos1.getInputStream(), "<soap:Envelope");
assertEquals(1, msg.getAttachments().size());
}
use of org.apache.cxf.service.model.InterfaceInfo in project cxf by apache.
the class RMManagerTest method testRecoverReliableClientEndpoint.
@Test
public void testRecoverReliableClientEndpoint() throws NoSuchMethodException, IOException {
Method method = RMManager.class.getDeclaredMethod("createReliableEndpoint", new Class[] { Endpoint.class });
manager = control.createMock(RMManager.class, new Method[] { method });
manager.setReliableEndpointsMap(new HashMap<Endpoint, RMEndpoint>());
Endpoint endpoint = control.createMock(Endpoint.class);
EndpointInfo ei = control.createMock(EndpointInfo.class);
ServiceInfo si = control.createMock(ServiceInfo.class);
BindingInfo bi = control.createMock(BindingInfo.class);
InterfaceInfo ii = control.createMock(InterfaceInfo.class);
setUpEndpointForRecovery(endpoint, ei, si, bi, ii);
Conduit conduit = control.createMock(Conduit.class);
setUpRecoverReliableEndpoint(endpoint, conduit, null, null, null);
control.replay();
manager.recoverReliableEndpoint(endpoint, conduit);
control.verify();
control.reset();
setUpEndpointForRecovery(endpoint, ei, si, bi, ii);
SourceSequence ss = control.createMock(SourceSequence.class);
DestinationSequence ds = control.createMock(DestinationSequence.class);
setUpRecoverReliableEndpoint(endpoint, conduit, ss, ds, null);
control.replay();
manager.recoverReliableEndpoint(endpoint, conduit);
control.verify();
control.reset();
setUpEndpointForRecovery(endpoint, ei, si, bi, ii);
RMMessage m = control.createMock(RMMessage.class);
setUpRecoverReliableEndpoint(endpoint, conduit, ss, ds, m);
control.replay();
manager.recoverReliableEndpoint(endpoint, conduit);
control.verify();
}
use of org.apache.cxf.service.model.InterfaceInfo in project cxf by apache.
the class RMEndpoint method buildInterfaceInfo.
void buildInterfaceInfo(ServiceInfo si, ProtocolVariation protocol) {
QName interfaceQName = new QName(protocol.getWSRMNamespace(), INTERFACE_NAME);
InterfaceInfo ii = new InterfaceInfo(si, interfaceQName);
buildOperationInfo(ii, protocol);
}
use of org.apache.cxf.service.model.InterfaceInfo in project cxf by apache.
the class JavaScriptContainer method execute.
@SuppressWarnings("unchecked")
public void execute() throws ToolException {
if (hasInfoOption()) {
return;
}
buildToolContext();
validate(context);
WSDLConstants.WSDLVersion version = getWSDLVersion();
String wsdlURL = (String) context.get(ToolConstants.CFG_WSDLURL);
List<ServiceInfo> serviceList = (List<ServiceInfo>) context.get(ToolConstants.SERVICE_LIST);
if (serviceList == null) {
serviceList = new ArrayList<>();
PluginLoader pluginLoader = PluginLoader.newInstance();
// for JavaScript generation, we always use JAX-WS.
FrontEndProfile frontend = pluginLoader.getFrontEndProfile("jaxws");
// Build the ServiceModel from the WSDLModel
if (version == WSDLConstants.WSDLVersion.WSDL11) {
AbstractWSDLBuilder builder = frontend.getWSDLBuilder();
builder.setContext(context);
builder.setBus(getBus());
context.put(Bus.class, getBus());
builder.build(URIParserUtil.getAbsoluteURI(wsdlURL));
builder.customize();
Definition definition = builder.getWSDLModel();
context.put(Definition.class, definition);
builder.validate(definition);
WSDLServiceBuilder serviceBuilder = new WSDLServiceBuilder(getBus());
String serviceName = (String) context.get(ToolConstants.CFG_SERVICENAME);
if (serviceName != null) {
List<ServiceInfo> services = serviceBuilder.buildServices(definition, getServiceQName(definition));
serviceList.addAll(services);
} else if (definition.getServices().size() > 0) {
serviceList = serviceBuilder.buildServices(definition);
} else {
serviceList = serviceBuilder.buildMockServices(definition);
}
} else {
// TODO: wsdl2.0 support
throw new ToolException("Only WSDL 1.1 supported");
}
}
if (serviceList.isEmpty()) {
throw new ToolException("Did not find any services in WSDL");
}
Map<String, InterfaceInfo> interfaces = new LinkedHashMap<String, InterfaceInfo>();
ServiceInfo service0 = serviceList.get(0);
SchemaCollection schemaCollection = service0.getXmlSchemaCollection();
context.put(ToolConstants.XML_SCHEMA_COLLECTION, schemaCollection);
context.put(ToolConstants.PORTTYPE_MAP, interfaces);
context.put(ClassCollector.class, new ClassCollector());
WSDLToJavaScriptProcessor processor = new WSDLToJavaScriptProcessor();
for (ServiceInfo service : serviceList) {
context.put(ServiceInfo.class, service);
validate(service);
processor.setEnvironment(context);
processor.process();
}
}
Aggregations