aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src/test/java
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-11-19 15:02:50 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2012-11-19 15:02:50 +0100
commitce4dfce6c8f3c085b4808a3e31bdf14112cb1663 (patch)
tree88d63496bf4886a908b1bb2364a58fc3226b5727 /sonar-core/src/test/java
parent929fd9533eda332db4689cd8f28290b886cc28dc (diff)
downloadsonarqube-ce4dfce6c8f3c085b4808a3e31bdf14112cb1663.tar.gz
sonarqube-ce4dfce6c8f3c085b4808a3e31bdf14112cb1663.zip
Support env variables in sonarsource integration tests
Diffstat (limited to 'sonar-core/src/test/java')
-rw-r--r--sonar-core/src/test/java/org/sonar/core/persistence/AbstractDaoTestCase.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/AbstractDaoTestCase.java b/sonar-core/src/test/java/org/sonar/core/persistence/AbstractDaoTestCase.java
index 71a53963353..7f228cb6877 100644
--- a/sonar-core/src/test/java/org/sonar/core/persistence/AbstractDaoTestCase.java
+++ b/sonar-core/src/test/java/org/sonar/core/persistence/AbstractDaoTestCase.java
@@ -22,6 +22,7 @@ package org.sonar.core.persistence;
import com.google.common.collect.Maps;
import com.google.common.io.Closeables;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.text.StrSubstitutor;
import org.dbunit.Assertion;
import org.dbunit.DataSourceDatabaseTester;
import org.dbunit.DatabaseUnitException;
@@ -51,6 +52,7 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.sql.Connection;
import java.sql.SQLException;
+import java.util.Map;
import java.util.Properties;
import static org.junit.Assert.fail;
@@ -101,6 +103,11 @@ public abstract class AbstractDaoTestCase {
Properties props = new Properties();
props.load(input);
settings.addProperties(props);
+ for (Map.Entry<String, String> entry : settings.getProperties().entrySet()) {
+ String interpolatedValue = StrSubstitutor.replace(entry.getValue(), System.getenv(), "${", "}");
+ settings.setProperty(entry.getKey(), interpolatedValue);
+ }
+
} finally {
IOUtils.closeQuietly(input);
}