diff --git a/redaction-service-image-v1/src/main/docker/Dockerfile b/redaction-service-image-v1/src/main/docker/Dockerfile index dd0387fb..3ab50727 100644 --- a/redaction-service-image-v1/src/main/docker/Dockerfile +++ b/redaction-service-image-v1/src/main/docker/Dockerfile @@ -7,3 +7,12 @@ ENV PLATFORM_JAR ${PLATFORM_JAR} ENV USES_ELASTICSEARCH false COPY ["${PLATFORM_JAR}", "/"] + +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + wget cabextract xfonts-utils fonts-liberation \ + && rm -rf /var/lib/apt/lists/* + +RUN curl http://ftp.br.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.7_all.deb -o /tmp/ttf-mscorefonts-installer_3.7_all.deb \ + && dpkg -i /tmp/ttf-mscorefonts-installer_3.7_all.deb \ + && rm /tmp/ttf-mscorefonts-installer_3.7_all.deb \ 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 f4ac8d2b..e6b337b2 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 @@ -14,13 +14,10 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; -import java.util.UUID; import java.util.stream.Collectors; import org.apache.commons.io.IOUtils; @@ -47,16 +44,10 @@ import com.iqser.red.service.configuration.v1.api.model.DictionaryResponse; import com.iqser.red.service.configuration.v1.api.model.RulesResponse; import com.iqser.red.service.configuration.v1.api.model.TypeResponse; import com.iqser.red.service.configuration.v1.api.model.TypeResult; -import com.iqser.red.service.redaction.v1.model.Comment; -import com.iqser.red.service.redaction.v1.model.IdRemoval; -import com.iqser.red.service.redaction.v1.model.ManualRedactionEntry; import com.iqser.red.service.redaction.v1.model.ManualRedactions; -import com.iqser.red.service.redaction.v1.model.Point; -import com.iqser.red.service.redaction.v1.model.Rectangle; import com.iqser.red.service.redaction.v1.model.RedactionLogEntry; import com.iqser.red.service.redaction.v1.model.RedactionRequest; import com.iqser.red.service.redaction.v1.model.RedactionResult; -import com.iqser.red.service.redaction.v1.model.Status; import com.iqser.red.service.redaction.v1.server.client.DictionaryClient; import com.iqser.red.service.redaction.v1.server.client.RulesClient; import com.iqser.red.service.redaction.v1.server.controller.RedactionController; @@ -352,62 +343,39 @@ public class RedactionIntegrationTest { public void testManualRedaction() throws IOException { -// { -// "id": "fed70e44fafdfd814d8caf4738296aa7", -// "user": "9f649779-1b43-4ce1-926a-deadeecbdd94", -// "type": "manual", -// "value": "Shults", -// "reason": "the method of manufacture", -// "legalBasis": "Reg (EC) No 1107/2009 Art. 63 (2a)", -// "positions": [ -// { -// "topLeft": { -// "x": 167.04001, -// "y": 449.00894 -// }, -// "width": 30.494343, -// "height": 11.852395, -// "page": 28 -// } -// ], -// "status": "APPROVED", -// "addToDictionary": false, -// "requestDate": "2020-11-17T10:01:21Z", -// "processedDate": "2020-11-17T10:01:21Z" -// }, - - + ClassPathResource redactionLogResource = new ClassPathResource("files/ManualRedactions.json"); + ManualRedactions manualRedactions = objectMapper.readValue(redactionLogResource.getInputStream(), ManualRedactions.class); System.out.println("testManualRedaction"); long start = System.currentTimeMillis(); - ClassPathResource pdfFileResource = new ClassPathResource("files/21 Chlorothalonil RAR 11 Volume 3CA B 9 August 2017-server.pdf"); + ClassPathResource pdfFileResource = new ClassPathResource("files/21 Chlorothalonil RAR 11 Volume 3CA B 9 August 2017.pdf"); - ManualRedactions manualRedactions = new ManualRedactions(); - - String manualAddId = UUID.randomUUID().toString(); - - Comment comment = Comment.builder() - .date(OffsetDateTime.now()) - .user("TEST_USER") - .text("This is a comment test") - .build(); - manualRedactions.setIdsToRemove(Set.of(IdRemoval.builder() - .id("0836727c3508a0b2ea271da69c04cc2f") - .status(Status.REQUESTED) - .build())); - - manualRedactions.getComments().put("e5be0f1d941bbb92a068e198648d06c4", List.of(comment)); - manualRedactions.getComments().put("0836727c3508a0b2ea271da69c04cc2f", List.of(comment)); - manualRedactions.getComments().put(manualAddId, List.of(comment)); - - ManualRedactionEntry manualRedactionEntry = new ManualRedactionEntry(); - manualRedactionEntry.setId(manualAddId); - manualRedactionEntry.setStatus(Status.REQUESTED); - manualRedactionEntry.setType("name"); - manualRedactionEntry.setValue("O'Loughlin C.K."); - manualRedactionEntry.setReason("Manual Redaction"); - manualRedactionEntry.setPositions(List.of(new Rectangle(new Point(375.61096f, 241.282f), 7.648041f, 43.72262f, 1), new Rectangle(new Point(384.83517f, 241.282f), 7.648041f, 17.043358f, 1))); +// ManualRedactions manualRedactions = new ManualRedactions(); +// +// String manualAddId = UUID.randomUUID().toString(); +// +// Comment comment = Comment.builder() +// .date(OffsetDateTime.now()) +// .user("TEST_USER") +// .text("This is a comment test") +// .build(); +// manualRedactions.setIdsToRemove(Set.of(IdRemoval.builder() +// .id("0836727c3508a0b2ea271da69c04cc2f") +// .status(Status.REQUESTED) +// .build())); +// +// manualRedactions.getComments().put("e5be0f1d941bbb92a068e198648d06c4", List.of(comment)); +// manualRedactions.getComments().put("0836727c3508a0b2ea271da69c04cc2f", List.of(comment)); +// manualRedactions.getComments().put(manualAddId, List.of(comment)); +// +// ManualRedactionEntry manualRedactionEntry = new ManualRedactionEntry(); +// manualRedactionEntry.setId(manualAddId); +// manualRedactionEntry.setStatus(Status.REQUESTED); +// manualRedactionEntry.setType("name"); +// manualRedactionEntry.setValue("O'Loughlin C.K."); +// manualRedactionEntry.setReason("Manual Redaction"); +// manualRedactionEntry.setPositions(List.of(new Rectangle(new Point(375.61096f, 241.282f), 7.648041f, 43.72262f, 1), new Rectangle(new Point(384.83517f, 241.282f), 7.648041f, 17.043358f, 1))); // manualRedactions.getEntriesToAdd().add(manualRedactionEntry); diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/files/21 Chlorothalonil RAR 11 Volume 3CA B 9 August 2017.pdf b/redaction-service-v1/redaction-service-server-v1/src/test/resources/files/21 Chlorothalonil RAR 11 Volume 3CA B 9 August 2017.pdf new file mode 100644 index 00000000..dcf32eaf Binary files /dev/null and b/redaction-service-v1/redaction-service-server-v1/src/test/resources/files/21 Chlorothalonil RAR 11 Volume 3CA B 9 August 2017.pdf differ