@Test public void testObjectFactoryCheckSum() throws Exception { File path = getCodegenQEDataFileInput("AccountService.wsdl"); String[] testArgs = { "-serviceName", "AccountService", "-genType", "ServiceFromWSDLIntf", "-wsdl", path.getAbsolutePath(), "-namespace", "http://www.ebayopensource.org/marketplace/service", "-dest", destDir.getAbsolutePath(), "-src", destDir.getAbsolutePath(), "-slayer", "INTERMEDIATE", "-jdest", destDir.getAbsolutePath() + "/gen-src/client", "-bin", binDir.getAbsolutePath(), "-scv", "1.0.0", "-pr", destDir.getAbsolutePath() }; Set<String> targetNS = WsdlParserUtil.getAllTargetNamespces(path.getAbsolutePath()); List<String> packageList = new ArrayList<String>(); Iterator<String> it = targetNS.iterator(); while (it.hasNext()) { packageList.add(WSDLUtil.getPackageFromNamespace(it.next())); } for (int i = 0; i < 5; i++) { performDirectCodeGen(testArgs, binDir); File objectFactory = null; for (String pkg : packageList) { String p = pkg.replace(".", "/"); objectFactory = new File(destDir.getAbsolutePath() + "/gen-src/client/" + p + "/ObjectFactory.java"); FileUtils.copyFile( objectFactory.getAbsolutePath(), getObjectFactoryFile(p).getAbsolutePath()); } } for (String pkg : packageList) { String p = pkg.replace(".", "/"); File file = new File(destDir.getAbsolutePath() + "/objFactory/" + p); Assert.assertTrue(fileCompare(file)); } }
@Test public void CheckWsdlWithPublicServiceName() { File wsdl = getCodegenQEDataFileInput("Testing1.wsdl"); System.out.println( "*****************CheckWsdlWithPublicServiceName Starts*************************"); String publicServiceWsdlPath = destDir.getAbsolutePath() + "/gen-meta-src/META-INF/soa/services/wsdl/MyServiceV1/MyServiceV1_public.wsdl"; boolean isException = false; ServiceGenerator servicegenerator = createServiceGenerator(); try { String[] testArgs = new String[] { "-servicename", "MyServiceV1", "-wsdl", wsdl.getAbsolutePath(), "-genType", "ServiceMetadataProps", "-publicservicename", "MyService", "-pr", destDir.getAbsolutePath() }; servicegenerator.startCodeGen(testArgs); } catch (Exception e) { isException = true; assertFalse(true); } assertFalse(isException); File modifiedWsdlPath = new File(publicServiceWsdlPath); /*Quick Bug 6570 fir the wsdl not created at the required wsl location with Ad Commerce support .*/ assertTrue(modifiedWsdlPath.exists()); String serviceName = null; /*Test case # 1 and 2 Validate that the service wsdl is created at required location and consist of service name tag value as public service name*/ try { serviceName = WSDLUtil.getFirstServiceQName(publicServiceWsdlPath).getLocalPart(); } catch (PreProcessFailedException e) { assertTrue(false); } /*Bug Id :: 6567 for the wsdl not updated with the public service name*/ assertEquals("MyService", serviceName); System.out.println( "*************************CheckWsdlWithPublicServiceName Ends*****************************"); }