fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From my...@apache.org
Subject [fineract-cn-test] 26/32: Ribbon list of servers should be set as default property and not as appname.listofservices. Also, it should be easier to set properties when TestEnvironment is used as a static variable.
Date Mon, 22 Jan 2018 15:13:31 GMT
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-test.git

commit 013937aac01660659bf3de0011d0209e61bfcf41
Author: myrle-krantz <mkrantz@mifos.org>
AuthorDate: Fri May 26 16:56:00 2017 +0200

    Ribbon list of servers should be set as default property and not as appname.listofservices.
 Also, it should be easier to set properties when TestEnvironment is used as a static variable.
---
 .../io/mifos/core/test/env/ExtraProperties.java    | 29 ++++++++++++++++++++++
 .../io/mifos/core/test/env/TestEnvironment.java    |  8 +++++-
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/src/main/java/io/mifos/core/test/env/ExtraProperties.java b/src/main/java/io/mifos/core/test/env/ExtraProperties.java
new file mode 100644
index 0000000..e327e20
--- /dev/null
+++ b/src/main/java/io/mifos/core/test/env/ExtraProperties.java
@@ -0,0 +1,29 @@
+/*
+ * 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.core.test.env;
+
+import java.util.Hashtable;
+
+/**
+ * @author Myrle Krantz
+ */
+@SuppressWarnings("WeakerAccess")
+public class ExtraProperties extends Hashtable<String, String> {
+  @SuppressWarnings("unused")
+  public synchronized String setProperty (String key, String value ) {
+    return put(key, value);
+  }
+}
diff --git a/src/main/java/io/mifos/core/test/env/TestEnvironment.java b/src/main/java/io/mifos/core/test/env/TestEnvironment.java
index 6e27da6..dc6e352 100644
--- a/src/main/java/io/mifos/core/test/env/TestEnvironment.java
+++ b/src/main/java/io/mifos/core/test/env/TestEnvironment.java
@@ -122,6 +122,12 @@ public final class TestEnvironment extends ExternalResource {
     populate();
   }
 
+  public TestEnvironment addProperties(final ExtraProperties properties) {
+    properties.entrySet().forEach(x -> setProperty(x.getKey(), x.getValue()));
+
+    return this;
+  }
+
   public String generateUniqueIdentifer(final String prefix) {
     return generateUniqueIdentifer(prefix, 1);
   }
@@ -213,7 +219,7 @@ public final class TestEnvironment extends ExternalResource {
     this.properties.setProperty(FLYWAY_ENABLED_PROPERTY, FLYWAY_ENABLED_DEFAULT);
     this.properties.setProperty(HYSTRIX_ENABLED_PROPERTY, HYSTRIX_ENABLED_DEFAULT);
     this.properties.setProperty(RIBBON_USES_EUREKA_PROPERTY, RIBBON_USES_EUREKA_DEFAULT);
-    this.properties.setProperty(springApplicationName + "." + RIBBON_LIST_OF_SERVERS_PROPERTY,
RIBBON_SERVER_DEFAULT + ":" + SERVER_PORT_DEFAULT);
+    this.properties.setProperty(RIBBON_LIST_OF_SERVERS_PROPERTY, RIBBON_SERVER_DEFAULT +
":" + SERVER_PORT_DEFAULT);
 
     this.keyPairHolder = RsaKeyPairFactory.createKeyPair();
 

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

Mime
View raw message