RED-4510: Generated Redaction Log and Generating will not run with profile
This commit is contained in:
parent
4236ba868f
commit
2237ae3910
@ -245,7 +245,7 @@ public class RulesTest {
|
|||||||
* Analyses all files and compares its RedactionLog with saved one from here: REDACTION_LOG_PATH.
|
* Analyses all files and compares its RedactionLog with saved one from here: REDACTION_LOG_PATH.
|
||||||
* If RedactionLog Json for one file does not exist, whole test will fail.
|
* If RedactionLog Json for one file does not exist, whole test will fail.
|
||||||
*/
|
*/
|
||||||
@IfProfileValue(name = "test-groups", value = "rules-test")
|
@IfProfileValue(name = "test-groups", value = "rules-test") //TODO PSC
|
||||||
@Test
|
@Test
|
||||||
public void analyseAllFilesAndCompareRedactionLogs() {
|
public void analyseAllFilesAndCompareRedactionLogs() {
|
||||||
|
|
||||||
@ -415,6 +415,9 @@ public class RulesTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String cleanPath(String path) {
|
||||||
|
return StringUtils.replace(path, "\\", "/");
|
||||||
|
}
|
||||||
|
|
||||||
private boolean doesRedactionLogExist(String pdfFileName) {
|
private boolean doesRedactionLogExist(String pdfFileName) {
|
||||||
|
|
||||||
@ -463,9 +466,12 @@ public class RulesTest {
|
|||||||
System.out.println("XXXXXXXXX pdfFileName: " + pdfFileName);
|
System.out.println("XXXXXXXXX pdfFileName: " + pdfFileName);
|
||||||
|
|
||||||
File pdfFile = new File(pdfFileName);
|
File pdfFile = new File(pdfFileName);
|
||||||
String directory = pdfFile.getParentFile().getPath();
|
String directory = cleanPath(pdfFile.getParentFile().getPath());
|
||||||
if (StringUtils.contains(directory, RESOURCES_PATH) || StringUtils.contains(directory, StringUtils.replace(RESOURCES_PATH, "/", "\\"))) {
|
if (StringUtils.contains(directory, RESOURCES_PATH)) {// || StringUtils.contains(directory, StringUtils.replace(RESOURCES_PATH, "/", "\\"))
|
||||||
directory = directory + "/" + REDACTION_LOG_PATH;
|
if (!StringUtils.endsWith(directory, "/")) {
|
||||||
|
directory = directory + "/";
|
||||||
|
}
|
||||||
|
directory = directory + REDACTION_LOG_PATH;
|
||||||
} else {
|
} else {
|
||||||
if (StringUtils.startsWith(directory, "/")) {
|
if (StringUtils.startsWith(directory, "/")) {
|
||||||
directory = StringUtils.substring(directory, 1);
|
directory = StringUtils.substring(directory, 1);
|
||||||
@ -630,14 +636,14 @@ public class RulesTest {
|
|||||||
if (path.toFile().isDirectory()) {
|
if (path.toFile().isDirectory()) {
|
||||||
getFileNames(fileNames, path);
|
getFileNames(fileNames, path);
|
||||||
} else if (StringUtils.endsWith(path.toAbsolutePath().toString(), ".pdf")) {
|
} else if (StringUtils.endsWith(path.toAbsolutePath().toString(), ".pdf")) {
|
||||||
String absolutePath = path.toAbsolutePath().toString();
|
String absolutePath = cleanPath(path.toAbsolutePath().toString());
|
||||||
System.out.println("absolutePath: " + absolutePath);
|
System.out.println("absolutePath: " + absolutePath);
|
||||||
|
|
||||||
int pos = StringUtils.indexOf(absolutePath, RESOURCES_PATH);
|
int pos = StringUtils.indexOf(absolutePath, RESOURCES_PATH) + RESOURCES_PATH.length();
|
||||||
if (pos < 0) {
|
// if (pos < 0) {
|
||||||
pos = StringUtils.indexOf(absolutePath, StringUtils.replace(RESOURCES_PATH, "/", "\\"));
|
// pos = StringUtils.indexOf(absolutePath, StringUtils.replace(RESOURCES_PATH, "/", "\\"));
|
||||||
}
|
// }
|
||||||
pos += 18;
|
// pos += 18;
|
||||||
|
|
||||||
System.out.println("pos: " + pos);
|
System.out.println("pos: " + pos);
|
||||||
fileNames.add(StringUtils.substring(absolutePath, pos));
|
fileNames.add(StringUtils.substring(absolutePath, pos));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user