use of org.apache.cxf.wsdl11.CatalogWSDLLocator in project cxf by apache.
the class WSDLGenerationTester method writeDefinition.
public File writeDefinition(File targetDir, File defnFile) throws Exception {
WSDLManager wm = BusFactory.getThreadDefaultBus().getExtension(WSDLManager.class);
WSDLFactory factory = WSDLFactory.newInstance("org.apache.cxf.tools.corba.utils.TestWSDLCorbaFactoryImpl");
WSDLReader reader = factory.newWSDLReader();
reader.setFeature("javax.wsdl.importDocuments", false);
reader.setExtensionRegistry(wm.getExtensionRegistry());
final String url = defnFile.toString();
CatalogWSDLLocator locator = new CatalogWSDLLocator(url, (Bus) null);
Definition wsdlDefn = reader.readWSDL(locator);
File bkFile = new File(targetDir, "bk_" + defnFile.getName());
try (Writer writer = Files.newBufferedWriter(bkFile.toPath())) {
factory.newWSDLWriter().writeWSDL(wsdlDefn, writer);
}
return bkFile;
}
use of org.apache.cxf.wsdl11.CatalogWSDLLocator in project cxf by apache.
the class JaxWsServiceConfigurationTest method getMockedServiceModel.
private ServiceInfo getMockedServiceModel(String wsdlUrl) throws Exception {
WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
wsdlReader.setFeature("javax.wsdl.verbose", false);
Definition def = wsdlReader.readWSDL(new CatalogWSDLLocator(wsdlUrl));
IMocksControl control = EasyMock.createNiceControl();
Bus bus = control.createMock(Bus.class);
BindingFactoryManager bindingFactoryManager = control.createMock(BindingFactoryManager.class);
DestinationFactoryManager dfm = control.createMock(DestinationFactoryManager.class);
WSDLServiceBuilder wsdlServiceBuilder = new WSDLServiceBuilder(bus);
Service service = null;
for (Iterator<?> it = def.getServices().values().iterator(); it.hasNext(); ) {
Object obj = it.next();
if (obj instanceof Service) {
service = (Service) obj;
break;
}
}
EasyMock.expect(bus.getExtension(BindingFactoryManager.class)).andReturn(bindingFactoryManager);
EasyMock.expect(bus.getExtension(DestinationFactoryManager.class)).andStubReturn(dfm);
control.replay();
ServiceInfo serviceInfo = wsdlServiceBuilder.buildServices(def, service).get(0);
serviceInfo.setProperty(WSDLServiceBuilder.WSDL_DEFINITION, null);
serviceInfo.setProperty(WSDLServiceBuilder.WSDL_SERVICE, null);
return serviceInfo;
}
use of org.apache.cxf.wsdl11.CatalogWSDLLocator in project cxf by apache.
the class OASISCatalogTest method testWSDLLocatorWithDefaultCatalog.
@Test
public void testWSDLLocatorWithDefaultCatalog() throws Exception {
URL wsdl = getClass().getResource("/wsdl/catalog/hello_world_services.wsdl");
assertNotNull(wsdl);
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
CatalogWSDLLocator wsdlLocator = new CatalogWSDLLocator(wsdl.toString(), OASISCatalogManager.getCatalogManager(null));
wsdlReader.setFeature("javax.wsdl.verbose", false);
wsdlReader.readWSDL(wsdlLocator);
}
use of org.apache.cxf.wsdl11.CatalogWSDLLocator in project cxf by apache.
the class OASISCatalogTest method testWSDLLocatorWithoutCatalog.
@Test
public void testWSDLLocatorWithoutCatalog() throws Exception {
URL wsdl = getClass().getResource("/wsdl/catalog/hello_world_services.wsdl");
assertNotNull(wsdl);
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
wsdlReader.setFeature("javax.wsdl.verbose", false);
OASISCatalogManager catalog = new OASISCatalogManager();
CatalogWSDLLocator wsdlLocator = new CatalogWSDLLocator(wsdl.toString(), catalog);
try {
wsdlReader.readWSDL(wsdlLocator);
fail("Test did not fail as expected");
} catch (WSDLException e) {
// ignore
}
}
Aggregations