ARTEMIS-119 Added proper tests for webserver component startup checks.
This commit is contained in:
parent
e2f301dd85
commit
fed0317df8
|
@ -92,7 +92,7 @@ public class WebServerComponent implements ExternalComponent
|
||||||
|
|
||||||
public boolean isStarted()
|
public boolean isStarted()
|
||||||
{
|
{
|
||||||
return server.isStarted();
|
return server != null && server.isStarted();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deployWar(String url, String warURL, String activeMQHome, String path)
|
private void deployWar(String url, String warURL, String activeMQHome, String path)
|
||||||
|
|
|
@ -64,6 +64,7 @@ public class WebServerComponentTest extends Assert
|
||||||
webServerDTO.bind = "http://localhost:8161";
|
webServerDTO.bind = "http://localhost:8161";
|
||||||
webServerDTO.path = "webapps";
|
webServerDTO.path = "webapps";
|
||||||
WebServerComponent webServerComponent = new WebServerComponent();
|
WebServerComponent webServerComponent = new WebServerComponent();
|
||||||
|
Assert.assertFalse(webServerComponent.isStarted());
|
||||||
webServerComponent.configure(webServerDTO, "./src/test/resources/", "./src/test/resources/");
|
webServerComponent.configure(webServerDTO, "./src/test/resources/", "./src/test/resources/");
|
||||||
webServerComponent.start();
|
webServerComponent.start();
|
||||||
// Make the connection attempt.
|
// Make the connection attempt.
|
||||||
|
@ -92,7 +93,9 @@ public class WebServerComponentTest extends Assert
|
||||||
assertEquals(clientHandler.body, "12345");
|
assertEquals(clientHandler.body, "12345");
|
||||||
// Wait for the server to close the connection.
|
// Wait for the server to close the connection.
|
||||||
ch.close();
|
ch.close();
|
||||||
|
Assert.assertTrue(webServerComponent.isStarted());
|
||||||
webServerComponent.stop();
|
webServerComponent.stop();
|
||||||
|
Assert.assertFalse(webServerComponent.isStarted());
|
||||||
}
|
}
|
||||||
|
|
||||||
class ClientHandler extends SimpleChannelInboundHandler<HttpObject>
|
class ClientHandler extends SimpleChannelInboundHandler<HttpObject>
|
||||||
|
|
Loading…
Reference in New Issue