diff --git a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java index 8453c46335..7a1a42357f 100644 --- a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java +++ b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java @@ -92,7 +92,7 @@ public class WebServerComponent implements ExternalComponent public boolean isStarted() { - return server.isStarted(); + return server != null && server.isStarted(); } private void deployWar(String url, String warURL, String activeMQHome, String path) diff --git a/artemis-web/src/test/java/org/apache/activemq/artemis/test/WebServerComponentTest.java b/artemis-web/src/test/java/org/apache/activemq/artemis/test/WebServerComponentTest.java index d432d5f2b8..dafd14ecdb 100644 --- a/artemis-web/src/test/java/org/apache/activemq/artemis/test/WebServerComponentTest.java +++ b/artemis-web/src/test/java/org/apache/activemq/artemis/test/WebServerComponentTest.java @@ -64,6 +64,7 @@ public class WebServerComponentTest extends Assert webServerDTO.bind = "http://localhost:8161"; webServerDTO.path = "webapps"; WebServerComponent webServerComponent = new WebServerComponent(); + Assert.assertFalse(webServerComponent.isStarted()); webServerComponent.configure(webServerDTO, "./src/test/resources/", "./src/test/resources/"); webServerComponent.start(); // Make the connection attempt. @@ -92,7 +93,9 @@ public class WebServerComponentTest extends Assert assertEquals(clientHandler.body, "12345"); // Wait for the server to close the connection. ch.close(); + Assert.assertTrue(webServerComponent.isStarted()); webServerComponent.stop(); + Assert.assertFalse(webServerComponent.isStarted()); } class ClientHandler extends SimpleChannelInboundHandler