RED-8480: adjusted tests

This commit is contained in:
Ali Oezyetimoglu 2024-02-16 10:01:13 +01:00
parent bb3d6f5d74
commit 3a0ffaef72
5 changed files with 27 additions and 25 deletions

View File

@ -7,7 +7,7 @@ description = "redaction-service-api-v1"
dependencies { dependencies {
implementation("org.springframework:spring-web:6.0.12") implementation("org.springframework:spring-web:6.0.12")
implementation("com.iqser.red.service:persistence-service-internal-api-v1:RED-8480-2") implementation("com.iqser.red.service:persistence-service-internal-api-v1:2.351.0")
} }
publishing { publishing {

View File

@ -16,7 +16,7 @@ val layoutParserVersion = "0.86.0"
val jacksonVersion = "2.15.2" val jacksonVersion = "2.15.2"
val droolsVersion = "9.44.0.Final" val droolsVersion = "9.44.0.Final"
val pdfBoxVersion = "3.0.0" val pdfBoxVersion = "3.0.0"
val persistenceServiceVersion = "RED-8480-2" val persistenceServiceVersion = "2.351.0"
val springBootStarterVersion = "3.1.5" val springBootStarterVersion = "3.1.5"
configurations { configurations {

View File

@ -131,7 +131,7 @@ public class ManualChangeOverwrite {
if (manualChange instanceof ManualRecategorization recategorization) { if (manualChange instanceof ManualRecategorization recategorization) {
recategorized = true; recategorized = true;
type = recategorization.getType(); type = recategorization.getType();
if (!recategorization.getLegalBasis().isEmpty()) { if (recategorization.getLegalBasis() != null && !recategorization.getLegalBasis().isEmpty()) {
legalBasis = recategorization.getLegalBasis(); legalBasis = recategorization.getLegalBasis();
} }
} }

View File

@ -1014,7 +1014,7 @@ public class RedactionIntegrationTest extends AbstractRedactionIntegrationTest {
.annotationId("675eba69b0c2917de55462c817adaa05") .annotationId("675eba69b0c2917de55462c817adaa05")
.fileId("fileId") .fileId("fileId")
.legalBasis("Something") .legalBasis("Something")
.requestDate(OffsetDateTime.now()) .requestDate(OffsetDateTime.now())
.processedDate(OffsetDateTime.now()) .processedDate(OffsetDateTime.now())
.build())); .build()));
@ -1040,14 +1040,14 @@ public class RedactionIntegrationTest extends AbstractRedactionIntegrationTest {
manualRedactions.setIdsToRemove(Set.of(IdRemoval.builder() manualRedactions.setIdsToRemove(Set.of(IdRemoval.builder()
.annotationId("5b940b2cb401ed9f5be6fc24f6e77bcf") .annotationId("5b940b2cb401ed9f5be6fc24f6e77bcf")
.fileId("fileId") .fileId("fileId")
.requestDate(OffsetDateTime.now()) .requestDate(OffsetDateTime.now())
.processedDate(OffsetDateTime.now()) .processedDate(OffsetDateTime.now())
.build())); .build()));
manualRedactions.setLegalBasisChanges((Set.of(ManualLegalBasisChange.builder() manualRedactions.setLegalBasisChanges((Set.of(ManualLegalBasisChange.builder()
.annotationId("675eba69b0c2917de55462c817adaa05") .annotationId("675eba69b0c2917de55462c817adaa05")
.fileId("fileId") .fileId("fileId")
.legalBasis("Manual Legal Basis Change") .legalBasis("Manual Legal Basis Change")
.processedDate(OffsetDateTime.now()) .processedDate(OffsetDateTime.now())
.requestDate(OffsetDateTime.now()) .requestDate(OffsetDateTime.now())
.build()))); .build())));
manualRedactions.setResizeRedactions(Set.of(ManualResizeRedaction.builder() manualRedactions.setResizeRedactions(Set.of(ManualResizeRedaction.builder()
@ -1060,7 +1060,7 @@ public class RedactionIntegrationTest extends AbstractRedactionIntegrationTest {
Rectangle.builder().topLeftX(298.67056f).topLeftY(327.567f).width(7.648041f).height(75.32377f).page(1).build(), Rectangle.builder().topLeftX(298.67056f).topLeftY(327.567f).width(7.648041f).height(75.32377f).page(1).build(),
Rectangle.builder().topLeftX(307.89517f).topLeftY(327.567f).width(7.648041f).height(61.670967f).page(1).build(), Rectangle.builder().topLeftX(307.89517f).topLeftY(327.567f).width(7.648041f).height(61.670967f).page(1).build(),
Rectangle.builder().topLeftX(316.99985f).topLeftY(327.567f).width(7.648041f).height(38.104286f).page(1).build())) Rectangle.builder().topLeftX(316.99985f).topLeftY(327.567f).width(7.648041f).height(38.104286f).page(1).build()))
.updateDictionary(false) .updateDictionary(false)
.build())); .build()));
analyzeService.reanalyze(request); analyzeService.reanalyze(request);
@ -1193,7 +1193,7 @@ public class RedactionIntegrationTest extends AbstractRedactionIntegrationTest {
.section("[19, 2]: Paragraph: Contact point: LexCo Contact:") .section("[19, 2]: Paragraph: Contact point: LexCo Contact:")
.value("0049 331 441 551 14") .value("0049 331 441 551 14")
.requestDate(OffsetDateTime.now()) .requestDate(OffsetDateTime.now())
.fileId(TEST_FILE_ID) .fileId(TEST_FILE_ID)
.legalBasis("Article 39(e)(2) of Regulation (EC) No 178/2002") .legalBasis("Article 39(e)(2) of Regulation (EC) No 178/2002")
.build())) .build()))
.build()); .build());
@ -1230,14 +1230,15 @@ public class RedactionIntegrationTest extends AbstractRedactionIntegrationTest {
.section("[19, 2]: Paragraph: Contact point: LexCo Contact:") .section("[19, 2]: Paragraph: Contact point: LexCo Contact:")
.value("0049 331 441 551 14") .value("0049 331 441 551 14")
.requestDate(OffsetDateTime.now()) .requestDate(OffsetDateTime.now())
.fileId(TEST_FILE_ID) .fileId(TEST_FILE_ID)
.legalBasis("Article 39(e)(2) of Regulation (EC) No 178/2002") .legalBasis("Article 39(e)(2) of Regulation (EC) No 178/2002")
.build())) .build()))
.recategorizations(Set.of(ManualRecategorization.builder() .recategorizations(Set.of(ManualRecategorization.builder()
.annotationId("3029651d0842a625f2d23f8375c23600") .annotationId("3029651d0842a625f2d23f8375c23600")
.type("CBI_author") .type("CBI_author")
.legalBasis("")
.requestDate(OffsetDateTime.now()) .requestDate(OffsetDateTime.now())
.fileId(TEST_FILE_ID) .fileId(TEST_FILE_ID)
.build())) .build()))
.build()); .build());
@ -1331,6 +1332,7 @@ public class RedactionIntegrationTest extends AbstractRedactionIntegrationTest {
assertEquals(entityLog.getEntityLogEntry().stream().filter(entityLogEntry -> entityLogEntry.getId().equals(manualAddId2)).findFirst().get().getState(), EntryState.REMOVED); assertEquals(entityLog.getEntityLogEntry().stream().filter(entityLogEntry -> entityLogEntry.getId().equals(manualAddId2)).findFirst().get().getState(), EntryState.REMOVED);
} }
@Test @Test
@SneakyThrows @SneakyThrows
public void testResizeWithUpdateDictionaryTrue() { public void testResizeWithUpdateDictionaryTrue() {
@ -1345,14 +1347,14 @@ public class RedactionIntegrationTest extends AbstractRedactionIntegrationTest {
var david = entityLog.getEntityLogEntry().stream().filter(e -> e.getValue().equals("David")).findFirst().get(); var david = entityLog.getEntityLogEntry().stream().filter(e -> e.getValue().equals("David")).findFirst().get();
request.setManualRedactions(ManualRedactions.builder() request.setManualRedactions(ManualRedactions.builder()
.resizeRedactions(Set.of(ManualResizeRedaction.builder() .resizeRedactions(Set.of(ManualResizeRedaction.builder()
.updateDictionary(true) .updateDictionary(true)
.annotationId(david.getId()) .annotationId(david.getId())
.requestDate(OffsetDateTime.now()) .requestDate(OffsetDateTime.now())
.value("David Ksenia") .value("David Ksenia")
.positions(List.of(Rectangle.builder().topLeftX(56.8f).topLeftY(293.564f).width(65.592f).height(15.408f).page(1).build())) .positions(List.of(Rectangle.builder().topLeftX(56.8f).topLeftY(293.564f).width(65.592f).height(15.408f).page(1).build()))
.addToAllDossiers(false) .addToAllDossiers(false)
.build())) .build()))
.build()); .build());
analyzeService.reanalyze(request); analyzeService.reanalyze(request);
entityLog = redactionStorageService.getEntityLog(TEST_DOSSIER_ID, TEST_FILE_ID); entityLog = redactionStorageService.getEntityLog(TEST_DOSSIER_ID, TEST_FILE_ID);
@ -1364,12 +1366,7 @@ public class RedactionIntegrationTest extends AbstractRedactionIntegrationTest {
private IdRemoval getIdRemoval(String id) { private IdRemoval getIdRemoval(String id) {
return IdRemoval.builder() return IdRemoval.builder().annotationId(id).removeFromAllDossiers(false).removeFromDictionary(false).requestDate(OffsetDateTime.now()).build();
.annotationId(id)
.removeFromAllDossiers(false)
.removeFromDictionary(false)
.requestDate(OffsetDateTime.now())
.build();
} }

View File

@ -115,7 +115,12 @@ public class ManualChangesUnitTest extends BuildDocumentIntegrationTest {
assertEquals(legalBasis, entity.getManualOverwrite().getLegalBasis().orElse(entity.getMatchedRule().getLegalBasis())); assertEquals(legalBasis, entity.getManualOverwrite().getLegalBasis().orElse(entity.getMatchedRule().getLegalBasis()));
assertEquals(section, entity.getManualOverwrite().getSection().orElse(entity.getDeepestFullyContainingNode().toString())); assertEquals(section, entity.getManualOverwrite().getSection().orElse(entity.getDeepestFullyContainingNode().toString()));
ManualRecategorization imageRecategorizationRequest = ManualRecategorization.builder().type("type").requestDate(start.plusSeconds(5)).annotationId(annotationId).build(); ManualRecategorization imageRecategorizationRequest = ManualRecategorization.builder()
.type("type")
.requestDate(start.plusSeconds(5))
.annotationId(annotationId)
.legalBasis("")
.build();
entity.getManualOverwrite().addChange(imageRecategorizationRequest); entity.getManualOverwrite().addChange(imageRecategorizationRequest);
assertTrue(entity.getManualOverwrite().getRecategorized().isPresent()); assertTrue(entity.getManualOverwrite().getRecategorized().isPresent());
assertTrue(entity.getManualOverwrite().getRecategorized().get()); assertTrue(entity.getManualOverwrite().getRecategorized().get());