Merge pull request #1 from myrle-krantz/develop

Added TestSuite to make running all the component tests faster.
diff --git a/component-test/src/main/java/io/mifos/deposit/AbstractDepositAccountManagementTest.java b/component-test/src/main/java/io/mifos/deposit/AbstractDepositAccountManagementTest.java
index 6899007..b93a584 100644
--- a/component-test/src/main/java/io/mifos/deposit/AbstractDepositAccountManagementTest.java
+++ b/component-test/src/main/java/io/mifos/deposit/AbstractDepositAccountManagementTest.java
@@ -18,10 +18,7 @@
 import io.mifos.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
 import io.mifos.core.api.context.AutoUserContext;
 import io.mifos.core.lang.ApplicationName;
-import io.mifos.core.test.env.TestEnvironment;
 import io.mifos.core.test.fixture.TenantDataStoreContextTestRule;
-import io.mifos.core.test.fixture.cassandra.CassandraInitializer;
-import io.mifos.core.test.fixture.mariadb.MariaDBInitializer;
 import io.mifos.core.test.listener.EnableEventRecording;
 import io.mifos.core.test.listener.EventRecorder;
 import io.mifos.deposit.api.v1.EventConstants;
@@ -32,8 +29,6 @@
 import org.junit.Before;
 import org.junit.ClassRule;
 import org.junit.Rule;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TestRule;
 import org.junit.runner.RunWith;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -54,23 +49,12 @@
     webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT,
     classes = {AbstractDepositAccountManagementTest.TestConfiguration.class}
 )
-public abstract class AbstractDepositAccountManagementTest {
-
-  private static final String APP_NAME = "deposit-v1";
+public abstract class AbstractDepositAccountManagementTest extends SuiteTestEnvironment {
   private static final String TEST_USER = "shed";
   public static final String TEST_LOGGER = "test-logger";
 
-  private final static TestEnvironment testEnvironment = new TestEnvironment(APP_NAME);
-  private final static CassandraInitializer cassandraInitializer = new CassandraInitializer();
-  private final static MariaDBInitializer mariaDBInitializer = new MariaDBInitializer();
-  private final static TenantDataStoreContextTestRule tenantDataStoreContext = TenantDataStoreContextTestRule.forRandomTenantName(cassandraInitializer, mariaDBInitializer);
-
   @ClassRule
-  public static TestRule orderClassRules = RuleChain
-      .outerRule(testEnvironment)
-      .around(cassandraInitializer)
-      .around(mariaDBInitializer)
-      .around(tenantDataStoreContext);
+  public final static TenantDataStoreContextTestRule tenantDataStoreContext = TenantDataStoreContextTestRule.forRandomTenantName(cassandraInitializer, mariaDBInitializer);
 
   @Rule
   public final TenantApplicationSecurityEnvironmentTestRule tenantApplicationSecurityEnvironment
diff --git a/component-test/src/main/java/io/mifos/deposit/SuiteTestEnvironment.java b/component-test/src/main/java/io/mifos/deposit/SuiteTestEnvironment.java
new file mode 100644
index 0000000..3fef93a
--- /dev/null
+++ b/component-test/src/main/java/io/mifos/deposit/SuiteTestEnvironment.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.deposit;
+
+
+import io.mifos.core.test.env.TestEnvironment;
+import io.mifos.core.test.fixture.cassandra.CassandraInitializer;
+import io.mifos.core.test.fixture.mariadb.MariaDBInitializer;
+import org.junit.ClassRule;
+import org.junit.rules.RuleChain;
+import org.junit.rules.RunExternalResourceOnce;
+import org.junit.rules.TestRule;
+
+/**
+ * @author Myrle Krantz
+ */
+public class SuiteTestEnvironment {
+  static final String APP_NAME = "deposit-v1";
+  static final TestEnvironment testEnvironment = new TestEnvironment(APP_NAME);
+  static final CassandraInitializer cassandraInitializer = new CassandraInitializer();
+  static final MariaDBInitializer mariaDBInitializer = new MariaDBInitializer();
+
+  @ClassRule
+  public static TestRule orderClassRules = RuleChain
+      .outerRule(new RunExternalResourceOnce(testEnvironment))
+      .around(new RunExternalResourceOnce(cassandraInitializer))
+      .around(new RunExternalResourceOnce(mariaDBInitializer));
+}
diff --git a/component-test/src/main/java/io/mifos/deposit/TestSuite.java b/component-test/src/main/java/io/mifos/deposit/TestSuite.java
new file mode 100644
index 0000000..abb4cc2
--- /dev/null
+++ b/component-test/src/main/java/io/mifos/deposit/TestSuite.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.deposit;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * @author Myrle Krantz
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    TestActions.class,
+    TestProductDefinition.class,
+    TestProductInstance.class,
+})
+public class TestSuite extends SuiteTestEnvironment {
+}