RED-10200: update test
This commit is contained in:
parent
8126e7f81e
commit
bd97e60e0f
@ -1653,7 +1653,17 @@ public class RedactionIntegrationTest extends RulesIntegrationTest {
|
|||||||
.findFirst()
|
.findFirst()
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
|
List<Rectangle> positions = List.of(Rectangle.builder().topLeftX(56.8f).topLeftY(293.564f).width(29.2922f).height(15.408f).page(1).build());
|
||||||
request.setManualRedactions(ManualRedactions.builder()
|
request.setManualRedactions(ManualRedactions.builder()
|
||||||
|
.entriesToAdd(Set.of(ManualRedactionEntry.builder()
|
||||||
|
.annotationId("newId")
|
||||||
|
.fileId(TEST_FILE_ID)
|
||||||
|
.user("user")
|
||||||
|
.requestDate(OffsetDateTime.now())
|
||||||
|
.value("David")
|
||||||
|
.type("CBI_author")
|
||||||
|
.positions(positions)
|
||||||
|
.build()))
|
||||||
.resizeRedactions(Set.of(ManualResizeRedaction.builder()
|
.resizeRedactions(Set.of(ManualResizeRedaction.builder()
|
||||||
.updateDictionary(false)
|
.updateDictionary(false)
|
||||||
.annotationId(davidKsenia.getId())
|
.annotationId(davidKsenia.getId())
|
||||||
@ -1661,28 +1671,30 @@ public class RedactionIntegrationTest extends RulesIntegrationTest {
|
|||||||
.user("user")
|
.user("user")
|
||||||
.requestDate(OffsetDateTime.now())
|
.requestDate(OffsetDateTime.now())
|
||||||
.value("David")
|
.value("David")
|
||||||
.positions(List.of(Rectangle.builder()
|
.positions(positions)
|
||||||
.topLeftX(56.8f)
|
|
||||||
.topLeftY(293.564f)
|
|
||||||
.width(29.2922f)
|
|
||||||
.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);
|
||||||
var resizedEntity = entityLog.getEntityLogEntry()
|
var resizedEntity = entityLog.getEntityLogEntry()
|
||||||
|
.stream()
|
||||||
|
.filter(e -> e.getId().equals("newId"))
|
||||||
|
.findFirst()
|
||||||
|
.get();
|
||||||
|
|
||||||
|
var removedEntity = entityLog.getEntityLogEntry()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(e -> e.getId().equals(davidKsenia.getId()))
|
.filter(e -> e.getId().equals(davidKsenia.getId()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.get();
|
.get();
|
||||||
assertEquals(resizedEntity.getState(), EntryState.APPLIED);
|
|
||||||
assertEquals(resizedEntity.getValue(), "David");
|
assertEquals(EntryState.APPLIED, resizedEntity.getState());
|
||||||
|
assertEquals("David", resizedEntity.getValue());
|
||||||
assertEquals(1, resizedEntity.getManualChanges().size());
|
assertEquals(1, resizedEntity.getManualChanges().size());
|
||||||
assertEquals(resizedEntity.getManualChanges()
|
assertEquals(1, resizedEntity.getEngines().size());
|
||||||
.get(0).getManualRedactionType(), ManualRedactionType.RESIZE);
|
|
||||||
|
assertEquals(EntryState.REMOVED, removedEntity.getState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2353,8 +2365,10 @@ public class RedactionIntegrationTest extends RulesIntegrationTest {
|
|||||||
assertEquals(entityLog.getEntityLogEntry().size(), 3);
|
assertEquals(entityLog.getEntityLogEntry().size(), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPurityRule() {
|
public void testPurityRule() {
|
||||||
|
|
||||||
String EFSA_SANITISATION_RULES = loadFromClassPath("drools/efsa_sanitisation.drl");
|
String EFSA_SANITISATION_RULES = loadFromClassPath("drools/efsa_sanitisation.drl");
|
||||||
when(rulesClient.getRules(TEST_DOSSIER_TEMPLATE_ID, RuleFileType.ENTITY)).thenReturn(JSONPrimitive.of(EFSA_SANITISATION_RULES));
|
when(rulesClient.getRules(TEST_DOSSIER_TEMPLATE_ID, RuleFileType.ENTITY)).thenReturn(JSONPrimitive.of(EFSA_SANITISATION_RULES));
|
||||||
|
|
||||||
@ -2363,7 +2377,10 @@ public class RedactionIntegrationTest extends RulesIntegrationTest {
|
|||||||
analyzeService.analyze(request);
|
analyzeService.analyze(request);
|
||||||
|
|
||||||
var entityLog = redactionStorageService.getEntityLog(TEST_DOSSIER_ID, TEST_FILE_ID);
|
var entityLog = redactionStorageService.getEntityLog(TEST_DOSSIER_ID, TEST_FILE_ID);
|
||||||
var entriesCount = entityLog.getEntityLogEntry().stream().filter(e -> e.getValue().toLowerCase(Locale.ENGLISH).startsWith("purity")).collect(Collectors.toList()).size();
|
var entriesCount = entityLog.getEntityLogEntry()
|
||||||
|
.stream()
|
||||||
|
.filter(e -> e.getValue().toLowerCase(Locale.ENGLISH).startsWith("purity"))
|
||||||
|
.collect(Collectors.toList()).size();
|
||||||
assertEquals(7, entriesCount);
|
assertEquals(7, entriesCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user