summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2009-08-16 23:15:41 +0000
committerMartin Ritchie <ritchiem@apache.org>2009-08-16 23:15:41 +0000
commit021db895982e0f2b9d3baa90c6b5a0d4dcb30619 (patch)
tree0fa8e50cfb64109a206bd5cde1fff427db736610 /java
parentda454430e2b811bbfc409dedc07d1063baee0286 (diff)
downloadqpid-python-021db895982e0f2b9d3baa90c6b5a0d4dcb30619.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/qpid@804811 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java29
1 files changed, 28 insertions, 1 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java b/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java
index e7218d6975..db096710dc 100644
--- a/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java
+++ b/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.