You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2017/01/10 17:46:49 UTC

[5/5] tika git commit: TIKA-2232 -- shorten one unit test and update changes.

TIKA-2232 -- shorten one unit test and update changes.


Project: http://git-wip-us.apache.org/repos/asf/tika/repo
Commit: http://git-wip-us.apache.org/repos/asf/tika/commit/86dbde4e
Tree: http://git-wip-us.apache.org/repos/asf/tika/tree/86dbde4e
Diff: http://git-wip-us.apache.org/repos/asf/tika/diff/86dbde4e

Branch: refs/heads/master
Commit: 86dbde4ec93d4dc962d99349d23f08c326e607a3
Parents: 9fdf9a8
Author: tballison <ta...@mitre.org>
Authored: Tue Jan 10 12:46:22 2017 -0500
Committer: tballison <ta...@mitre.org>
Committed: Tue Jan 10 12:46:22 2017 -0500

----------------------------------------------------------------------
 CHANGES.txt                                       |  9 +++++++--
 .../org/apache/tika/parser/pdf/PDFParserTest.java | 18 ++++--------------
 2 files changed, 11 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tika/blob/86dbde4e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 630aa73..32caa4e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,10 +1,14 @@
 Release 1.15 - ??
 
+  * Add parsing of JBIG2 and extraction of JBIG2 from PDFs when
+    required dependencies are added to class path by user.
+    Contributed by Pascal Essiembre (TIKA-2232).
+
   * Mime magic for the OneNote family (.one / .onetoc / .onepkg), no parser
     (TIKA-2224).
 
   * Add parsers for WordPerfect and QuattroPro (.qpw) files.
-    Contributed by Pascal Essiembre (TIKA-1946).
+    Contributed by Pascal Essiembre (TIKA-1946 and TIKA-2228).
 
   * Add configurability of "preserve-interword-spacing" to
     TesseractOCRParser (TIKA-2190).
@@ -40,7 +44,8 @@ Release 1.15 - ??
 
   * Allow configuration of timeout for ForkParser (TIKA-2170).
 
-  * Add extraction of .jpx inline images from PDFs (TIKA-2175).
+  * Add extraction of .jpx inline images from PDFs when required
+    dependencies are added by user to class path (TIKA-2175).
 
   * Add .jpx, .jp2, .ppm to formats handled by Tesseract (TIKA-2174).
 

http://git-wip-us.apache.org/repos/asf/tika/blob/86dbde4e/tika-parsers/src/test/java/org/apache/tika/parser/pdf/PDFParserTest.java
----------------------------------------------------------------------
diff --git a/tika-parsers/src/test/java/org/apache/tika/parser/pdf/PDFParserTest.java b/tika-parsers/src/test/java/org/apache/tika/parser/pdf/PDFParserTest.java
index 34c98f9..2d056c7 100644
--- a/tika-parsers/src/test/java/org/apache/tika/parser/pdf/PDFParserTest.java
+++ b/tika-parsers/src/test/java/org/apache/tika/parser/pdf/PDFParserTest.java
@@ -643,28 +643,18 @@ public class PDFParserTest extends TikaTest {
 
     @Test // TIKA-2232
     public void testEmbeddedJBIG2Image() throws Exception {
-        String xml = getXML("/testPDF_JBIG2.pdf").xml;
-        assertContains("test images compressed using JBIG2", xml);
-        
-        RecursiveParserWrapper p = new RecursiveParserWrapper(
-                new AutoDetectParser(), new BasicContentHandlerFactory(
-                        BasicContentHandlerFactory.HANDLER_TYPE.IGNORE, -1));
+
         ParseContext context = new ParseContext();
         PDFParserConfig config = new PDFParserConfig();
         config.setExtractInlineImages(true);
         config.setExtractUniqueInlineImagesOnly(false);
         context.set(PDFParserConfig.class, config);
-        context.set(Parser.class, p);
 
-        try (TikaInputStream tis = TikaInputStream.get(
-                getResourceAsStream("/test-documents/testPDF_JBIG2.pdf"))) {
-            p.parse(tis, new BodyContentHandler(-1), new Metadata(), context);
-        }
-
-        List<Metadata> metadatas = p.getMetadata();
 
+        List<Metadata> metadatas = getRecursiveMetadata("testPDF_JBIG2.pdf", context);
         assertEquals(2, metadatas.size());
-        
+        assertContains("test images compressed using JBIG2", metadatas.get(0).get(RecursiveParserWrapper.TIKA_CONTENT));
+
         for (String key : metadatas.get(1).names()) {
             if (key.startsWith("X-TIKA:EXCEPTION")) {
                 fail("Exception: " + metadatas.get(1).get(key));