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/05/16 12:15:51 UTC

[tika] branch master updated (c95c66d -> c020e48)

This is an automated email from the ASF dual-hosted git repository.

tallison pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tika.git.

      from  c95c66d   TIKA-2361 upgrade to PDFBox 2.0.6
       new  464fb97   TIKA-2363 skip image recognition test if network call fails
       new  c020e48   TIKA-2360 -- require users to turn on SentimentParser; remove glob detection for .sent; skip unit tests if network call fails.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../tika/dl/imagerec/DL4JInceptionV3NetTest.java   | 11 +++++-
 .../services/org.apache.tika.parser.Parser         |  1 -
 .../tika/org/apache/tika/mime/custom-mimetypes.xml | 17 ---------
 .../sentiment/analysis/SentimentParserTest.java    | 42 +++++++++++++++-------
 4 files changed, 39 insertions(+), 32 deletions(-)
 delete mode 100644 tika-parsers/src/main/tika/org/apache/tika/mime/custom-mimetypes.xml

-- 
To stop receiving notification emails like this one, please contact
['"commits@tika.apache.org" <co...@tika.apache.org>'].

[tika] 01/02: TIKA-2363 skip image recognition test if network call fails

Posted by ta...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tallison pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tika.git

commit 464fb97ec486a63492b705f06e9c75781afeae35
Author: tballison <ta...@mitre.org>
AuthorDate: Tue May 16 08:13:56 2017 -0400

    TIKA-2363 skip image recognition test if network call fails
---
 .../org/apache/tika/dl/imagerec/DL4JInceptionV3NetTest.java   | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tika-dl/src/test/java/org/apache/tika/dl/imagerec/DL4JInceptionV3NetTest.java b/tika-dl/src/test/java/org/apache/tika/dl/imagerec/DL4JInceptionV3NetTest.java
index 5bcd678..d250834 100644
--- a/tika-dl/src/test/java/org/apache/tika/dl/imagerec/DL4JInceptionV3NetTest.java
+++ b/tika-dl/src/test/java/org/apache/tika/dl/imagerec/DL4JInceptionV3NetTest.java
@@ -18,6 +18,7 @@ package org.apache.tika.dl.imagerec;
 
 import org.apache.tika.Tika;
 import org.apache.tika.config.TikaConfig;
+import org.apache.tika.exception.TikaConfigException;
 import org.apache.tika.metadata.Metadata;
 import org.junit.Test;
 
@@ -28,7 +29,15 @@ public class DL4JInceptionV3NetTest {
 
     @Test
     public void recognise() throws Exception {
-        TikaConfig config = new TikaConfig(getClass().getResourceAsStream("dl4j-inception3-config.xml"));
+        TikaConfig config;
+        try {
+             config = new TikaConfig(getClass().getResourceAsStream("dl4j-inception3-config.xml"));
+        } catch (TikaConfigException e) {
+            if (e.getMessage() != null && e.getMessage().contains("Connection refused") ) {
+                return;
+            }
+            throw e;
+        }
         Tika tika = new Tika(config);
         Metadata md = new Metadata();
         tika.parse(getClass().getResourceAsStream("cat.jpg"), md);

-- 
To stop receiving notification emails like this one, please contact
"commits@tika.apache.org" <co...@tika.apache.org>.

[tika] 02/02: TIKA-2360 -- require users to turn on SentimentParser; remove glob detection for .sent; skip unit tests if network call fails.

Posted by ta...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tallison pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tika.git

commit c020e48a263e2b2a29543ccc4a1946be8002c7f3
Author: tballison <ta...@mitre.org>
AuthorDate: Tue May 16 08:15:22 2017 -0400

    TIKA-2360 -- require users to turn on SentimentParser; remove glob detection for .sent; skip unit tests if network call fails.
---
 .../services/org.apache.tika.parser.Parser         |  1 -
 .../tika/org/apache/tika/mime/custom-mimetypes.xml | 17 ---------
 .../sentiment/analysis/SentimentParserTest.java    | 42 +++++++++++++++-------
 3 files changed, 29 insertions(+), 31 deletions(-)

diff --git a/tika-parsers/src/main/resources/META-INF/services/org.apache.tika.parser.Parser b/tika-parsers/src/main/resources/META-INF/services/org.apache.tika.parser.Parser
index a8592c3..aa8725e 100644
--- a/tika-parsers/src/main/resources/META-INF/services/org.apache.tika.parser.Parser
+++ b/tika-parsers/src/main/resources/META-INF/services/org.apache.tika.parser.Parser
@@ -80,4 +80,3 @@ org.apache.tika.parser.external.CompositeExternalParser
 org.apache.tika.parser.journal.JournalParser
 org.apache.tika.parser.image.ICNSParser
 org.apache.tika.parser.dbf.DBFParser
-org.apache.tika.parser.sentiment.analysis.SentimentParser
diff --git a/tika-parsers/src/main/tika/org/apache/tika/mime/custom-mimetypes.xml b/tika-parsers/src/main/tika/org/apache/tika/mime/custom-mimetypes.xml
deleted file mode 100644
index 2c87837..0000000
--- a/tika-parsers/src/main/tika/org/apache/tika/mime/custom-mimetypes.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
-	license agreements. See the NOTICE file distributed with this work for additional 
-	information regarding copyright ownership. The ASF licenses this file to 
-	You under the Apache License, Version 2.0 (the "License"); you may not use 
-	this file except in compliance with the License. You may obtain a copy of 
-	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
-	by applicable law or agreed to in writing, software distributed under the 
-	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
-	OF ANY KIND, either express or implied. See the License for the specific 
-	language governing permissions and limitations under the License. -->
-<mime-info>
-	<mime-type type="application/sentiment">
-		<glob pattern="*.sent" />
-		<sub-class-of type="text/plain" />
-	</mime-type>
-</mime-info>
\ No newline at end of file
diff --git a/tika-parsers/src/test/java/org/apache/tika/parser/sentiment/analysis/SentimentParserTest.java b/tika-parsers/src/test/java/org/apache/tika/parser/sentiment/analysis/SentimentParserTest.java
index 3a98a87..3540a0b 100644
--- a/tika-parsers/src/test/java/org/apache/tika/parser/sentiment/analysis/SentimentParserTest.java
+++ b/tika-parsers/src/test/java/org/apache/tika/parser/sentiment/analysis/SentimentParserTest.java
@@ -18,10 +18,15 @@ package org.apache.tika.parser.sentiment.analysis;
 
 import org.apache.tika.Tika;
 import org.apache.tika.config.TikaConfig;
+import org.apache.tika.exception.TikaConfigException;
+import org.apache.tika.exception.TikaException;
 import org.apache.tika.metadata.Metadata;
 import org.junit.Test;
+import org.xml.sax.SAXException;
 
 import java.io.ByteArrayInputStream;
+import java.io.IOError;
+import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.Charset;
 
@@ -35,12 +40,11 @@ public class SentimentParserTest {
     @Test
     public void endToEndTest() throws Exception {
 
-        Tika tika;
-        try (InputStream confStream = getClass().getResourceAsStream("tika-config-sentiment-opennlp.xml")) {
-            assert confStream != null;
-            TikaConfig config = new TikaConfig(confStream);
-            tika = new Tika(config);
+        Tika tika = getTika("tika-config-sentiment-opennlp.xml");
+        if (tika == null) {
+            return;
         }
+
         String text = "What a wonderful thought it is that" +
                 " some of the best days of our lives haven't happened yet.";
         ByteArrayInputStream stream = new ByteArrayInputStream(text.getBytes(Charset.defaultCharset()));
@@ -54,13 +58,10 @@ public class SentimentParserTest {
 
    @Test
    public void testCategorical() throws Exception{
-       Tika tika;
-       try (InputStream confStream = getClass().getResourceAsStream("tika-config-sentiment-opennlp-cat.xml")) {
-	       assert confStream != null;
-	       TikaConfig config = new TikaConfig(confStream);
-	       tika = new Tika(config);
-	   }
-
+       Tika tika = getTika("tika-config-sentiment-opennlp-cat.xml");
+        if (tika == null) {
+            return;
+        }
         String text = "Whatever, I need some cooling off time!";
         ByteArrayInputStream stream = new ByteArrayInputStream(text.getBytes(Charset.defaultCharset()));
         Metadata md = new Metadata();
@@ -68,6 +69,21 @@ public class SentimentParserTest {
         String sentiment = md.get("Sentiment");
         assertNotNull(sentiment);
         assertEquals(sentiment, "angry");
-    }
+   }
+
+   private Tika getTika(String configXml) throws TikaException, SAXException, IOException {
+
+       try (InputStream confStream = getClass().getResourceAsStream("tika-config-sentiment-opennlp.xml")) {
+           assert confStream != null;
+           TikaConfig config = new TikaConfig(confStream);
+           return new Tika(config);
+       } catch (TikaConfigException e) {
+           //if can't connect to pull sentiment model...ignore test
+           if (e.getCause() != null && e.getCause() instanceof java.net.ConnectException) {
+               return null;
+           }
+           throw e;
+       }
+   }
 
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@tika.apache.org" <co...@tika.apache.org>.