diff options
author | Robert Gemmell <robbie@apache.org> | 2009-12-01 14:22:44 +0000 |
---|---|---|
committer | Robert Gemmell <robbie@apache.org> | 2009-12-01 14:22:44 +0000 |
commit | 5889e5364ebbb3a5c936b3dec527bba85f1ce565 (patch) | |
tree | 47e4f0f5c2aa5a7f593b282bf24984e5a1351451 /java/systests/src | |
parent | 4497af06e34c177b4b84a5dff74a254a3d05fb2f (diff) | |
download | qpid-python-5889e5364ebbb3a5c936b3dec527bba85f1ce565.tar.gz |
QPID-2184: replace random 1second wait with a LogMonitor check that the reload has occured. Also update some method and paramter names
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@885765 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/systests/src')
-rw-r--r-- | java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java | 18 | ||||
-rw-r--r-- | java/systests/src/main/java/org/apache/qpid/util/LogMonitor.java | 4 |
2 files changed, 9 insertions, 13 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 7f43a3ee68..5e209e69d6 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 @@ -34,6 +34,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.LogMonitor; import org.apache.log4j.Level; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -76,7 +77,8 @@ public class QpidTestCase extends TestCase protected File _configFile = new File(System.getProperty("broker.config")); protected static final Logger _logger = LoggerFactory.getLogger(QpidTestCase.class); - + protected static final int LOGMONITOR_TIMEOUT = 5000; + protected long RECEIVE_TIMEOUT = 1000l; private Map<String, String> _propertiesSetForTestOnly = new HashMap<String, String>(); @@ -1251,7 +1253,7 @@ public class QpidTestCase extends TestCase { if (_broker.equals(VM)) { - ApplicationRegistry.getInstance().getConfiguration().reparseConfigFile(); + ApplicationRegistry.getInstance().getConfiguration().reparseConfigFileSecuritySections(); } else // FIXME: should really use the JMX interface to do this { @@ -1264,15 +1266,9 @@ public class QpidTestCase extends TestCase String cmd = "/bin/kill -SIGHUP " + reader.readLine(); p = Runtime.getRuntime().exec(cmd); - //delay to ensure the reload time has time to occur - try - { - Thread.sleep(1000); - } - catch (InterruptedException e) - { - //ignore - } + LogMonitor _monitor = new LogMonitor(_outputFile); + assertTrue("The expected server security configuration reload did not occur", + _monitor.waitForMessage(ServerConfiguration.SECURITY_CONFIG_RELOADED, LOGMONITOR_TIMEOUT)); } } diff --git a/java/systests/src/main/java/org/apache/qpid/util/LogMonitor.java b/java/systests/src/main/java/org/apache/qpid/util/LogMonitor.java index 44ac5b4838..7d55c68b75 100644 --- a/java/systests/src/main/java/org/apache/qpid/util/LogMonitor.java +++ b/java/systests/src/main/java/org/apache/qpid/util/LogMonitor.java @@ -151,9 +151,9 @@ public class LogMonitor } - public boolean waitForMessage(String messageCountAlert, long alertLogWaitPeriod) throws FileNotFoundException, IOException + public boolean waitForMessage(String message, long alertLogWaitPeriod) throws FileNotFoundException, IOException { - return waitForMessage(messageCountAlert, alertLogWaitPeriod, true); + return waitForMessage(message, alertLogWaitPeriod, true); } |