This is an automated email from the ASF dual-hosted git repository.
mattmann pushed a commit to branch gsoc17
in repository https://gitbox.apache.org/repos/asf/tika.git
The following commit(s) were added to refs/heads/gsoc17 by this push:
new 56ab7b2 - handle exceptions
56ab7b2 is described below
commit 56ab7b2305aa77c97cdcade9f843e905ebcfc446
Author: Chris Mattmann <[email protected]>
AuthorDate: Sat Jul 8 23:03:10 2017 -0700
- handle exceptions
---
.../recognition/ObjectRecognitionParserTest.java | 40 +++++++++++++++++-----
1 file changed, 32 insertions(+), 8 deletions(-)
diff --git
a/tika-parsers/src/test/java/org/apache/tika/parser/recognition/ObjectRecognitionParserTest.java
b/tika-parsers/src/test/java/org/apache/tika/parser/recognition/ObjectRecognitionParserTest.java
index e34a529..36c478f 100644
---
a/tika-parsers/src/test/java/org/apache/tika/parser/recognition/ObjectRecognitionParserTest.java
+++
b/tika-parsers/src/test/java/org/apache/tika/parser/recognition/ObjectRecognitionParserTest.java
@@ -82,8 +82,14 @@ public class ObjectRecognitionParserTest {
@Test
public void jpegRESTObjRecTest() throws Exception {
String apiUrl = "http://localhost:8764/inception/v4/ping";
- int status = WebClient.create(apiUrl).get().getStatus();
- Assume.assumeTrue(status == 200);
+ boolean available = false;
+ int status = 500;
+ try{
+ status = WebClient.create(apiUrl).get().getStatus();
+ available = status == 200;
+ }
+ catch(Exception ignore){}
+ Assume.assumeTrue(available);
String[] expectedObjects = {"Egyptian cat", "tabby, tabby cat"};
doRecognize(CONFIG_REST_FILE_OBJ_REC, CAT_IMAGE_JPEG,
ObjectRecognitionParser.MD_KEY_OBJ_REC, expectedObjects);
@@ -92,8 +98,14 @@ public class ObjectRecognitionParserTest {
@Test
public void jpegRESTim2txtTest() throws Exception {
String apiUrl = "http://localhost:8764/inception/v3/ping";
- int status = WebClient.create(apiUrl).get().getStatus();
- Assume.assumeTrue(status == 200);
+ boolean available = false;
+ int status = 500;
+ try{
+ status = WebClient.create(apiUrl).get().getStatus();
+ available = status == 200;
+ }
+ catch(Exception ignore){}
+ Assume.assumeTrue(available);
String[] expectedCaption = {"a baseball player holding a bat on a
field"};
doRecognize(CONFIG_REST_FILE_IM2TXT, BASEBALL_IMAGE_JPEG,
ObjectRecognitionParser.MD_KEY_IMG_CAP, expectedCaption);
@@ -102,8 +114,14 @@ public class ObjectRecognitionParserTest {
@Test
public void pngRESTim2txtTest() throws Exception {
String apiUrl = "http://localhost:8764/inception/v3/ping";
- int status = WebClient.create(apiUrl).get().getStatus();
- Assume.assumeTrue(status == 200);
+ boolean available = false;
+ int status = 500;
+ try{
+ status = WebClient.create(apiUrl).get().getStatus();
+ available = status == 200;
+ }
+ catch(Exception ignore){}
+ Assume.assumeTrue(available);
String[] expectedCaption = {"a baseball player holding a bat on a
field"};
doRecognize(CONFIG_REST_FILE_IM2TXT, BASEBALL_IMAGE_PNG,
ObjectRecognitionParser.MD_KEY_IMG_CAP, expectedCaption);
@@ -112,8 +130,14 @@ public class ObjectRecognitionParserTest {
@Test
public void gifRESTim2txtTest() throws Exception {
String apiUrl = "http://localhost:8764/inception/v3/ping";
- int status = WebClient.create(apiUrl).get().getStatus();
- Assume.assumeTrue(status == 200);
+ boolean available = false;
+ int status = 500;
+ try{
+ status = WebClient.create(apiUrl).get().getStatus();
+ available = status == 200;
+ }
+ catch(Exception ignore){}
+ Assume.assumeTrue(available);
String[] expectedCaption = {"a baseball player pitching a ball on top
of a field"};
doRecognize(CONFIG_REST_FILE_IM2TXT, BASEBALL_IMAGE_GIF,
ObjectRecognitionParser.MD_KEY_IMG_CAP, expectedCaption);
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].