summaryrefslogtreecommitdiff
path: root/java/systests/src
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2011-03-15 17:04:57 +0000
committerRobert Gemmell <robbie@apache.org>2011-03-15 17:04:57 +0000
commitad1276e874b9fcad739bddf074467ff7acc31ede (patch)
tree42c069ec921079f90b24f3bcec6a637541f72c06 /java/systests/src
parenta537010f4dc49fbcb05820eefa132c879f96b7ba (diff)
downloadqpid-python-ad1276e874b9fcad739bddf074467ff7acc31ede.tar.gz
QPID-3142: enable tests to run against a copy of an existing work directory
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1081858 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/systests/src')
-rw-r--r--java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java31
1 files changed, 30 insertions, 1 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java b/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java
index ae38a75e7a..45f76f7fc7 100644
--- a/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java
+++ b/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java
@@ -67,6 +67,7 @@ import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry;
import org.apache.qpid.server.store.DerbyMessageStore;
import org.apache.qpid.url.URLSyntaxException;
+import org.apache.qpid.util.FileUtils;
import org.apache.qpid.util.LogMonitor;
/**
@@ -109,6 +110,7 @@ public class QpidBrokerTestCase extends QpidTestCase
private static final String BROKER = "broker";
private static final String BROKER_CLEAN = "broker.clean";
private static final String BROKER_CLEAN_BETWEEN_TESTS = "broker.clean.between.tests";
+ private static final String BROKER_EXISTING_QPID_WORK = "broker.existing.qpid.work";
private static final String BROKER_VERSION = "broker.version";
protected static final String BROKER_READY = "broker.ready";
private static final String BROKER_STOPPED = "broker.stopped";
@@ -283,6 +285,19 @@ public class QpidBrokerTestCase extends QpidTestCase
fail("Unable to test without config file:" + _configFile);
}
+ if(_brokerCleanBetweenTests)
+ {
+ cleanBroker();
+
+ String existingQpidWorkPath = System.getProperty(BROKER_EXISTING_QPID_WORK);
+ if(existingQpidWorkPath != null && !existingQpidWorkPath.equals(""))
+ {
+ File existing = new File(existingQpidWorkPath);
+ File qpidWork = new File(getQpidWork(_broker, getPort()));
+ FileUtils.copyRecursive(existing, qpidWork);
+ }
+ }
+
startBroker();
}
@@ -490,7 +505,7 @@ public class QpidBrokerTestCase extends QpidTestCase
// DON'T change PNAME, qpid.stop needs this value.
env.put("QPID_PNAME", "-DPNAME=QPBRKR -DTNAME=\"" + _testName + "\"");
// Add the port to QPID_WORK to ensure unique working dirs for multi broker tests
- env.put("QPID_WORK", System.getProperty("QPID_WORK")+ "/" + port);
+ env.put("QPID_WORK", getQpidWork(_broker, port));
// Use the environment variable to set amqj.logging.level for the broker
@@ -578,6 +593,20 @@ public class QpidBrokerTestCase extends QpidTestCase
_brokers.put(port, process);
}
+ private String getQpidWork(String broker, int port)
+ {
+ if (broker.equals(VM))
+ {
+ return System.getProperty("QPID_WORK");
+ }
+ else if (!broker.equals(EXTERNAL))
+ {
+ return System.getProperty("QPID_WORK")+ "/" + port;
+ }
+
+ return System.getProperty("QPID_WORK");
+ }
+
public String getTestConfigFile()
{
String path = _output == null ? System.getProperty("java.io.tmpdir") : _output;