diff options
Diffstat (limited to 'java/systests/src')
| -rw-r--r-- | java/systests/src/main/java/org/apache/qpid/test/utils/FailoverBaseCase.java | 1 | ||||
| -rw-r--r-- | java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java | 30 |
2 files changed, 30 insertions, 1 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/test/utils/FailoverBaseCase.java b/java/systests/src/main/java/org/apache/qpid/test/utils/FailoverBaseCase.java index bfae6ad115..acdc149525 100644 --- a/java/systests/src/main/java/org/apache/qpid/test/utils/FailoverBaseCase.java +++ b/java/systests/src/main/java/org/apache/qpid/test/utils/FailoverBaseCase.java @@ -54,6 +54,7 @@ public class FailoverBaseCase extends QpidTestCase protected void setUp() throws java.lang.Exception { super.setUp(); + System.setProperty("QPID_WORK", System.getProperty("java.io.tmpdir")+"/"+getFailingPort()); startBroker(getFailingPort()); } 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 a28e1181fe..2d19bb6e49 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 @@ -387,7 +387,7 @@ 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")); process = pb.start(); Piper p = new Piper(process.getInputStream(), @@ -469,6 +469,34 @@ public class QpidTestCase extends TestCase ApplicationRegistry.remove(port); } } + + public void nukeBroker() throws Exception + { + nukeBroker(0); + } + + public void nukeBroker(int port) throws Exception + { + Process proc = _brokers.get(getPort(port)); + if (proc == null) + { + stopBroker(port); + } + else + { + String command = "pkill -KILL -f "+getBrokerCommand(getPort(port)); + try + { + Runtime.getRuntime().exec(command); + } + catch (Exception e) + { + // Can't do that, try the old fashioned way + _logger.warn("Could not run "+command+", killing with stopBroker()"); + stopBroker(port); + } + } + } protected void setSystemProperty(String property, String value) { |
