Search in sources :

Example 16 with VFSJavaIOFile

use of org.olat.test.VFSJavaIOFile in project openolat by klemens.

the class PDFDocumentTest method testPDFDocument.

@Test
public void testPDFDocument() throws DocumentException, DocumentAccessException, URISyntaxException, IOException {
    URL pdfUrl = PDFDocumentTest.class.getResource("Test_pdf_indexing.pdf");
    Assert.assertNotNull(pdfUrl);
    VFSLeaf doc = new VFSJavaIOFile("Test_1.pdf", new File(pdfUrl.toURI()));
    String temp = System.getProperty("java.io.tmpdir");
    PdfDocument document = new PdfDocument(temp, false);
    FileContent content = document.readContent(doc);
    Assert.assertNotNull(content);
    Assert.assertEquals("Test pdf indexing", content.getTitle());
    String body = content.getContent();
    Assert.assertEquals("Un petit texte en français", body.trim());
}
Also used : VFSLeaf(org.olat.core.util.vfs.VFSLeaf) VFSJavaIOFile(org.olat.test.VFSJavaIOFile) File(java.io.File) URL(java.net.URL) VFSJavaIOFile(org.olat.test.VFSJavaIOFile) Test(org.junit.Test)

Aggregations

File (java.io.File)16 URL (java.net.URL)16 Test (org.junit.Test)16 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)16 VFSJavaIOFile (org.olat.test.VFSJavaIOFile)16