ARTEMIS-119 Added proper tests for webserver component startup checks.

This commit is contained in:
John D. Ament 2015-06-04 09:53:49 -04:00 committed by Clebert Suconic
parent e2f301dd85
commit fed0317df8
2 changed files with 4 additions and 1 deletions

View File

@ -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)

View File

@ -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>