tika-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1222887 - in /tika/trunk: tika-parent/pom.xml tika-parsers/src/test/java/org/apache/tika/parser/fork/ForkParserIntegrationTest.java
Date Fri, 23 Dec 2011 23:33:19 GMT
Author: jukka
Date: Fri Dec 23 23:33:19 2011
New Revision: 1222887

URL: http://svn.apache.org/viewvc?rev=1222887&view=rev
Log:
TIKA-808: Fork Parser doesn't work for PDF files

Enable previously failing test cases.

Modified:
    tika/trunk/tika-parent/pom.xml
    tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/fork/ForkParserIntegrationTest.java

Modified: tika/trunk/tika-parent/pom.xml
URL: http://svn.apache.org/viewvc/tika/trunk/tika-parent/pom.xml?rev=1222887&r1=1222886&r2=1222887&view=diff
==============================================================================
--- tika/trunk/tika-parent/pom.xml (original)
+++ tika/trunk/tika-parent/pom.xml Fri Dec 23 23:33:19 2011
@@ -294,7 +294,7 @@
             <artifactId>maven-surefire-plugin</artifactId>
             <configuration>
               <excludes>
-                <exclude>**/ForkParserTest.java</exclude>
+                <exclude>**/ForkParser*Test.java</exclude>
               </excludes>
             </configuration>
           </plugin>

Modified: tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/fork/ForkParserIntegrationTest.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/fork/ForkParserIntegrationTest.java?rev=1222887&r1=1222886&r2=1222887&view=diff
==============================================================================
--- tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/fork/ForkParserIntegrationTest.java
(original)
+++ tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/fork/ForkParserIntegrationTest.java
Fri Dec 23 23:33:19 2011
@@ -20,6 +20,7 @@ import java.io.InputStream;
 
 import junit.framework.TestCase;
 
+import org.apache.tika.Tika;
 import org.apache.tika.fork.ForkParser;
 import org.apache.tika.metadata.Metadata;
 import org.apache.tika.parser.ParseContext;
@@ -31,24 +32,26 @@ import org.xml.sax.ContentHandler;
  *  wired in to the regular Parsers and their test data
  */
 public class ForkParserIntegrationTest extends TestCase {
+
     /**
      * Simple text parsing
-     * TODO Fix this test so it passes
      */
-    public void DISABLEDtestForkedTextParsing() throws Exception {
-       final ForkParser parser = new ForkParser(
-             ForkParserIntegrationTest.class.getClassLoader(),
-             new ForkParser());
+    public void testForkedTextParsing() throws Exception {
+        Tika tika = new Tika();
+        ForkParser parser = new ForkParser(
+                ForkParserIntegrationTest.class.getClassLoader(),
+                tika.getParser());
 
        try {
           ContentHandler output = new BodyContentHandler();
-          InputStream stream = ForkParserIntegrationTest.class.getResourceAsStream("testTXT.txt");
+          InputStream stream = ForkParserIntegrationTest.class.getResourceAsStream(
+                  "/test-documents/testTXT.txt");
           ParseContext context = new ParseContext();
           parser.parse(stream, output, new Metadata(), context);
 
           String content = output.toString();
           assertTrue(content.contains("Test d'indexation"));
-          assertTrue(content.contains("http://www.apache.org/"));
+          assertTrue(content.contains("http://www.apache.org"));
        } finally {
           parser.close();
        }
@@ -56,31 +59,28 @@ public class ForkParserIntegrationTest e
    
     /**
      * TIKA-808 - Ensure that parsing of our test PDFs work under
-     *  the Fork Parser, to ensure that complex parsing behaves
-     * TODO Fix this test so it passes
+     * the Fork Parser, to ensure that complex parsing behaves
      */
-    public void DISABLEDtestForkedPDFParsing() throws Exception {
-       final ForkParser parser = new ForkParser(
-             ForkParserIntegrationTest.class.getClassLoader(),
-             new ForkParser());
-       
-       try {
-          ContentHandler output = new BodyContentHandler();
-          InputStream stream = ForkParserIntegrationTest.class.getResourceAsStream("testPDF.pdf");
-          ParseContext context = new ParseContext();
-          parser.parse(stream, output, new Metadata(), context);
-          
-          String content = output.toString();
-          assertTrue(content.contains("Apache Tika"));
-          assertTrue(content.contains("Tika - Content Analysis Toolkit"));
-          assertTrue(content.contains("incubator"));
-          assertTrue(content.contains("Apache Software Foundation"));
-      } finally {
-          parser.close();
-      }
-    }
-    
-    public void testDUMMY() {
-       // To avoid warnings about no tests while others are disabled
+    public void testForkedPDFParsing() throws Exception {
+        Tika tika = new Tika();
+        ForkParser parser = new ForkParser(
+                ForkParserIntegrationTest.class.getClassLoader(),
+                tika.getParser());
+        try {
+            ContentHandler output = new BodyContentHandler();
+            InputStream stream = ForkParserIntegrationTest.class.getResourceAsStream(
+                    "/test-documents/testPDF.pdf");
+            ParseContext context = new ParseContext();
+            parser.parse(stream, output, new Metadata(), context);
+
+            String content = output.toString();
+            assertTrue(content.contains("Apache Tika"));
+            assertTrue(content.contains("Tika - Content Analysis Toolkit"));
+            assertTrue(content.contains("incubator"));
+            assertTrue(content.contains("Apache Software Foundation"));
+        } finally {
+            parser.close();
+        }
     }
+
 }



Mime
View raw message