use of org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException in project product-iots by wso2.
the class CarbonServerManagerExtension method generateCoverageReport.
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");
}
use of org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException in project product-iots by wso2.
the class CarbonServerManagerExtension method setUpCarbonHome.
/**
* Unzip carbon zip file and return the carbon home. Based on the coverage configuration in automation.xml
* This method will inject jacoco agent to the carbon server startup scripts.
*
* @param carbonServerZipFile - Carbon zip file, which should be specified in test module pom
* @return - carbonHome - carbon home
* @throws IOException - If pack extraction fails
*/
public synchronized String setUpCarbonHome(String carbonServerZipFile) throws IOException, AutomationFrameworkException {
if (this.process != null) {
return this.carbonHome;
} else {
int indexOfZip = carbonServerZipFile.lastIndexOf(".zip");
if (indexOfZip == -1) {
throw new IllegalArgumentException(carbonServerZipFile + " is not a zip file");
} else {
String fileSeparator = File.separator.equals("\\") ? "\\" : "/";
if (fileSeparator.equals("\\")) {
carbonServerZipFile = carbonServerZipFile.replace("/", "\\");
}
String extractedCarbonDir = carbonServerZipFile.substring(carbonServerZipFile.lastIndexOf(fileSeparator) + 1, indexOfZip);
FileManipulator.deleteDir(extractedCarbonDir);
String extractDir = "carbontmp" + System.currentTimeMillis();
String baseDir = System.getProperty("basedir", ".") + File.separator + "target";
log.info("Extracting carbon zip file.. ");
(new ArchiveExtractor()).extractFile(carbonServerZipFile, baseDir + File.separator + extractDir);
this.carbonHome = (new File(baseDir)).getAbsolutePath() + File.separator + extractDir + File.separator + extractedCarbonDir;
try {
this.isCoverageEnable = Boolean.parseBoolean(this.automationContext.getConfigurationValue("//coverage"));
} catch (XPathExpressionException var8) {
throw new AutomationFrameworkException("Coverage configuration not found in automation.xml", var8);
}
if (this.isCoverageEnable) {
this.instrumentForCoverage();
}
return this.carbonHome;
}
}
}
use of org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException in project product-iots by wso2.
the class IOTServerExtension method initiate.
@Override
public void initiate() throws AutomationFrameworkException {
try {
automationContext = new AutomationContext("IOT", TestUserMode.SUPER_TENANT_USER);
if (getParameters().get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) == null) {
getParameters().put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, "0");
}
serverManager = new CustomTestServerManager(getAutomationContext(), null, getParameters());
executionEnvironment = automationContext.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT);
} catch (XPathExpressionException e) {
handleException("Error while initiating test environment", e);
}
}
use of org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException in project product-iots by wso2.
the class AnalyticsServerExtension method initiate.
@Override
public void initiate() throws AutomationFrameworkException {
try {
automationContext = new AutomationContext("IOT", TestUserMode.SUPER_TENANT_USER);
if (getParameters().get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) == null) {
getParameters().put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, "2");
}
serverManager = new CustomTestServerManager(getAutomationContext(), null, getParameters());
executionEnvironment = automationContext.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT);
} catch (XPathExpressionException e) {
handleException("Error while initiating test environment", e);
}
}
use of org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException in project product-iots by wso2.
the class AndroidDeviceManagementAPIJmeterTestCase method listServices.
@Test(description = "Testing the basic android device management API calls", dependsOnMethods = { "permutationTest" })
public void listServices() throws AutomationFrameworkException {
URL url = Thread.currentThread().getContextClassLoader().getResource("jmeter-scripts" + File.separator + "NewAndroidDeviceManagementAPI.jmx");
JMeterTest script = new JMeterTest(new File(url.getPath()));
JMeterTestManager manager = new JMeterTestManager();
log.info("Running API service test using jmeter scripts");
manager.runTest(script);
}
Aggregations