diff options
author | Martin Ritchie <ritchiem@apache.org> | 2009-08-16 23:15:41 +0000 |
---|---|---|
committer | Martin Ritchie <ritchiem@apache.org> | 2009-08-16 23:15:41 +0000 |
commit | 47c024237135d9db387bb5db7f234e324871dfa4 (patch) | |
tree | 0778dd0bbf3631c5787a6f1c21366eaee977c83b | |
parent | 8d243720ce877ef59db7572194b80a2c5d0737e8 (diff) | |
download | qpid-python-47c024237135d9db387bb5db7f234e324871dfa4.tar.gz |
Give QpidTestCase the ability to set environment variables for the external brokers
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@804811 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java index e7218d6975..db096710dc 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java @@ -157,7 +157,7 @@ public class QpidTestCase extends TestCase private static final String VERSION_08 = "0-8"; private static final String VERSION_010 = "0-10"; - private static final String QPID_HOME = "QPID_HOME"; + protected static final String QPID_HOME = "QPID_HOME"; protected static int DEFAULT_VM_PORT = 1; protected static int DEFAULT_PORT = Integer.getInteger("test.port", 5672); @@ -182,6 +182,8 @@ public class QpidTestCase extends TestCase protected List<Connection> _connections = new ArrayList<Connection>(); public static final String QUEUE = "queue"; public static final String TOPIC = "topic"; + /** Map to hold test defined environment properties */ + private Map<String,String> _env; public QpidTestCase(String name) @@ -199,6 +201,9 @@ public class QpidTestCase extends TestCase _testName = getClass().getSimpleName() + "." + getName(); String qname = getClass().getName() + "." + getName(); + // Initalise this for each test run + _env = new HashMap<String, String>(); + PrintStream oldOut = System.out; PrintStream oldErr = System.err; PrintStream out = null; @@ -435,6 +440,16 @@ public class QpidTestCase extends TestCase //Add the test name to the broker run. env.put("QPID_PNAME", "-DPNAME=\"" + _testName + "\""); env.put("QPID_WORK", System.getProperty("QPID_WORK")); + + // Add all the environment settings the test requested + if (!_env.isEmpty()) + { + for(Map.Entry<String,String> entry : _env.entrySet()) + { + env.put(entry.getKey() ,entry.getValue()); + } + } + process = pb.start(); Piper p = new Piper(process.getInputStream(), @@ -677,6 +692,18 @@ public class QpidTestCase extends TestCase } /** + * Add an environtmen variable for the external broker environment + * + * @param property the property to set + * @param value the value to set it to + */ + protected void setBrokerEnvironment(String property, String value) + { + _env.put(property,value); + } + + + /** * Check whether the broker is an 0.8 * * @return true if the broker is an 0_8 version, false otherwise. |