Skip to content

Commit

Permalink
Added dynamic version (in code), fixed typos and fixed previously bro…
Browse files Browse the repository at this point in the history
…ken code.
  • Loading branch information
ppouchin committed Feb 24, 2021
1 parent 4f19bf1 commit 0d75893
Show file tree
Hide file tree
Showing 111 changed files with 6,334 additions and 5,752 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ compile:
- target

# ------------------------- Deploy ----------------------------------------
# Deploy the Maven artifacts generated by "Compile" stage to Gitlab's Maven repository.
# Deploy the Maven artifacts generated by "Compile" stage to Gitlab Maven repository.

deploy:
stage: deploy
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>${project.build.sourceDirectory}</directory>
Expand Down
67 changes: 36 additions & 31 deletions src/main/java/gred/nucleus/analyseTest/OutputFileVerification.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,67 +50,73 @@ public OutputFileVerification(String PathExpectedResult, String PathOutPut) {
this._rawPathOutPut = PathOutPut;
}


/**
* List files expected and compute md5sum stored in hashMap (read recursively folders)
*
* @param path : path of folder which contains files expected
*/
public void GetFileResultExpected(String path) throws IOException {
public void GetFileResultExpected(String path) {
File root = new File(path);
File[] list = root.listFiles();
for (File f : list) {
if (f.isDirectory()) {
GetFileResultExpected(f.getAbsolutePath());
} else {
String temps = f.getPath().replace(
this._rawPathExpectedResult, "");
this._myMapInitialFilesInputFolder.put(temps, md5(f.getPath()));
if(list != null) {
for (File f : list) {
if (f.isDirectory()) {
GetFileResultExpected(f.getAbsolutePath());
} else {
String temps = f.getPath().replace(
this._rawPathExpectedResult, "");
this._myMapInitialFilesInputFolder.put(temps, md5(f.getPath()));
}
}
}

}


/**
* List files already inside the output folder and compute md5sum stored in hashMap (read recursively folders)
*
* @param path : path of folder which contains files expected
*/
public void GetFilesOutputFolder(String path) throws IOException {
public void GetFilesOutputFolder(String path) {
File root = new File(path);
File[] list = root.listFiles();
for (File f : list) {
if (f.isDirectory()) {
GetFilesOutputFolder(f.getAbsolutePath());
} else {
String temps = f.getPath().replace(this._rawPathOutPut,
"");
this._myMapInitialFileOutputFolder.put(temps, md5(f.getPath()));
if(list != null) {
for (File f : list) {
if (f.isDirectory()) {
GetFilesOutputFolder(f.getAbsolutePath());
} else {
String temps = f.getPath().replace(this._rawPathOutPut, "");
this._myMapInitialFileOutputFolder.put(temps, md5(f.getPath()));
}
}
}

}


/**
* List files output folder produce by the analyse and compute md5sum stored in hashMap (read recursively folders)
*
* @param path : path of folder which contains files expected
*/
public void GetFilesResultingOfAnalysis(String path) throws IOException {
public void GetFilesResultingOfAnalysis(String path) {
File root = new File(path);
File[] list = root.listFiles();
for (File f : list) {
if (f.isDirectory()) {
GetFilesResultingOfAnalysis(f.getAbsolutePath());
} else {
String temps = f.getPath().replace(this._rawPathOutPut
, "");
System.out.println(temps);
this._myMapFilesProduceByAnalysis.put(temps, md5(f.getPath()));
if(list != null) {
for (File f : list) {
if (f.isDirectory()) {
GetFilesResultingOfAnalysis(f.getAbsolutePath());
} else {
String temps = f.getPath().replace(this._rawPathOutPut
, "");
System.out.println(temps);
this._myMapFilesProduceByAnalysis.put(temps, md5(f.getPath()));
}
}
}

}


/** Method to compare md5sum of files from output analysis with expected results */
public void CompareAnalysisResult() {
for (Map.Entry<String, String> entry :
Expand All @@ -126,20 +132,19 @@ public void CompareAnalysisResult() {
+ hashCode + "\n"
+ this._myMapFilesProduceByAnalysis.get(fileName) + "\n");
}

}
}


/**
* Method to compute md5sum of file
*
* @param path path of file
*
* @return hash md5 of file
*
* @throws IOException
*/
public String md5(String path) throws IOException {
public String md5(String path) {
String checksumMD5 = "Na";
try {
checksumMD5 = DigestUtils.md5Hex(new FileInputStream(path));
Expand Down
Loading

0 comments on commit 0d75893

Please sign in to comment.