GrobidRestProcessFiles { protected PDDocument dispatchProcessing(GrobidRestUtils.Annotation type, PDDocument document, DocumentSource documentSource, Document teiDoc ) throws Exception { PDDocument out = null; if (type == GrobidRestUtils.Annotation.CITATION) { out = CitationsVisualizer.annotatePdfWithCitations(document, teiDoc, null); } else if (type == GrobidRestUtils.Annotation.BLOCK) { out = BlockVisualizer.annotateBlocks(document, documentSource.getXmlFile(), teiDoc, true, true, false); } else if (type == GrobidRestUtils.Annotation.FIGURE) { out = FigureTableVisualizer.annotateFigureAndTables(document, documentSource.getXmlFile(), teiDoc, true, true, true, false, false); } return out; } @Inject  GrobidRestProcessFiles(); Response processStatelessHeaderDocument(
        final InputStream inputStream,
        final int consolidate,
        final boolean includeRawAffiliations
    ); Response processFulltextDocument(final InputStream inputStream,
                                          final int consolidateHeader,
                                          final int consolidateCitations,
                                          final boolean includeRawAffiliations,
                                          final boolean includeRawCitations,
                                          final int startPage,
                                          final int endPage,
                                          final boolean generateIDs,
                                          final boolean segmentSentences,
                                          final List<String> teiCoordinates); Response processStatelessFulltextAssetDocument(final InputStream inputStream,
                                                          final int consolidateHeader,
                                                          final int consolidateCitations,
                                                          final boolean includeRawAffiliations,
                                                          final boolean includeRawCitations,
                                                          final int startPage,
                                                          final int endPage,
                                                          final boolean generateIDs,
                                                          final boolean segmentSentences); Response processCitationPatentPDF(final InputStream inputStream,
                                             final int consolidate,
                                             final boolean includeRawCitations); Response processCitationPatentST36(final InputStream inputStream,
                                              final int consolidate,
                                              final boolean includeRawCitations); Response processStatelessReferencesDocument(final InputStream inputStream,
                                                       final int consolidate,
                                                       final boolean includeRawCitations,
                                                       ExpectedResponseType expectedResponseType); Response processPDFAnnotation(final InputStream inputStream,
                                         final String fileName,
                                         final int consolidateHeader,
                                         final int consolidateCitations,
                                         final boolean includeRawAffiliations,
                                         final boolean includeRawCitations,
                                         final GrobidRestUtils.Annotation type); Response processPDFReferenceAnnotation(final InputStream inputStream,
                                                  final int consolidateHeader,
                                                  final int consolidateCitations,
                                                  final boolean includeRawCitations); Response annotateCitationPatentPDF(final InputStream inputStream,
                                              final int consolidate,
                                              final boolean includeRawCitations); String methodLogIn(); String methodLogOut();  }
@Test public void dispatchProcessing_selectionCitation_shouldWork() throws Exception { PowerMock.mockStatic(CitationsVisualizer.class); expect(CitationsVisualizer.annotatePdfWithCitations(anyObject(PDDocument.class), anyObject(Document.class), anyObject(List.class))).andReturn(null); PowerMock.replay(CitationsVisualizer.class); target.dispatchProcessing(GrobidRestUtils.Annotation.CITATION, null, null, null); PowerMock.verify(CitationsVisualizer.class); }
@Test public void dispatchProcessing_selectionBlock_shouldWork() throws Exception { PowerMock.mockStatic(BlockVisualizer.class); expect(BlockVisualizer.annotateBlocks((PDDocument) anyObject(), EasyMock.<File>anyObject(), EasyMock.<Document>anyObject(), anyBoolean(), anyBoolean(), anyBoolean())).andReturn(null); File fakeFile = File.createTempFile("justForTheTest", "baomiao"); fakeFile.deleteOnExit(); expect(documentSourceMock.getXmlFile()).andReturn(fakeFile); PowerMock.replay(BlockVisualizer.class); replay(documentSourceMock); target.dispatchProcessing(GrobidRestUtils.Annotation.BLOCK, null, documentSourceMock, null); PowerMock.verify(BlockVisualizer.class); verify(documentSourceMock); }
@Test public void dispatchProcessing_selectionFigure_shouldWork() throws Exception { PowerMock.mockStatic(FigureTableVisualizer.class); File fakeFile = File.createTempFile("justForTheTest", "baomiao"); fakeFile.deleteOnExit(); expect(FigureTableVisualizer.annotateFigureAndTables(anyObject(), EasyMock.anyObject(), EasyMock.anyObject(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean())) .andReturn(null); expect(documentSourceMock.getXmlFile()).andReturn(fakeFile); PowerMock.replay(FigureTableVisualizer.class); replay(documentSourceMock); target.dispatchProcessing(GrobidRestUtils.Annotation.FIGURE, null, documentSourceMock, null); PowerMock.verify(FigureTableVisualizer.class); verify(documentSourceMock); }