Search in sources :

Example 11 with VFSJavaIOFile

use of org.olat.test.VFSJavaIOFile in project OpenOLAT by OpenOLAT.

the class OfficeDocumentTest method testExcelOpenXMLDocument.

@Test
public void testExcelOpenXMLDocument() throws IOException, DocumentException, DocumentAccessException, URISyntaxException {
    URL docUrl = OfficeDocumentTest.class.getResource("Test_excel_indexing.xlsx");
    Assert.assertNotNull(docUrl);
    VFSLeaf doc = new VFSJavaIOFile(new File(docUrl.toURI()));
    ExcelOOXMLDocument document = new ExcelOOXMLDocument();
    FileContent content = document.readContent(doc);
    Assert.assertNotNull(content);
    String body = content.getContent();
    Assert.assertTrue(body.contains("Numbers and their Squares"));
    Assert.assertTrue(body.contains("225"));
}
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)

Example 12 with VFSJavaIOFile

use of org.olat.test.VFSJavaIOFile in project OpenOLAT by OpenOLAT.

the class OfficeDocumentTest method testWordDocument.

@Test
public void testWordDocument() throws IOException, DocumentException, DocumentAccessException, URISyntaxException {
    URL docUrl = OfficeDocumentTest.class.getResource("Test_word_indexing.doc");
    Assert.assertNotNull(docUrl);
    VFSLeaf doc = new VFSJavaIOFile(new File(docUrl.toURI()));
    WordDocument document = new WordDocument();
    FileContent content = document.readContent(doc);
    Assert.assertNotNull(content);
    String body = content.getContent();
    // content
    Assert.assertTrue(body.contains("Lorem ipsum dolor sit amet"));
    // footer
    Assert.assertTrue(body.contains("Rue (domicile)"));
}
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)

Example 13 with VFSJavaIOFile

use of org.olat.test.VFSJavaIOFile in project OpenOLAT by OpenOLAT.

the class OfficeDocumentTest method testExcelDocument.

@Test
public void testExcelDocument() throws IOException, DocumentException, DocumentAccessException, URISyntaxException {
    URL docUrl = OfficeDocumentTest.class.getResource("Test_excel_indexing.xls");
    Assert.assertNotNull(docUrl);
    VFSLeaf doc = new VFSJavaIOFile(new File(docUrl.toURI()));
    ExcelDocument document = new ExcelDocument();
    FileContent content = document.readContent(doc);
    Assert.assertNotNull(content);
    String body = content.getContent();
    Assert.assertTrue(body.contains("Nachname"));
    Assert.assertTrue(body.contains("olat4you"));
}
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)

Example 14 with VFSJavaIOFile

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

the class OfficeDocumentTest method testWordOpenXMLDocument.

@Test
public void testWordOpenXMLDocument() throws IOException, DocumentException, DocumentAccessException, URISyntaxException {
    URL docUrl = OfficeDocumentTest.class.getResource("Test_word_indexing.docx");
    Assert.assertNotNull(docUrl);
    VFSLeaf doc = new VFSJavaIOFile(new File(docUrl.toURI()));
    WordOOXMLDocument document = new WordOOXMLDocument();
    FileContent content = document.readContent(doc);
    Assert.assertNotNull(content);
    String body = content.getContent();
    Assert.assertTrue(body.contains("Document compatibility test"));
    Assert.assertTrue(body.contains("They prefer to start writing a document at home in desktop or laptop computer"));
}
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)

Example 15 with VFSJavaIOFile

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

the class OfficeDocumentTest method testExcelDocument.

@Test
public void testExcelDocument() throws IOException, DocumentException, DocumentAccessException, URISyntaxException {
    URL docUrl = OfficeDocumentTest.class.getResource("Test_excel_indexing.xls");
    Assert.assertNotNull(docUrl);
    VFSLeaf doc = new VFSJavaIOFile(new File(docUrl.toURI()));
    ExcelDocument document = new ExcelDocument();
    FileContent content = document.readContent(doc);
    Assert.assertNotNull(content);
    String body = content.getContent();
    Assert.assertTrue(body.contains("Nachname"));
    Assert.assertTrue(body.contains("olat4you"));
}
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