org.wso2.carbon.automation.engine.frameworkutils.CodeCoverageUtils Java Examples
The following examples show how to use
org.wso2.carbon.automation.engine.frameworkutils.CodeCoverageUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CarbonServerManager.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * This methods will insert jacoco agent settings into startup script under JAVA_OPTS * * @param scriptName - Name of the startup script * @throws IOException - throws if shell script edit fails */ private void insertJacocoAgentToShellScript(String scriptName) throws IOException { String jacocoAgentFile = CodeCoverageUtils.getJacocoAgentJarLocation(); coverageDumpFilePath = FrameworkPathUtil.getCoverageDumpFilePath(); File inFile = Paths.get(carbonHome, "bin", scriptName + ".sh").toFile(); File tmpFile = Paths.get(carbonHome, "tmp" + scriptName + ".sh").toFile(); String lineToBeChecked = "-Dwso2.server.standalone=true"; String lineToBeInserted = "-javaagent:" + jacocoAgentFile + "=destfile=" + coverageDumpFilePath + "" + ",append=true,includes=" + CodeCoverageUtils.getInclusionJarsPattern(":") + ",excludes=" + CodeCoverageUtils .getExclusionJarsPattern(":") + " \\"; CodeCoverageUtils.insertStringToFile(inFile, tmpFile, lineToBeChecked, lineToBeInserted); }
Example #2
Source File: CarbonServerManager.java From product-ei with Apache License 2.0 | 6 votes |
private void generateCoverageReport(File classesDir) throws IOException, AutomationFrameworkException { CodeCoverageUtils.executeMerge(FrameworkPathUtil.getJacocoCoverageHome(), FrameworkPathUtil.getCoverageMergeFilePath()); ReportGenerator reportGenerator = new ReportGenerator(new File(FrameworkPathUtil.getCoverageMergeFilePath()), classesDir, new File(CodeCoverageUtils.getJacocoReportDirectory()), null); reportGenerator.create(); log.info("Jacoco coverage dump file path : " + FrameworkPathUtil.getCoverageDumpFilePath()); log.info("Jacoco class file path : " + classesDir); log.info("Jacoco coverage HTML report path : " + CodeCoverageUtils.getJacocoReportDirectory() + File.separator + "index.html"); }
Example #3
Source File: CarbonServerManager.java From product-ei with Apache License 2.0 | 5 votes |
/** * This method will check the OS and edit server startup script to inject jacoco agent * * @throws IOException - If agent insertion fails. */ private void instrumentForCoverage() throws IOException, AutomationFrameworkException { String scriptName = TestFrameworkUtils.getStartupScriptFileName(carbonHome); if (System.getProperty("os.name").toLowerCase().contains("windows")) { insertJacocoAgentToBatScript(scriptName); if (log.isDebugEnabled()) { log.debug("Included files " + CodeCoverageUtils.getInclusionJarsPattern(":")); log.debug("Excluded files " + CodeCoverageUtils.getExclusionJarsPattern(":")); } } else { insertJacocoAgentToShellScript(scriptName); } }
Example #4
Source File: StratosTestServerManager.java From attic-stratos with Apache License 2.0 | 5 votes |
private void instrumentForCoverage() throws IOException, AutomationFrameworkException { String scriptName = TestFrameworkUtils.getStartupScriptFileName(this.carbonHome); if (System.getProperty("os.name").toLowerCase().contains("windows")) { this.insertJacocoAgentToBatScript(scriptName); if (log.isDebugEnabled()) { log.debug("Included files " + CodeCoverageUtils.getInclusionJarsPattern(":")); log.debug("Excluded files " + CodeCoverageUtils.getExclusionJarsPattern(":")); } } else { this.insertJacocoAgentToShellScript(scriptName); } }
Example #5
Source File: StratosTestServerManager.java From attic-stratos with Apache License 2.0 | 5 votes |
private void insertJacocoAgentToBatScript(String scriptName) throws IOException { String jacocoAgentFile = CodeCoverageUtils.getJacocoAgentJarLocation(); this.coverageDumpFilePath = FrameworkPathUtil.getCoverageDumpFilePath(); CodeCoverageUtils.insertJacocoAgentToStartupBat( new File(this.carbonHome + File.separator + "bin" + File.separator + scriptName + ".bat"), new File(this.carbonHome + File.separator + "tmp" + File.separator + scriptName + ".bat"), "-Dcatalina.base", "-javaagent:" + jacocoAgentFile + "=destfile=" + this.coverageDumpFilePath + "" + ",append=true,includes=" + CodeCoverageUtils.getInclusionJarsPattern(":")); }
Example #6
Source File: StratosTestServerManager.java From attic-stratos with Apache License 2.0 | 5 votes |
private void insertJacocoAgentToShellScript(String scriptName) throws IOException { String jacocoAgentFile = CodeCoverageUtils.getJacocoAgentJarLocation(); this.coverageDumpFilePath = FrameworkPathUtil.getCoverageDumpFilePath(); CodeCoverageUtils.insertStringToFile( new File(this.carbonHome + File.separator + "bin" + File.separator + scriptName + ".sh"), new File(this.carbonHome + File.separator + "tmp" + File.separator + scriptName + ".sh"), "-Dwso2.server.standalone=true", "-javaagent:" + jacocoAgentFile + "=destfile=" + this.coverageDumpFilePath + "" + ",append=true,includes=" + CodeCoverageUtils.getInclusionJarsPattern(":") + " \\"); }
Example #7
Source File: StratosTestServerManager.java From attic-stratos with Apache License 2.0 | 5 votes |
private void generateCoverageReport(File classesDir) throws IOException, AutomationFrameworkException { CodeCoverageUtils .executeMerge(FrameworkPathUtil.getJacocoCoverageHome(), FrameworkPathUtil.getCoverageMergeFilePath()); ReportGenerator reportGenerator = new ReportGenerator(new File(FrameworkPathUtil.getCoverageMergeFilePath()), classesDir, new File(CodeCoverageUtils.getJacocoReportDirectory()), (File) null); reportGenerator.create(); log.info("Jacoco coverage dump file path : " + FrameworkPathUtil.getCoverageDumpFilePath()); log.info("Jacoco class file path : " + classesDir); log.info("Jacoco coverage HTML report path : " + CodeCoverageUtils.getJacocoReportDirectory() + File.separator + "index.html"); }
Example #8
Source File: CarbonServerManagerExtension.java From product-iots with Apache License 2.0 | 5 votes |
/** * This method will check the OS and edit server startup script to inject jacoco agent * * @throws IOException - If agent insertion fails. */ private void instrumentForCoverage() throws IOException, AutomationFrameworkException { String scriptName = TestFrameworkUtils.getStartupScriptFileName(this.carbonHome); if(System.getProperty("os.name").toLowerCase().contains("windows")) { this.insertJacocoAgentToBatScript(scriptName); if(log.isDebugEnabled()) { log.debug("Included files " + CodeCoverageUtils.getInclusionJarsPattern(":")); log.debug("Excluded files " + CodeCoverageUtils.getExclusionJarsPattern(":")); } } else { this.insertJacocoAgentToShellScript(scriptName); } }
Example #9
Source File: CarbonServerManagerExtension.java From product-iots with Apache License 2.0 | 5 votes |
private void generateCoverageReport(File classesDir) throws IOException, AutomationFrameworkException { checkJacocoDataFileSizes(FrameworkPathUtil.getJacocoCoverageHome()); CodeCoverageUtils.executeMerge(FrameworkPathUtil.getJacocoCoverageHome(), FrameworkPathUtil.getCoverageMergeFilePath()); ReportGenerator reportGenerator = new ReportGenerator(new File(FrameworkPathUtil.getCoverageMergeFilePath()), classesDir, new File(CodeCoverageUtils.getJacocoReportDirectory()), (File)null); reportGenerator.create(); log.info("Jacoco coverage dump file path : " + FrameworkPathUtil.getCoverageDumpFilePath()); log.info("Jacoco class file path : " + classesDir); log.info("Jacoco coverage HTML report path : " + CodeCoverageUtils.getJacocoReportDirectory() + File.separator + "index.html"); }
Example #10
Source File: TestCoverageGenerator.java From micro-integrator with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws AutomationFrameworkException, IOException { if (carbonZip == null) { carbonZip = FrameworkPathUtil.getCarbonZipLocation(); log.info("Using carbon zip file at " + carbonZip); } if (carbonZip == null) { throw new IllegalArgumentException( "carbon zip file cannot find in the given location " + FrameworkPathUtil.getCarbonZipLocation()); } String carbonHome = ArchiveExtractorUtil.setUpCarbonHome(carbonZip); File parentDirectory = new File(System.getProperty("basedir")).getParentFile(); CodeCoverageUtils.executeMerge(parentDirectory.getAbsolutePath(), FrameworkPathUtil.getCoverageMergeFilePath()); File carbonPluginDir = new File( carbonHome + File.separator + "wso2" + File.separator + "components" + File.separator + "plugins" + File.separator); ReportGenerator reportGenerator = new ReportGenerator(new File(FrameworkPathUtil.getCoverageMergeFilePath()), carbonPluginDir, new File(CodeCoverageUtils.getJacocoReportDirectory()), null); reportGenerator.create(); File carbonHomeDir = new File(carbonHome); if (carbonHomeDir.exists()) { FileUtils.deleteQuietly(new File(carbonHome)); //delete extracted dir } log.info("Jacoco coverage merged file : " + FrameworkPathUtil.getCoverageMergeFilePath()); log.info("Jacoco class file path : " + carbonPluginDir.getAbsolutePath()); log.info("Jacoco coverage HTML report path : " + CodeCoverageUtils.getJacocoReportDirectory() + File.separator + "index.html"); }
Example #11
Source File: CarbonServerManager.java From product-ei with Apache License 2.0 | 5 votes |
/** * This methods will insert jacoco agent settings into windows bat script * * @param scriptName - Name of the startup script * @throws IOException - throws if shell script edit fails */ private void insertJacocoAgentToBatScript(String scriptName) throws IOException { String jacocoAgentFile = CodeCoverageUtils.getJacocoAgentJarLocation(); coverageDumpFilePath = FrameworkPathUtil.getCoverageDumpFilePath(); scriptName = "integrator"; CodeCoverageUtils.insertJacocoAgentToStartupBat(Paths.get(carbonHome, "bin", scriptName + ".bat").toFile(), Paths.get(carbonHome, "wso2", "tmp", scriptName + ".bat").toFile(), "-Dcatalina.base", "-javaagent:" + jacocoAgentFile + "=destfile=" + coverageDumpFilePath + "" + ",append=true,includes=" + CodeCoverageUtils.getInclusionJarsPattern(":") + ",excludes=" + CodeCoverageUtils .getExclusionJarsPattern(":")); }
Example #12
Source File: CarbonServerManager.java From product-ei with Apache License 2.0 | 5 votes |
/** * This methods will insert jacoco agent settings into startup script under JAVA_OPTS * * @param scriptName - Name of the startup script * @throws IOException - throws if shell script edit fails */ private void insertJacocoAgentToShellScript(String scriptName) throws IOException { scriptName = "integrator"; String jacocoAgentFile = CodeCoverageUtils.getJacocoAgentJarLocation(); coverageDumpFilePath = FrameworkPathUtil.getCoverageDumpFilePath(); CodeCoverageUtils.insertStringToFile(Paths.get(carbonHome, "bin", scriptName + ".sh").toFile(), Paths.get(carbonHome, "wso2", "tmp", scriptName + ".sh").toFile(), "-Dwso2.server.standalone=true", "-javaagent:" + jacocoAgentFile + "=destfile=" + coverageDumpFilePath + "" + ",append=true,includes=" + CodeCoverageUtils.getInclusionJarsPattern(":") + ",excludes=" + CodeCoverageUtils .getExclusionJarsPattern(":") + " \\"); }
Example #13
Source File: TestCoverageGenerator.java From product-ei with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws AutomationFrameworkException, IOException { if (carbonZip == null) { carbonZip = FrameworkPathUtil.getCarbonZipLocation(); log.info("Using carbon zip file at " + carbonZip); } if (carbonZip == null) { throw new IllegalArgumentException("carbon zip file cannot find in the given location " + FrameworkPathUtil.getCarbonZipLocation()); } String carbonHome = ArchiveExtractorUtil.setUpCarbonHome(carbonZip); File parentDirectory = new File(System.getProperty("basedir")).getParentFile(); CodeCoverageUtils.executeMerge(parentDirectory.getAbsolutePath(), FrameworkPathUtil.getCoverageMergeFilePath()); File carbonPluginDir = new File(carbonHome + File.separator + "wso2" + File.separator + "components" + File.separator + "plugins" + File.separator); ReportGenerator reportGenerator = new ReportGenerator(new File(FrameworkPathUtil.getCoverageMergeFilePath()), carbonPluginDir, new File(CodeCoverageUtils.getJacocoReportDirectory()), null); reportGenerator.create(); File carbonHomeDir = new File(carbonHome); if (carbonHomeDir.exists()) { FileUtils.deleteQuietly(new File(carbonHome)); //delete extracted dir } log.info("Jacoco coverage merged file : " + FrameworkPathUtil.getCoverageMergeFilePath()); log.info("Jacoco class file path : " + carbonPluginDir.getAbsolutePath()); log.info("Jacoco coverage HTML report path : " + CodeCoverageUtils.getJacocoReportDirectory() + File.separator + "index.html"); }
Example #14
Source File: CarbonServerManager.java From micro-integrator with Apache License 2.0 | 5 votes |
/** * This method will check the OS and edit server startup script to inject jacoco agent * * @throws IOException - If agent insertion fails. */ private void instrumentForCoverage(String startupScriptName) throws IOException { if (System.getProperty("os.name").toLowerCase().contains("windows")) { insertJacocoAgentToBatScript(startupScriptName); if (log.isDebugEnabled()) { log.debug("Included files " + CodeCoverageUtils.getInclusionJarsPattern(":")); log.debug("Excluded files " + CodeCoverageUtils.getExclusionJarsPattern(":")); } } else { insertJacocoAgentToShellScript(startupScriptName); } }
Example #15
Source File: CarbonServerManager.java From micro-integrator with Apache License 2.0 | 5 votes |
/** * This methods will insert jacoco agent settings into windows bat script * * @param scriptName - Name of the startup script * @throws IOException - throws if shell script edit fails */ private void insertJacocoAgentToBatScript(String scriptName) throws IOException { String jacocoAgentFile = CodeCoverageUtils.getJacocoAgentJarLocation(); coverageDumpFilePath = FrameworkPathUtil.getCoverageDumpFilePath(); CodeCoverageUtils.insertJacocoAgentToStartupBat(Paths.get(carbonHome, "bin", scriptName + ".bat").toFile(), Paths.get(carbonHome, "wso2", "tmp", scriptName + ".bat").toFile(), "-Dcatalina.base", "-javaagent:" + jacocoAgentFile + "=destfile=" + coverageDumpFilePath + "" + ",append=true,includes=" + CodeCoverageUtils.getInclusionJarsPattern(":") + ",excludes=" + CodeCoverageUtils .getExclusionJarsPattern(":")); }
Example #16
Source File: CarbonServerManager.java From micro-integrator with Apache License 2.0 | 5 votes |
private void generateCoverageReport(File classesDir) throws IOException, AutomationFrameworkException { CodeCoverageUtils .executeMerge(FrameworkPathUtil.getJacocoCoverageHome(), FrameworkPathUtil.getCoverageMergeFilePath()); ReportGenerator reportGenerator = new ReportGenerator(new File(FrameworkPathUtil.getCoverageMergeFilePath()), classesDir, new File(CodeCoverageUtils.getJacocoReportDirectory()), null); reportGenerator.create(); log.info("Jacoco coverage dump file path : " + FrameworkPathUtil.getCoverageDumpFilePath()); log.info("Jacoco class file path : " + classesDir); log.info("Jacoco coverage HTML report path : " + CodeCoverageUtils.getJacocoReportDirectory() + File.separator + "index.html"); }
Example #17
Source File: CarbonServerManagerExtension.java From product-iots with Apache License 2.0 | 2 votes |
/** * This methods will insert jacoco agent settings into startup script under JAVA_OPTS * * @param scriptName - Name of the startup script * @throws IOException - throws if shell script edit fails */ private void insertJacocoAgentToShellScript(String scriptName) throws IOException { String jacocoAgentFile = CodeCoverageUtils.getJacocoAgentJarLocation(); this.coverageDumpFilePath = FrameworkPathUtil.getCoverageDumpFilePath(); CodeCoverageUtils.insertStringToFile(new File(this.carbonHome + File.separator + "bin" + File.separator + scriptName + ".sh"), new File(this.carbonHome + File.separator + "tmp" + File.separator + scriptName + ".sh"), "-Dwso2.server.standalone=true", "-javaagent:" + jacocoAgentFile + "=destfile=" + this.coverageDumpFilePath + "" + ",append=true,includes=" + CodeCoverageUtils.getInclusionJarsPattern(":") + " \\"); }
Example #18
Source File: CarbonServerManagerExtension.java From product-iots with Apache License 2.0 | 2 votes |
/** * This methods will insert jacoco agent settings into windows bat script * * @param scriptName - Name of the startup script * @throws IOException - throws if shell script edit fails */ private void insertJacocoAgentToBatScript(String scriptName) throws IOException { String jacocoAgentFile = CodeCoverageUtils.getJacocoAgentJarLocation(); this.coverageDumpFilePath = FrameworkPathUtil.getCoverageDumpFilePath(); CodeCoverageUtils.insertJacocoAgentToStartupBat(new File(this.carbonHome + File.separator + "bin" + File.separator + scriptName + ".bat"), new File(this.carbonHome + File.separator + "tmp" + File.separator + scriptName + ".bat"), "-Dcatalina.base", "-javaagent:" + jacocoAgentFile + "=destfile=" + this.coverageDumpFilePath + "" + ",append=true,includes=" + CodeCoverageUtils.getInclusionJarsPattern(":")); }