public Properties generate(File[] allTestFiles, String uploadDestPath) { FileOutputStream transformedHtml = null; File mergedResults = new File(folderToUpload.getAbsolutePath() + FileUtil.fileseparator() + TEST_RESULTS_FILE); File mergedResource = null; FileInputStream mergedFileStream = null; try { mergedResource = mergeAllTestResultToSingleFile(allTestFiles); transformedHtml = new FileOutputStream(mergedResults); try { mergedFileStream = new FileInputStream(mergedResource); InputStream xslt = getClass().getResourceAsStream("unittests.xsl"); Source xmlSource = new StreamSource(mergedFileStream); Source xsltSource = new StreamSource(xslt); TransformerFactory transFact = TransformerFactory.newInstance(); Transformer trans = transFact.newTransformer(xsltSource); StreamResult result = new StreamResult(transformedHtml); trans.transform(xmlSource, result); } catch (Exception e) { publisher.reportErrorMessage( "Unable to publish test properties. Error was " + e.getMessage(), e); } finally { IOUtils.closeQuietly(mergedFileStream); } extractProperties(mergedResults); publisher.upload(mergedResults, uploadDestPath); return null; } catch (Exception e) { publisher.reportErrorMessage( "Unable to publish test properties. Error was " + e.getMessage(), e); } finally { IOUtils.closeQuietly(mergedFileStream); IOUtils.closeQuietly(transformedHtml); if (mergedResource != null) { mergedResource.delete(); } } return new Properties(); }
protected void publishWithProperties(GoPublisher goPublisher, File fileToUpload, File rootPath) { goPublisher.upload(fileToUpload, destURL(rootPath, fileToUpload)); }