You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by my...@apache.org on 2018/01/22 15:21:20 UTC

[fineract-cn-service-starter] 08/23: Making it possible to define the tenant name within integration tests.

This is an automated email from the ASF dual-hosted git repository.

myrle pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-service-starter.git

commit 41776fd775f609ced2bf743bdd5a07c7e66c984b
Author: myrle-krantz <mk...@mifos.org>
AuthorDate: Wed Mar 29 16:20:15 2017 +0200

    Making it possible to define the tenant name within integration tests.
---
 .../test/servicestarter/IntegrationTestEnvironment.java     | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/main/java/io/mifos/core/test/servicestarter/IntegrationTestEnvironment.java b/src/main/java/io/mifos/core/test/servicestarter/IntegrationTestEnvironment.java
index 558a07a..685f01c 100644
--- a/src/main/java/io/mifos/core/test/servicestarter/IntegrationTestEnvironment.java
+++ b/src/main/java/io/mifos/core/test/servicestarter/IntegrationTestEnvironment.java
@@ -38,6 +38,7 @@ import static io.mifos.core.test.env.TestEnvironment.*;
 public class IntegrationTestEnvironment extends ExternalResource {
 
 
+
   static String getJava()
   {
     final String javaHome = System.getProperty("java.home");
@@ -50,6 +51,7 @@ public class IntegrationTestEnvironment extends ExternalResource {
     return homeDirectory + File.separator + ".m2" + File.separator + "repository";
   }
 
+  private final String tenantName;
   private int nextPort;
   private final Set<Integer> ports;
   private final RsaKeyPairFactory.KeyPairHolder keyPairHolder;
@@ -58,7 +60,13 @@ public class IntegrationTestEnvironment extends ExternalResource {
   private final List<String> applicationNames;
   private TenantDataStoreTestContext tenantDataStoreTestContext;
 
+  @SuppressWarnings("unused")
   public IntegrationTestEnvironment(final DataStoreTenantInitializer... dataStoreTenantInitializers) {
+    this(null, dataStoreTenantInitializers);
+  }
+
+  public IntegrationTestEnvironment(final String tenantName, final DataStoreTenantInitializer... dataStoreTenantInitializers) {
+    this.tenantName = tenantName;
     final Properties properties = System.getProperties();
     properties.setProperty(CASSANDRA_CLUSTER_NAME_PROPERTY, CASSANDRA_CLUSTER_NAME_DEFAULT);
     properties.setProperty(CASSANDRA_CONTACT_POINTS_PROPERTY, CASSANDRA_CONTACT_POINTS_DEFAULT);
@@ -95,7 +103,10 @@ public class IntegrationTestEnvironment extends ExternalResource {
 
   @Override
   protected void before() {
-    tenantDataStoreTestContext = TenantDataStoreTestContext.forRandomTenantName(dataStoreTenantInitializers);
+    if (tenantName == null)
+      tenantDataStoreTestContext = TenantDataStoreTestContext.forRandomTenantName(dataStoreTenantInitializers);
+    else
+      tenantDataStoreTestContext = TenantDataStoreTestContext.forDefinedTenantName(tenantName, dataStoreTenantInitializers);
   }
 
   @Override

-- 
To stop receiving notification emails like this one, please contact
myrle@apache.org.