Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…thiumSphere

# Conflicts:
#	Test-Output/Logs/Test.log
#	Test-Output/UpdateChecker/checker.json
  • Loading branch information
Abdelrhman-Ellithy committed Dec 11, 2024
2 parents 2912ca2 + d15cf1a commit a7048c9
Showing 1 changed file with 35 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ private static int compareVersions(String version1, String version2) {
return 0; // Versions are equal
}
public static void extractAllureFolderFromJar(File jarFile, File targetDirectory) throws IOException {
boolean result;
if (!targetDirectory.exists()) {
Files.createDirectory(targetDirectory.toPath());
}
Expand All @@ -126,7 +127,7 @@ public static void extractAllureFolderFromJar(File jarFile, File targetDirectory
if (entry.getName().startsWith("allure")) {
File targetFile = new File(targetDirectory, entry.getName().substring("allure".length()));
if (entry.isDirectory()) {
targetFile.mkdirs();
result=targetFile.mkdirs();
} else {
Files.copy(jar.getInputStream(entry), targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
if (entry.getName().endsWith("allure") || entry.getName().endsWith("allure.bat")) {
Expand All @@ -142,32 +143,51 @@ public static void extractAllureFolderFromJar(File jarFile, File targetDirectory
}
public static void TestOutputSolver(){
final String allureFile = basePath + "allure";
boolean result;
String allureReportPath= PropertyHelper.getDataFromProperties(allureFile,"allure.report.directory");
if (!checkFileExists(allureReportPath)) {
File allureReportDirectory = new File(allureReportPath);
allureReportDirectory.mkdirs();
result=allureReportDirectory.mkdirs();
if (!result){
System.err.println("Failed to Automatically create directory: " + allureReportPath+ " Due to IDE Permissions you need to make it manually");
}
}
String allureResultsPath= PropertyHelper.getDataFromProperties(allureFile,"allure.report.directory");
if (!checkFileExists(allureResultsPath)) {
File allureResultsDirectory = new File(allureResultsPath);
allureResultsDirectory.mkdirs();
result=allureResultsDirectory.mkdirs();
if (!result){
System.err.println("Failed to Automatically create directory: " + allureResultsPath+ " Due to IDE Permissions you need to make it manually");
}
}
if (!checkFileExists(ScreenShotPath)) {
File ScreenShotsDirectory = new File(ScreenShotPath);
ScreenShotsDirectory.mkdirs();
result=ScreenShotsDirectory.mkdirs();
if (!result){
System.err.println("Failed to Automatically create directory: " + ScreenShotsDirectory+ " Due to IDE Permissions you need to make it manually");
}
}
if (!checkFileExists(testPath)) {
File testDataDirectory = new File(testPath);
testDataDirectory.mkdirs();
result=testDataDirectory.mkdirs();
if (!result){
System.err.println("Failed to Automatically create directory: " + testDataDirectory+ " Due to IDE Permissions you need to make it manually");
}
}
if(!checkFileExists(checkerFolderPath)){
File checkerDirectory = new File(checkerFolderPath);
checkerDirectory.mkdirs();
result=checkerDirectory.mkdirs();
if (!result){
System.err.println("Failed to Automatically create directory: " + checkerDirectory+ " Due to IDE Permissions you need to make it manually");
}
}
if (!checkFileExists(checkerFilePath)) {
File checkerFile = new File(checkerFilePath);
try {
checkerFile.createNewFile();
result=checkerFile.createNewFile();
if (!result){
System.err.println("Failed to Automatically create the json file: " + checkerFile+ " Due to IDE Permissions you need to make it manually");
}
Files.write(checkerFile.toPath(), (
"{\n LastDateRun\": null\n } ").getBytes());
}catch (Exception e){
Expand All @@ -179,12 +199,18 @@ public static void TestOutputSolver(){
.concat(PropertyHelper.getDataFromProperties(ConfigContext.getLogFilePath(), "property.fileName"));
if (!checkFileExists(logFolderPath)) {
File logDirectory = new File(logFolderPath);
logDirectory.mkdirs();
result=logDirectory.mkdirs();
if (!result){
System.err.println("Failed to Automatically create directory: " + logDirectory+ " Due to IDE Permissions you need to make it manually");
}
}
if (!checkFileExists(logFilePath)) {
File logFile = new File(logFilePath);
try {
logFile.createNewFile();
result=logFile.createNewFile();
if (!result){
System.err.println("Failed to Automatically create the text file: " + logFile+ " Due to IDE Permissions you need to make it manually");
}
}
catch (IOException e){
System.err.println(e.getMessage());
Expand Down

0 comments on commit a7048c9

Please sign in to comment.