RED-4510: Generated Redaction Log and Generating will not run with profile

This commit is contained in:
Philipp Schramm 2022-07-26 13:10:59 +02:00
parent e1b8f5b89a
commit a4d41fc164

View File

@ -215,6 +215,7 @@ public class RulesTest {
* Please commit generated files, if not the following tests will fail * Please commit generated files, if not the following tests will fail
*/ */
@Test @Test
@Ignore// TODO PSC REMOVE
public void generateRedactionLogForAllFiles() { public void generateRedactionLogForAllFiles() {
Set<String> files = getFileNames(new HashSet<>(), FileSystems.getDefault().getPath(RESOURCES_PATH)); Set<String> files = getFileNames(new HashSet<>(), FileSystems.getDefault().getPath(RESOURCES_PATH));
@ -254,7 +255,7 @@ public class RulesTest {
} }
@Test @Test// TODO PSC REMOVE
@Ignore @Ignore
public void foo() { public void foo() {
String fileName = "oo-home/local-working-dir/3080193/RED-REDACTIONSERVICENIGHT0-JOB1/redaction-service-v1/redaction-service-server-v1/src/test/resources/files/Compounds/26 A8637C - EU AIR3 - LCP Section 10 - Ecotoxicological studies on the plant protection product - Reference list.pdf"; String fileName = "oo-home/local-working-dir/3080193/RED-REDACTIONSERVICENIGHT0-JOB1/redaction-service-v1/redaction-service-server-v1/src/test/resources/files/Compounds/26 A8637C - EU AIR3 - LCP Section 10 - Ecotoxicological studies on the plant protection product - Reference list.pdf";
@ -456,15 +457,21 @@ public class RulesTest {
@SneakyThrows @SneakyThrows
private RedactionLog loadSavedRedactionLog(String pdfFileName) { private RedactionLog loadSavedRedactionLog(String pdfFileName) {
System.out.println("XXXXXXXXX pdfFileName: " + pdfFileName);
File pdfFile = new File(pdfFileName); File pdfFile = new File(pdfFileName);
String directory = pdfFile.getParentFile().getPath(); String directory = 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; directory = directory + "/" + REDACTION_LOG_PATH;
} else { } else {
directory = REDACTION_LOG_RESOURCES_PATH + directory; directory = REDACTION_LOG_RESOURCES_PATH + directory;
} }
String fileName = StringUtils.replace(pdfFile.getName(), ".pdf", ".json"); String fileName = StringUtils.replace(pdfFile.getName(), ".pdf", ".json");
File file = new File(directory, fileName); File file = new File(directory, fileName);
System.out.println("XXXXXXXXX directory: " + directory);
System.out.println("XXXXXXXXX fileName: " + fileName);
assertThat(file).exists(); assertThat(file).exists();
return objectMapper.readValue(file, RedactionLog.class); return objectMapper.readValue(file, RedactionLog.class);