Test suite (!)
diff --git a/component-test/src/main/java/io/mifos/portfolio/AbstractPortfolioTest.java b/component-test/src/main/java/io/mifos/portfolio/AbstractPortfolioTest.java
index c711676..4e27123 100644
--- a/component-test/src/main/java/io/mifos/portfolio/AbstractPortfolioTest.java
+++ b/component-test/src/main/java/io/mifos/portfolio/AbstractPortfolioTest.java
@@ -18,10 +18,7 @@
import io.mifos.accounting.api.v1.client.LedgerManager;
import io.mifos.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
import io.mifos.core.api.context.AutoUserContext;
-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.individuallending.api.v1.client.IndividualLending;
@@ -37,8 +34,6 @@
import io.mifos.portfolio.service.internal.util.AccountingAdapter;
import io.mifos.portfolio.service.internal.util.RhythmAdapter;
import org.junit.*;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TestRule;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.slf4j.Logger;
@@ -76,8 +71,7 @@
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT,
classes = {AbstractPortfolioTest.TestConfiguration.class})
-public class AbstractPortfolioTest {
- private static final String APP_NAME = "portfolio-v1";
+public class AbstractPortfolioTest extends SuiteTestEnvironment {
private static final String LOGGER_NAME = "test-logger";
@Configuration
@@ -107,17 +101,9 @@
static final String TEST_USER = "setau";
- 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/portfolio/SuiteTestEnvironment.java b/component-test/src/main/java/io/mifos/portfolio/SuiteTestEnvironment.java
new file mode 100644
index 0000000..3b84ee0
--- /dev/null
+++ b/component-test/src/main/java/io/mifos/portfolio/SuiteTestEnvironment.java
@@ -0,0 +1,40 @@
+/*
+ * 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.portfolio;
+
+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.TestRule;
+import org.junit.rules.RunExternalResourceOnce;
+
+/**
+ * @author Myrle Krantz
+ */
+public class SuiteTestEnvironment {
+ static final String APP_NAME = "portfolio-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/portfolio/TestSuite.java b/component-test/src/main/java/io/mifos/portfolio/TestSuite.java
new file mode 100644
index 0000000..4fba15b
--- /dev/null
+++ b/component-test/src/main/java/io/mifos/portfolio/TestSuite.java
@@ -0,0 +1,36 @@
+/*
+ * 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.portfolio;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * @author Myrle Krantz
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ TestAccountingInteractionInLoanWorkflow.class,
+ TestCases.class,
+ TestChargeDefinitions.class,
+ TestCommands.class,
+ TestIndividualLoans.class,
+ TestPatterns.class,
+ TestProducts.class,
+ TestTaskDefinitions.class
+})
+public class TestSuite extends SuiteTestEnvironment {
+}