Skip to content
This repository was archived by the owner on Jan 10, 2020. It is now read-only.

Commit 9f5f408

Browse files
committed
config override with system properties
1 parent 01072e2 commit 9f5f408

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/test/java/org/arangodb/objectmapper/test/BaseTestCase.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.io.InputStream;
44
import java.util.Properties;
55

6+
import org.apache.commons.codec.binary.StringUtils;
67
import org.apache.log4j.Logger;
78
import org.arangodb.objectmapper.ArangoDb4JException;
89
import org.arangodb.objectmapper.Database;
@@ -110,12 +111,22 @@ private Properties loadPropertiesFromFile() {
110111
InputStream resourceAsStream = BaseTestCase.class.getResourceAsStream("/arangodb.properties");
111112
props.load(resourceAsStream);
112113

113-
LOG.info("Load " + props.size() +" Properties from " + BaseTestCase.class.getResource("/arangodb.properties").getFile());
114+
LOG.debug("Load " + props.size() +" Properties from " + BaseTestCase.class.getResource("/arangodb.properties").getFile());
115+
116+
props.forEach((key, val) -> {
117+
118+
String systemProp = System.getProperty(key.toString());
119+
120+
if(systemProp != null && systemProp.equals(val) == false) {
121+
LOG.info("Found System Property for " + key + " with Value " + systemProp);
122+
props.put(key, systemProp);
123+
}
124+
125+
});
126+
114127

115128
} catch (Exception e) {
116-
117129
LOG.warn("Cant read Properties from File", e);
118-
119130
}
120131

121132
return props;

0 commit comments

Comments
 (0)