modules/common/cassandra-common-itests/src/main/java/org/rhq/cassandra/CassandraClusterManager.java | 6 +++- modules/enterprise/server/server-metrics/pom.xml | 14 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-)
New commits: commit 5829edd2a5d43719fdde1f8b0aaee6b92ab4a735 Author: John Sanda jsanda@redhat.com Date: Mon Nov 5 11:07:13 2012 -0500
adding option to skip cluster shutdown during test runs
The @ShutdownCluster annotation causes each node in the cluster to be shut down. This type of clean up is particularly useful in a continuous integration environment. But in a dev environment when running tests repeatedly prior to a commit for example, it gets to be cumbersome to redeploy/restart the cluster for each test run.
CassandraClusterManager now checks a system property named rhq.cassandra.cluster.skip-shutdown to decide whether or not cluster shut down should be initiated when the @ShutdownCluster annotation is present.
The server-metrics build has been updated to pass in the system property when running tests from the command line. You can easily disable shut down as follows,
mvn test -Dtest=MetricsDAOTest -DskipClusterShutdown=true
If there are multiple test/configuration methods with the @ShutdownCluster annotation, then -DskipClusterShutdown=true will affect all of them.
diff --git a/modules/common/cassandra-common-itests/src/main/java/org/rhq/cassandra/CassandraClusterManager.java b/modules/common/cassandra-common-itests/src/main/java/org/rhq/cassandra/CassandraClusterManager.java index 0fa49b8..8702b51 100644 --- a/modules/common/cassandra-common-itests/src/main/java/org/rhq/cassandra/CassandraClusterManager.java +++ b/modules/common/cassandra-common-itests/src/main/java/org/rhq/cassandra/CassandraClusterManager.java @@ -64,7 +64,11 @@ public class CassandraClusterManager implements IInvokedMethodListener { Method method = invokedMethod.getTestMethod().getConstructorOrMethod().getMethod(); if (method.isAnnotationPresent(ShutdownCluster.class)) { try { - shutdownCluster(); + Boolean skipShutdown = Boolean.valueOf( + System.getProperty("rhq.cassandra.cluster.skip-shutdown", "false")); + if (!skipShutdown) { + shutdownCluster(); + } } catch (Exception e) { log.warn("An error occurred while shutting down the cluster", e); } diff --git a/modules/enterprise/server/server-metrics/pom.xml b/modules/enterprise/server/server-metrics/pom.xml index f10b468..0494f81 100644 --- a/modules/enterprise/server/server-metrics/pom.xml +++ b/modules/enterprise/server/server-metrics/pom.xml @@ -40,6 +40,7 @@
<properties> <cassandra.version>1.1.5</cassandra.version> + <skipClusterShutdown>false</skipClusterShutdown> </properties>
<dependencies> @@ -127,4 +128,17 @@ <version>1.7.1</version> </dependency> </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <systemPropertyVariables> + <rhq.cassandra.cluster.skip-shutdown>${skipClusterShutdown}</rhq.cassandra.cluster.skip-shutdown> + </systemPropertyVariables> + </configuration> + </plugin> + </plugins> + </build> </project>
rhq-commits@lists.fedorahosted.org