fix tests
This commit is contained in:
parent
3052b82842
commit
c9e330ab97
@ -482,8 +482,54 @@ public class RedactionIntegrationTest {
|
|||||||
assertThat(result).isNotNull();
|
assertThat(result).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMergedImages() throws IOException {
|
||||||
|
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
ClassPathResource pdfFileResource = new ClassPathResource("files/Minimal Examples/merge_images.pdf");
|
||||||
|
|
||||||
|
AnalyzeRequest request = prepareStorage(pdfFileResource.getInputStream());
|
||||||
|
AnalyzeResult result = reanalyzeService.analyze(request);
|
||||||
|
|
||||||
|
Map<String, List<RedactionLogEntry>> duplicates = new HashMap<>();
|
||||||
|
|
||||||
|
var redactionLog = redactionStorageService.getRedactionLog(TEST_PROJECT_ID, TEST_FILE_ID);
|
||||||
|
|
||||||
|
redactionLog.getRedactionLogEntry().forEach(entry -> {
|
||||||
|
duplicates.computeIfAbsent(entry.getId(), v -> new ArrayList<>()).add(entry);
|
||||||
|
});
|
||||||
|
|
||||||
|
duplicates.entrySet().forEach(entry -> {
|
||||||
|
assertThat(entry.getValue().size()).isEqualTo(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
dictionary.get(AUTHOR).add("Drinking water");
|
||||||
|
when(dictionaryClient.getVersion(TEST_RULESET_ID)).thenReturn(1L);
|
||||||
|
|
||||||
|
AnnotateResponse annotateResponse = redactionController.annotate(AnnotateRequest.builder()
|
||||||
|
.projectId(TEST_PROJECT_ID)
|
||||||
|
.fileId(TEST_FILE_ID)
|
||||||
|
.build());
|
||||||
|
|
||||||
|
try (FileOutputStream fileOutputStream = new FileOutputStream("/tmp/Annotated3.pdf")) {
|
||||||
|
fileOutputStream.write(annotateResponse.getDocument());
|
||||||
|
}
|
||||||
|
long rstart = System.currentTimeMillis();
|
||||||
|
reanalyzeService.reanalyze(request);
|
||||||
|
|
||||||
|
long rend = System.currentTimeMillis();
|
||||||
|
System.out.println("reanalysis analysis duration: " + (rend - rstart));
|
||||||
|
|
||||||
|
|
||||||
|
long end = System.currentTimeMillis();
|
||||||
|
|
||||||
|
System.out.println("duration: " + (end - start));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Ignore
|
||||||
public void noExceptionShouldBeThrownForAnyFiles() throws IOException {
|
public void noExceptionShouldBeThrownForAnyFiles() throws IOException {
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|||||||
@ -77,14 +77,6 @@ public class PdfSegmentationServiceTest {
|
|||||||
assertThat(document.getPages().get(0).getImages().size()).isEqualTo(1);
|
assertThat(document.getPages().get(0).getImages().size()).isEqualTo(1);
|
||||||
assertThat(document.getPages().get(1).getImages().size()).isEqualTo(0);
|
assertThat(document.getPages().get(1).getImages().size()).isEqualTo(0);
|
||||||
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void testMergeImages2() throws IOException {
|
|
||||||
|
|
||||||
ClassPathResource pdfFileResource = new ClassPathResource("files/new/Single Study - Oral (Gavage) Mouse.pdf");
|
|
||||||
|
|
||||||
Document document = pdfSegmentationService.parseDocument(pdfFileResource.getInputStream());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user