You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2009/08/17 01:15:41 UTC
svn commit: r804811 -
/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java
Author: ritchiem
Date: Sun Aug 16 23:15:41 2009
New Revision: 804811
URL: http://svn.apache.org/viewvc?rev=804811&view=rev
Log:
Give QpidTestCase the ability to set environment variables for the external brokers
Modified:
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java
Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java?rev=804811&r1=804810&r2=804811&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java Sun Aug 16 23:15:41 2009
@@ -157,7 +157,7 @@
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 @@
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 @@
_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 @@
//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 @@
}
/**
+ * 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.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org