RED-7763 - Use EntityLog in tests in persistence-service

- updates junit tests
This commit is contained in:
Corina Olariu 2023-10-17 14:14:23 +03:00
parent 3611c9e33f
commit 8d0cafd0c8

View File

@ -414,7 +414,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.build();
var addRedactions = manualRedactionClient.addRedactionBulk(dossier1.getId(), file1.getId(), Set.of(redactionDos, redactionDosTempDict));
var loadedRedactionsFile1 = manualRedactionClient.getManualRedactions(file1.getId(), file1.getFileId());
var loadedRedactionsFile1 = manualRedactionClient.getManualRedactions(file1.getDossierId(), file1.getFileId());
var entityLog1 = new EntityLog(1,
1,
@ -440,8 +440,8 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
0,
0);
fileManagementStorageService.storeJSONObject(dossier1.getId(), file1.getId(), FileType.ENTITY_LOG, entityLog1);
var redactionRequest1 = RedactionRequest.builder().dossierId(file1.getId()).fileId(file1.getFileId()).dossierTemplateId(file1.getId()).build();
when(entityLogService.getEntityLog(file1.getId(), file1.getFileId())).thenReturn(entityLog1);
var redactionRequest1 = RedactionRequest.builder().dossierId(file1.getDossierId()).fileId(file1.getFileId()).dossierTemplateId(file1.getDossierTemplateId()).build();
when(entityLogService.getEntityLog(file1.getDossierId(), file1.getFileId())).thenReturn(entityLog1);
var entityLog2 = new EntityLog(1,
1,
@ -459,8 +459,8 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
0,
0);
fileManagementStorageService.storeJSONObject(dossier2.getId(), file2.getId(), FileType.ENTITY_LOG, entityLog2);
var redactionRequest2 = RedactionRequest.builder().dossierId(file2.getId()).fileId(file2.getFileId()).dossierTemplateId(file2.getId()).build();
when(entityLogService.getEntityLog(file2.getId(), file2.getFileId())).thenReturn(entityLog2);
var redactionRequest2 = RedactionRequest.builder().dossierId(file2.getDossierId()).fileId(file2.getFileId()).dossierTemplateId(file2.getDossierTemplateId()).build();
when(entityLogService.getEntityLog(file2.getDossierId(), file2.getFileId())).thenReturn(entityLog2);
// resize redaction in dossier 1
var resizeRedactionDosAndAddToAllDos = ResizeRedactionRequestModel.builder()
@ -473,7 +473,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
manualRedactionClient.resizeRedactionBulk(dossier1.getId(), file1.getFileId(), Set.of(resizeRedactionDosAndAddToAllDos));
loadedRedactionsFile1 = manualRedactionClient.getManualRedactions(file1.getId(), file1.getFileId());
loadedRedactionsFile1 = manualRedactionClient.getManualRedactions(file1.getDossierId(), file1.getFileId());
assertThat(loadedRedactionsFile1.getResizeRedactions()).hasSize(1);
assertThat(loadedRedactionsFile1.getResizeRedactions().stream().toList().get(0).getValue()).isEqualTo("test redaction in dossier dictionary");
@ -483,41 +483,41 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
DictionaryEntryType.ENTRY);
assertThat(dictEntries.stream().filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier dictionary"))).isNotEmpty();
var dictionaryOfTypeDosDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier1.getId(), dossier1.getId());
var dictionaryOfTypeDosDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
assertThat(dictionaryOfTypeDosDictInDossier1.getEntries()).hasSize(1);
assertThat(dictionaryOfTypeDosDictInDossier1.getEntries().get(0)).isEqualTo("test redaction in dossier");
var dictionaryOfTypeDosDictInDossier2 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier2.getId(), dossier2.getId());
var dictionaryOfTypeDosDictInDossier2 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier2.getDossierTemplateId(), dossier2.getId());
assertThat(dictionaryOfTypeDosDictInDossier2.getEntries()).isEmpty();
var dictionaryOfTypeDosDictInDossierTemplate = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossierTemplate.getId(), null);
assertThat(dictionaryOfTypeDosDictInDossierTemplate.getEntries()).hasSize(1);
assertThat(dictionaryOfTypeDosDictInDossierTemplate.getEntries().get(0)).isEqualTo("test redaction in dossier dictionary");
var dictionaryOfTypeDosTempDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossier1.getId(), dossier1.getId());
var dictionaryOfTypeDosTempDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
assertThat(dictionaryOfTypeDosTempDictInDossier1.getEntries()).isEmpty();
var dictionaryOfTypeDosTempDictInDossier2 = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossier2.getId(), dossier2.getId());
var dictionaryOfTypeDosTempDictInDossier2 = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossier2.getDossierTemplateId(), dossier2.getId());
assertThat(dictionaryOfTypeDosTempDictInDossier2.getEntries()).isEmpty();
var dictionaryOfTypeDosTempDictInDossierTemplate = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossierTemplate.getId(), null);
assertThat(dictionaryOfTypeDosTempDictInDossierTemplate.getEntries()).hasSize(1);
assertThat(dictionaryOfTypeDosTempDictInDossierTemplate.getEntries().get(0)).isEqualTo("test redaction in dossier template");
var mergedDictForTypeDosDictInDossier1 = dictionaryClient.getMergedDictionaries(typeDosDict.getType(), dossier1.getId(), dossier1.getId());
var mergedDictForTypeDosDictInDossier1 = dictionaryClient.getMergedDictionaries(typeDosDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
assertThat(mergedDictForTypeDosDictInDossier1.getEntries()).hasSize(2);
assertThat(mergedDictForTypeDosDictInDossier1.getEntries().get(0)).isEqualTo("test redaction in dossier");
assertThat(mergedDictForTypeDosDictInDossier1.getEntries().get(1)).isEqualTo("test redaction in dossier dictionary");
var mergedDictForTypeDosTempDictInDossier1 = dictionaryClient.getMergedDictionaries(typeDosTempDict.getType(), dossier1.getId(), dossier1.getId());
var mergedDictForTypeDosTempDictInDossier1 = dictionaryClient.getMergedDictionaries(typeDosTempDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
assertThat(mergedDictForTypeDosTempDictInDossier1.getEntries()).hasSize(1);
assertThat(mergedDictForTypeDosTempDictInDossier1.getEntries().get(0)).isEqualTo("test redaction in dossier template");
var mergedDictForTypeDosDictInDossier2 = dictionaryClient.getMergedDictionaries(typeDosDict.getType(), dossier2.getId(), dossier2.getId());
var mergedDictForTypeDosDictInDossier2 = dictionaryClient.getMergedDictionaries(typeDosDict.getType(), dossier2.getDossierTemplateId(), dossier2.getId());
assertThat(mergedDictForTypeDosDictInDossier2.getEntries()).hasSize(1);
assertThat(mergedDictForTypeDosDictInDossier2.getEntries().get(0)).isEqualTo("test redaction in dossier dictionary");
var mergedDictForTypeDosTempDictInDossier2 = dictionaryClient.getMergedDictionaries(typeDosTempDict.getType(), dossier2.getId(), dossier2.getId());
var mergedDictForTypeDosTempDictInDossier2 = dictionaryClient.getMergedDictionaries(typeDosTempDict.getType(), dossier2.getDossierTemplateId(), dossier2.getId());
assertThat(mergedDictForTypeDosTempDictInDossier2.getEntries()).hasSize(1);
assertThat(mergedDictForTypeDosTempDictInDossier2.getEntries().get(0)).isEqualTo("test redaction in dossier template");
}
@ -569,7 +569,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.build();
var addRedactions = manualRedactionClient.addRedactionBulk(dossier1.getId(), file1.getId(), Set.of(redactionDos, redactionDosTempDict));
var loadedRedactionsFile1 = manualRedactionClient.getManualRedactions(file1.getId(), file1.getFileId());
var loadedRedactionsFile1 = manualRedactionClient.getManualRedactions(file1.getDossierId(), file1.getFileId());
var entityLog1 = new EntityLog(1,
1,
@ -595,8 +595,8 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
0,
0);
fileManagementStorageService.storeJSONObject(dossier1.getId(), file1.getId(), FileType.ENTITY_LOG, entityLog1);
var redactionRequest1 = RedactionRequest.builder().dossierId(file1.getId()).fileId(file1.getFileId()).dossierTemplateId(file1.getId()).build();
when(entityLogService.getEntityLog(file1.getId(), file1.getFileId())).thenReturn(entityLog1);
var redactionRequest1 = RedactionRequest.builder().dossierId(file1.getDossierId()).fileId(file1.getFileId()).dossierTemplateId(file1.getDossierTemplateId()).build();
when(entityLogService.getEntityLog(file1.getDossierId(), file1.getFileId())).thenReturn(entityLog1);
var entityLog2 = new EntityLog(1,
1,
@ -605,6 +605,8 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.type(typeDosTempDict.getType())
.value("test redaction in dossier template yayy")
.dictionaryEntry(true)
.entryType(EntryType.ENTITY)
.state(EntryState.APPLIED)
.build()),
null,
0,
@ -612,8 +614,8 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
0,
0);
fileManagementStorageService.storeJSONObject(dossier2.getId(), file2.getId(), FileType.ENTITY_LOG, entityLog2);
var redactionRequest2 = RedactionRequest.builder().dossierId(file2.getId()).fileId(file2.getFileId()).dossierTemplateId(file2.getId()).build();
when(entityLogService.getEntityLog(file2.getId(), file2.getFileId())).thenReturn(entityLog2);
var redactionRequest2 = RedactionRequest.builder().dossierId(file2.getDossierId()).fileId(file2.getFileId()).dossierTemplateId(file2.getDossierTemplateId()).build();
when(entityLogService.getEntityLog(file2.getDossierId(), file2.getFileId())).thenReturn(entityLog2);
// resize redaction in dossier 1
var resizeRedactionDosAndAddToAllDos = ResizeRedactionRequestModel.builder()
@ -626,7 +628,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
manualRedactionClient.resizeRedactionBulk(dossier1.getId(), file1.getFileId(), Set.of(resizeRedactionDosAndAddToAllDos));
loadedRedactionsFile1 = manualRedactionClient.getManualRedactions(file1.getId(), file1.getFileId());
loadedRedactionsFile1 = manualRedactionClient.getManualRedactions(file1.getDossierId(), file1.getFileId());
assertThat(loadedRedactionsFile1.getResizeRedactions()).hasSize(1);
assertThat(loadedRedactionsFile1.getResizeRedactions().stream().toList().get(0).getValue()).isEqualTo("test redaction in dossier");
@ -643,41 +645,41 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
DictionaryEntryType.ENTRY);
assertThat(dictEntriesNewValue.stream().filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier"))).isNotEmpty();
var dictionaryOfTypeDosDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier1.getId(), dossier1.getId());
var dictionaryOfTypeDosDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
assertThat(dictionaryOfTypeDosDictInDossier1.getEntries()).hasSize(1);
assertThat(dictionaryOfTypeDosDictInDossier1.getEntries().get(0)).isEqualTo("test redaction in dossier yayy");
var dictionaryOfTypeDosDictInDossier2 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier2.getId(), dossier2.getId());
var dictionaryOfTypeDosDictInDossier2 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier2.getDossierTemplateId(), dossier2.getId());
assertThat(dictionaryOfTypeDosDictInDossier2.getEntries()).isEmpty();
var dictionaryOfTypeDosDictInDossierTemplate = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossierTemplate.getId(), null);
assertThat(dictionaryOfTypeDosDictInDossierTemplate.getEntries()).hasSize(1);
assertThat(dictionaryOfTypeDosDictInDossierTemplate.getEntries().get(0)).isEqualTo("test redaction in dossier");
var dictionaryOfTypeDosTempDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossier1.getId(), dossier1.getId());
var dictionaryOfTypeDosTempDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
assertThat(dictionaryOfTypeDosTempDictInDossier1.getEntries()).isEmpty();
var dictionaryOfTypeDosTempDictInDossier2 = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossier2.getId(), dossier2.getId());
var dictionaryOfTypeDosTempDictInDossier2 = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossier2.getDossierTemplateId(), dossier2.getId());
assertThat(dictionaryOfTypeDosTempDictInDossier2.getEntries()).isEmpty();
var dictionaryOfTypeDosTempDictInDossierTemplate = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossierTemplate.getId(), null);
assertThat(dictionaryOfTypeDosTempDictInDossierTemplate.getEntries()).hasSize(1);
assertThat(dictionaryOfTypeDosTempDictInDossierTemplate.getEntries().get(0)).isEqualTo("test redaction in dossier template yayy");
var mergedDictForTypeDosDictInDossier1 = dictionaryClient.getMergedDictionaries(typeDosDict.getType(), dossier1.getId(), dossier1.getId());
var mergedDictForTypeDosDictInDossier1 = dictionaryClient.getMergedDictionaries(typeDosDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
assertThat(mergedDictForTypeDosDictInDossier1.getEntries()).hasSize(2);
assertThat(mergedDictForTypeDosDictInDossier1.getEntries().get(0)).isEqualTo("test redaction in dossier");
assertThat(mergedDictForTypeDosDictInDossier1.getEntries().get(1)).isEqualTo("test redaction in dossier yayy");
var mergedDictForTypeDosTempDictInDossier1 = dictionaryClient.getMergedDictionaries(typeDosTempDict.getType(), dossier1.getId(), dossier1.getId());
var mergedDictForTypeDosTempDictInDossier1 = dictionaryClient.getMergedDictionaries(typeDosTempDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
assertThat(mergedDictForTypeDosTempDictInDossier1.getEntries()).hasSize(1);
assertThat(mergedDictForTypeDosTempDictInDossier1.getEntries().get(0)).isEqualTo("test redaction in dossier template yayy");
var mergedDictForTypeDosDictInDossier2 = dictionaryClient.getMergedDictionaries(typeDosDict.getType(), dossier2.getId(), dossier2.getId());
var mergedDictForTypeDosDictInDossier2 = dictionaryClient.getMergedDictionaries(typeDosDict.getType(), dossier2.getDossierTemplateId(), dossier2.getId());
assertThat(mergedDictForTypeDosDictInDossier2.getEntries()).hasSize(1);
assertThat(mergedDictForTypeDosDictInDossier2.getEntries().get(0)).isEqualTo("test redaction in dossier");
var mergedDictForTypeDosTempDictInDossier2 = dictionaryClient.getMergedDictionaries(typeDosTempDict.getType(), dossier2.getId(), dossier2.getId());
var mergedDictForTypeDosTempDictInDossier2 = dictionaryClient.getMergedDictionaries(typeDosTempDict.getType(), dossier2.getDossierTemplateId(), dossier2.getId());
assertThat(mergedDictForTypeDosTempDictInDossier2.getEntries()).hasSize(1);
assertThat(mergedDictForTypeDosTempDictInDossier2.getEntries().get(0)).isEqualTo("test redaction in dossier template yayy");
}
@ -754,8 +756,8 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
0,
0);
fileManagementStorageService.storeJSONObject(dossier1.getId(), file1.getId(), FileType.ENTITY_LOG, entityLog1);
var redactionRequest1 = RedactionRequest.builder().dossierId(file1.getId()).fileId(file1.getFileId()).dossierTemplateId(file1.getId()).build();
when(entityLogService.getEntityLog(file1.getId(), file1.getFileId())).thenReturn(entityLog1);
var redactionRequest1 = RedactionRequest.builder().dossierId(file1.getDossierId()).fileId(file1.getFileId()).dossierTemplateId(file1.getDossierTemplateId()).build();
when(entityLogService.getEntityLog(file1.getDossierId(), file1.getFileId())).thenReturn(entityLog1);
var entityLog2 = new EntityLog(1,
1,
@ -773,8 +775,8 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
0,
0);
fileManagementStorageService.storeJSONObject(dossier2.getId(), file2.getId(), FileType.ENTITY_LOG, entityLog2);
var redactionRequest2 = RedactionRequest.builder().dossierId(file2.getId()).fileId(file2.getFileId()).dossierTemplateId(file2.getId()).build();
when(entityLogService.getEntityLog(file2.getId(), file2.getFileId())).thenReturn(entityLog2);
var redactionRequest2 = RedactionRequest.builder().dossierId(file2.getDossierId()).fileId(file2.getFileId()).dossierTemplateId(file2.getDossierTemplateId()).build();
when(entityLogService.getEntityLog(file2.getDossierId(), file2.getFileId())).thenReturn(entityLog2);
// resize redaction in dossier dict
var resizeRedactionDosTemp = ResizeRedactionRequestModel.builder()
@ -787,7 +789,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
var resizeRedactions = manualRedactionClient.resizeRedactionBulk(dossier2.getId(), file2.getFileId(), Set.of(resizeRedactionDosTemp));
var loadedRedactionsFile2 = manualRedactionClient.getManualRedactions(file2.getId(), file2.getFileId());
var loadedRedactionsFile2 = manualRedactionClient.getManualRedactions(file2.getDossierId(), file2.getFileId());
assertThat(loadedRedactionsFile2.getResizeRedactions()).hasSize(1);
assertThat(loadedRedactionsFile2.getResizeRedactions().stream().toList().get(0).getValue()).isEqualTo("test redaction in dossier template dictionary");
@ -797,20 +799,20 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
DictionaryEntryType.ENTRY);
assertThat(dictEntries.stream().filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier template dictionary"))).hasSize(1);
var dictionaryOfTypeDosDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier1.getId(), dossier1.getId());
var dictionaryOfTypeDosDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
assertThat(dictionaryOfTypeDosDictInDossier1.getEntries()).hasSize(1);
assertThat(dictionaryOfTypeDosDictInDossier1.getEntries().get(0)).isEqualTo("test redaction in dossier");
var dictionaryOfTypeDosDictInDossier2 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier2.getId(), dossier2.getId());
var dictionaryOfTypeDosDictInDossier2 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier2.getDossierTemplateId(), dossier2.getId());
assertThat(dictionaryOfTypeDosDictInDossier2.getEntries()).isEmpty();
var dictionaryOfTypeDosDictInDossierTemplate = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossierTemplate.getId(), null);
assertThat(dictionaryOfTypeDosDictInDossierTemplate.getEntries()).isEmpty();
var dictionaryOfTypeDosTempDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossier1.getId(), dossier1.getId());
var dictionaryOfTypeDosTempDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
assertThat(dictionaryOfTypeDosTempDictInDossier1.getEntries()).isEmpty();
var dictionaryOfTypeDosTempDictInDossier2 = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossier2.getId(), dossier2.getId());
var dictionaryOfTypeDosTempDictInDossier2 = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossier2.getDossierTemplateId(), dossier2.getId());
assertThat(dictionaryOfTypeDosTempDictInDossier2.getEntries()).isEmpty();
var dictionaryOfTypeDosTempDictInDossierTemplate = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossierTemplate.getId(), null);
@ -818,19 +820,19 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
assertThat(dictionaryOfTypeDosTempDictInDossierTemplate.getEntries().get(0)).isEqualTo("test redaction in dossier template");
assertThat(dictionaryOfTypeDosTempDictInDossierTemplate.getEntries().get(1)).isEqualTo("test redaction in dossier template dictionary");
var mergedDictForTypeDosDictInDossier1 = dictionaryClient.getMergedDictionaries(typeDosDict.getType(), dossier1.getId(), dossier1.getId());
var mergedDictForTypeDosDictInDossier1 = dictionaryClient.getMergedDictionaries(typeDosDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
assertThat(mergedDictForTypeDosDictInDossier1.getEntries()).hasSize(1);
assertThat(mergedDictForTypeDosDictInDossier1.getEntries().get(0)).isEqualTo("test redaction in dossier");
var mergedDictForTypeDosTempDictInDossier1 = dictionaryClient.getMergedDictionaries(typeDosTempDict.getType(), dossier1.getId(), dossier1.getId());
var mergedDictForTypeDosTempDictInDossier1 = dictionaryClient.getMergedDictionaries(typeDosTempDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
assertThat(mergedDictForTypeDosTempDictInDossier1.getEntries()).hasSize(2);
assertThat(mergedDictForTypeDosTempDictInDossier1.getEntries().get(0)).isEqualTo("test redaction in dossier template");
assertThat(mergedDictForTypeDosTempDictInDossier1.getEntries().get(1)).isEqualTo("test redaction in dossier template dictionary");
var mergedDictForTypeDosDictInDossier2 = dictionaryClient.getMergedDictionaries(typeDosDict.getType(), dossier2.getId(), dossier2.getId());
var mergedDictForTypeDosDictInDossier2 = dictionaryClient.getMergedDictionaries(typeDosDict.getType(), dossier2.getDossierTemplateId(), dossier2.getId());
assertThat(mergedDictForTypeDosDictInDossier2.getEntries()).isEmpty();
var mergedDictForTypeDosTempDictInDossier2 = dictionaryClient.getMergedDictionaries(typeDosTempDict.getType(), dossier2.getId(), dossier2.getId());
var mergedDictForTypeDosTempDictInDossier2 = dictionaryClient.getMergedDictionaries(typeDosTempDict.getType(), dossier2.getDossierTemplateId(), dossier2.getId());
assertThat(mergedDictForTypeDosTempDictInDossier2.getEntries()).hasSize(2);
assertThat(mergedDictForTypeDosTempDictInDossier2.getEntries().get(0)).isEqualTo("test redaction in dossier template");
assertThat(mergedDictForTypeDosTempDictInDossier2.getEntries().get(1)).isEqualTo("test redaction in dossier template dictionary");
@ -908,8 +910,8 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
0,
0);
fileManagementStorageService.storeJSONObject(dossier1.getId(), file1.getId(), FileType.ENTITY_LOG, entityLog1);
var redactionRequest1 = RedactionRequest.builder().dossierId(file1.getId()).fileId(file1.getFileId()).dossierTemplateId(file1.getId()).build();
when(entityLogService.getEntityLog(file1.getId(), file1.getFileId())).thenReturn(entityLog1);
var redactionRequest1 = RedactionRequest.builder().dossierId(file1.getDossierId()).fileId(file1.getFileId()).dossierTemplateId(file1.getDossierTemplateId()).build();
when(entityLogService.getEntityLog(file1.getDossierId(), file1.getFileId())).thenReturn(entityLog1);
var entityLog2 = new EntityLog(1,
1,
@ -927,8 +929,8 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
0,
0);
fileManagementStorageService.storeJSONObject(dossier2.getId(), file2.getId(), FileType.ENTITY_LOG, entityLog2);
var redactionRequest2 = RedactionRequest.builder().dossierId(file2.getId()).fileId(file2.getFileId()).dossierTemplateId(file2.getId()).build();
when(entityLogService.getEntityLog(file2.getId(), file2.getFileId())).thenReturn(entityLog2);
var redactionRequest2 = RedactionRequest.builder().dossierId(file2.getDossierId()).fileId(file2.getFileId()).dossierTemplateId(file2.getDossierTemplateId()).build();
when(entityLogService.getEntityLog(file2.getDossierId(), file2.getFileId())).thenReturn(entityLog2);
// resize redaction in dossier dict
var resizeRedactionDosTemp = ResizeRedactionRequestModel.builder()
@ -941,7 +943,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
var resizeRedactions = manualRedactionClient.resizeRedactionBulk(dossier2.getId(), file2.getFileId(), Set.of(resizeRedactionDosTemp));
var loadedRedactionsFile2 = manualRedactionClient.getManualRedactions(file2.getId(), file2.getFileId());
var loadedRedactionsFile2 = manualRedactionClient.getManualRedactions(file2.getDossierId(), file2.getFileId());
assertThat(loadedRedactionsFile2.getResizeRedactions()).hasSize(1);
assertThat(loadedRedactionsFile2.getResizeRedactions().stream().toList().get(0).getValue()).isEqualTo("test redaction in dossier template");
@ -958,38 +960,38 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
DictionaryEntryType.ENTRY);
assertThat(dictEntriesNewValue.stream().filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier template"))).isNotEmpty();
var dictionaryOfTypeDosDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier1.getId(), dossier1.getId());
var dictionaryOfTypeDosDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
assertThat(dictionaryOfTypeDosDictInDossier1.getEntries()).hasSize(1);
assertThat(dictionaryOfTypeDosDictInDossier1.getEntries().get(0)).isEqualTo("test redaction in dossier yayy");
var dictionaryOfTypeDosDictInDossier2 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier2.getId(), dossier2.getId());
var dictionaryOfTypeDosDictInDossier2 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier2.getDossierTemplateId(), dossier2.getId());
assertThat(dictionaryOfTypeDosDictInDossier2.getEntries()).isEmpty();
var dictionaryOfTypeDosDictInDossierTemplate = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossierTemplate.getId(), null);
assertThat(dictionaryOfTypeDosDictInDossierTemplate.getEntries()).isEmpty();
var dictionaryOfTypeDosTempDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossier1.getId(), dossier1.getId());
var dictionaryOfTypeDosTempDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
assertThat(dictionaryOfTypeDosTempDictInDossier1.getEntries()).isEmpty();
var dictionaryOfTypeDosTempDictInDossier2 = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossier2.getId(), dossier2.getId());
var dictionaryOfTypeDosTempDictInDossier2 = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossier2.getDossierTemplateId(), dossier2.getId());
assertThat(dictionaryOfTypeDosTempDictInDossier2.getEntries()).isEmpty();
var dictionaryOfTypeDosTempDictInDossierTemplate = dictionaryClient.getDictionaryForType(typeDosTempDict.getType(), dossierTemplate.getId(), null);
assertThat(dictionaryOfTypeDosTempDictInDossierTemplate.getEntries()).hasSize(1);
assertThat(dictionaryOfTypeDosTempDictInDossierTemplate.getEntries().get(0)).isEqualTo("test redaction in dossier template");
var mergedDictForTypeDosDictInDossier1 = dictionaryClient.getMergedDictionaries(typeDosDict.getType(), dossier1.getId(), dossier1.getId());
var mergedDictForTypeDosDictInDossier1 = dictionaryClient.getMergedDictionaries(typeDosDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
assertThat(mergedDictForTypeDosDictInDossier1.getEntries()).hasSize(1);
assertThat(mergedDictForTypeDosDictInDossier1.getEntries().get(0)).isEqualTo("test redaction in dossier yayy");
var mergedDictForTypeDosTempDictInDossier1 = dictionaryClient.getMergedDictionaries(typeDosTempDict.getType(), dossier1.getId(), dossier1.getId());
var mergedDictForTypeDosTempDictInDossier1 = dictionaryClient.getMergedDictionaries(typeDosTempDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
assertThat(mergedDictForTypeDosTempDictInDossier1.getEntries()).hasSize(1);
assertThat(mergedDictForTypeDosTempDictInDossier1.getEntries().get(0)).isEqualTo("test redaction in dossier template");
var mergedDictForTypeDosDictInDossier2 = dictionaryClient.getMergedDictionaries(typeDosDict.getType(), dossier2.getId(), dossier2.getId());
var mergedDictForTypeDosDictInDossier2 = dictionaryClient.getMergedDictionaries(typeDosDict.getType(), dossier2.getDossierTemplateId(), dossier2.getId());
assertThat(mergedDictForTypeDosDictInDossier2.getEntries()).isEmpty();
var mergedDictForTypeDosTempDictInDossier2 = dictionaryClient.getMergedDictionaries(typeDosTempDict.getType(), dossier2.getId(), dossier2.getId());
var mergedDictForTypeDosTempDictInDossier2 = dictionaryClient.getMergedDictionaries(typeDosTempDict.getType(), dossier2.getDossierTemplateId(), dossier2.getId());
assertThat(mergedDictForTypeDosTempDictInDossier2.getEntries()).hasSize(1);
assertThat(mergedDictForTypeDosTempDictInDossier2.getEntries().get(0)).isEqualTo("test redaction in dossier template");
}