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()
|
||||
{
|
||||
return server.isStarted();
|
||||
return server != null && server.isStarted();
|
||||
}
|
||||
|
||||
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.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<HttpObject>
|
||||
|
|
Loading…
Reference in New Issue