finished basic tests
This commit is contained in:
parent
49ced1cb50
commit
4ed731d114
@ -84,7 +84,7 @@ public interface ManualRedactionResource {
|
||||
|
||||
|
||||
@GetMapping(value = MANUAL_REDACTION_REST_PATH + "/comment" + COMMENT_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
Comment getComment( @PathVariable(COMMENT_ID) long commentId);
|
||||
Comment getComment(@PathVariable(COMMENT_ID) long commentId);
|
||||
|
||||
|
||||
@DeleteMapping(MANUAL_REDACTION_REST_PATH + "/add" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + ANNOTATION_ID_PATH_VARIABLE)
|
||||
@ -112,8 +112,8 @@ public interface ManualRedactionResource {
|
||||
@PathVariable(ANNOTATION_ID) String annotationId);
|
||||
|
||||
|
||||
@DeleteMapping(MANUAL_REDACTION_REST_PATH + "/comment" + FILE_ID_PATH_VARIABLE + COMMENT_ID_PATH_VARIABLE)
|
||||
void deleteComment( @PathVariable(FILE_ID) String fileId,@PathVariable(COMMENT_ID) long commentId);
|
||||
@DeleteMapping(MANUAL_REDACTION_REST_PATH + "/comment" + FILE_ID_PATH_VARIABLE + COMMENT_ID_PATH_VARIABLE)
|
||||
void deleteComment(@PathVariable(FILE_ID) String fileId, @PathVariable(COMMENT_ID) long commentId);
|
||||
|
||||
|
||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/status/add" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + ANNOTATION_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@ -12,7 +12,6 @@ import com.iqser.red.service.redaction.v1.model.RedactionLogEntry;
|
||||
import feign.FeignException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@ -484,11 +483,8 @@ public class ManualRedactionService {
|
||||
dictionaryClient.addEntries(typeId, List.of(value), false);
|
||||
|
||||
fileStatusService.setStatusReprocess(dossierId, fileId, 100);
|
||||
} catch (FeignException e) {
|
||||
if (e.status() == HttpStatus.NOT_FOUND.value()) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -500,10 +496,7 @@ public class ManualRedactionService {
|
||||
dictionaryClient.deleteEntries(typeId, List.of(value));
|
||||
fileStatusService.setStatusReprocess(dossierId, fileId, 100);
|
||||
} catch (FeignException e) {
|
||||
if (e.status() == HttpStatus.NOT_FOUND.value()) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
throw e;
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -33,7 +33,9 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
|
||||
var file = fileTesterAndProvider.testAndProvideFile(dossier);
|
||||
|
||||
var type = typeProvider.testAndProvideType(dossier.getDossierTemplate(),null, "manual");
|
||||
var type = typeProvider.testAndProvideType(dossier.getDossierTemplate(), null, "manual");
|
||||
|
||||
|
||||
|
||||
|
||||
var comment = manualRedactionClient.addComment(dossier.getId(), file.getId(), "1", CommentRequest.builder().text("test").user("1").build());
|
||||
@ -41,12 +43,24 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
assertThat(loadedComment.getText()).isEqualTo("test");
|
||||
|
||||
|
||||
|
||||
|
||||
var addRedaction = manualRedactionClient.addAddRedaction(dossier.getId(), file.getId(), AddRedactionRequest.builder().addToDictionary(true)
|
||||
.addToDossierDictionary(false).status(AnnotationStatus.REQUESTED).type(type.getId()).user("user").reason("1").value("1").legalBasis("1").build());
|
||||
.addToDossierDictionary(false).status(AnnotationStatus.REQUESTED).type(type.getId()).user("user").reason("1").value("test").legalBasis("1").build());
|
||||
var loadedAddRedaction = manualRedactionClient.getAddRedaction(file.getId(), addRedaction.getAnnotationId());
|
||||
assertThat(loadedAddRedaction.getUser()).isEqualTo("user");
|
||||
assertThat(loadedAddRedaction.getTypeId()).contains("manual");
|
||||
|
||||
manualRedactionClient.updateAddRedactionStatus(dossier.getId(), file.getId(), addRedaction.getAnnotationId(), JSONPrimitive.of(AnnotationStatus.APPROVED));
|
||||
loadedAddRedaction = manualRedactionClient.getAddRedaction(file.getId(), addRedaction.getAnnotationId());
|
||||
assertThat(loadedAddRedaction.getStatus()).isEqualTo(AnnotationStatus.APPROVED);
|
||||
|
||||
manualRedactionClient.updateAddRedactionStatus(dossier.getId(), file.getId(), addRedaction.getAnnotationId(), JSONPrimitive.of(AnnotationStatus.DECLINED));
|
||||
loadedAddRedaction = manualRedactionClient.getAddRedaction(file.getId(), addRedaction.getAnnotationId());
|
||||
assertThat(loadedAddRedaction.getStatus()).isEqualTo(AnnotationStatus.DECLINED);
|
||||
|
||||
|
||||
|
||||
|
||||
var removeRedaction = manualRedactionClient.addRemoveRedaction(dossier.getId(), file.getId(), RemoveRedactionRequest.builder()
|
||||
.annotationId(addRedaction.getAnnotationId()).comment("comment").status(AnnotationStatus.REQUESTED).user("test").removeFromDictionary(false).build());
|
||||
@ -55,24 +69,79 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
assertThat(loadedRemoveRedaction.isRemoveFromDictionary()).isEqualTo(false);
|
||||
assertThat(loadedRemoveRedaction.getSoftDeletedTime()).isNull();
|
||||
|
||||
manualRedactionClient.updateRemoveRedactionStatus(dossier.getId(), file.getId(), removeRedaction.getAnnotationId(), JSONPrimitive.of(AnnotationStatus.APPROVED));
|
||||
loadedRemoveRedaction = manualRedactionClient.getRemoveRedaction(file.getId(), addRedaction.getAnnotationId());
|
||||
assertThat(loadedRemoveRedaction.getStatus()).isEqualTo(AnnotationStatus.APPROVED);
|
||||
|
||||
manualRedactionClient.updateRemoveRedactionStatus(dossier.getId(), file.getId(), removeRedaction.getAnnotationId(), JSONPrimitive.of(AnnotationStatus.DECLINED));
|
||||
loadedRemoveRedaction = manualRedactionClient.getRemoveRedaction(file.getId(), addRedaction.getAnnotationId());
|
||||
assertThat(loadedRemoveRedaction.getStatus()).isEqualTo(AnnotationStatus.DECLINED);
|
||||
|
||||
|
||||
|
||||
|
||||
var forceRedaction = manualRedactionClient.addForceRedaction(dossier.getId(), file.getId(), ForceRedactionRequest.builder()
|
||||
.annotationId(addRedaction.getAnnotationId()).comment("comment").status(AnnotationStatus.REQUESTED).user("test").legalBasis("1").build());
|
||||
var loadedForceRedaction = manualRedactionClient.getForceRedaction(file.getId(), forceRedaction.getAnnotationId());
|
||||
assertThat(loadedForceRedaction.getLegalBasis()).isEqualTo("1");
|
||||
|
||||
manualRedactionClient.updateForceRedactionStatus(dossier.getId(), file.getId(), forceRedaction.getAnnotationId(), JSONPrimitive.of(AnnotationStatus.APPROVED));
|
||||
loadedForceRedaction = manualRedactionClient.getForceRedaction(file.getId(), addRedaction.getAnnotationId());
|
||||
assertThat(loadedForceRedaction.getStatus()).isEqualTo(AnnotationStatus.APPROVED);
|
||||
|
||||
manualRedactionClient.updateForceRedactionStatus(dossier.getId(), file.getId(), forceRedaction.getAnnotationId(), JSONPrimitive.of(AnnotationStatus.DECLINED));
|
||||
loadedForceRedaction = manualRedactionClient.getForceRedaction(file.getId(), addRedaction.getAnnotationId());
|
||||
assertThat(loadedForceRedaction.getStatus()).isEqualTo(AnnotationStatus.DECLINED);
|
||||
|
||||
|
||||
|
||||
|
||||
var legalBasisChange = manualRedactionClient.addLegalBasisChange(dossier.getId(), file.getId(), LegalBasisChangeRequest.builder()
|
||||
.annotationId(addRedaction.getAnnotationId()).comment("comment").status(AnnotationStatus.REQUESTED).user("test").legalBasis("1").build());
|
||||
var loadedLegalBasisChange = manualRedactionClient.getLegalBasisChange(file.getId(), addRedaction.getAnnotationId());
|
||||
assertThat(loadedLegalBasisChange.getId().getId()).isEqualTo(legalBasisChange.getAnnotationId());
|
||||
|
||||
manualRedactionClient.updateLegalBasisChangeStatus(dossier.getId(), file.getId(), legalBasisChange.getAnnotationId(), JSONPrimitive.of(AnnotationStatus.APPROVED));
|
||||
loadedLegalBasisChange = manualRedactionClient.getLegalBasisChange(file.getId(), addRedaction.getAnnotationId());
|
||||
assertThat(loadedLegalBasisChange.getStatus()).isEqualTo(AnnotationStatus.APPROVED);
|
||||
|
||||
manualRedactionClient.updateLegalBasisChangeStatus(dossier.getId(), file.getId(), legalBasisChange.getAnnotationId(), JSONPrimitive.of(AnnotationStatus.DECLINED));
|
||||
loadedLegalBasisChange = manualRedactionClient.getLegalBasisChange(file.getId(), addRedaction.getAnnotationId());
|
||||
assertThat(loadedLegalBasisChange.getStatus()).isEqualTo(AnnotationStatus.DECLINED);
|
||||
|
||||
|
||||
|
||||
|
||||
var imageRecategorization = manualRedactionClient.addImageRecategorization(dossier.getId(), file.getId(), ImageRecategorizationRequest.builder()
|
||||
.annotationId(addRedaction.getAnnotationId()).comment("comment").status(AnnotationStatus.REQUESTED).user("test").type("new-type").build());
|
||||
var loadedImageRecategorization = manualRedactionClient.getImageRecategorization(file.getId(), addRedaction.getAnnotationId());
|
||||
assertThat(loadedImageRecategorization.getId().getId()).isEqualTo(imageRecategorization.getAnnotationId());
|
||||
|
||||
manualRedactionClient.updateImageRecategorizationStatus(dossier.getId(), file.getId(), imageRecategorization.getAnnotationId(), JSONPrimitive.of(AnnotationStatus.APPROVED));
|
||||
loadedImageRecategorization = manualRedactionClient.getImageRecategorization(file.getId(), addRedaction.getAnnotationId());
|
||||
assertThat(loadedImageRecategorization.getStatus()).isEqualTo(AnnotationStatus.APPROVED);
|
||||
|
||||
manualRedactionClient.updateImageRecategorizationStatus(dossier.getId(), file.getId(), imageRecategorization.getAnnotationId(), JSONPrimitive.of(AnnotationStatus.DECLINED));
|
||||
loadedImageRecategorization = manualRedactionClient.getImageRecategorization(file.getId(), addRedaction.getAnnotationId());
|
||||
assertThat(loadedImageRecategorization.getStatus()).isEqualTo(AnnotationStatus.DECLINED);
|
||||
|
||||
|
||||
ManualRedactions manualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId());
|
||||
assertThat(manualRedactions.getForceRedactions()).isNotEmpty();
|
||||
assertThat(manualRedactions.getLegalBasisChanges()).isNotEmpty();
|
||||
assertThat(manualRedactions.getEntriesToAdd()).isNotEmpty();
|
||||
assertThat(manualRedactions.getIdsToRemove()).isNotEmpty();
|
||||
assertThat(manualRedactions.getImageRecategorization()).isNotEmpty();
|
||||
assertThat(manualRedactions.getComments()).isNotEmpty();
|
||||
|
||||
|
||||
manualRedactions.getForceRedactions().forEach(e -> manualRedactionClient.deleteForceRedaction(dossier.getId(), file.getId(), e.getId().getId()));
|
||||
manualRedactions.getLegalBasisChanges().forEach(e -> manualRedactionClient.deleteLegalBasisChange(dossier.getId(), file.getId(), e.getId().getId()));
|
||||
manualRedactions.getEntriesToAdd().forEach(e -> manualRedactionClient.deleteAddRedaction(dossier.getId(), file.getId(), e.getId().getId()));
|
||||
manualRedactions.getIdsToRemove().forEach(e -> manualRedactionClient.deleteRemoveRedaction(dossier.getId(), file.getId(), e.getId().getId()));
|
||||
manualRedactions.getImageRecategorization().forEach(e -> manualRedactionClient.deleteImageRecategorization(dossier.getId(), file.getId(), e.getId().getId()));
|
||||
|
||||
manualRedactions.getComments().forEach((key, value) -> value.forEach(c -> manualRedactionClient.deleteComment(file.getId(), c.getId())));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user