diff --git a/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/mapper/DocumentDataMapper.java b/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/mapper/DocumentDataMapper.java index 419adff1..a1996fd9 100644 --- a/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/mapper/DocumentDataMapper.java +++ b/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/mapper/DocumentDataMapper.java @@ -118,7 +118,7 @@ public class DocumentDataMapper { .map(Integer::longValue) .toList()) .putAllProperties(properties); - + if (entry.getNode() != null) { documentBuilder.addAllEngines(entry.getNode().getEngines() .stream() diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/DeprecatedElementsFinder.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/DeprecatedElementsFinder.java index 2b0e3bc5..547989b8 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/DeprecatedElementsFinder.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/DeprecatedElementsFinder.java @@ -10,11 +10,13 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.regex.Pattern; import java.util.stream.Collectors; import org.reflections.Reflections; import org.reflections.scanners.Scanners; import org.reflections.util.ConfigurationBuilder; +import org.reflections.util.FilterBuilder; import com.iqser.red.service.redaction.v1.server.model.dictionary.SearchImplementation; @@ -25,6 +27,8 @@ import lombok.extern.slf4j.Slf4j; public class DeprecatedElementsFinder { public static final String PACKAGE_NAME = "com.iqser.red.service.redaction.v1.server"; + public static final Pattern DATA_PACKAGE = Pattern.compile(".*/data/.*"); + private Set deprecatedMethods; @Getter private Map deprecatedMethodsSignaturesMap; @@ -43,7 +47,10 @@ public class DeprecatedElementsFinder { Reflections reflections = new Reflections(new ConfigurationBuilder().forPackage(PACKAGE_NAME) .setExpandSuperTypes(true) - .setScanners(Scanners.MethodsAnnotated, Scanners.TypesAnnotated, Scanners.SubTypes)); + .setScanners(Scanners.MethodsAnnotated, Scanners.TypesAnnotated, Scanners.SubTypes) + .filterInputsBy(new FilterBuilder().includePackage(PACKAGE_NAME).excludePackage(PACKAGE_NAME + ".data") + // Exclude the generated proto data package + )); deprecatedMethods = reflections.get(Scanners.MethodsAnnotated.with(Deprecated.class).as(Method.class)); diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/AbstractRedactionIntegrationTest.java b/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/AbstractRedactionIntegrationTest.java index b1f8b3b6..3f0a66b2 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/AbstractRedactionIntegrationTest.java +++ b/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/AbstractRedactionIntegrationTest.java @@ -237,7 +237,9 @@ public abstract class AbstractRedactionIntegrationTest { @BeforeAll public static void init() { - PDFNet.initialize("demo:1650351709282:7bd235e003000000004ec28a6743e1163a085e2115de2536ab6e2cfe5a"); + synchronized (PDFNet.class) { + PDFNet.initialize("demo:1650351709282:7bd235e003000000004ec28a6743e1163a085e2115de2536ab6e2cfe5a"); + } } diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/RedactionIntegrationTest.java b/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/RedactionIntegrationTest.java index cf141971..ce08fcaf 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/RedactionIntegrationTest.java +++ b/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/RedactionIntegrationTest.java @@ -1986,7 +1986,7 @@ public class RedactionIntegrationTest extends RulesIntegrationTest { .get(1).getType(), ChangeType.IGNORED); assertEquals(responseDavidKsenia.getChanges() .get(1).getPropertyChanges() - .get("reason"), "No vertebrate found -> removed by manual override"); + .get("reason"), "No vertebrate found -> "); assertEquals(responseDavidKsenia.getChanges() .get(1).getPropertyChanges() .get("matchedRule"), "CBI.13.2 -> "); @@ -2040,7 +2040,7 @@ public class RedactionIntegrationTest extends RulesIntegrationTest { .get(1).getType(), ChangeType.RECATEGORIZE); assertEquals(responseDavidKsenia.getChanges() .get(1).getPropertyChanges() - .get("reason"), "No vertebrate found -> Recategorized entities are applied by default., recategorized by manual override"); + .get("reason"), "No vertebrate found -> Recategorized entities are applied by default."); assertEquals(responseDavidKsenia.getChanges() .get(1).getPropertyChanges() .get("matchedRule"), "CBI.13.2 -> MAN.3.3"); diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/manualchanges/ManualChangesUnitTest.java b/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/manualchanges/ManualChangesUnitTest.java index 99e864a4..b370bf1e 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/manualchanges/ManualChangesUnitTest.java +++ b/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/manualchanges/ManualChangesUnitTest.java @@ -62,7 +62,7 @@ public class ManualChangesUnitTest extends BuildDocumentIntegrationTest { entity.getManualOverwrite().addChange(removal); assertTrue(entity.ignored()); assertFalse(entity.applied()); - assertEquals(reason + ", removed by manual override", entity.buildReason()); + assertEquals(reason, entity.buildReason()); // force again ManualForceRedaction forceRedaction = ManualForceRedaction.builder() @@ -76,7 +76,7 @@ public class ManualChangesUnitTest extends BuildDocumentIntegrationTest { assertTrue(entity.applied()); assertFalse(entity.ignored()); assertFalse(entity.removed()); - assertEquals(reason + ", removed by manual override, forced by manual override", entity.buildReason()); + assertEquals(reason, entity.buildReason()); assertEquals("coolio", entity.getManualOverwrite().getLegalBasis() .orElse(entity.getMatchedRule().getLegalBasis())); @@ -86,7 +86,7 @@ public class ManualChangesUnitTest extends BuildDocumentIntegrationTest { entity.getManualOverwrite().addChange(removal2); assertTrue(entity.ignored()); assertFalse(entity.applied()); - assertEquals(reason + ", removed by manual override, forced by manual override, removed by manual override", entity.buildReason()); + assertEquals(reason, entity.buildReason()); // force again, with requestDate before removal2, but after force1 ManualForceRedaction forceRedaction2 = ManualForceRedaction.builder() @@ -99,7 +99,7 @@ public class ManualChangesUnitTest extends BuildDocumentIntegrationTest { entity.getManualOverwrite().addChange(forceRedaction2); assertTrue(entity.ignored()); assertFalse(entity.applied()); - assertEquals(reason + ", removed by manual override, forced by manual override, forced by manual override, removed by manual override", entity.buildReason()); + assertEquals(reason, entity.buildReason()); String legalBasis = "Yeah"; String section = "Some random section!"; @@ -116,8 +116,7 @@ public class ManualChangesUnitTest extends BuildDocumentIntegrationTest { entity.getManualOverwrite().addChange(legalBasisChange); assertTrue(entity.ignored()); assertFalse(entity.applied()); - assertEquals(reason + ", removed by manual override, forced by manual override, forced by manual override, removed by manual override, legal basis was manually changed", - entity.buildReason()); + assertEquals(reason, entity.buildReason()); assertEquals(value, entity.getManualOverwrite().getValue() .orElse(entity.getValue())); @@ -172,7 +171,7 @@ public class ManualChangesUnitTest extends BuildDocumentIntegrationTest { entity.getManualOverwrite().addChange(removal); assertTrue(entity.ignored()); assertFalse(entity.applied()); - assertEquals(reason + ", removed by manual override", entity.buildReason()); + assertEquals(reason, entity.buildReason()); // force again ManualForceRedaction forceRedaction = ManualForceRedaction.builder() @@ -186,7 +185,7 @@ public class ManualChangesUnitTest extends BuildDocumentIntegrationTest { assertFalse(entity.applied()); assertFalse(entity.ignored()); assertFalse(entity.removed()); - assertEquals(reason + ", removed by manual override, forced by manual override", entity.buildReason()); + assertEquals(reason, entity.buildReason()); assertEquals("coolio", entity.getManualOverwrite().getLegalBasis() .orElse(entity.getMatchedRule().getLegalBasis()));