RED-7384: migration fixes
* fix test
This commit is contained in:
parent
7df02d588a
commit
5bfeec1b21
@ -243,14 +243,13 @@ public class EntityLogMergeTest {
|
|||||||
String dossierId = "dossierId";
|
String dossierId = "dossierId";
|
||||||
String dossierTemplateId = "dossierTemplateId";
|
String dossierTemplateId = "dossierTemplateId";
|
||||||
|
|
||||||
String entryToAddId = UUID.randomUUID().toString();
|
|
||||||
String rectangleToAddId = UUID.randomUUID().toString();
|
String rectangleToAddId = UUID.randomUUID().toString();
|
||||||
String entryToRemoveId = UUID.randomUUID().toString();
|
String entryToRemoveId = UUID.randomUUID().toString();
|
||||||
String entryToResizeId = UUID.randomUUID().toString();
|
String entryToResizeId = UUID.randomUUID().toString();
|
||||||
String entryLegalBasisId = UUID.randomUUID().toString();
|
String entryLegalBasisId = UUID.randomUUID().toString();
|
||||||
String forceRedactionId = UUID.randomUUID().toString();
|
String forceRedactionId = UUID.randomUUID().toString();
|
||||||
|
|
||||||
ManualRedactions manualRedactions = provideManualRedactions(entryToAddId, entryToRemoveId, entryToResizeId, entryLegalBasisId, forceRedactionId, fileId, rectangleToAddId);
|
ManualRedactions manualRedactions = provideManualRedactions(entryLegalBasisId, entryToRemoveId, entryToResizeId, entryLegalBasisId, forceRedactionId, fileId, rectangleToAddId);
|
||||||
|
|
||||||
var entityLog = provideEntityLog(entryToRemoveId, entryToResizeId, entryLegalBasisId, forceRedactionId, true);
|
var entityLog = provideEntityLog(entryToRemoveId, entryToResizeId, entryLegalBasisId, forceRedactionId, true);
|
||||||
|
|
||||||
@ -272,21 +271,22 @@ public class EntityLogMergeTest {
|
|||||||
.filter(entityLogEntry1 -> entityLogEntry1.getId().equals(entryToResizeId))
|
.filter(entityLogEntry1 -> entityLogEntry1.getId().equals(entryToResizeId))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
assertTrue(optionalResizeEntryLogEntry.isPresent());
|
assertTrue(optionalResizeEntryLogEntry.isPresent());
|
||||||
assertEquals(optionalResizeEntryLogEntry.get().getEntryType(), EntryType.ENTITY);
|
assertEquals(EntryType.ENTITY, optionalResizeEntryLogEntry.get().getEntryType());
|
||||||
|
|
||||||
var optionalLegalBasisEntryLogEntry = response.getEntityLogEntry()
|
var legalBasisEntries = response.getEntityLogEntry()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(entityLogEntry1 -> entityLogEntry1.getId().equals(entryLegalBasisId))
|
.filter(entityLogEntry1 -> entityLogEntry1.getId().equals(entryLegalBasisId))
|
||||||
.findFirst();
|
.toList();
|
||||||
assertTrue(optionalLegalBasisEntryLogEntry.isPresent());
|
assertEquals(2, legalBasisEntries.size());
|
||||||
assertEquals(optionalLegalBasisEntryLogEntry.get().getState(), EntryState.REMOVED);
|
assertEquals(EntryState.REMOVED, legalBasisEntries.get(0).getState());
|
||||||
|
assertEquals(EntryState.APPLIED, legalBasisEntries.get(1).getState());
|
||||||
|
|
||||||
var optionalForceRedactionEntryLogEntry = response.getEntityLogEntry()
|
var optionalForceRedactionEntryLogEntry = response.getEntityLogEntry()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(entityLogEntry1 -> entityLogEntry1.getId().equals(forceRedactionId))
|
.filter(entityLogEntry1 -> entityLogEntry1.getId().equals(forceRedactionId))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
assertTrue(optionalForceRedactionEntryLogEntry.isPresent());
|
assertTrue(optionalForceRedactionEntryLogEntry.isPresent());
|
||||||
assertEquals(optionalForceRedactionEntryLogEntry.get().getState(), EntryState.REMOVED);
|
assertEquals(EntryState.APPLIED, optionalForceRedactionEntryLogEntry.get().getState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -302,7 +302,6 @@ public class EntityLogMergeTest {
|
|||||||
String entryLegalBasisId = UUID.randomUUID().toString();
|
String entryLegalBasisId = UUID.randomUUID().toString();
|
||||||
String forceRedactionId = UUID.randomUUID().toString();
|
String forceRedactionId = UUID.randomUUID().toString();
|
||||||
|
|
||||||
|
|
||||||
ManualRedactions manualRedactions = new ManualRedactions();
|
ManualRedactions manualRedactions = new ManualRedactions();
|
||||||
List<Rectangle> positions = new ArrayList<>();
|
List<Rectangle> positions = new ArrayList<>();
|
||||||
positions.add(new Rectangle(2, 2, 2, 2, 1));
|
positions.add(new Rectangle(2, 2, 2, 2, 1));
|
||||||
@ -329,10 +328,16 @@ public class EntityLogMergeTest {
|
|||||||
|
|
||||||
EntityLog response = entityLogMergeService.mergeEntityLog(manualRedactions, entityLog, DossierEntity.builder().dossierTemplateId(dossierTemplateId).build());
|
EntityLog response = entityLogMergeService.mergeEntityLog(manualRedactions, entityLog, DossierEntity.builder().dossierTemplateId(dossierTemplateId).build());
|
||||||
|
|
||||||
var resizedEntry = response.getEntityLogEntry().stream().filter(entityLogEntry1 -> entityLogEntry1.getId().equals(entryToResizeId)).findFirst().get();
|
var resizedEntry = response.getEntityLogEntry()
|
||||||
|
.stream()
|
||||||
|
.filter(entityLogEntry1 -> entityLogEntry1.getId().equals(entryToResizeId))
|
||||||
|
.findFirst()
|
||||||
|
.get();
|
||||||
int index = response.getEntityLogEntry().indexOf(resizedEntry);
|
int index = response.getEntityLogEntry().indexOf(resizedEntry);
|
||||||
assertEquals(response.getEntityLogEntry().get(index + 1).getId(), resizedEntry.getId());
|
assertEquals(response.getEntityLogEntry()
|
||||||
assertEquals(response.getEntityLogEntry().get(index + 1).getState(), EntryState.PENDING);
|
.get(index + 1).getId(), resizedEntry.getId());
|
||||||
|
assertEquals(response.getEntityLogEntry()
|
||||||
|
.get(index + 1).getState(), EntryState.PENDING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user