/** * Test for modification of TypeIformation.xml * * <p>Quick bug 638 * * @throws IOException */ @Test public void testGenTypeCleanBuildTypeLibrarySimpleType() throws IOException { String folderConstant = "cleanBuildTypeLibrarySimpleType"; String xsdFileName = "CategoryName.xsd"; // create library boolean createLibraryFlag = createTypeLibrary(); assertTrue("Problem occured during Library creation.", createLibraryFlag); TestResourceUtil.copyResource( "types/CategoryName.xsd", testingdir, "CategoryTypeLibrary/meta-src/"); // add types boolean addType = addTypeToLibrary(xsdFileName); assertTrue("Problem occured during Type addition.", addType); // modify TypeInformation.xml String newTIXmlPath = getTestResrcDir().getAbsolutePath() + "/TypeLibraryCodegen/CategoryTypeLibrary/gen-meta-src/META-INF/CategoryTypeLibrary/cleanBuildTypeLibrarySimpleType/" + TYPE_INFO; String oldTIXmlPath = utility.getTypeInformationXMLPath(PROJECT_ROOT_CATEGORY, CATEGORY_TYPE_LIBRARY, null); MavenTestingUtils.ensureEmpty(testingdir.getFile("gen-meta-src")); MavenTestingUtils.ensureEmpty(testingdir.getFile("gen-src")); // Validate the changes. ServiceGenerator sGenerator = new ServiceGenerator(); String[] pluginParameter = { "-gentype", "genTypeCleanBuildTypeLibrary", "-pr", PROJECT_ROOT_CATEGORY, "-libname", CATEGORY_TYPE_LIBRARY }; try { sGenerator.startCodeGen(pluginParameter); boolean compareTIXml = utility.compareFiles(oldTIXmlPath, newTIXmlPath); assertTrue("TypeInformation.xml content does not match.", compareTIXml); File typeInformation = new File(oldTIXmlPath); Assert.assertTrue(typeInformation.exists()); } catch (Exception e) { e.printStackTrace(); assertTrue("No exception should be thrown. Exception: " + e.getMessage(), false); } }
@Test public void serviceGeneratorWSDLWithImportReferringToHttpLink() throws Exception { // Initialize testing paths MavenTestingUtils.ensureEmpty(testingdir.getDir()); File wsdl = TestResourceUtil.getResource( "org/ebayopensource/turmeric/test/tools/codegen/data/WsdlWith_HTTP_Import.wsdl"); File srcDir = getTestSrcDir(); File destDir = getTestDestDir(); File binDir = testingdir.getFile("bin"); // Setup arguments // @formatter:off String args[] = new String[] { "-servicename", "CalcService", "-wsdl", wsdl.getAbsolutePath(), "-gentype", "All", "-src", srcDir.getAbsolutePath(), "-dest", destDir.getAbsolutePath(), "-namespace", "http://www.ebay.com/soaframework/service/calc", "-scv", "1.0.0", "-gip", "org.ebayopensource.test.soaframework.tools.codegen", "-bin", binDir.getAbsolutePath() }; // @formatter:on performDirectCodeGen(args); }