skip image recognition test if network call fails
@@ -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);
