Search in sources :

Example 1 with PackageParser

use of org.apache.tika.parser.pkg.PackageParser in project tika by apache.

the class TikaParsersTest method testGetHTML.

@Test
public void testGetHTML() throws Exception {
    for (boolean details : new boolean[] { false, true }) {
        Response response = WebClient.create(endPoint + getPath(details)).type("text/html").accept("text/html").get();
        String text = getStringFromInputStream((InputStream) response.getEntity());
        assertContains("<h2>DefaultParser</h2>", text);
        assertContains("Composite", text);
        assertContains("<h3>OpusParser", text);
        assertContains("<h3>PackageParser", text);
        assertContains("<h3>OOXMLParser", text);
        assertContains(OpusParser.class.getName(), text);
        assertContains(PackageParser.class.getName(), text);
        assertContains(OOXMLParser.class.getName(), text);
        if (details) {
            // Should have the mimetypes they handle
            assertContains("<li>text/plain", text);
            assertContains("<li>application/pdf", text);
            assertContains("<li>audio/ogg", text);
        } else {
            // Shouldn't do
            assertNotFound("text/plain", text);
            assertNotFound("application/pdf", text);
            assertNotFound("audio/ogg", text);
        }
    }
}
Also used : Response(javax.ws.rs.core.Response) OOXMLParser(org.apache.tika.parser.microsoft.ooxml.OOXMLParser) PackageParser(org.apache.tika.parser.pkg.PackageParser) OpusParser(org.gagravarr.tika.OpusParser) Test(org.junit.Test)

Aggregations

Response (javax.ws.rs.core.Response)1 OOXMLParser (org.apache.tika.parser.microsoft.ooxml.OOXMLParser)1 PackageParser (org.apache.tika.parser.pkg.PackageParser)1 OpusParser (org.gagravarr.tika.OpusParser)1 Test (org.junit.Test)1