JAMES-1950 swallow exception inside timers for ESReporterTest

Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/4a47f7a7
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/4a47f7a7
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/4a47f7a7

Branch: refs/heads/master
Commit: 4a47f7a78f8cfb5ccc3bc64c575e651c33b4db6a
Parents: a495cd3
Author: benwa <btell...@linagora.com>
Authored: Thu Mar 16 17:03:52 2017 +0700
Committer: benwa <btell...@linagora.com>
Committed: Thu Mar 16 17:04:29 2017 +0700

----------------------------------------------------------------------
 .../java/org/apache/james/ESReporterTest.java   | 22 ++++++++++++--------
 1 file changed, 13 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/4a47f7a7/server/container/guice/cassandra-guice/src/test/java/org/apache/james/ESReporterTest.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/ESReporterTest.java
 
b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/ESReporterTest.java
index ede63e2..724129b 100644
--- 
a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/ESReporterTest.java
+++ 
b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/ESReporterTest.java
@@ -43,9 +43,10 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Charsets;
-import com.google.common.base.Throwables;
 import com.jayway.awaitility.Duration;
 import com.jayway.restassured.RestAssured;
 import com.jayway.restassured.builder.RequestSpecBuilder;
@@ -57,6 +58,8 @@ public class ESReporterTest {
     private static final int DELAY_IN_MS = 100;
     private static final int PERIOD_IN_MS = 100;
 
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(ESReporterTest.class);
+
     private static final String DOMAIN = "james.org";
     private static final String USERNAME = "user1@" + DOMAIN;
     private static final String PASSWORD = "secret";
@@ -100,11 +103,10 @@ public class ESReporterTest {
 
     @After
     public void tearDown() throws Exception {
+        timer.cancel();
         if (server != null) {
             server.stop();
         }
-
-        timer.cancel();
     }
 
     @Test
@@ -118,8 +120,8 @@ public class ESReporterTest {
             public void run() {
                 try {
                     client.list("", "*");
-                } catch (IOException e) {
-                    throw Throwables.propagate(e);
+                } catch (Exception e) {
+                    LOGGER.error("Error while sending LIST command", e);
                 }
             }
         };
@@ -134,13 +136,15 @@ public class ESReporterTest {
         TimerTask timerTask = new TimerTask() {
             @Override
             public void run() {
+                try {
                     given()
                         .header("Authorization", accessToken.serialize())
                         .body("[[\"getMailboxes\", {}, \"#0\"]]")
-                    .when()
-                        .post("/jmap")
-                    .then()
-                        .statusCode(200);
+                    .with()
+                        .post("/jmap");
+                } catch (Exception e) {
+                    LOGGER.error("Error while listing mailboxes", e);
+                }
             }
         };
         timer.schedule(timerTask, DELAY_IN_MS, PERIOD_IN_MS);


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to