james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [01/17] james-project git commit: JAMES-2314 Use awaitStop to await error handlers cleanup
Date Mon, 05 Nov 2018 10:52:04 GMT
Repository: james-project
Updated Branches:
  refs/heads/master 719e254ac -> c68e430fc


JAMES-2314 Use awaitStop to await error handlers cleanup

This strategy is better than using a static setUp/tearDown. It is enabled thanks to latest
Spark upgrade.


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

Branch: refs/heads/master
Commit: c85b4a6da02c3f717a548270d4eb25a0d8463cbf
Parents: 7d6cbe2
Author: Benoit Tellier <btellier@linagora.com>
Authored: Thu Nov 1 09:28:22 2018 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Thu Nov 1 09:28:22 2018 +0700

----------------------------------------------------------------------
 .../org/apache/james/webadmin/WebAdminServer.java     |  1 +
 .../apache/james/webadmin/routes/ErrorRoutesTest.java | 14 +++++++-------
 2 files changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/c85b4a6d/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/WebAdminServer.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/WebAdminServer.java
b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/WebAdminServer.java
index 5315794..595db70 100644
--- a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/WebAdminServer.java
+++ b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/WebAdminServer.java
@@ -160,6 +160,7 @@ public class WebAdminServer implements Configurable {
     public void destroy() {
         if (configuration.isEnabled()) {
             service.stop();
+            service.awaitStop();
             LOGGER.info("Web admin server stopped");
         }
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/c85b4a6d/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/ErrorRoutesTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/ErrorRoutesTest.java
b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/ErrorRoutesTest.java
index 94993e3..f8896f9 100644
--- a/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/ErrorRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/ErrorRoutesTest.java
@@ -35,8 +35,8 @@ import org.apache.james.metrics.api.NoopMetricFactory;
 import org.apache.james.webadmin.WebAdminServer;
 import org.apache.james.webadmin.WebAdminUtils;
 import org.apache.james.webadmin.utils.ErrorResponder;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 
 import io.restassured.RestAssured;
@@ -44,10 +44,10 @@ import io.restassured.RestAssured;
 public class ErrorRoutesTest {
     private static final String NOT_FOUND = "notFound";
 
-    private static WebAdminServer webAdminServer;
+    private WebAdminServer webAdminServer;
 
-    @BeforeClass
-    public static void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         webAdminServer = WebAdminUtils.createWebAdminServer(
                 new NoopMetricFactory(),
                 new ErrorRoutes());
@@ -60,8 +60,8 @@ public class ErrorRoutesTest {
         RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
     }
 
-    @AfterClass
-    public static void tearDown() {
+    @After
+    public void tearDown() {
         webAdminServer.destroy();
     }
 


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


Mime
View raw message