diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/RedactionIntegrationTest.java b/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/RedactionIntegrationTest.java index ac368c12..87c5f4fa 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/RedactionIntegrationTest.java +++ b/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/RedactionIntegrationTest.java @@ -51,6 +51,7 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.AnalyzeResu import com.iqser.red.service.persistence.service.v1.api.shared.model.FileAttribute; import com.iqser.red.service.persistence.service.v1.api.shared.model.RuleFileType; import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.ChangeType; +import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLog; import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLogEntry; import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntryState; import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntryType; @@ -2197,6 +2198,21 @@ public class RedactionIntegrationTest extends RulesIntegrationTest { } + @Test + public void testFileWithImagesAndNoText() { + + AnalyzeRequest request = prepareStorage("files/new/only_images.pdf", + "files/cv_service_empty_response.json", + "files/only_images_file_image_response.json"); + + analyzeDocumentStructure(LayoutParsingType.REDACT_MANAGER, request); + AnalyzeResult result = analyzeService.analyze(request); + assertThat(result).isNotNull(); + EntityLog entityLog = redactionStorageService.getEntityLog(TEST_DOSSIER_ID, TEST_FILE_ID); + assertEquals(entityLog.getEntityLogEntry().size(), 3); + } + + private IdRemoval getIdRemoval(String id) { return IdRemoval.builder() diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/files/new/only_images.pdf b/redaction-service-v1/redaction-service-server-v1/src/test/resources/files/new/only_images.pdf new file mode 100644 index 00000000..824a1c27 Binary files /dev/null and b/redaction-service-v1/redaction-service-server-v1/src/test/resources/files/new/only_images.pdf differ diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/files/only_images_file_image_response.json b/redaction-service-v1/redaction-service-server-v1/src/test/resources/files/only_images_file_image_response.json new file mode 100644 index 00000000..0eb2875d --- /dev/null +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/files/only_images_file_image_response.json @@ -0,0 +1,135 @@ +{ + "dossierId": "8cde6e20-8cf4-47cc-84df-5fd61f5e370b", + "fileId": "af2212cfe439684a8504073325bce45b", + "targetFileExtension": "ORIGIN.pdf.gz", + "responseFileExtension": "IMAGE_INFO.json.gz", + "X-TENANT-ID": "redaction", + "data": [ + { + "classification": { + "label": "signature", + "probabilities": { + "signature": 0.8641, + "other": 0.0741, + "logo": 0.0561, + "formula": 0.0057 + } + }, + "representation": "FFAF1EFEF9F7EFBFFC38F3EF9", + "position": { + "x1": 48, + "x2": 276, + "y1": 583, + "y2": 663, + "pageNumber": 1 + }, + "geometry": { + "width": 228, + "height": 80 + }, + "alpha": false, + "filters": { + "geometry": { + "imageSize": { + "quotient": 0.1908, + "tooLarge": false, + "tooSmall": false + }, + "imageFormat": { + "quotient": 2.85, + "tooTall": false, + "tooWide": false + } + }, + "probability": { + "unconfident": false + }, + "allPassed": true + } + }, + { + "classification": { + "label": "logo", + "probabilities": { + "logo": 0.3884, + "other": 0.2522, + "signature": 0.2145, + "formula": 0.1449 + } + }, + "representation": "FF0F0C30F0C30E0C2030830E", + "position": { + "x1": 54, + "x2": 142, + "y1": 683, + "y2": 759, + "pageNumber": 1 + }, + "geometry": { + "width": 88, + "height": 76 + }, + "alpha": false, + "filters": { + "geometry": { + "imageSize": { + "quotient": 0.1155, + "tooLarge": false, + "tooSmall": false + }, + "imageFormat": { + "quotient": 1.1579, + "tooTall": false, + "tooWide": false + } + }, + "probability": { + "unconfident": true + }, + "allPassed": false + } + }, + { + "classification": { + "label": "other", + "probabilities": { + "other": 0.9197, + "formula": 0.0786, + "signature": 0.0016, + "logo": 0.0 + } + }, + "representation": "CF377FF072C933606391CFF7E", + "position": { + "x1": 55, + "x2": 234, + "y1": 410, + "y2": 520, + "pageNumber": 1 + }, + "geometry": { + "width": 179, + "height": 110 + }, + "alpha": false, + "filters": { + "geometry": { + "imageSize": { + "quotient": 0.1982, + "tooLarge": false, + "tooSmall": false + }, + "imageFormat": { + "quotient": 1.6273, + "tooTall": false, + "tooWide": false + } + }, + "probability": { + "unconfident": false + }, + "allPassed": true + } + } + ] +} \ No newline at end of file