CreateFunction implements IFunction { public void execute(String[] params) { parseOptionsFromCommandLine(params); File bpelFile = new File(bpelFileName); File bptsFile = getBptsFile(bpelFile, testSuiteDir); Map<String, File> wsdlFilesByNamespace = new HashMap<String, File>(); new File(bptsFile.getParentFile(), "wsdl").mkdir(); try { IProcess bpel = BpelFactory.loadProcess(new FileInputStream( bpelFile)); List<? extends IImport> imports = bpel.getImports(); for (IImport i : imports) { wsdlFilesByNamespace.put(i.getNamespace(), new File(bpelFile.getParentFile(), i.getLocation()) .getCanonicalFile()); } XMLTestSuiteDocument testSuiteDoc = XMLTestSuiteDocument.Factory .newInstance(); XMLTestSuite testSuite = testSuiteDoc.addNewTestSuite(); XMLDeploymentSection deployment = testSuite.addNewDeployment(); testSuite.addNewTestCases(); testSuite.setName(bptsFile.getName()); testSuite.setBaseURL(baseUrl); XMLPUTDeploymentInformation processUnderTest = deployment .addNewPut(); processUnderTest.setName(bpel.getName()); processUnderTest.setType(deployerType); addPartners(bptsFile, wsdlFilesByNamespace, bpel, deployment); processUnderTest.setWsdl(deployment.getPartnerArray(0).getWsdl()); XMLTestCase dummyTestCase = testSuite.getTestCases().addNewTestCase(); dummyTestCase.setName("TODO"); dummyTestCase.addNewClientTrack(); for(XMLPartnerDeploymentInformation p : deployment.getPartnerList()) { dummyTestCase.addNewPartnerTrack().setName(p.getName()); } testSuiteDoc.save(bptsFile); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (WSDLException e) { e.printStackTrace(); } } CreateFunction(); String getName(); String getDescription(); String getHelp(); void execute(String[] params);  }
@Test @Ignore("Disabled until ActiveVOS9 deployer ready") public void testExecute() throws Exception { createFunction.execute(new String[]{ "src/test/resources/bpel/test/Test.bpel", "-d", "../../../../../target/test" }); assertTrue(new File("target/test").exists()); assertTrue(new File("target/test").isDirectory()); assertTrue(new File("target/test/Test.bpts").isFile()); BPELUnitBaseRunner r = new TestTestRunner(); TestSuite testSuite = r.loadTestSuite(new File("target/test/Test.bpts")); testSuite.run(); assertEquals(ArtefactStatus.StatusCode.PASSED, testSuite.getStatus().getCode()); }