You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2014/12/22 15:07:45 UTC
[6/7] incubator-brooklyn git commit: restart/rebind tests:
incorporate review comments
restart/rebind tests: incorporate review comments
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/4cd3d96e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/4cd3d96e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/4cd3d96e
Branch: refs/heads/master
Commit: 4cd3d96ee58441e236fef5de86bbac2f8d5a7ba2
Parents: ba5edf9
Author: Aled Sage <al...@gmail.com>
Authored: Fri Dec 19 23:03:03 2014 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Sat Dec 20 22:13:51 2014 +0000
----------------------------------------------------------------------
...ctSoftwareProcessRestartIntegrationTest.java | 93 ++++++++++++++++++++
.../mysql/MySqlRestartIntegrationTest.java | 60 ++-----------
.../PostgreSqlRebindIntegrationTest.java | 3 +-
.../PostgreSqlRestartIntegrationTest.java | 57 ++----------
.../mongodb/MongoDBRestartIntegrationTest.java | 60 ++-----------
.../TomcatServerRestartIntegrationTest.java | 58 ++----------
6 files changed, 123 insertions(+), 208 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4cd3d96e/software/base/src/test/java/brooklyn/entity/basic/AbstractSoftwareProcessRestartIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/brooklyn/entity/basic/AbstractSoftwareProcessRestartIntegrationTest.java b/software/base/src/test/java/brooklyn/entity/basic/AbstractSoftwareProcessRestartIntegrationTest.java
new file mode 100644
index 0000000..c2c7291
--- /dev/null
+++ b/software/base/src/test/java/brooklyn/entity/basic/AbstractSoftwareProcessRestartIntegrationTest.java
@@ -0,0 +1,93 @@
+/*
+ * 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.basic;
+
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.Test;
+
+import brooklyn.entity.BrooklynAppLiveTestSupport;
+import brooklyn.entity.Effector;
+import brooklyn.entity.basic.SoftwareProcess.RestartSoftwareParameters;
+import brooklyn.entity.basic.SoftwareProcess.StopSoftwareParameters;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
+import brooklyn.test.EntityTestUtils;
+import brooklyn.util.collections.CollectionFunctionals;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Tests restart of the software *process* (as opposed to the VM).
+ */
+public abstract class AbstractSoftwareProcessRestartIntegrationTest extends BrooklynAppLiveTestSupport {
+
+ // TODO Remove duplication from TomcatServerRestartIntegrationTest and MySqlRestartIntegrationTest
+
+ @SuppressWarnings("unused")
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractSoftwareProcessRestartIntegrationTest.class);
+
+ protected abstract EntitySpec<? extends SoftwareProcess> newEntitySpec();
+
+ @Test(groups="Integration")
+ public void testStopProcessAndRestart() throws Exception {
+ runStopProcessAndRestart(
+ SoftwareProcess.RESTART,
+ ImmutableMap.of(RestartSoftwareParameters.RESTART_MACHINE.getName(), RestartSoftwareParameters.RestartMachineMode.FALSE));
+ }
+
+ @Test(groups="Integration")
+ public void testStopProcessAndStart() throws Exception {
+ runStopProcessAndRestart(
+ SoftwareProcess.START,
+ ImmutableMap.of("locations", ImmutableList.of()));
+ }
+
+ protected void runStopProcessAndRestart(Effector<?> restartEffector, Map<String, ?> args) throws Exception {
+ LocalhostMachineProvisioningLocation loc = app.newLocalhostProvisioningLocation();
+ SoftwareProcess entity = app.createAndManageChild(newEntitySpec());
+
+ // Start the app
+ app.start(ImmutableList.of(loc));
+ EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_UP, true);
+ EntityTestUtils.assertAttributeEqualsEventually(app, SoftwareProcess.SERVICE_UP, true);
+
+ // Stop the process
+ Entities.invokeEffector(app, entity, SoftwareProcess.STOP, ImmutableMap.of(
+ StopSoftwareParameters.STOP_MACHINE.getName(), false))
+ .get();
+ EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_UP, false);
+ EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED);
+ EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_PROCESS_IS_RUNNING, false);
+ EntityTestUtils.assertAttributeEventually(entity, ServiceStateLogic.SERVICE_NOT_UP_INDICATORS, CollectionFunctionals.<String>mapSizeEquals(1));
+
+ // Restart the process
+ Entities.invokeEffector(app, entity, restartEffector, args).get();
+ EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_UP, true);
+ EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
+ EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_PROCESS_IS_RUNNING, true);
+ EntityTestUtils.assertAttributeEqualsEventually(entity, ServiceStateLogic.SERVICE_NOT_UP_INDICATORS, ImmutableMap.<String, Object>of());
+
+ EntityTestUtils.assertAttributeEqualsEventually(app, SoftwareProcess.SERVICE_UP, true);
+ EntityTestUtils.assertAttributeEqualsEventually(app, SoftwareProcess.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4cd3d96e/software/database/src/test/java/brooklyn/entity/database/mysql/MySqlRestartIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/database/src/test/java/brooklyn/entity/database/mysql/MySqlRestartIntegrationTest.java b/software/database/src/test/java/brooklyn/entity/database/mysql/MySqlRestartIntegrationTest.java
index d850dca..50100cf 100644
--- a/software/database/src/test/java/brooklyn/entity/database/mysql/MySqlRestartIntegrationTest.java
+++ b/software/database/src/test/java/brooklyn/entity/database/mysql/MySqlRestartIntegrationTest.java
@@ -18,71 +18,25 @@
*/
package brooklyn.entity.database.mysql;
-import java.util.Map;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.Test;
-import brooklyn.entity.BrooklynAppLiveTestSupport;
-import brooklyn.entity.Effector;
-import brooklyn.entity.basic.Entities;
-import brooklyn.entity.basic.Lifecycle;
-import brooklyn.entity.basic.ServiceStateLogic;
-import brooklyn.entity.basic.SoftwareProcess.RestartSoftwareParameters;
-import brooklyn.entity.basic.SoftwareProcess.StopSoftwareParameters;
+import brooklyn.entity.basic.AbstractSoftwareProcessRestartIntegrationTest;
+import brooklyn.entity.basic.SoftwareProcess;
import brooklyn.entity.proxying.EntitySpec;
-import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
-import brooklyn.test.EntityTestUtils;
-import brooklyn.util.collections.CollectionFunctionals;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
/**
* Tests restart of the software *process* (as opposed to the VM).
*/
-public class MySqlRestartIntegrationTest extends BrooklynAppLiveTestSupport {
-
- // TODO Remove duplication from TomcatServerRestartIntegrationTest
+@Test(groups="Integration")
+public class MySqlRestartIntegrationTest extends AbstractSoftwareProcessRestartIntegrationTest {
@SuppressWarnings("unused")
private static final Logger LOG = LoggerFactory.getLogger(MySqlRestartIntegrationTest.class);
- @Test(groups="Integration")
- public void testStopProcessAndRestart() throws Exception {
- runStopProcessAndRestart(
- MySqlNode.RESTART,
- ImmutableMap.of(RestartSoftwareParameters.RESTART_MACHINE.getName(), RestartSoftwareParameters.RestartMachineMode.FALSE));
- }
-
- @Test(groups="Integration")
- public void testStopProcessAndStart() throws Exception {
- runStopProcessAndRestart(
- MySqlNode.START,
- ImmutableMap.of("locations", ImmutableList.of()));
- }
-
- protected void runStopProcessAndRestart(Effector<?> restartEffector, Map<String, ?> args) throws Exception {
- LocalhostMachineProvisioningLocation loc = app.newLocalhostProvisioningLocation();
- MySqlNode entity = app.createAndManageChild(EntitySpec.create(MySqlNode.class));
- app.start(ImmutableList.of(loc));
-
- Entities.invokeEffector(app, entity, MySqlNode.STOP, ImmutableMap.of(
- StopSoftwareParameters.STOP_MACHINE.getName(), false))
- .get();
- EntityTestUtils.assertAttributeEqualsEventually(entity, MySqlNode.SERVICE_UP, false);
- EntityTestUtils.assertAttributeEqualsEventually(entity, MySqlNode.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED);
- EntityTestUtils.assertAttributeEqualsEventually(entity, MySqlNode.SERVICE_PROCESS_IS_RUNNING, false);
- EntityTestUtils.assertAttributeEventually(entity, ServiceStateLogic.SERVICE_NOT_UP_INDICATORS, CollectionFunctionals.<String>mapSizeEquals(1));
-
- Entities.invokeEffector(app, entity, restartEffector, args).get();
- EntityTestUtils.assertAttributeEqualsEventually(entity, MySqlNode.SERVICE_UP, true);
- EntityTestUtils.assertAttributeEqualsEventually(entity, MySqlNode.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
- EntityTestUtils.assertAttributeEqualsEventually(entity, MySqlNode.SERVICE_PROCESS_IS_RUNNING, true);
- EntityTestUtils.assertAttributeEqualsEventually(entity, ServiceStateLogic.SERVICE_NOT_UP_INDICATORS, ImmutableMap.<String, Object>of());
-
- EntityTestUtils.assertAttributeEqualsEventually(app, MySqlNode.SERVICE_UP, true);
- EntityTestUtils.assertAttributeEqualsEventually(app, MySqlNode.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
+ @Override
+ protected EntitySpec<? extends SoftwareProcess> newEntitySpec() {
+ return EntitySpec.create(MySqlNode.class);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4cd3d96e/software/database/src/test/java/brooklyn/entity/database/postgresql/PostgreSqlRebindIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/database/src/test/java/brooklyn/entity/database/postgresql/PostgreSqlRebindIntegrationTest.java b/software/database/src/test/java/brooklyn/entity/database/postgresql/PostgreSqlRebindIntegrationTest.java
index bff1cd2..b58e685 100644
--- a/software/database/src/test/java/brooklyn/entity/database/postgresql/PostgreSqlRebindIntegrationTest.java
+++ b/software/database/src/test/java/brooklyn/entity/database/postgresql/PostgreSqlRebindIntegrationTest.java
@@ -43,8 +43,7 @@ public class PostgreSqlRebindIntegrationTest extends RebindTestFixtureWithApp {
@Test(groups = {"Integration"})
public void testRebind() throws Exception {
- origApp.createAndManageChild(EntitySpec.create(PostgreSqlNode.class)
- .configure("mongodbConfTemplateUrl", "classpath:///test-mongodb.conf"));
+ origApp.createAndManageChild(EntitySpec.create(PostgreSqlNode.class));
origApp.start(ImmutableList.of(loc));
// rebind
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4cd3d96e/software/database/src/test/java/brooklyn/entity/database/postgresql/PostgreSqlRestartIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/database/src/test/java/brooklyn/entity/database/postgresql/PostgreSqlRestartIntegrationTest.java b/software/database/src/test/java/brooklyn/entity/database/postgresql/PostgreSqlRestartIntegrationTest.java
index ea15b79..d26c7f4 100644
--- a/software/database/src/test/java/brooklyn/entity/database/postgresql/PostgreSqlRestartIntegrationTest.java
+++ b/software/database/src/test/java/brooklyn/entity/database/postgresql/PostgreSqlRestartIntegrationTest.java
@@ -18,42 +18,26 @@
*/
package brooklyn.entity.database.postgresql;
-import java.util.Map;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.Test;
-import brooklyn.entity.BrooklynAppLiveTestSupport;
-import brooklyn.entity.Effector;
-import brooklyn.entity.basic.Entities;
-import brooklyn.entity.basic.Lifecycle;
-import brooklyn.entity.basic.ServiceStateLogic;
-import brooklyn.entity.basic.SoftwareProcess.RestartSoftwareParameters;
-import brooklyn.entity.basic.SoftwareProcess.StopSoftwareParameters;
+import brooklyn.entity.basic.AbstractSoftwareProcessRestartIntegrationTest;
+import brooklyn.entity.basic.SoftwareProcess;
import brooklyn.entity.proxying.EntitySpec;
-import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
-import brooklyn.test.EntityTestUtils;
-import brooklyn.util.collections.CollectionFunctionals;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
/**
* Tests restart of the software *process* (as opposed to the VM).
*/
-public class PostgreSqlRestartIntegrationTest extends BrooklynAppLiveTestSupport {
-
- // TODO Remove duplication from TomcatServerRestartIntegrationTest, MySqlRestartIntegrationTest
+@Test(groups="Integration")
+public class PostgreSqlRestartIntegrationTest extends AbstractSoftwareProcessRestartIntegrationTest {
@SuppressWarnings("unused")
private static final Logger LOG = LoggerFactory.getLogger(PostgreSqlRestartIntegrationTest.class);
- @Test(groups="Integration")
- public void testStopProcessAndRestart() throws Exception {
- runStopProcessAndRestart(
- PostgreSqlNode.RESTART,
- ImmutableMap.of(RestartSoftwareParameters.RESTART_MACHINE.getName(), RestartSoftwareParameters.RestartMachineMode.FALSE));
+ @Override
+ protected EntitySpec<? extends SoftwareProcess> newEntitySpec() {
+ return EntitySpec.create(PostgreSqlNode.class);
}
// TODO The second start() will fail because customize operations forbidden while there is existing data:
@@ -61,31 +45,6 @@ public class PostgreSqlRestartIntegrationTest extends BrooklynAppLiveTestSupport
// I haven't checked whether it damaged the data in the database though!
@Test(enabled=false, groups={"Integration", "WIP"})
public void testStopProcessAndStart() throws Exception {
- runStopProcessAndRestart(
- PostgreSqlNode.START,
- ImmutableMap.of("locations", ImmutableList.of()));
- }
-
- protected void runStopProcessAndRestart(Effector<?> restartEffector, Map<String, ?> args) throws Exception {
- LocalhostMachineProvisioningLocation loc = app.newLocalhostProvisioningLocation();
- PostgreSqlNode entity = app.createAndManageChild(EntitySpec.create(PostgreSqlNode.class));
- app.start(ImmutableList.of(loc));
-
- Entities.invokeEffector(app, entity, PostgreSqlNode.STOP, ImmutableMap.of(
- StopSoftwareParameters.STOP_MACHINE.getName(), false))
- .get();
- EntityTestUtils.assertAttributeEqualsEventually(entity, PostgreSqlNode.SERVICE_UP, false);
- EntityTestUtils.assertAttributeEqualsEventually(entity, PostgreSqlNode.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED);
- EntityTestUtils.assertAttributeEqualsEventually(entity, PostgreSqlNode.SERVICE_PROCESS_IS_RUNNING, false);
- EntityTestUtils.assertAttributeEventually(entity, ServiceStateLogic.SERVICE_NOT_UP_INDICATORS, CollectionFunctionals.<String>mapSizeEquals(1));
-
- Entities.invokeEffector(app, entity, restartEffector, args).get();
- EntityTestUtils.assertAttributeEqualsEventually(entity, PostgreSqlNode.SERVICE_UP, true);
- EntityTestUtils.assertAttributeEqualsEventually(entity, PostgreSqlNode.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
- EntityTestUtils.assertAttributeEqualsEventually(entity, PostgreSqlNode.SERVICE_PROCESS_IS_RUNNING, true);
- EntityTestUtils.assertAttributeEqualsEventually(entity, ServiceStateLogic.SERVICE_NOT_UP_INDICATORS, ImmutableMap.<String, Object>of());
-
- EntityTestUtils.assertAttributeEqualsEventually(app, PostgreSqlNode.SERVICE_UP, true);
- EntityTestUtils.assertAttributeEqualsEventually(app, PostgreSqlNode.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
+ super.testStopProcessAndStart();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4cd3d96e/software/nosql/src/test/java/brooklyn/entity/nosql/mongodb/MongoDBRestartIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/test/java/brooklyn/entity/nosql/mongodb/MongoDBRestartIntegrationTest.java b/software/nosql/src/test/java/brooklyn/entity/nosql/mongodb/MongoDBRestartIntegrationTest.java
index c7376fe..3d21055 100644
--- a/software/nosql/src/test/java/brooklyn/entity/nosql/mongodb/MongoDBRestartIntegrationTest.java
+++ b/software/nosql/src/test/java/brooklyn/entity/nosql/mongodb/MongoDBRestartIntegrationTest.java
@@ -18,71 +18,25 @@
*/
package brooklyn.entity.nosql.mongodb;
-import java.util.Map;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.Test;
-import brooklyn.entity.BrooklynAppLiveTestSupport;
-import brooklyn.entity.Effector;
-import brooklyn.entity.basic.Entities;
-import brooklyn.entity.basic.Lifecycle;
-import brooklyn.entity.basic.ServiceStateLogic;
-import brooklyn.entity.basic.SoftwareProcess.RestartSoftwareParameters;
-import brooklyn.entity.basic.SoftwareProcess.StopSoftwareParameters;
+import brooklyn.entity.basic.AbstractSoftwareProcessRestartIntegrationTest;
+import brooklyn.entity.basic.SoftwareProcess;
import brooklyn.entity.proxying.EntitySpec;
-import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
-import brooklyn.test.EntityTestUtils;
-import brooklyn.util.collections.CollectionFunctionals;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
/**
* Tests restart of the software *process* (as opposed to the VM).
*/
-public class MongoDBRestartIntegrationTest extends BrooklynAppLiveTestSupport {
-
- // TODO Remove duplication from TomcatServerRestartIntegrationTest and MySqlRestartIntegrationTest
+@Test(groups="Integration")
+public class MongoDBRestartIntegrationTest extends AbstractSoftwareProcessRestartIntegrationTest {
@SuppressWarnings("unused")
private static final Logger LOG = LoggerFactory.getLogger(MongoDBRestartIntegrationTest.class);
- @Test(groups="Integration")
- public void testStopProcessAndRestart() throws Exception {
- runStopProcessAndRestart(
- MongoDBServer.RESTART,
- ImmutableMap.of(RestartSoftwareParameters.RESTART_MACHINE.getName(), RestartSoftwareParameters.RestartMachineMode.FALSE));
- }
-
- @Test(groups="Integration")
- public void testStopProcessAndStart() throws Exception {
- runStopProcessAndRestart(
- MongoDBServer.START,
- ImmutableMap.of("locations", ImmutableList.of()));
- }
-
- protected void runStopProcessAndRestart(Effector<?> restartEffector, Map<String, ?> args) throws Exception {
- LocalhostMachineProvisioningLocation loc = app.newLocalhostProvisioningLocation();
- MongoDBServer entity = app.createAndManageChild(EntitySpec.create(MongoDBServer.class));
- app.start(ImmutableList.of(loc));
-
- Entities.invokeEffector(app, entity, MongoDBServer.STOP, ImmutableMap.of(
- StopSoftwareParameters.STOP_MACHINE.getName(), false))
- .get();
- EntityTestUtils.assertAttributeEqualsEventually(entity, MongoDBServer.SERVICE_UP, false);
- EntityTestUtils.assertAttributeEqualsEventually(entity, MongoDBServer.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED);
- EntityTestUtils.assertAttributeEqualsEventually(entity, MongoDBServer.SERVICE_PROCESS_IS_RUNNING, false);
- EntityTestUtils.assertAttributeEventually(entity, ServiceStateLogic.SERVICE_NOT_UP_INDICATORS, CollectionFunctionals.<String>mapSizeEquals(1));
-
- Entities.invokeEffector(app, entity, restartEffector, args).get();
- EntityTestUtils.assertAttributeEqualsEventually(entity, MongoDBServer.SERVICE_UP, true);
- EntityTestUtils.assertAttributeEqualsEventually(entity, MongoDBServer.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
- EntityTestUtils.assertAttributeEqualsEventually(entity, MongoDBServer.SERVICE_PROCESS_IS_RUNNING, true);
- EntityTestUtils.assertAttributeEqualsEventually(entity, ServiceStateLogic.SERVICE_NOT_UP_INDICATORS, ImmutableMap.<String, Object>of());
-
- EntityTestUtils.assertAttributeEqualsEventually(app, MongoDBServer.SERVICE_UP, true);
- EntityTestUtils.assertAttributeEqualsEventually(app, MongoDBServer.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
+ @Override
+ protected EntitySpec<? extends SoftwareProcess> newEntitySpec() {
+ return EntitySpec.create(MongoDBServer.class);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4cd3d96e/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerRestartIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerRestartIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerRestartIntegrationTest.java
index 5c7e702..665cc69 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerRestartIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerRestartIntegrationTest.java
@@ -18,71 +18,27 @@
*/
package brooklyn.entity.webapp.tomcat;
-import java.util.Map;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.Test;
-import brooklyn.entity.BrooklynAppLiveTestSupport;
-import brooklyn.entity.Effector;
-import brooklyn.entity.basic.Entities;
-import brooklyn.entity.basic.Lifecycle;
-import brooklyn.entity.basic.ServiceStateLogic;
-import brooklyn.entity.basic.SoftwareProcess.RestartSoftwareParameters;
-import brooklyn.entity.basic.SoftwareProcess.StopSoftwareParameters;
+import brooklyn.entity.basic.AbstractSoftwareProcessRestartIntegrationTest;
+import brooklyn.entity.basic.SoftwareProcess;
import brooklyn.entity.proxying.EntitySpec;
-import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
-import brooklyn.test.EntityTestUtils;
-import brooklyn.util.collections.CollectionFunctionals;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
/**
* Tests restart of the software *process* (as opposed to the VM).
*/
-public class TomcatServerRestartIntegrationTest extends BrooklynAppLiveTestSupport {
+@Test(groups="Integration")
+public class TomcatServerRestartIntegrationTest extends AbstractSoftwareProcessRestartIntegrationTest {
// TODO Remove duplication from MySqlRestartIntegrationTest
@SuppressWarnings("unused")
private static final Logger LOG = LoggerFactory.getLogger(TomcatServerRestartIntegrationTest.class);
-
- @Test(groups="Integration")
- public void testStopProcessAndRestart() throws Exception {
- runStopProcessAndRestart(
- TomcatServer.RESTART,
- ImmutableMap.of(RestartSoftwareParameters.RESTART_MACHINE.getName(), RestartSoftwareParameters.RestartMachineMode.FALSE));
- }
-
- @Test(groups="Integration")
- public void testStopProcessAndStart() throws Exception {
- runStopProcessAndRestart(
- TomcatServer.START,
- ImmutableMap.of("locations", ImmutableList.of()));
- }
-
- protected void runStopProcessAndRestart(Effector<?> restartEffector, Map<String, ?> args) throws Exception {
- LocalhostMachineProvisioningLocation loc = app.newLocalhostProvisioningLocation();
- TomcatServer entity = app.createAndManageChild(EntitySpec.create(TomcatServer.class));
- app.start(ImmutableList.of(loc));
-
- Entities.invokeEffector(app, entity, TomcatServer.STOP, ImmutableMap.of(
- StopSoftwareParameters.STOP_MACHINE.getName(), false))
- .get();
- EntityTestUtils.assertAttributeEqualsEventually(entity, TomcatServer.SERVICE_UP, false);
- EntityTestUtils.assertAttributeEqualsEventually(entity, TomcatServer.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED);
- EntityTestUtils.assertAttributeEqualsEventually(entity, TomcatServer.SERVICE_PROCESS_IS_RUNNING, false);
- EntityTestUtils.assertAttributeEventually(entity, ServiceStateLogic.SERVICE_NOT_UP_INDICATORS, CollectionFunctionals.<String>mapSizeEquals(1));
-
- Entities.invokeEffector(app, entity, restartEffector, args).get();
- EntityTestUtils.assertAttributeEqualsEventually(entity, TomcatServer.SERVICE_UP, true);
- EntityTestUtils.assertAttributeEqualsEventually(entity, TomcatServer.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
- EntityTestUtils.assertAttributeEqualsEventually(entity, TomcatServer.SERVICE_PROCESS_IS_RUNNING, true);
- EntityTestUtils.assertAttributeEqualsEventually(entity, ServiceStateLogic.SERVICE_NOT_UP_INDICATORS, ImmutableMap.<String, Object>of());
- EntityTestUtils.assertAttributeEqualsEventually(app, TomcatServer.SERVICE_UP, true);
- EntityTestUtils.assertAttributeEqualsEventually(app, TomcatServer.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
+ @Override
+ protected EntitySpec<? extends SoftwareProcess> newEntitySpec() {
+ return EntitySpec.create(TomcatServer.class);
}
}