RHSSO-423 - Added default value for 'log-dir'. Set to ${project.build.dir}/surefire-reports

This commit is contained in:
Marek Baluch 2016-09-06 18:16:08 +02:00
parent eebd496c2f
commit fd25dbcb5c

View file

@ -86,13 +86,24 @@ public class AggregateResultsReporter extends RunListener {
} }
private File createReportFile() throws Exception { private File createReportFile() throws Exception {
String logDirPath = null;
try {
PropertiesConfiguration config = new PropertiesConfiguration(System.getProperty("testsuite.constants")); PropertiesConfiguration config = new PropertiesConfiguration(System.getProperty("testsuite.constants"));
config.setThrowExceptionOnMissing(true); config.setThrowExceptionOnMissing(true);
logDirPath = config.getString("log-dir");
} catch (Exception e) {
logDirPath = System.getProperty("project.build.directory");
if (logDirPath == null) {
throw new RuntimeException("Could not determine the path to the log directory.");
}
logDirPath += File.separator + "surefire-reports";
}
final File logDir = new File(config.getString("log-dir")); final File logDir = new File(logDirPath);
logDir.mkdirs(); logDir.mkdirs();
final File reportFile = new File(logDir, "junit-report.xml").getAbsoluteFile(); final File reportFile = new File(logDir, "junit-single-report.xml").getAbsoluteFile();
reportFile.createNewFile(); reportFile.createNewFile();
return reportFile; return reportFile;