You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/02/01 18:47:04 UTC
[12/50] [abbrv] brooklyn-library git commit: Add Tomcat 8 support
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/f2de556e/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerEc2LiveTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerEc2LiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerEc2LiveTest.java
new file mode 100644
index 0000000..568ffeb
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerEc2LiveTest.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package brooklyn.entity.webapp.tomcat;
+
+import static org.testng.Assert.assertNotNull;
+
+import org.testng.annotations.Test;
+
+import brooklyn.entity.AbstractEc2LiveTest;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.entity.webapp.tomcat.Tomcat8Server;
+import brooklyn.location.Location;
+import brooklyn.test.Asserts;
+import brooklyn.test.HttpTestUtils;
+import brooklyn.test.TestResourceUnavailableException;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * A simple test of installing+running on AWS-EC2, using various OS distros and versions.
+ */
+public class Tomcat8ServerEc2LiveTest extends AbstractEc2LiveTest {
+
+ public String getTestWar() {
+ TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+ return "classpath://hello-world.war";
+ }
+
+ @Override
+ protected void doTest(Location loc) throws Exception {
+ final Tomcat8Server server = app.createAndManageChild(EntitySpec.create(Tomcat8Server.class)
+ .configure("war", getTestWar()));
+
+ app.start(ImmutableList.of(loc));
+
+ String url = server.getAttribute(Tomcat8Server.ROOT_URL);
+
+ HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200);
+ HttpTestUtils.assertContentContainsText(url, "Hello");
+
+ Asserts.succeedsEventually(new Runnable() {
+ @Override public void run() {
+ assertNotNull(server.getAttribute(Tomcat8Server.REQUEST_COUNT));
+ assertNotNull(server.getAttribute(Tomcat8Server.ERROR_COUNT));
+ assertNotNull(server.getAttribute(Tomcat8Server.TOTAL_PROCESSING_TIME));
+ }});
+ }
+
+ @Test(enabled=false)
+ public void testDummy() {} // Convince testng IDE integration that this really does have test methods
+}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/f2de556e/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerRestartIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerRestartIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerRestartIntegrationTest.java
new file mode 100644
index 0000000..d84c8a0
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerRestartIntegrationTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package brooklyn.entity.webapp.tomcat;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.Test;
+
+import brooklyn.entity.basic.AbstractSoftwareProcessRestartIntegrationTest;
+import brooklyn.entity.basic.SoftwareProcess;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.entity.webapp.tomcat.Tomcat8Server;
+
+/**
+ * Tests restart of the software *process* (as opposed to the VM).
+ */
+@Test(groups="Integration")
+public class Tomcat8ServerRestartIntegrationTest extends AbstractSoftwareProcessRestartIntegrationTest {
+
+ // TODO Remove duplication from MySqlRestartIntegrationTest
+
+ @SuppressWarnings("unused")
+ private static final Logger LOG = LoggerFactory.getLogger(Tomcat8ServerRestartIntegrationTest.class);
+
+ @Override
+ protected EntitySpec<? extends SoftwareProcess> newEntitySpec() {
+ return EntitySpec.create(Tomcat8Server.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/f2de556e/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerSimpleIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerSimpleIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerSimpleIntegrationTest.java
new file mode 100644
index 0000000..c8f33a7
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerSimpleIntegrationTest.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package brooklyn.entity.webapp.tomcat;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.fail;
+
+import java.net.ServerSocket;
+import java.util.Iterator;
+
+import org.jclouds.util.Throwables2;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import brooklyn.entity.basic.ApplicationBuilder;
+import brooklyn.entity.basic.Entities;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.location.PortRange;
+import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
+import brooklyn.location.basic.PortRanges;
+import brooklyn.test.entity.TestApplication;
+import brooklyn.util.net.Networking;
+import brooklyn.util.time.Duration;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * This tests the operation of the {@link Tomcat8Server} entity.
+ *
+ * FIXME this test is largely superseded by WebApp*IntegrationTest which tests inter alia Tomcat
+ */
+public class Tomcat8ServerSimpleIntegrationTest {
+ @SuppressWarnings("unused")
+ private static final Logger LOG = LoggerFactory.getLogger(Tomcat8ServerSimpleIntegrationTest.class);
+
+ /** don't use 8080 since that is commonly used by testing software; use different from other tests. */
+ static PortRange DEFAULT_HTTP_PORT_RANGE = PortRanges.fromString("7880-7980");
+
+ private TestApplication app;
+ private Tomcat8Server tc;
+ private int httpPort;
+
+ @BeforeMethod(alwaysRun=true)
+ public void pickFreePort() {
+ for (Iterator<Integer> iter = DEFAULT_HTTP_PORT_RANGE.iterator(); iter.hasNext();) {
+ Integer port = iter.next();
+ if (Networking.isPortAvailable(port)) {
+ httpPort = port;
+ return;
+ }
+ }
+ fail("someone is already listening on ports "+DEFAULT_HTTP_PORT_RANGE+"; tests assume that port is free on localhost");
+ }
+
+ @AfterMethod(alwaysRun=true)
+ public void tearDown() throws Exception {
+ if (app != null) Entities.destroyAll(app.getManagementContext());
+ }
+
+ /*
+ * TODO Tomcat's HTTP connector fails to start when the HTTP port is in use.
+ *
+ * This prevents the the SERVICE_UP check from receiving an answer,
+ * which causes the test to timeout.
+ */
+ @Test(groups="Integration")
+ public void detectFailureIfTomcatCantBindToPort() throws Exception {
+ ServerSocket listener = new ServerSocket(httpPort);
+ try {
+ app = ApplicationBuilder.newManagedApp(TestApplication.class);
+ tc = app.createAndManageChild(EntitySpec.create(Tomcat8Server.class)
+ .configure("httpPort", httpPort)
+ .configure(TomcatServer.START_TIMEOUT, Duration.ONE_MINUTE));
+ try {
+ tc.start(ImmutableList.of(app.getManagementContext().getLocationManager().manage(new LocalhostMachineProvisioningLocation())));
+ fail("Should have thrown start-exception");
+ } catch (Exception e) {
+ // LocalhostMachineProvisioningLocation does NetworkUtils.isPortAvailable, so get -1
+ IllegalArgumentException iae = Throwables2.getFirstThrowableOfType(e, IllegalArgumentException.class);
+ if (iae == null || iae.getMessage() == null || !iae.getMessage().equals("port for httpPort is null")) throw e;
+ } finally {
+ tc.stop();
+ }
+ assertFalse(tc.getAttribute(Tomcat8ServerImpl.SERVICE_UP));
+ } finally {
+ listener.close();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/f2de556e/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerSoftlayerLiveTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerSoftlayerLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerSoftlayerLiveTest.java
new file mode 100644
index 0000000..176ef86
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerSoftlayerLiveTest.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package brooklyn.entity.webapp.tomcat;
+
+import static org.testng.Assert.assertNotNull;
+
+import org.testng.annotations.Test;
+
+import brooklyn.entity.AbstractSoftlayerLiveTest;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.entity.webapp.tomcat.Tomcat8Server;
+import brooklyn.location.Location;
+import brooklyn.test.Asserts;
+import brooklyn.test.HttpTestUtils;
+import brooklyn.test.TestResourceUnavailableException;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * A simple test of installing+running on Softlayer, using various OS distros and versions.
+ */
+public class Tomcat8ServerSoftlayerLiveTest extends AbstractSoftlayerLiveTest {
+
+ public String getTestWar() {
+ TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+ return "classpath://hello-world.war";
+ }
+
+ @Override
+ protected void doTest(Location loc) throws Exception {
+ final Tomcat8Server server = app.createAndManageChild(EntitySpec.create(Tomcat8Server.class)
+ .configure("war", getTestWar()));
+
+ app.start(ImmutableList.of(loc));
+
+ String url = server.getAttribute(Tomcat8Server.ROOT_URL);
+
+ HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200);
+ HttpTestUtils.assertContentContainsText(url, "Hello");
+
+ Asserts.succeedsEventually(new Runnable() {
+ @Override public void run() {
+ assertNotNull(server.getAttribute(Tomcat8Server.REQUEST_COUNT));
+ assertNotNull(server.getAttribute(Tomcat8Server.ERROR_COUNT));
+ assertNotNull(server.getAttribute(Tomcat8Server.TOTAL_PROCESSING_TIME));
+
+ // TODO These appear not to be set in TomcatServerImpl.connectSensors
+ // See TomcatServerEc2LiveTest, where these are also not included.
+// assertNotNull(server.getAttribute(TomcatServer.MAX_PROCESSING_TIME));
+// assertNotNull(server.getAttribute(TomcatServer.BYTES_RECEIVED));
+// assertNotNull(server.getAttribute(TomcatServer.BYTES_SENT));
+ }});
+ }
+
+ @Test(groups = {"Live", "Live-sanity"})
+ @Override
+ public void test_Ubuntu_12_0_4() throws Exception {
+ super.test_Ubuntu_12_0_4();
+ }
+}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/f2de556e/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerWebAppFixtureIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerWebAppFixtureIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerWebAppFixtureIntegrationTest.java
new file mode 100644
index 0000000..e3bd45b
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerWebAppFixtureIntegrationTest.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package brooklyn.entity.webapp.tomcat;
+
+import java.io.File;
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.SocketException;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import brooklyn.entity.basic.SoftwareProcess;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.entity.webapp.AbstractWebAppFixtureIntegrationTest;
+import brooklyn.entity.webapp.HttpsSslConfig;
+import brooklyn.entity.webapp.JavaWebAppSoftwareProcess;
+import brooklyn.entity.webapp.tomcat.Tomcat8Server;
+import brooklyn.location.basic.PortRanges;
+import brooklyn.test.TestResourceUnavailableException;
+import brooklyn.test.entity.TestApplication;
+import brooklyn.util.exceptions.Exceptions;
+import brooklyn.util.repeat.Repeater;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+
+public class Tomcat8ServerWebAppFixtureIntegrationTest extends AbstractWebAppFixtureIntegrationTest {
+
+ @SuppressWarnings("unused")
+ private static final Logger log = LoggerFactory.getLogger(Tomcat8ServerWebAppFixtureIntegrationTest.class);
+
+ @DataProvider(name = "basicEntities")
+ public Object[][] basicEntities() {
+ TestApplication tomcatApp = newTestApplication();
+ Tomcat8Server tomcat = tomcatApp.createAndManageChild(EntitySpec.create(Tomcat8Server.class)
+ .configure(Tomcat8Server.HTTP_PORT, PortRanges.fromString(DEFAULT_HTTP_PORT)));
+
+
+ File keystoreFile;
+ try {
+ keystoreFile = createTemporaryKeyStore("myname", "mypass");
+ keystoreFile.deleteOnExit();
+ } catch (Exception e) {
+ throw Exceptions.propagate(e);
+ }
+
+ TestApplication tomcatHttpsApp = newTestApplication();
+ Tomcat8Server httpsTomcat = tomcatHttpsApp.createAndManageChild(EntitySpec.create(Tomcat8Server.class)
+ .configure(Tomcat8Server.ENABLED_PROTOCOLS, ImmutableSet.of("https"))
+ .configure(Tomcat8Server.HTTPS_SSL_CONFIG,
+ new HttpsSslConfig().keyAlias("myname").keystorePassword("mypass").keystoreUrl(keystoreFile.getAbsolutePath())));
+
+ return new JavaWebAppSoftwareProcess[][] {
+ new JavaWebAppSoftwareProcess[] { tomcat },
+ new JavaWebAppSoftwareProcess[] { httpsTomcat }
+ };
+ }
+
+ // exists to be able to test on this class from GUI in Eclipse IDE
+ @Test(groups = "Integration", dataProvider = "basicEntities")
+ public void canStartAndStop(final SoftwareProcess entity) {
+ super.canStartAndStop(entity);
+ }
+ @Test(groups = "Integration", dataProvider = "basicEntities")
+ public void testReportsServiceDownWhenKilled(final SoftwareProcess entity) throws Exception {
+ super.testReportsServiceDownWhenKilled(entity);
+ }
+
+ @Override
+ // as parent, but with spring travel
+ @DataProvider(name = "entitiesWithWarAndURL")
+ public Object[][] entitiesWithWar() {
+ TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+ List<Object[]> result = Lists.newArrayList();
+
+ for (Object[] entity : basicEntities()) {
+ result.add(new Object[] {
+ entity[0],
+ "hello-world.war",
+ "hello-world/",
+ "" // no sub-page path
+ });
+ }
+
+ // TODO would be nice to test against spring web framework stock booking example
+ // but we'd need an external URL for that (we removed the binary from here for apache compliance reasons)
+// TestApplication tomcatApp = newTestApplication();
+// TomcatServer tomcat = tomcatApp.createAndManageChild(EntitySpec.create(TomcatServer.class)
+// .configure(TomcatServer.HTTP_PORT, PortRanges.fromString(DEFAULT_HTTP_PORT)));
+// result.add(new Object[] {
+// tomcat,
+// "swf-booking-mvc.war",
+// "swf-booking-mvc/",
+// "spring/intro",
+// });
+
+ return result.toArray(new Object[][] {});
+ }
+
+ @AfterMethod(alwaysRun=true, dependsOnMethods="shutdownApp")
+ public void ensureIsShutDown() throws Exception {
+ final AtomicReference<Socket> shutdownSocket = new AtomicReference<Socket>();
+ final AtomicReference<SocketException> gotException = new AtomicReference<SocketException>();
+ final Integer shutdownPort = (entity != null) ? entity.getAttribute(Tomcat8Server.SHUTDOWN_PORT) : null;
+
+ if (shutdownPort != null) {
+ boolean socketClosed = Repeater.create("Checking WebApp has shut down")
+ .repeat(new Callable<Void>() {
+ public Void call() throws Exception {
+ if (shutdownSocket.get() != null) shutdownSocket.get().close();
+ try {
+ shutdownSocket.set(new Socket(InetAddress.getLocalHost(), shutdownPort));
+ gotException.set(null);
+ } catch (SocketException e) {
+ gotException.set(e);
+ }
+ return null;
+ }})
+ .every(100, TimeUnit.MILLISECONDS)
+ .until(new Callable<Boolean>() {
+ public Boolean call() {
+ return (gotException.get() != null);
+ }})
+ .limitIterationsTo(25)
+ .run();
+
+ if (socketClosed == false) {
+// log.error("WebApp did not shut down - this is a failure of the last test run");
+// log.warn("I'm sending a message to the shutdown port {}", shutdownPort);
+// OutputStreamWriter writer = new OutputStreamWriter(shutdownSocket.getOutputStream());
+// writer.write("SHUTDOWN\r\n");
+// writer.flush();
+// writer.close();
+// shutdownSocket.close();
+ throw new Exception("Last test run did not shut down WebApp entity "+entity+" (port "+shutdownPort+")");
+ }
+ } else {
+ Assert.fail("Cannot shutdown, because shutdown-port not set for "+entity);
+ }
+ }
+
+ public static void main(String ...args) throws Exception {
+ Tomcat8ServerWebAppFixtureIntegrationTest t = new Tomcat8ServerWebAppFixtureIntegrationTest();
+ t.setUp();
+ t.testReportsServiceDownWhenKilled((SoftwareProcess) t.basicEntities()[0][0]);
+ t.shutdownApp();
+ t.ensureIsShutDown();
+ t.shutdownMgmt();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/f2de556e/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerSimpleIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerSimpleIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerSimpleIntegrationTest.java
index 032e49a..0189456 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerSimpleIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerSimpleIntegrationTest.java
@@ -39,6 +39,7 @@ import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
import brooklyn.location.basic.PortRanges;
import brooklyn.test.entity.TestApplication;
import brooklyn.util.net.Networking;
+import brooklyn.util.time.Duration;
import com.google.common.collect.ImmutableList;
@@ -75,13 +76,20 @@ public class TomcatServerSimpleIntegrationTest {
if (app != null) Entities.destroyAll(app.getManagementContext());
}
+ /*
+ * TODO Tomcat's HTTP connector fails to start when the HTTP port is in use.
+ *
+ * This prevents the the SERVICE_UP check from receiving an answer,
+ * which causes the test to timeout.
+ */
@Test(groups="Integration")
public void detectFailureIfTomcatCantBindToPort() throws Exception {
ServerSocket listener = new ServerSocket(httpPort);
try {
app = ApplicationBuilder.newManagedApp(TestApplication.class);
- tc = app.createAndManageChild(EntitySpec.create(TomcatServer.class).configure("httpPort", httpPort));
-
+ tc = app.createAndManageChild(EntitySpec.create(TomcatServer.class)
+ .configure("httpPort", httpPort)
+ .configure(TomcatServer.START_TIMEOUT, Duration.ONE_MINUTE));
try {
tc.start(ImmutableList.of(app.getManagementContext().getLocationManager().manage(new LocalhostMachineProvisioningLocation())));
fail("Should have thrown start-exception");