diff options
| author | Robert Gemmell <robbie@apache.org> | 2010-03-30 13:45:18 +0000 |
|---|---|---|
| committer | Robert Gemmell <robbie@apache.org> | 2010-03-30 13:45:18 +0000 |
| commit | 849df0c69c5068a6557a5aac8bfce68c3f4ad4af (patch) | |
| tree | 8d9c0e062b7590cd6294db3884cde9f70401f9ad /java/systests/src | |
| parent | a6cb3b13f6e4c5790cb4346c771a277c29f5b516 (diff) | |
| download | qpid-python-849df0c69c5068a6557a5aac8bfce68c3f4ad4af.tar.gz | |
QPID-2360, QPID-2361: Restore the virtualhosts.xml file. When a virtualhosts.xml file is specified load it as its own Configuration object to ensure the property heirarchy is not lost. Enforce that virtualhost config can only be specified in either the main config.xml file or the virtualhosts.xml file, but not both. Allow the virtualhosts.xml file to be a combined configuration and use to provide override abilities for testing.
Applied patch from Andrew Kennedy <andrew.international@gmail.com>
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@929136 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/systests/src')
6 files changed, 193 insertions, 142 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java b/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java index 0a88ef391c..4a2d626a5b 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java @@ -42,6 +42,8 @@ public class ServerConfigurationFileTest extends QpidTestCase } saveTestConfiguration(); + saveTestVirtualhosts(); + _serverConfig = new ServerConfiguration(_configFile); } diff --git a/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java b/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java index 3429edd6bc..a4b47268e2 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java @@ -20,19 +20,16 @@ */ package org.apache.qpid.server.logging; +import javax.jms.Connection; +import javax.jms.Queue; +import javax.jms.Session; + import org.apache.qpid.client.AMQDestination; import org.apache.qpid.client.AMQSession; import org.apache.qpid.framing.AMQShortString; -import org.apache.qpid.server.registry.ApplicationRegistry; import org.apache.qpid.server.configuration.ServerConfiguration; -import org.apache.qpid.test.utils.QpidTestCase; +import org.apache.qpid.server.registry.ApplicationRegistry; import org.apache.qpid.util.FileUtils; -import org.apache.qpid.util.LogMonitor; - -import javax.jms.Connection; -import javax.jms.Queue; -import javax.jms.Session; -import java.io.File; public class AlertingTest extends AbstractTestLogging { @@ -49,6 +46,7 @@ public class AlertingTest extends AbstractTestLogging { // Update the configuration to make our virtualhost Persistent. makeVirtualHostPersistent(VIRTUALHOST); + setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.expiredMessageCheckPeriod", "5000"); _numMessages = 50; @@ -114,7 +112,7 @@ public class AlertingTest extends AbstractTestLogging message.append(FileUtils.readFileAsString(getTestConfigFile())); message.append("\nVirtualhost maxMessageCount:\n"); - message.append((new ServerConfiguration(_configFile)).getConfig().getString("virtualhosts.virtualhost." + VIRTUALHOST + ".queues.maximumMessageCount")); + message.append(new ServerConfiguration(_configFile).getVirtualHostConfig(VIRTUALHOST).getMaximumMessageCount()); fail(message.toString()); } @@ -185,7 +183,7 @@ public class AlertingTest extends AbstractTestLogging setupConnection(); // Validate the queue depth is as expected - long messageCount = ((AMQSession) _session).getQueueDepth((AMQDestination) _destination); + long messageCount = ((AMQSession<?, ?>) _session).getQueueDepth((AMQDestination) _destination); assertEquals("Broker has invalid message count for test", 2, messageCount); // Ensure the alert has not occured yet @@ -198,5 +196,4 @@ public class AlertingTest extends AbstractTestLogging // Validate that the alert occured. wasAlertFired(); } - } diff --git a/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java b/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java index 1bcef1dbb0..c3c2574519 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java @@ -20,13 +20,13 @@ */ package org.apache.qpid.server.logging; -import org.apache.commons.configuration.Configuration; +import java.util.Arrays; +import java.util.List; + import org.apache.qpid.server.configuration.ServerConfiguration; import org.apache.qpid.server.logging.subjects.AbstractTestLogSubject; import org.apache.qpid.util.LogMonitor; -import java.util.List; - /** * The MessageStore test suite validates that the follow log messages as * specified in the Functional Specification. @@ -90,7 +90,7 @@ public class MemoryMessageStoreLoggingTest extends AbstractTestLogging // Load VirtualHost list from file. ServerConfiguration configuration = new ServerConfiguration(_configFile); - List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name"); + List<String> vhosts = Arrays.asList(configuration.getVirtualHosts()); //Validate each vhost logs a creation results = _monitor.waitAndFindMatches("MST-1001", DEFAULT_LOG_WAIT); @@ -101,15 +101,12 @@ public class MemoryMessageStoreLoggingTest extends AbstractTestLogging { String result = getLog(results.get(index)); - // getSlize will return extract the vhost from vh(/test) -> '/test' + // getSlice will return extract the vhost from vh(/test) -> '/test' // so remove the '/' to get the name String vhostName = AbstractTestLogSubject.getSlice("vh", result).substring(1); - // To get the store class used in the configuration we need to know - // the virtualhost name, found above. AND - // the index that the virtualhost is within the configuration. - // we can retrive that from the vhosts list previously extracted. - String fullStoreName = configuration.getConfig().getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class"); + // Get the store class used in the configuration for the virtualhost. + String fullStoreName = configuration.getVirtualHostConfig(vhostName).getMessageStoreClass(); // Get the Simple class name from the expected class name of o.a.q.s.s.MMS String storeName = fullStoreName.substring(fullStoreName.lastIndexOf(".") + 1); @@ -157,7 +154,7 @@ public class MemoryMessageStoreLoggingTest extends AbstractTestLogging // Load VirtualHost list from file. ServerConfiguration configuration = new ServerConfiguration(_configFile); - List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name"); + List<String> vhosts = Arrays.asList(configuration.getVirtualHosts()); //Validate each vhost logs a creation results = _monitor.waitAndFindMatches("MST-1003", DEFAULT_LOG_WAIT); @@ -168,15 +165,12 @@ public class MemoryMessageStoreLoggingTest extends AbstractTestLogging { String result = getLog(results.get(index)); - // getSlize will return extract the vhost from vh(/test) -> '/test' + // getSlice will return extract the vhost from vh(/test) -> '/test' // so remove the '/' to get the name String vhostName = AbstractTestLogSubject.getSlice("vh", result).substring(1); - // To get the store class used in the configuration we need to know - // the virtualhost name, found above. AND - // the index that the virtualhost is within the configuration. - // we can retrive that from the vhosts list previously extracted. - String fullStoreName = configuration.getConfig().getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class"); + // Get the store class used in the configuration for the virtualhost. + String fullStoreName = configuration.getVirtualHostConfig(vhostName).getMessageStoreClass(); // Get the Simple class name from the expected class name of o.a.q.s.s.MMS String storeName = fullStoreName.substring(fullStoreName.lastIndexOf(".") + 1); diff --git a/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java b/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java index b97bd64a55..d4c3689365 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java @@ -21,11 +21,12 @@ package org.apache.qpid.server.logging; +import java.util.Arrays; +import java.util.List; + import junit.framework.AssertionFailedError; -import org.apache.commons.configuration.Configuration; -import org.apache.qpid.server.configuration.ServerConfiguration; -import java.util.List; +import org.apache.qpid.server.configuration.ServerConfiguration; /** * Virtualhost Test Cases @@ -60,28 +61,26 @@ public class VirtualHostLoggingTest extends AbstractTestLogging public void testVirtualhostCreation() throws Exception { //Wait for the correct VHT message to arrive. - _monitor.waitForMessage("VHT-1001",DEFAULT_LOG_WAIT); - - List<String> results = _monitor.findMatches(VHT_PREFIX); + _monitor.waitForMessage(VHT_PREFIX + "1001", DEFAULT_LOG_WAIT); + + //Validate each vhost logs a creation + List<String> results = _monitor.findMatches(VHT_PREFIX + "1001"); + try { - // Validation + // Load VirtualHost list from file. ServerConfiguration configuration = new ServerConfiguration(_configFile); - List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name"); - - //Validate each vhost logs a creation - results = _monitor.findMatches("VHT-1001"); + List<String> vhosts = Arrays.asList(configuration.getVirtualHosts()); assertEquals("Each vhost did not create a store.", vhosts.size(), results.size()); for (int index = 0; index < results.size(); index++) { - String result = getLog(results.get(index)); - // Retrieve the vhostname from the log entry message 'Created : <vhostname>' + String result = getLog(results.get(index)); String vhostName = getMessageString(fromMessage(result)).split(" ")[2]; - assertTrue("Virualhost named in log not found in config file:" + vhostName + ":" + vhosts, vhosts.contains(vhostName)); + assertTrue("Virtualhost named in log not found in config file:" + vhostName + ":" + vhosts, vhosts.contains(vhostName)); } } catch (AssertionFailedError afe) @@ -114,21 +113,19 @@ public class VirtualHostLoggingTest extends AbstractTestLogging { stopBroker(); - //Wait for the correct VHT message to arrive. - _monitor.waitForMessage("VHT-1002",DEFAULT_LOG_WAIT); - - List<String> results = _monitor.findMatches(VHT_PREFIX); + // Wait for the correct VHT message to arrive. + _monitor.waitForMessage(VHT_PREFIX + "1002", DEFAULT_LOG_WAIT); + + // Validate each vhost logs a closure + List<String> results = _monitor.findMatches(VHT_PREFIX + "1002"); + try { - // Validation - + // Load VirtualHost list from file. ServerConfiguration configuration = new ServerConfiguration(_configFile); - List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name"); - - //Validate each vhost logs a creation - results = _monitor.findMatches("VHT-1002"); + List<String> vhosts = Arrays.asList(configuration.getVirtualHosts()); - assertEquals("Each vhost did not create a store.", vhosts.size(), results.size()); + assertEquals("Each vhost did not close their store.", vhosts.size(), results.size()); } catch (AssertionFailedError afe) { diff --git a/java/systests/src/main/java/org/apache/qpid/server/security/firewall/FirewallConfigTest.java b/java/systests/src/main/java/org/apache/qpid/server/security/firewall/FirewallConfigTest.java index 5e387be91b..ec9a297047 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/security/firewall/FirewallConfigTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/security/firewall/FirewallConfigTest.java @@ -33,8 +33,8 @@ import org.apache.qpid.test.utils.QpidTestCase; public class FirewallConfigTest extends QpidTestCase { - - private File tmpFile = null; + private File _tmpConfig, _tmpVirtualhosts; + @Override protected void setUp() throws Exception { @@ -46,22 +46,32 @@ public class FirewallConfigTest extends QpidTestCase fail("QPID_HOME not set"); } - // Setup initial config. + // Setup initial config file. _configFile = new File(QPID_HOME, "etc/config-systests-firewall.xml"); - tmpFile = File.createTempFile("config-systests-firewall", ".xml"); - setSystemProperty("QPID_FIREWALL_SETTINGS", tmpFile.getAbsolutePath()); - tmpFile.deleteOnExit(); + + // Setup temporary config file + _tmpConfig = File.createTempFile("config-systests-firewall", ".xml"); + setSystemProperty("QPID_FIREWALL_CONFIG_SETTINGS", _tmpConfig.getAbsolutePath()); + _tmpConfig.deleteOnExit(); + + // Setup temporary virtualhosts file + _tmpVirtualhosts = File.createTempFile("virtualhosts-systests-firewall", ".xml"); + setSystemProperty("QPID_FIREWALL_VIRTUALHOSTS_SETTINGS", _tmpVirtualhosts.getAbsolutePath()); + _tmpVirtualhosts.deleteOnExit(); } private void writeFirewallFile(boolean allow, boolean inVhost) throws IOException { - FileWriter out = new FileWriter(tmpFile); + FileWriter out = new FileWriter(inVhost ? _tmpVirtualhosts : _tmpConfig); String ipAddr = "127.0.0.1"; // FIXME: get this from InetAddress.getLocalHost().getAddress() ? - out.write("<broker>"); if (inVhost) { out.write("<virtualhosts><virtualhost><test>"); } + else + { + out.write("<broker>"); + } out.write("<security><firewall>"); out.write("<rule access=\""+((allow) ? "allow" : "deny")+"\" network=\""+ipAddr +"\"/>"); out.write("</firewall></security>"); @@ -69,7 +79,10 @@ public class FirewallConfigTest extends QpidTestCase { out.write("</test></virtualhost></virtualhosts>"); } - out.write("</broker>"); + else + { + out.write("</broker>"); + } out.close(); } @@ -188,6 +201,23 @@ public class FirewallConfigTest extends QpidTestCase }); } + public void testAllowOnReloadInVhost() throws Exception + { + testFirewall(false, true, new Runnable() { + + public void run() + { + try + { + reloadBroker(); + } catch (Exception e) + { + fail(e.getMessage()); + } + } + }); + } + public void testDenyOnReload() throws Exception { testDeny(false, new Runnable() { @@ -224,18 +254,17 @@ public class FirewallConfigTest extends QpidTestCase ); } - + private void testDeny(boolean inVhost, Runnable restartOrReload) throws Exception { - if (_broker.equals(VM)) - { - // No point running this test in a vm broker - return; - } - - writeFirewallFile(false, inVhost); - super.setUp(); - + testFirewall(true, inVhost, restartOrReload); + } + + /* + * Check we can get a connection + */ + private boolean checkConnection() throws Exception + { Exception exception = null; Connection conn = null; try @@ -246,22 +275,27 @@ public class FirewallConfigTest extends QpidTestCase { exception = e; } - assertNotNull(exception); - // Check we can get a connection + return conn != null; + } + + private void testFirewall(boolean initial, boolean inVhost, Runnable restartOrReload) throws Exception + { + if (_broker.equals(VM)) + { + // No point running this test in a vm broker + return; + } + + writeFirewallFile(initial, inVhost); + super.setUp(); - writeFirewallFile(true, inVhost); + assertEquals("Initial connection check failed", initial, checkConnection()); + + // Reload changed firewall file after restart or reload + writeFirewallFile(!initial, inVhost); restartOrReload.run(); - exception = null; - try - { - conn = getConnection(); - } - catch (JMSException e) - { - exception = e; - } - assertNull(exception); - } + assertEquals("Second connection check failed", !initial, checkConnection()); + } } 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 d693c7f6c1..9ec0f61351 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 @@ -17,14 +17,41 @@ */ package org.apache.qpid.test.utils; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.LineNumberReader; +import java.io.PrintStream; +import java.net.MalformedURLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import javax.jms.Connection; +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageConsumer; +import javax.jms.MessageProducer; +import javax.jms.Queue; +import javax.jms.Session; +import javax.naming.InitialContext; +import javax.naming.NamingException; + import junit.framework.TestCase; import junit.framework.TestResult; + import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.XMLConfiguration; +import org.apache.commons.lang.StringUtils; import org.apache.log4j.Level; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import org.apache.qpid.AMQException; import org.apache.qpid.client.AMQConnection; import org.apache.qpid.client.AMQConnectionFactory; @@ -39,33 +66,8 @@ 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 javax.jms.Connection; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.MessageProducer; -import javax.jms.Queue; -import javax.jms.Session; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.LineNumberReader; -import java.io.PrintStream; -import java.net.MalformedURLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -86,6 +88,7 @@ public class QpidTestCase extends TestCase private Map<org.apache.log4j.Logger, Level> _loggerLevelSetForTest = new HashMap<org.apache.log4j.Logger, Level>(); private XMLConfiguration _testConfiguration = new XMLConfiguration(); + private XMLConfiguration _testVirtualhosts = new XMLConfiguration(); protected static final String INDEX = "index"; @@ -178,9 +181,10 @@ public class QpidTestCase extends TestCase 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); - protected static int DEFAULT_MANAGEMENT_PORT = Integer.getInteger("test.mport", 8999); + public static final int DEFAULT_VM_PORT = 1; + public static final int DEFAULT_PORT = Integer.getInteger("test.port", ServerConfiguration.DEFAULT_PORT); + public static final int DEFAULT_MANAGEMENT_PORT = Integer.getInteger("test.mport", ServerConfiguration.DEFAULT_JMXPORT); + public static final int DEFAULT_SSL_PORT = Integer.getInteger("test.sslport", ServerConfiguration.DEFAULT_SSL_PORT); protected String _brokerLanguage = System.getProperty(BROKER_LANGUAGE, JAVA); protected String _broker = System.getProperty(BROKER, VM); @@ -208,6 +212,7 @@ 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; @@ -477,14 +482,16 @@ public class QpidTestCase extends TestCase { port = getPort(port); - // Save any configuratio changes that have been made + // Save any configuration changes that have been made saveTestConfiguration(); + saveTestVirtualhosts(); Process process = null; if (_broker.equals(VM)) { setConfigurationProperty("management.jmxport", String.valueOf(getManagementPort(port))); saveTestConfiguration(); + // create an in_VM broker final ConfigurationFileApplicationRegistry registry = new ConfigurationFileApplicationRegistry(_configFile); try @@ -608,22 +615,41 @@ public class QpidTestCase extends TestCase public String getTestConfigFile() { String path = _output == null ? System.getProperty("java.io.tmpdir") : _output; - return path + "/" + getTestQueueName() + ".xml"; + return path + "/" + getTestQueueName() + "-config.xml"; + } + + public String getTestVirtualhostsFile() + { + String path = _output == null ? System.getProperty("java.io.tmpdir") : _output; + return path + "/" + getTestQueueName() + "-virtualhosts.xml"; } protected void saveTestConfiguration() throws ConfigurationException { + // Specifiy the test config file String testConfig = getTestConfigFile(); - //Specifiy the test configuration setSystemProperty("test.config", testConfig); - // This is a work + // Create the file if configuration does not exist if (_testConfiguration.isEmpty()) { - _testConfiguration.addProperty("test", getTestQueueName()); + _testConfiguration.addProperty("__ignore", "true"); } + _testConfiguration.save(testConfig); + } - _testConfiguration.save(getTestConfigFile()); + protected void saveTestVirtualhosts() throws ConfigurationException + { + // Specifiy the test virtualhosts file + String testVirtualhosts = getTestVirtualhostsFile(); + setSystemProperty("test.virtualhosts", testVirtualhosts); + + // Create the file if configuration does not exist + if (_testVirtualhosts.isEmpty()) + { + _testVirtualhosts.addProperty("__ignore", "true"); + } + _testVirtualhosts.save(testVirtualhosts); } public void cleanBroker() @@ -690,29 +716,23 @@ public class QpidTestCase extends TestCase protected void makeVirtualHostPersistent(String virtualhost) throws ConfigurationException, IOException { - Class storeClass = DerbyMessageStore.class; - - Class bdb = null; + Class<?> storeClass = null; try { - bdb = Class.forName("org.apache.qpid.server.store.berkeleydb.BDBMessageStore"); + // Try and lookup the BDB class + storeClass = Class.forName("org.apache.qpid.server.store.berkeleydb.BDBMessageStore"); } catch (ClassNotFoundException e) { // No BDB store, we'll use Derby instead. - } - - if (bdb != null) - { - storeClass = bdb; + storeClass = DerbyMessageStore.class; } - _testConfiguration.setProperty("virtualhosts.virtualhost." + virtualhost + - ".store.class", storeClass.getName()); - _testConfiguration.setProperty("virtualhosts.virtualhost." + virtualhost + - ".store." + DerbyMessageStore.ENVIRONMENT_PATH_PROPERTY, - "${QPID_WORK}/" + virtualhost); + setConfigurationProperty("virtualhosts.virtualhost." + virtualhost + ".store.class", + storeClass.getName()); + setConfigurationProperty("virtualhosts.virtualhost." + virtualhost + ".store." + DerbyMessageStore.ENVIRONMENT_PATH_PROPERTY, + "${QPID_WORK}/" + virtualhost); } /** @@ -730,6 +750,7 @@ public class QpidTestCase extends TestCase // Call save Configuration to be sure we have saved the test specific // file. As the optional status saveTestConfiguration(); + saveTestVirtualhosts(); ServerConfiguration configuration = new ServerConfiguration(_configFile); return configuration.getConfig().getString(property); @@ -753,9 +774,15 @@ public class QpidTestCase extends TestCase protected void setConfigurationProperty(String property, String value) throws ConfigurationException, IOException { - //Write the value in to this configuration file which will override the - // defaults. - _testConfiguration.setProperty(property, value); + // Choose which file to write the property to based on prefix. + if (property.startsWith("virtualhosts")) + { + _testVirtualhosts.setProperty(StringUtils.substringAfter(property, "virtualhosts."), value); + } + else + { + _testConfiguration.setProperty(property, value); + } } /** |
