diff options
author | Alex Rudyy <orudyy@apache.org> | 2013-01-24 17:55:19 +0000 |
---|---|---|
committer | Alex Rudyy <orudyy@apache.org> | 2013-01-24 17:55:19 +0000 |
commit | 9e9429481c1657746e09c0f6e8a8981a64a6bf92 (patch) | |
tree | f25724f5df7240961a6667ed0d229d5b2a717b01 | |
parent | fdd5fe40740adb4a9c829b635c15d4d9a0be4d0c (diff) | |
download | qpid-python-9e9429481c1657746e09c0f6e8a8981a64a6bf92.tar.gz |
QPID-4390: Change system tests to use broker configuration in json format
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/java-broker-config-qpid-4390@1438107 13f79535-47bb-0310-9956-ffa450edef68
94 files changed, 892 insertions, 1023 deletions
diff --git a/qpid/java/bdbstore/jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterManagementTest.java b/qpid/java/bdbstore/jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterManagementTest.java index bf1381bb02..ff47ed958d 100644 --- a/qpid/java/bdbstore/jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterManagementTest.java +++ b/qpid/java/bdbstore/jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterManagementTest.java @@ -67,7 +67,6 @@ public class HAClusterManagementTest extends QpidBrokerTestCase protected void setUp() throws Exception { _brokerType = BrokerType.SPAWNED; - _jmxUtils.setUp(); _clusterCreator.configureClusterNodes(); _brokerFailoverUrl = _clusterCreator.getConnectionUrlForAllClusterNodes(); diff --git a/qpid/java/bdbstore/jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterTwoNodeTest.java b/qpid/java/bdbstore/jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterTwoNodeTest.java index b8f5a11fbd..95626f7fa5 100644 --- a/qpid/java/bdbstore/jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterTwoNodeTest.java +++ b/qpid/java/bdbstore/jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterTwoNodeTest.java @@ -57,7 +57,6 @@ public class HAClusterTwoNodeTest extends QpidBrokerTestCase assertTrue(isJavaBroker()); assertTrue(isBrokerStorePersistent()); - _jmxUtils.setUp(); super.setUp(); } @@ -87,11 +86,11 @@ public class HAClusterTwoNodeTest extends QpidBrokerTestCase String storeConfigKeyPrefix = _clusterCreator.getStoreConfigKeyPrefix(); - setConfigurationProperty(storeConfigKeyPrefix + ".repConfig(0).name", ReplicationConfig.INSUFFICIENT_REPLICAS_TIMEOUT); - setConfigurationProperty(storeConfigKeyPrefix + ".repConfig(0).value", "2 s"); + setVirtualHostConfigurationProperty(storeConfigKeyPrefix + ".repConfig(0).name", ReplicationConfig.INSUFFICIENT_REPLICAS_TIMEOUT); + setVirtualHostConfigurationProperty(storeConfigKeyPrefix + ".repConfig(0).value", "2 s"); - setConfigurationProperty(storeConfigKeyPrefix + ".repConfig(1).name", ReplicationConfig.ELECTIONS_PRIMARY_RETRIES); - setConfigurationProperty(storeConfigKeyPrefix + ".repConfig(1).value", "0"); + setVirtualHostConfigurationProperty(storeConfigKeyPrefix + ".repConfig(1).name", ReplicationConfig.ELECTIONS_PRIMARY_RETRIES); + setVirtualHostConfigurationProperty(storeConfigKeyPrefix + ".repConfig(1).value", "0"); _clusterCreator.configureClusterNodes(); _clusterCreator.setDesignatedPrimaryOnFirstBroker(designedPrimary); diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStoreTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStoreTest.java index a75a01c37d..8e32a1d113 100644 --- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStoreTest.java +++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStoreTest.java @@ -20,14 +20,11 @@ */ package org.apache.qpid.server.store.berkeleydb; -import static org.mockito.Mockito.mock; - import java.io.File; import java.net.InetAddress; import org.apache.commons.configuration.XMLConfiguration; import org.apache.qpid.server.configuration.VirtualHostConfiguration; -import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.util.BrokerTestHelper; import org.apache.qpid.server.virtualhost.VirtualHost; import org.apache.qpid.test.utils.QpidTestCase; @@ -63,16 +60,25 @@ public class BDBHAMessageStoreTest extends QpidTestCase FileUtils.delete(new File(_workDir), true); _configXml = new XMLConfiguration(); + + BrokerTestHelper.setUp(); } public void tearDown() throws Exception { - FileUtils.delete(new File(_workDir), true); - if (_virtualHost != null) + try + { + FileUtils.delete(new File(_workDir), true); + if (_virtualHost != null) + { + _virtualHost.close(); + } + } + finally { - _virtualHost.close(); + BrokerTestHelper.tearDown(); + super.tearDown(); } - super.tearDown(); } public void testSetSystemConfiguration() throws Exception diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java index c7d3c4072c..e4837b212e 100644 --- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java +++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java @@ -91,10 +91,7 @@ public class BDBUpgradeTest extends QpidBrokerTestCase InputStream src = getClass().getClassLoader().getResourceAsStream("upgrade/bdbstore-v4/test-store/00000000.jdb"); FileUtils.copy(src, new File(_storeLocation, "00000000.jdb")); - //override the broker config used and then start the broker with the updated store - _configFile = new File("build/etc/config-systests-bdb.xml"); - setConfigurationProperty("management.enabled", "true"); - + getBrokerConfiguration().addJmxManagementConfiguration(); super.setUp(); } diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java index 014b93a1ba..4c2fa910f5 100644 --- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java +++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java @@ -43,6 +43,7 @@ import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.apache.qpid.client.AMQConnection; import org.apache.qpid.client.AMQConnectionURL; +import org.apache.qpid.test.utils.TestBrokerConfiguration; import org.apache.qpid.test.utils.QpidBrokerTestCase; import org.apache.qpid.url.URLSyntaxException; @@ -67,7 +68,7 @@ public class HATestClusterCreator private final Map<Integer, Integer> _brokerPortToBdbPortMap = new HashMap<Integer, Integer>(); private final Map<Integer, BrokerConfigHolder> _brokerConfigurations = new TreeMap<Integer, BrokerConfigHolder>(); private final String _virtualHostName; - private final String _storeConfigKeyPrefix; + private final String _vhostStoreConfigKeyPrefix; private final String _ipAddressOfBroker; private final String _groupName ; @@ -82,7 +83,7 @@ public class HATestClusterCreator _groupName = "group" + _testcase.getName(); _ipAddressOfBroker = getIpAddressOfBrokerHost(); _numberOfNodes = numberOfNodes; - _storeConfigKeyPrefix = "virtualhosts.virtualhost." + _virtualHostName + ".store."; + _vhostStoreConfigKeyPrefix = "virtualhosts.virtualhost." + _virtualHostName + ".store."; _bdbHelperPort = 0; } @@ -102,7 +103,9 @@ public class HATestClusterCreator } configureClusterNode(brokerPort, bdbPort); - collectConfig(brokerPort, _testcase.getTestConfiguration(), _testcase.getTestVirtualhosts()); + TestBrokerConfiguration brokerConfiguration = _testcase.getBrokerConfiguration(brokerPort); + brokerConfiguration.addJmxManagementConfiguration(); + collectConfig(brokerPort, brokerConfiguration, _testcase.getTestVirtualhosts()); brokerPort = _testcase.getNextAvailable(bdbPort + 1); } @@ -127,7 +130,7 @@ public class HATestClusterCreator */ private String getConfigKey(String configKeySuffix) { - final String configKey = StringUtils.substringAfter(_storeConfigKeyPrefix + configKeySuffix, "virtualhosts."); + final String configKey = StringUtils.substringAfter(_vhostStoreConfigKeyPrefix + configKeySuffix, "virtualhosts."); return configKey; } @@ -135,7 +138,6 @@ public class HATestClusterCreator { final BrokerConfigHolder brokerConfigHolder = _brokerConfigurations.get(brokerPortNumber); - _testcase.setTestConfiguration(brokerConfigHolder.getTestConfiguration()); _testcase.setTestVirtualhosts(brokerConfigHolder.getTestVirtualhosts()); _testcase.startBroker(brokerPortNumber); @@ -348,12 +350,12 @@ public class HATestClusterCreator { final String nodeName = getNodeNameForNodeAt(bdbPort); - _testcase.setConfigurationProperty(_storeConfigKeyPrefix + "class", "org.apache.qpid.server.store.berkeleydb.BDBHAMessageStore"); + _testcase.setVirtualHostConfigurationProperty(_vhostStoreConfigKeyPrefix + "class", "org.apache.qpid.server.store.berkeleydb.BDBHAMessageStore"); - _testcase.setConfigurationProperty(_storeConfigKeyPrefix + "highAvailability.groupName", _groupName); - _testcase.setConfigurationProperty(_storeConfigKeyPrefix + "highAvailability.nodeName", nodeName); - _testcase.setConfigurationProperty(_storeConfigKeyPrefix + "highAvailability.nodeHostPort", getNodeHostPortForNodeAt(bdbPort)); - _testcase.setConfigurationProperty(_storeConfigKeyPrefix + "highAvailability.helperHostPort", getHelperHostPort()); + _testcase.setVirtualHostConfigurationProperty(_vhostStoreConfigKeyPrefix + "highAvailability.groupName", _groupName); + _testcase.setVirtualHostConfigurationProperty(_vhostStoreConfigKeyPrefix + "highAvailability.nodeName", nodeName); + _testcase.setVirtualHostConfigurationProperty(_vhostStoreConfigKeyPrefix + "highAvailability.nodeHostPort", getNodeHostPortForNodeAt(bdbPort)); + _testcase.setVirtualHostConfigurationProperty(_vhostStoreConfigKeyPrefix + "highAvailability.helperHostPort", getHelperHostPort()); } public String getIpAddressOfBrokerHost() @@ -369,24 +371,24 @@ public class HATestClusterCreator } } - private void collectConfig(final int brokerPortNumber, XMLConfiguration testConfiguration, XMLConfiguration testVirtualhosts) + private void collectConfig(final int brokerPortNumber, TestBrokerConfiguration testConfiguration, XMLConfiguration testVirtualhosts) { - _brokerConfigurations.put(brokerPortNumber, new BrokerConfigHolder((XMLConfiguration) testConfiguration.clone(), + _brokerConfigurations.put(brokerPortNumber, new BrokerConfigHolder(testConfiguration, (XMLConfiguration) testVirtualhosts.clone())); } public class BrokerConfigHolder { - private final XMLConfiguration _testConfiguration; + private final TestBrokerConfiguration _testConfiguration; private final XMLConfiguration _testVirtualhosts; - public BrokerConfigHolder(XMLConfiguration testConfiguration, XMLConfiguration testVirtualhosts) + public BrokerConfigHolder(TestBrokerConfiguration testConfiguration, XMLConfiguration testVirtualhosts) { _testConfiguration = testConfiguration; _testVirtualhosts = testVirtualhosts; } - public XMLConfiguration getTestConfiguration() + public TestBrokerConfiguration getTestConfiguration() { return _testConfiguration; } @@ -416,7 +418,7 @@ public class HATestClusterCreator public String getStoreConfigKeyPrefix() { - return _storeConfigKeyPrefix; + return _vhostStoreConfigKeyPrefix; } diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java index 7df07cefd5..17434f1b67 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java +++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java @@ -125,7 +125,7 @@ public class HttpManagement extends AbstractPluginAdapter put(HTTPS_BASIC_AUTHENTICATION_ENABLED, Boolean.class); put(HTTP_SASL_AUTHENTICATION_ENABLED, Boolean.class); put(HTTPS_SASL_AUTHENTICATION_ENABLED, Boolean.class); - put(NAME, Boolean.class); + put(NAME, String.class); put(TIME_OUT, Integer.class); put(PluginFactory.PLUGIN_TYPE, String.class); }}); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BrokerConfigurationStoreCreator.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BrokerConfigurationStoreCreator.java index 9ffa2ac158..c96f0dd463 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BrokerConfigurationStoreCreator.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BrokerConfigurationStoreCreator.java @@ -21,7 +21,6 @@ package org.apache.qpid.server.configuration; import org.apache.qpid.server.BrokerOptions; -import org.apache.qpid.server.configuration.store.CommandLineOptionsHandler; import org.apache.qpid.server.configuration.store.XMLConfigurationEntryStore; import org.apache.qpid.server.plugin.QpidServiceLoader; @@ -60,7 +59,7 @@ public class BrokerConfigurationStoreCreator throw new IllegalConfigurationException("Cannot create store for the type " + storeType); } store.open(storeLocation); - return new CommandLineOptionsHandler(options, store); + return store; } } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStore.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStore.java index 8cdf949d78..969935376a 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStore.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStore.java @@ -47,18 +47,29 @@ public class JsonConfigurationEntryStore implements ConfigurationEntryStore private Map<UUID, ConfigurationEntry> _entries; private File _storeFile; private UUID _rootId; + private String _initialStoreLocation; + public JsonConfigurationEntryStore() { + this(BrokerConfigurationStoreCreator.INITIAL_STORE_LOCATION); + } + + public JsonConfigurationEntryStore(String initialStore) + { + _initialStoreLocation = initialStore; _objectMapper = new ObjectMapper(); _objectMapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); _objectMapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true); _entries = new HashMap<UUID, ConfigurationEntry>(); } - public JsonConfigurationEntryStore(URL storeURL) + public void load(URL storeURL) { - this(); + if (_rootId != null) + { + throw new IllegalStateException("Cannot load the store from"); + } JsonNode node = load(storeURL, _objectMapper); ConfigurationEntry brokerEntry = toEntry(node, true, _entries); _rootId = brokerEntry.getId(); @@ -73,11 +84,7 @@ public class JsonConfigurationEntryStore implements ConfigurationEntryStore copyInitialStore(); } - URL storeURL = fileToURL(_storeFile); - JsonNode node = load(storeURL, _objectMapper); - ConfigurationEntry brokerEntry = toEntry(node, true, _entries); - _rootId = brokerEntry.getId(); - + load(fileToURL(_storeFile)); } private void copyInitialStore() @@ -85,7 +92,7 @@ public class JsonConfigurationEntryStore implements ConfigurationEntryStore InputStream in = null; try { - in = JsonConfigurationEntryStore.class.getClassLoader().getResourceAsStream(BrokerConfigurationStoreCreator.INITIAL_STORE_LOCATION); + in = JsonConfigurationEntryStore.class.getClassLoader().getResourceAsStream(_initialStoreLocation); FileUtils.copy(in, _storeFile); } catch (IOException e) @@ -396,7 +403,14 @@ public class JsonConfigurationEntryStore implements ConfigurationEntryStore UUID id = null; if (idAsString == null) { - id = createUUID(type, name); + if (isRoot) + { + id = UUIDGenerator.generateRandomUUID(); + } + else + { + id = UUIDGenerator.generateBrokerChildUUID(type, name); + } } else { @@ -420,11 +434,6 @@ public class JsonConfigurationEntryStore implements ConfigurationEntryStore return entry; } - private UUID createUUID(String type, String name) - { - return UUIDGenerator.generateBrokerChildUUID(type, name); - } - private Object toObject(JsonNode node) { if (node.isValueNode()) diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderAdapter.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderAdapter.java index 3f02a0bcb1..f8b5b3016f 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderAdapter.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderAdapter.java @@ -63,11 +63,14 @@ public abstract class AuthenticationProviderAdapter<T extends AuthenticationMana private GroupPrincipalAccessor _groupAccessor; - private AuthenticationProviderAdapter(UUID id, Broker broker, final T authManager, Map<String, Object> defaults) + private Object _type; + + private AuthenticationProviderAdapter(UUID id, Broker broker, final T authManager, Map<String, Object> attributes) { - super(id, defaults); + super(id, null, attributes); _authManager = authManager; _broker = broker; + _type = authManager instanceof PrincipalDatabaseAuthenticationManager? PrincipalDatabaseAuthenticationManager.class.getSimpleName() : AuthenticationManager.class.getSimpleName() ; addParent(Broker.class, broker); } @@ -85,7 +88,7 @@ public abstract class AuthenticationProviderAdapter<T extends AuthenticationMana @Override public String getName() { - return _authManager.getClass().getSimpleName(); + return (String)getAttribute(AuthenticationProvider.NAME); } @Override @@ -155,7 +158,7 @@ public abstract class AuthenticationProviderAdapter<T extends AuthenticationMana { if(TYPE.equals(name)) { - return getName(); + return _type; } else if(CREATED.equals(name)) { @@ -173,10 +176,6 @@ public abstract class AuthenticationProviderAdapter<T extends AuthenticationMana { return LifetimePolicy.PERMANENT; } - else if(NAME.equals(name)) - { - return getName(); - } else if(STATE.equals(name)) { return State.ACTIVE; // TODO @@ -245,22 +244,22 @@ public abstract class AuthenticationProviderAdapter<T extends AuthenticationMana public static class SimpleAuthenticationProviderAdapter extends AuthenticationProviderAdapter<AuthenticationManager> { + public SimpleAuthenticationProviderAdapter( - UUID id, Broker broker, AuthenticationManager authManager, Map<String, Object> defaults) + UUID id, Broker broker, AuthenticationManager authManager, Map<String, Object> attributes) { - super(id, broker,authManager, defaults); + super(id, broker,authManager, attributes); } } - //TODO: add file path attribute into actual attributes public static class PrincipalDatabaseAuthenticationManagerAdapter extends AuthenticationProviderAdapter<PrincipalDatabaseAuthenticationManager> implements PasswordCredentialManagingAuthenticationProvider { public PrincipalDatabaseAuthenticationManagerAdapter( - UUID id, Broker broker, PrincipalDatabaseAuthenticationManager authManager, Map<String, Object> defaults) + UUID id, Broker broker, PrincipalDatabaseAuthenticationManager authManager, Map<String, Object> attributes) { - super(id, broker, authManager, defaults); + super(id, broker, authManager, attributes); } @Override diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderFactory.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderFactory.java index 4283428253..e5108ebbcf 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderFactory.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderFactory.java @@ -59,15 +59,11 @@ public class AuthenticationProviderFactory AuthenticationProviderAdapter<?> authenticationProvider; if (manager instanceof PrincipalDatabaseAuthenticationManager) { - // TODO : add defaults - Map<String, Object> defaults = null; authenticationProvider = new PrincipalDatabaseAuthenticationManagerAdapter(id, broker, - (PrincipalDatabaseAuthenticationManager) manager, defaults); + (PrincipalDatabaseAuthenticationManager) manager, attributes); } else { - // TODO : add defaults - Map<String, Object> defaults = null; authenticationProvider = new SimpleAuthenticationProviderAdapter(id, broker, manager, attributes); } authenticationProvider.setGroupAccessor(groupPrincipalAccessor); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java index a71a97ed1e..0a781c3e99 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java @@ -20,6 +20,7 @@ */ package org.apache.qpid.server.registry; +import java.util.Collection; import java.util.Timer; import java.util.TimerTask; @@ -136,7 +137,7 @@ public class ApplicationRegistry implements IApplicationRegistry if (report > 0L) { _reportingTimer = new Timer("Statistics-Reporting", true); - StatisticsReportingTask task = new StatisticsReportingTask(true, true, reset, _rootMessageLogger); + StatisticsReportingTask task = new StatisticsReportingTask(reset, _rootMessageLogger); _reportingTimer.scheduleAtFixedRate(task, report / 2, report); } } @@ -146,15 +147,11 @@ public class ApplicationRegistry implements IApplicationRegistry private final int DELIVERED = 0; private final int RECEIVED = 1; - private final boolean _broker; - private final boolean _virtualhost; private final boolean _reset; private final RootMessageLogger _logger; - public StatisticsReportingTask(boolean broker, boolean virtualhost, boolean reset, RootMessageLogger logger) + public StatisticsReportingTask(boolean reset, RootMessageLogger logger) { - _broker = broker; - _virtualhost = virtualhost; _reset = reset; _logger = logger; } @@ -168,38 +165,44 @@ public class ApplicationRegistry implements IApplicationRegistry return "[" + Thread.currentThread().getName() + "] "; } }); - - if (_broker) + try { CurrentActor.get().message(BrokerMessages.STATS_DATA(DELIVERED, _dataDelivered.getPeak() / 1024.0, _dataDelivered.getTotal())); CurrentActor.get().message(BrokerMessages.STATS_MSGS(DELIVERED, _messagesDelivered.getPeak(), _messagesDelivered.getTotal())); CurrentActor.get().message(BrokerMessages.STATS_DATA(RECEIVED, _dataReceived.getPeak() / 1024.0, _dataReceived.getTotal())); CurrentActor.get().message(BrokerMessages.STATS_MSGS(RECEIVED, _messagesReceived.getPeak(), _messagesReceived.getTotal())); - } + Collection<VirtualHost> hosts = _virtualHostRegistry.getVirtualHosts(); - if (_virtualhost) - { - for (VirtualHost vhost : _virtualHostRegistry.getVirtualHosts()) + if (hosts.size() > 1) { - String name = vhost.getName(); - StatisticsCounter dataDelivered = vhost.getDataDeliveryStatistics(); - StatisticsCounter messagesDelivered = vhost.getMessageDeliveryStatistics(); - StatisticsCounter dataReceived = vhost.getDataReceiptStatistics(); - StatisticsCounter messagesReceived = vhost.getMessageReceiptStatistics(); - - CurrentActor.get().message(VirtualHostMessages.STATS_DATA(name, DELIVERED, dataDelivered.getPeak() / 1024.0, dataDelivered.getTotal())); - CurrentActor.get().message(VirtualHostMessages.STATS_MSGS(name, DELIVERED, messagesDelivered.getPeak(), messagesDelivered.getTotal())); - CurrentActor.get().message(VirtualHostMessages.STATS_DATA(name, RECEIVED, dataReceived.getPeak() / 1024.0, dataReceived.getTotal())); - CurrentActor.get().message(VirtualHostMessages.STATS_MSGS(name, RECEIVED, messagesReceived.getPeak(), messagesReceived.getTotal())); + for (VirtualHost vhost : hosts) + { + String name = vhost.getName(); + StatisticsCounter dataDelivered = vhost.getDataDeliveryStatistics(); + StatisticsCounter messagesDelivered = vhost.getMessageDeliveryStatistics(); + StatisticsCounter dataReceived = vhost.getDataReceiptStatistics(); + StatisticsCounter messagesReceived = vhost.getMessageReceiptStatistics(); + + CurrentActor.get().message(VirtualHostMessages.STATS_DATA(name, DELIVERED, dataDelivered.getPeak() / 1024.0, dataDelivered.getTotal())); + CurrentActor.get().message(VirtualHostMessages.STATS_MSGS(name, DELIVERED, messagesDelivered.getPeak(), messagesDelivered.getTotal())); + CurrentActor.get().message(VirtualHostMessages.STATS_DATA(name, RECEIVED, dataReceived.getPeak() / 1024.0, dataReceived.getTotal())); + CurrentActor.get().message(VirtualHostMessages.STATS_MSGS(name, RECEIVED, messagesReceived.getPeak(), messagesReceived.getTotal())); + } } - } - if (_reset) + if (_reset) + { + resetStatistics(); + } + } + catch(Exception e) { - resetStatistics(); + ApplicationRegistry._logger.warn("Unexpected exception occured while reporting the statistics", e); + } + finally + { + CurrentActor.remove(); } - - CurrentActor.remove(); } } diff --git a/qpid/java/broker/src/main/resources/default.json b/qpid/java/broker/src/main/resources/default.json index 6951889590..de36492eda 100644 --- a/qpid/java/broker/src/main/resources/default.json +++ b/qpid/java/broker/src/main/resources/default.json @@ -20,7 +20,7 @@ */ { "type" : "Broker", - "name": "Broker", + "name": "QpidBroker", "defaultAuthenticationProvider" : "defaultAuthenticationProvider", "defaultVirtualHost" : "default", "authenticationproviders" : [ { diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java index ffed6ef6f2..f20f3e53f5 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java @@ -51,11 +51,15 @@ public class PortFactoryTest extends QpidTestCase private Map<String, Object> _attributes = new HashMap<String, Object>(); private Broker _broker = mock(Broker.class); - private PortFactory _portFactory = new PortFactory(); + private PortFactory _portFactory; @Override protected void setUp() throws Exception { + setTestSystemProperty(BrokerProperties.PROPERTY_BROKER_DEFAULT_AMQP_PROTOCOL_EXCLUDES, null); + setTestSystemProperty(BrokerProperties.PROPERTY_BROKER_DEFAULT_AMQP_PROTOCOL_INCLUDES, null); + _portFactory = new PortFactory(); + _attributes.put(Port.PORT, _portNumber); _attributes.put(Port.TRANSPORTS, _tcpStringSet); diff --git a/qpid/java/common/src/test/java/org/apache/qpid/test/utils/QpidTestCase.java b/qpid/java/common/src/test/java/org/apache/qpid/test/utils/QpidTestCase.java index ec06400b7d..eeff291f9e 100644 --- a/qpid/java/common/src/test/java/org/apache/qpid/test/utils/QpidTestCase.java +++ b/qpid/java/common/src/test/java/org/apache/qpid/test/utils/QpidTestCase.java @@ -115,12 +115,7 @@ public class QpidTestCase extends TestCase public QpidTestCase() { - this("QpidTestCase"); - } - - public QpidTestCase(String name) - { - super(name); + super(); } public void run(TestResult testResult) diff --git a/qpid/java/module.xml b/qpid/java/module.xml index 7daf38417c..57797d0da1 100644 --- a/qpid/java/module.xml +++ b/qpid/java/module.xml @@ -398,6 +398,7 @@ <propertyref prefix="profile"/> <propertyref prefix="javax.net.ssl"/> <propertyref prefix="broker"/> + <propertyref prefix="qpid"/> <propertyref name="amqj.logging.level"/> <propertyref name="amqj.server.logging.level"/> @@ -410,11 +411,8 @@ <propertyref name="java.naming.factory.initial"/> <propertyref name="java.naming.provider.url"/> <propertyref name="messagestore.class.name" /> - <propertyref name="qpid.amqp.version"/> <propertyref name="max_prefetch"/> - <propertyref name="qpid.dest_syntax"/> - <propertyref name="test.output"/> <propertyref name="QPID_HOME"/> <propertyref name="QPID_WORK"/> <propertyref name="example.plugin.target"/> diff --git a/qpid/java/systests/etc/config-systests-bdb-settings.xml b/qpid/java/systests/etc/config-systests-bdb-settings.xml deleted file mode 100644 index 4fa69d0abc..0000000000 --- a/qpid/java/systests/etc/config-systests-bdb-settings.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<broker> - <virtualhosts>${QPID_HOME}/etc/virtualhosts-systests-bdb.xml</virtualhosts> -</broker> - - diff --git a/qpid/java/systests/etc/config-systests-bdb.xml b/qpid/java/systests/etc/config-systests-bdb.xml deleted file mode 100644 index 6b17b564a8..0000000000 --- a/qpid/java/systests/etc/config-systests-bdb.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<configuration> - <system/> - <override> - <xml fileName="${QPID_HOME}/${test.config}" optional="true"/> - <xml fileName="${QPID_HOME}/etc/config-systests-bdb-settings.xml"/> - <xml fileName="${QPID_HOME}/etc/config-systests-settings.xml"/> - </override> -</configuration> diff --git a/qpid/java/systests/etc/config-systests-derby-mem-settings.xml b/qpid/java/systests/etc/config-systests-derby-mem-settings.xml deleted file mode 100644 index 69369d9ac9..0000000000 --- a/qpid/java/systests/etc/config-systests-derby-mem-settings.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<broker> - <virtualhosts>${QPID_HOME}/etc/virtualhosts-systests-derby-mem.xml</virtualhosts> -</broker> - - diff --git a/qpid/java/systests/etc/config-systests-derby-mem.xml b/qpid/java/systests/etc/config-systests-derby-mem.xml deleted file mode 100644 index 8e40df986e..0000000000 --- a/qpid/java/systests/etc/config-systests-derby-mem.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<configuration> - <system/> - <override> - <xml fileName="${QPID_HOME}/${test.config}" optional="true"/> - <xml fileName="${QPID_HOME}/etc/config-systests-derby-mem-settings.xml"/> - <xml fileName="${QPID_HOME}/etc/config-systests-settings.xml"/> - </override> -</configuration> diff --git a/qpid/java/systests/etc/config-systests-derby-settings.xml b/qpid/java/systests/etc/config-systests-derby-settings.xml deleted file mode 100644 index 3ed3a9e33b..0000000000 --- a/qpid/java/systests/etc/config-systests-derby-settings.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<broker> - <virtualhosts>${QPID_HOME}/etc/virtualhosts-systests-derby.xml</virtualhosts> -</broker> - - diff --git a/qpid/java/systests/etc/config-systests-derby.xml b/qpid/java/systests/etc/config-systests-derby.xml deleted file mode 100644 index 21a7a8cabe..0000000000 --- a/qpid/java/systests/etc/config-systests-derby.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<configuration> - <system/> - <override> - <xml fileName="${QPID_HOME}/${test.config}" optional="true"/> - <xml fileName="${QPID_HOME}/etc/config-systests-derby-settings.xml"/> - <xml fileName="${QPID_HOME}/etc/config-systests-settings.xml"/> - </override> -</configuration> diff --git a/qpid/java/systests/etc/config-systests-settings.xml b/qpid/java/systests/etc/config-systests-settings.xml deleted file mode 100644 index 621a69dc9c..0000000000 --- a/qpid/java/systests/etc/config-systests-settings.xml +++ /dev/null @@ -1,99 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<broker> - <prefix>${QPID_HOME}</prefix> - <work>${QPID_WORK}</work> - <conf>${prefix}/etc</conf> - - <connector> - <!-- To enable SSL edit the keystorePath and keystorePassword - and set enabled to true. - To disable Non-SSL port set sslOnly to true --> - <ssl> - <port>15671</port> - <enabled>false</enabled> - <sslOnly>false</sslOnly> - <keyStorePath>${QPID_HOME}/../test-profiles/test_resources/ssl/java_broker_keystore.jks</keyStorePath> - <keyStorePassword>password</keyStorePassword> - </ssl> - <port>5672</port> - <socketReceiveBuffer>262144</socketReceiveBuffer> - <socketSendBuffer>262144</socketSendBuffer> - </connector> - <management> - <enabled>false</enabled> - <jmxport> - <registryServer>8999</registryServer> - <!-- - If unspecified, connectorServer defaults to 100 + registryServer port. - <connectorServer>9099</connectionServer> - --> - </jmxport> - <ssl> - <enabled>false</enabled> - <keyStorePath>${QPID_HOME}/../test-profiles/test_resources/ssl/java_broker_keystore.jks</keyStorePath> - <keyStorePassword>password</keyStorePassword> - </ssl> - <http> - <enabled>false</enabled> - </http> - </management> - <advanced> - <framesize>65535</framesize> - <locale>en_US</locale> - </advanced> - - <security> - <pd-auth-manager> - <principal-database> - <class>org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase</class> - <attributes> - <attribute> - <name>passwordFile</name> - <value>${conf}/passwd</value> - </attribute> - </attributes> - </principal-database> - </pd-auth-manager> - - <file-group-manager> - <attributes> - <attribute> - <name>groupFile</name> - <value>${conf}/groups-systests</value> - </attribute> - </attributes> - </file-group-manager> - - <msg-auth>false</msg-auth> - </security> - - <virtualhosts>${QPID_HOME}/etc/virtualhosts-systests.xml</virtualhosts> - - <heartbeat> - <delay>0</delay> - <timeoutFactor>2.0</timeoutFactor> - </heartbeat> - <queue> - <auto_register>true</auto_register> - </queue> -</broker> diff --git a/qpid/java/systests/etc/config-systests.json b/qpid/java/systests/etc/config-systests.json new file mode 100644 index 0000000000..8bc0cfda39 --- /dev/null +++ b/qpid/java/systests/etc/config-systests.json @@ -0,0 +1,73 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +{ + "type" : "Broker", + "name": "QpidBroker", + "defaultAuthenticationProvider" : "plain", + "defaultVirtualHost" : "test", + "keyStorePath": "${QPID_HOME}/../test-profiles/test_resources/ssl/java_broker_keystore.jks", + "keyStorePassword": "password", + "trustStorePath": "${QPID_HOME}/../test-profiles/test_resources/ssl/java_client_truststore.jks", + "trustStorePassword": "password", + "authenticationproviders" : [ { + "type" : "AuthenticationProvider", + "name" : "plain", + "authenticationProviderType" : "PlainPasswordFileAuthenticationProvider", + "path" : "${QPID_HOME}/etc/passwd" + } ], + "ports" : [ { + "type" : "Port", + "name" : "amqp", + "port" : "${test.port}" + }, { + "type" : "Port", + "name" : "http", + "port" : "${test.hport}", + "protocols" : [ "HTTP" ] + }, { + "type" : "Port", + "name" : "rmi", + "port" : "${test.mport}", + "protocols" : [ "RMI" ] + }, { + "type" : "Port", + "name" : "jmx", + "port" : "${test.cport}", + "protocols" : [ "JMX_RMI" ] + }], + "virtualhosts" : [ { + "type" : "VirtualHost", + "name" : "test", + "configPath" : "${broker.virtualhosts-config}" + } ] + /* +, + "plugins" : [ { + "type" : "Plugin", + "pluginType" : "MANAGEMENT-HTTP", + "name" : "httpManagement" + }, { + "type" : "Plugin", + "pluginType" : "MANAGEMENT-JMX", + "name" : "jmxManagement" + } ] + */ +}
\ No newline at end of file diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/client/failover/MultipleBrokersFailoverTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/client/failover/MultipleBrokersFailoverTest.java index 0e55557806..a0fd093bfe 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/client/failover/MultipleBrokersFailoverTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/client/failover/MultipleBrokersFailoverTest.java @@ -20,7 +20,6 @@ */ package org.apache.qpid.client.failover; -import java.net.InetSocketAddress; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -33,16 +32,12 @@ import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.TextMessage; -import org.apache.commons.configuration.XMLConfiguration; import org.apache.log4j.Logger; -import org.apache.qpid.client.AMQBrokerDetails; import org.apache.qpid.client.AMQConnection; import org.apache.qpid.client.AMQConnectionURL; import org.apache.qpid.jms.ConnectionListener; -import org.apache.qpid.server.store.MessageStoreConstants; import org.apache.qpid.test.utils.QpidBrokerTestCase; import org.apache.qpid.test.utils.TestUtils; -import org.apache.qpid.transport.network.NetworkConnection; import org.apache.qpid.util.FileUtils; public class MultipleBrokersFailoverTest extends QpidBrokerTestCase implements ConnectionListener @@ -90,10 +85,7 @@ public class MultipleBrokersFailoverTest extends QpidBrokerTestCase implements C } _brokerPorts[i] = port; - XMLConfiguration testConfiguration = new XMLConfiguration(); - testConfiguration.addProperty("management.enabled", "false"); - - XMLConfiguration testVirtualhosts = new XMLConfiguration(); + createBrokerConfiguration(port); String host = null; if (i == 1 || i == _brokerPorts.length - 1) { @@ -103,13 +95,9 @@ public class MultipleBrokersFailoverTest extends QpidBrokerTestCase implements C { host = NON_FAILOVER_VIRTUAL_HOST; } - testVirtualhosts.addProperty("virtualhost.name", host); - testVirtualhosts.addProperty("virtualhost." + host + ".store.class", getTestProfileMessageStoreClassName()); - testVirtualhosts.addProperty( - "virtualhost." + host + ".store." + MessageStoreConstants.ENVIRONMENT_PATH_PROPERTY, "${QPID_WORK}/" - + host); + createTestVirtualHost(port, host); - startBroker(port, testConfiguration, testVirtualhosts); + startBroker(port); revertSystemProperties(); } @@ -121,6 +109,11 @@ public class MultipleBrokersFailoverTest extends QpidBrokerTestCase implements C _failoverStarted = new CountDownLatch(1); } + public void startBroker() throws Exception + { + // noop, prevent the broker startup in super.setUp() + } + private String generateUrlString(int numBrokers) { String baseString = "amqp://guest:guest@test/" + FAILOVER_VIRTUAL_HOST @@ -163,10 +156,6 @@ public class MultipleBrokersFailoverTest extends QpidBrokerTestCase implements C } } - public void startBroker() throws Exception - { - // noop, stop starting broker in super.tearDown() - } public void testFailoverOnBrokerKill() throws Exception { diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java index 4fafcb3504..884e89fb65 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java @@ -29,13 +29,19 @@ import org.apache.commons.configuration.ConfigurationException; import org.apache.qpid.client.AMQConnectionURL; import org.apache.qpid.client.AMQTestConnection_0_10; import org.apache.qpid.jms.ConnectionURL; +import org.apache.qpid.server.model.Port; +import org.apache.qpid.server.model.Transport; import org.apache.qpid.test.utils.QpidBrokerTestCase; +import org.apache.qpid.test.utils.TestBrokerConfiguration; import javax.jms.Connection; import javax.jms.JMSException; import javax.jms.Session; import java.io.ByteArrayOutputStream; import java.io.PrintStream; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; public class SSLTest extends QpidBrokerTestCase { @@ -353,17 +359,13 @@ public class SSLTest extends QpidBrokerTestCase { if(isJavaBroker()) { - setConfigurationProperty("connector.ssl.enabled", String.valueOf(sslEnabled)); - setConfigurationProperty("connector.ssl.sslOnly", String.valueOf(sslOnly)); - setConfigurationProperty("connector.ssl.needClientAuth", String.valueOf(needClientAuth)); - setConfigurationProperty("connector.ssl.wantClientAuth", String.valueOf(wantClientAuth)); - - if(needClientAuth || wantClientAuth) - { - //TODO: make a broker trust store? - setConfigurationProperty("connector.ssl.trustStorePath", TRUSTSTORE); - setConfigurationProperty("connector.ssl.trustStorePassword", TRUSTSTORE_PASSWORD); - } + Map<String, Object> sslPortAttributes = new HashMap<String, Object>(); + sslPortAttributes.put(Port.TRANSPORTS, Collections.singleton(Transport.SSL)); + sslPortAttributes.put(Port.PORT, DEFAULT_SSL_PORT); + sslPortAttributes.put(Port.NEED_CLIENT_AUTH, needClientAuth); + sslPortAttributes.put(Port.WANT_CLIENT_AUTH, wantClientAuth); + sslPortAttributes.put(Port.NAME, TestBrokerConfiguration.ENTRY_NAME_SSL_PORT); + getBrokerConfiguration().addPortConfiguration(sslPortAttributes); } } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/SupportedProtocolVersionsTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/SupportedProtocolVersionsTest.java index 039673f045..23a00431d1 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/SupportedProtocolVersionsTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/SupportedProtocolVersionsTest.java @@ -24,13 +24,16 @@ import org.apache.qpid.client.AMQConnection; import org.apache.qpid.configuration.ClientProperties; import org.apache.qpid.framing.ProtocolVersion; import org.apache.qpid.server.configuration.BrokerProperties; -import org.apache.qpid.server.configuration.ServerConfiguration; +import org.apache.qpid.server.model.Protocol; +import org.apache.qpid.server.model.adapter.PortFactoryTest; import org.apache.qpid.test.utils.QpidBrokerTestCase; /** * Tests to validate it is possible to disable support for particular protocol * versions entirely, rather than selectively excluding them on particular ports, * and it is possible to configure the reply to an unsupported protocol initiation. + *<p> + * Protocol exclusion/inclusion are unit tested as part of {@link PortFactoryTest} */ public class SupportedProtocolVersionsTest extends QpidBrokerTestCase { @@ -42,8 +45,8 @@ public class SupportedProtocolVersionsTest extends QpidBrokerTestCase private void clearProtocolSupportManipulations() { //Remove the QBTC provided protocol manipulations, giving only the protocols which default to enabled - setTestSystemProperty(QpidBrokerTestCase.BROKER_PROTOCOL_EXCLUDES, null); - setTestSystemProperty(QpidBrokerTestCase.BROKER_PROTOCOL_INCLUDES, null); + setSystemProperty(BrokerProperties.PROPERTY_BROKER_DEFAULT_AMQP_PROTOCOL_EXCLUDES, null); + setSystemProperty(BrokerProperties.PROPERTY_BROKER_DEFAULT_AMQP_PROTOCOL_INCLUDES, null); } /** @@ -88,8 +91,8 @@ public class SupportedProtocolVersionsTest extends QpidBrokerTestCase clearProtocolSupportManipulations(); //disable 0-10 and 1-0 support - setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP010ENABLED, "false"); - setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP10ENABLED, "false"); + setSystemProperty(BrokerProperties.PROPERTY_BROKER_DEFAULT_AMQP_PROTOCOL_EXCLUDES, + Protocol.AMQP_1_0 + "," + Protocol.AMQP_0_10); super.setUp(); @@ -101,52 +104,14 @@ public class SupportedProtocolVersionsTest extends QpidBrokerTestCase connection.close(); } - public void testDisabling091and010and10() throws Exception - { - clearProtocolSupportManipulations(); - - //disable 0-91 and 0-10 and 1-0 support - setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP10ENABLED, "false"); - setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP010ENABLED, "false"); - setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP091ENABLED, "false"); - - super.setUp(); - - //Verify initially requesting a 0-10 connection now negotiates a 0-9 - //connection as the broker should reply with its highest supported protocol - setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-10"); - AMQConnection connection = (AMQConnection) getConnection(); - assertEquals("Unexpected protocol version in use", ProtocolVersion.v0_9, connection.getProtocolVersion()); - connection.close(); - } - - public void testDisabling09and091and010and10() throws Exception - { - clearProtocolSupportManipulations(); - - //disable 0-9, 0-91, 0-10 and 1-0 support - setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP09ENABLED, "false"); - setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP091ENABLED, "false"); - setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP010ENABLED, "false"); - setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP10ENABLED, "false"); - - super.setUp(); - - //Verify initially requesting a 0-10 connection now negotiates a 0-8 - //connection as the broker should reply with its highest supported protocol - setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-10"); - AMQConnection connection = (AMQConnection) getConnection(); - assertEquals("Unexpected protocol version in use", ProtocolVersion.v8_0, connection.getProtocolVersion()); - connection.close(); - } - public void testConfiguringReplyingToUnsupported010ProtocolInitiationWith09insteadOf091() throws Exception { clearProtocolSupportManipulations(); //disable 0-10 support, and set the default unsupported protocol initiation reply to 0-9 - setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP010ENABLED, "false"); - setTestSystemProperty(BrokerProperties.PROPERTY_DEFAULT_SUPPORTED_PROTOCOL_REPLY, "v0_9"); + setSystemProperty(BrokerProperties.PROPERTY_BROKER_DEFAULT_AMQP_PROTOCOL_EXCLUDES, + Protocol.AMQP_1_0 + "," + Protocol.AMQP_0_10); + setSystemProperty(BrokerProperties.PROPERTY_DEFAULT_SUPPORTED_PROTOCOL_REPLY, "v0_9"); super.setUp(); @@ -165,71 +130,5 @@ public class SupportedProtocolVersionsTest extends QpidBrokerTestCase connection.close(); } - public void testProtocolInclusionThroughQBTCSystemPropertiesOverridesProtocolExclusion() throws Exception - { - testProtocolInclusionOverridesProtocolExclusion(false); - } - - public void testProtocolInclusionThroughConfigOverridesProtocolExclusion() throws Exception - { - testProtocolInclusionOverridesProtocolExclusion(true); - } - - private void testProtocolInclusionOverridesProtocolExclusion(boolean useConfig) throws Exception - { - clearProtocolSupportManipulations(); - - //selectively exclude 0-10 and 1-0 on the test port - setTestSystemProperty(QpidBrokerTestCase.BROKER_PROTOCOL_EXCLUDES,"--exclude-0-10 @PORT --exclude-1-0 @PORT"); - - super.setUp(); - - //Verify initially requesting a 0-10 connection negotiates a 0-9-1 connection - setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-10"); - AMQConnection connection = (AMQConnection) getConnection(); - assertEquals("Unexpected protocol version in use", ProtocolVersion.v0_91, connection.getProtocolVersion()); - connection.close(); - - stopBroker(); - - if(useConfig) - { - //selectively include 0-10 support again on the test port through config - setConfigurationProperty(ServerConfiguration.CONNECTOR_INCLUDE_010, String.valueOf(getPort())); - } - else - { - //selectively include 0-10 support again on the test port through QBTC sys props - setTestSystemProperty(QpidBrokerTestCase.BROKER_PROTOCOL_INCLUDES,"--include-0-10 @PORT"); - } - - startBroker(); - - //Verify requesting a 0-10 connection now returns one - setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-10"); - connection = (AMQConnection) getConnection(); - assertEquals("Unexpected protocol version in use", ProtocolVersion.v0_10, connection.getProtocolVersion()); - connection.close(); - } - - public void testProtocolInclusionOverridesProtocolDisabling() throws Exception - { - clearProtocolSupportManipulations(); - - //disable 0-10 and 1-0 - setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP010ENABLED, "false"); - setConfigurationProperty(ServerConfiguration.CONNECTOR_AMQP10ENABLED, "false"); - - //selectively include 0-10 support again on the test port - setConfigurationProperty(ServerConfiguration.CONNECTOR_INCLUDE_010, String.valueOf(getPort())); - - super.setUp(); - - //Verify initially requesting a 0-10 connection still works - setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-10"); - AMQConnection connection = (AMQConnection) getConnection(); - assertEquals("Unexpected protocol version in use", ProtocolVersion.v0_10, connection.getProtocolVersion()); - connection.close(); - } }
\ No newline at end of file diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java deleted file mode 100644 index f62211f76e..0000000000 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.configuration; - -import org.apache.commons.configuration.ConfigurationException; - -import org.apache.qpid.test.utils.QpidBrokerTestCase; - -/** - * This system test ensures that when loading our default system-test - * configuration file the configuration is correctly loaded. - * - * All configuration values should be set in the systest config file so that - * the ability to load them can be validated. - */ -public class ServerConfigurationFileTest extends QpidBrokerTestCase -{ - private ServerConfiguration _serverConfig; - - public void setUp() throws ConfigurationException - { - if (!_configFile.exists()) - { - fail("Unable to test without config file:" + _configFile); - } - - getTestConfiguration().setProperty("connector.port", "9999"); - saveTestConfiguration(); - saveTestVirtualhosts(); - - _serverConfig = new ServerConfiguration(_configFile); - } - - /** - * This helper method ensures that when we attempt to read a value that is - * set in the configuration file we do actualy read a value and not - * simply get a defaulted value from the ServerConfiguration.get*() methods. - * - * @param property the propert to test - */ - private void validatePropertyDefinedInFile(String property) - { - //Verify that we are not just picking up the the default value from the getBoolean - assertNotNull("The value set in the configuration file is not being read for property:" + property, - _serverConfig.getConfig().getProperty(property)); - } - - public void testChangedProperty() throws ConfigurationException - { - validatePropertyDefinedInFile("connector.port"); - assertEquals("Unexpected port", "9999", _serverConfig.getConfig().getProperty("connector.port")); - } - -} diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java index 7c676ad01d..68ec101245 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java @@ -42,8 +42,8 @@ public class AlertingTest extends AbstractTestLogging { _numMessages = 50; - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", String.valueOf(ALERT_LOG_WAIT_PERIOD)); - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".queues.maximumMessageCount", String.valueOf(_numMessages)); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", String.valueOf(ALERT_LOG_WAIT_PERIOD)); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".queues.maximumMessageCount", String.valueOf(_numMessages)); // Then we do the normal setup stuff like starting the broker, getting a connection etc. super.setUp(); @@ -141,7 +141,7 @@ public class AlertingTest extends AbstractTestLogging _monitor.markDiscardPoint(); // Change max message count to 5, start broker and make sure that that's triggered at the right time - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".queues.maximumMessageCount", "5"); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".queues.maximumMessageCount", "5"); startBroker(); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java index dee593b12b..208e613776 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java @@ -23,12 +23,18 @@ package org.apache.qpid.server.logging; import junit.framework.AssertionFailedError; import org.apache.qpid.server.BrokerOptions; +import org.apache.qpid.server.model.Port; +import org.apache.qpid.server.model.Transport; +import org.apache.qpid.test.utils.TestBrokerConfiguration; import org.apache.qpid.transport.ConnectionException; import org.apache.qpid.util.LogMonitor; import java.io.IOException; import java.net.Socket; +import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * Broker Test Suite @@ -118,8 +124,9 @@ public class BrokerLoggingTest extends AbstractTestLogging 1, results.size()); //3 - assertTrue("Config file details not correctly logged", - log.endsWith(configFilePath)); + assertTrue("Config file details not correctly logged, got " + + log + " but expected it to end with " + configFilePath, + log.endsWith(configFilePath)); } catch (AssertionFailedError afe) { @@ -293,8 +300,9 @@ public class BrokerLoggingTest extends AbstractTestLogging 1, findMatches(TESTID).size()); //3 - assertTrue("Log4j file details not correctly logged:" + getMessageString(log), - getMessageString(log).endsWith(customLog4j)); + assertTrue("Log4j file details not correctly logged, got " + + getMessageString(log) + " but expected it to end with " +customLog4j, + getMessageString(log).endsWith(customLog4j)); validation = true; } @@ -512,12 +520,11 @@ public class BrokerLoggingTest extends AbstractTestLogging String TESTID = "BRK-1002"; // Enable SSL on the connection - setConfigurationProperty("connector.ssl.enabled", "true"); - setConfigurationProperty("connector.ssl.sslOnly", "false"); - setConfigurationProperty("connector.ssl.keyStorePath", getConfigurationStringProperty("management.ssl.keyStorePath")); - setConfigurationProperty("connector.ssl.keyStorePassword", getConfigurationStringProperty("management.ssl.keyStorePassword")); - - Integer sslPort = Integer.parseInt(getConfigurationStringProperty("connector.ssl.port")); + Map<String, Object> sslPortAttributes = new HashMap<String, Object>(); + sslPortAttributes.put(Port.TRANSPORTS, Collections.singleton(Transport.SSL)); + sslPortAttributes.put(Port.PORT, DEFAULT_SSL_PORT); + sslPortAttributes.put(Port.NAME, TestBrokerConfiguration.ENTRY_NAME_SSL_PORT); + getBrokerConfiguration().addPortConfiguration(sslPortAttributes); startBroker(); @@ -575,11 +582,11 @@ public class BrokerLoggingTest extends AbstractTestLogging // Check the third, ssl listen. message = getMessageString(getLog(listenMessages .get(2))); assertTrue("Expected Listen log not correct" + message, - message.endsWith("Listening on TCP/SSL port " + sslPort)); + message.endsWith("Listening on TCP/SSL port " + DEFAULT_SSL_PORT)); //4 Test ports open testSocketOpen(getPort()); - testSocketOpen(sslPort); + testSocketOpen(DEFAULT_SSL_PORT); validation = true; } @@ -803,11 +810,11 @@ public class BrokerLoggingTest extends AbstractTestLogging String TESTID = "BRK-1003"; // Enable SSL on the connection - setConfigurationProperty("connector.ssl.enabled", "true"); - setConfigurationProperty("connector.ssl.keyStorePath", getConfigurationStringProperty("management.ssl.keyStorePath")); - setConfigurationProperty("connector.ssl.keyStorePassword", getConfigurationStringProperty("management.ssl.keyStorePassword")); - - Integer sslPort = Integer.parseInt(getConfigurationStringProperty("connector.ssl.port")); + Map<String, Object> sslPortAttributes = new HashMap<String, Object>(); + sslPortAttributes.put(Port.TRANSPORTS, Collections.singleton(Transport.SSL)); + sslPortAttributes.put(Port.PORT, DEFAULT_SSL_PORT); + sslPortAttributes.put(Port.NAME, TestBrokerConfiguration.ENTRY_NAME_SSL_PORT); + getBrokerConfiguration().addPortConfiguration(sslPortAttributes); startBroker(); @@ -848,13 +855,13 @@ public class BrokerLoggingTest extends AbstractTestLogging // Check second, ssl, listen. message = getMessageString(getLog(listenMessages.get(1))); assertTrue("Expected shutdown log not correct" + message, - message.endsWith("TCP/SSL port " + sslPort)); + message.endsWith("TCP/SSL port " + DEFAULT_SSL_PORT)); //4 //Test Port closed checkSocketClosed(getPort()); //Test SSL Port closed - checkSocketClosed(sslPort); + checkSocketClosed(DEFAULT_SSL_PORT); } catch (AssertionFailedError afe) { diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java index bcad59a1fa..82b421a531 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java @@ -39,7 +39,7 @@ import org.apache.qpid.test.utils.QpidBrokerTestCase; */ public class NoLocalAfterRecoveryTest extends QpidBrokerTestCase { - protected final String MY_TOPIC_SUBSCRIPTION_NAME = this.getName(); + protected final String MY_TOPIC_SUBSCRIPTION_NAME = getTestQueueName(); protected static final int SEND_COUNT = 10; public void testNoLocalNotQueued() throws Exception diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/MultipleTransactedBatchProducerTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/MultipleTransactedBatchProducerTest.java index 8536651ffb..cbf4e032db 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/MultipleTransactedBatchProducerTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/MultipleTransactedBatchProducerTest.java @@ -30,6 +30,7 @@ import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageListener; import javax.jms.Session; + import java.util.Random; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -54,7 +55,9 @@ public class MultipleTransactedBatchProducerTest extends QpidBrokerTestCase //debug level logging often makes this test pass artificially, turn the level down to info. setSystemProperty("amqj.server.logging.level", "INFO"); _receivedLatch = new CountDownLatch(MESSAGE_COUNT * NUM_PRODUCERS); - setConfigurationProperty("management.enabled", "true"); + + getBrokerConfiguration().addJmxManagementConfiguration(); + super.setUp(); _queueName = getTestQueueName(); _failMsg = null; diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java index 7b50749f5f..814936f342 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java @@ -26,6 +26,7 @@ import org.apache.qpid.client.AMQConnection; import org.apache.qpid.client.AMQConnectionURL; import org.apache.qpid.jms.ConnectionListener; import org.apache.qpid.protocol.AMQConstant; +import org.apache.qpid.server.model.Broker; import org.apache.qpid.test.utils.QpidBrokerTestCase; import org.apache.qpid.url.URLSyntaxException; @@ -58,25 +59,11 @@ public abstract class AbstractACLTestCase extends QpidBrokerTestCase implements { /** Used to synchronise {@link #tearDown()} when exceptions are thrown */ protected CountDownLatch _exceptionReceived; - - /** Override this to return the name of the configuration XML file. */ - public String getConfig() - { - return "config-systests.xml"; - } - /** - * This setup method checks {@link #getConfig()} and {@link #getHostList()} to initialise the broker with specific - * ACL configurations and then runs an optional per-test setup method, which is simply a method with the same name - * as the test, but starting with {@code setUp} rather than {@code test}. - * - * @see org.apache.qpid.test.utils.QpidBrokerTestCase#setUp() - */ @Override public void setUp() throws Exception { - // Initialise ACLs. - _configFile = new File("build" + File.separator + "etc" + File.separator + getConfig()); + getBrokerConfiguration().setBrokerAttribute(Broker.GROUP_FILE, System.getProperty(QPID_HOME) + "/etc/groups-systests"); // run test specific setup String testSetup = StringUtils.replace(getName(), "test", "setUp"); @@ -123,11 +110,11 @@ public abstract class AbstractACLTestCase extends QpidBrokerTestCase implements if (vhost == null) { - testcase.setConfigurationProperty("security.acl", aclFile.getAbsolutePath()); + testcase.getBrokerConfiguration().setBrokerAttribute(Broker.ACL_FILE, aclFile.getAbsolutePath()); } else { - testcase.setConfigurationProperty("virtualhosts.virtualhost." + vhost + ".security.acl", aclFile.getAbsolutePath()); + testcase.setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + vhost + ".security.acl", aclFile.getAbsolutePath()); } PrintWriter out = new PrintWriter(new FileWriter(aclFile)); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLJMXTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLJMXTest.java index 52229316be..1830040007 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLJMXTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLJMXTest.java @@ -43,8 +43,8 @@ public class ExternalACLJMXTest extends AbstractACLTestCase @Override public void setUp() throws Exception { - createTestVirtualHost(TEST_VHOST); - createTestVirtualHost(TEST2_VHOST); + createTestVirtualHost(0, TEST_VHOST); + createTestVirtualHost(0, TEST2_VHOST); _jmx = new JMXTestUtils(this); _jmx.setUp(); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationTest.java index 295aac9f97..c7a43a292b 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationTest.java @@ -20,21 +20,30 @@ */ package org.apache.qpid.server.security.auth.manager; +import static org.apache.qpid.test.utils.TestSSLConstants.KEYSTORE; +import static org.apache.qpid.test.utils.TestSSLConstants.KEYSTORE_PASSWORD; +import static org.apache.qpid.test.utils.TestSSLConstants.TRUSTSTORE; +import static org.apache.qpid.test.utils.TestSSLConstants.TRUSTSTORE_PASSWORD; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + import javax.jms.Connection; import javax.jms.JMSException; import org.apache.commons.configuration.ConfigurationException; import org.apache.qpid.client.AMQConnectionURL; +import org.apache.qpid.server.model.AuthenticationProvider; +import org.apache.qpid.server.model.Broker; +import org.apache.qpid.server.model.Port; +import org.apache.qpid.server.model.Transport; +import org.apache.qpid.server.plugin.AuthenticationManagerFactory; import org.apache.qpid.test.utils.QpidBrokerTestCase; +import org.apache.qpid.test.utils.TestBrokerConfiguration; public class ExternalAuthenticationTest extends QpidBrokerTestCase { - private static final String EXTERNAL_AUTH_MANAGER = ExternalAuthenticationManager.class.getSimpleName(); - private static final String KEYSTORE = "test-profiles/test_resources/ssl/java_client_keystore.jks"; - private static final String KEYSTORE_PASSWORD = "password"; - private static final String TRUSTSTORE = "test-profiles/test_resources/ssl/java_client_truststore.jks"; - private static final String TRUSTSTORE_PASSWORD = "password"; - @Override protected void setUp() throws Exception { @@ -48,9 +57,7 @@ public class ExternalAuthenticationTest extends QpidBrokerTestCase public void testExternalAuthenticationManagerOnSSLPort() throws Exception { setCommonBrokerSSLProperties(true); - setConfigurationProperty("security.port-mappings.port-mapping.port", String.valueOf(QpidBrokerTestCase.DEFAULT_SSL_PORT)); - setConfigurationProperty("security.port-mappings.port-mapping.auth-manager", EXTERNAL_AUTH_MANAGER); - setConfigurationProperty("security.default-auth-manager", PrincipalDatabaseAuthenticationManager.class.getSimpleName()); + getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_SSL_PORT, Port.AUTHENTICATION_MANAGER, TestBrokerConfiguration.ENTRY_NAME_EXTERNAL_PROVIDER); super.setUp(); setClientKeystoreProperties(); @@ -83,7 +90,7 @@ public class ExternalAuthenticationTest extends QpidBrokerTestCase public void testExternalAuthenticationManagerAsDefault() throws Exception { setCommonBrokerSSLProperties(true); - setConfigurationProperty("security.default-auth-manager", EXTERNAL_AUTH_MANAGER); + getBrokerConfiguration().setBrokerAttribute(Broker.DEFAULT_AUTHENTICATION_PROVIDER, TestBrokerConfiguration.ENTRY_NAME_EXTERNAL_PROVIDER); super.setUp(); setClientKeystoreProperties(); @@ -116,7 +123,7 @@ public class ExternalAuthenticationTest extends QpidBrokerTestCase public void testExternalAuthenticationManagerWithoutClientKeyStore() throws Exception { setCommonBrokerSSLProperties(false); - setConfigurationProperty("security.default-auth-manager", EXTERNAL_AUTH_MANAGER); + getBrokerConfiguration().setBrokerAttribute(Broker.DEFAULT_AUTHENTICATION_PROVIDER, TestBrokerConfiguration.ENTRY_NAME_EXTERNAL_PROVIDER); super.setUp(); setClientTrustoreProperties(); @@ -148,12 +155,18 @@ public class ExternalAuthenticationTest extends QpidBrokerTestCase private void setCommonBrokerSSLProperties(boolean needClientAuth) throws ConfigurationException { - setConfigurationProperty("connector.ssl.enabled", "true"); - setConfigurationProperty("connector.ssl.sslOnly", "false"); - setConfigurationProperty("connector.ssl.trustStorePath", TRUSTSTORE); - setConfigurationProperty("connector.ssl.trustStorePassword", TRUSTSTORE_PASSWORD); - setConfigurationProperty("connector.ssl.needClientAuth", String.valueOf(needClientAuth)); - setConfigurationProperty("security.external-auth-manager", ""); + TestBrokerConfiguration config = getBrokerConfiguration(); + Map<String, Object> sslPortAttributes = new HashMap<String, Object>(); + sslPortAttributes.put(Port.TRANSPORTS, Collections.singleton(Transport.SSL)); + sslPortAttributes.put(Port.PORT, DEFAULT_SSL_PORT); + sslPortAttributes.put(Port.NEED_CLIENT_AUTH, String.valueOf(needClientAuth)); + sslPortAttributes.put(Port.NAME, TestBrokerConfiguration.ENTRY_NAME_SSL_PORT); + config.addPortConfiguration(sslPortAttributes); + + Map<String, Object> externalAuthProviderAttributes = new HashMap<String, Object>(); + externalAuthProviderAttributes.put(AuthenticationManagerFactory.ATTRIBUTE_TYPE, ExternalAuthenticationManagerFactory.PROVIDER_TYPE); + externalAuthProviderAttributes.put(AuthenticationProvider.NAME, TestBrokerConfiguration.ENTRY_NAME_EXTERNAL_PROVIDER); + config.addAuthenticationProviderConfiguration(externalAuthProviderAttributes); } private void setClientKeystoreProperties() diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/MultipleAuthenticationManagersTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/MultipleAuthenticationManagersTest.java index 34b62e0b92..f41f1159ab 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/MultipleAuthenticationManagersTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/MultipleAuthenticationManagersTest.java @@ -25,23 +25,39 @@ import static org.apache.qpid.test.utils.TestSSLConstants.KEYSTORE_PASSWORD; import static org.apache.qpid.test.utils.TestSSLConstants.TRUSTSTORE; import static org.apache.qpid.test.utils.TestSSLConstants.TRUSTSTORE_PASSWORD; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + import javax.jms.Connection; import javax.jms.JMSException; import org.apache.qpid.AMQException; import org.apache.qpid.client.AMQConnection; +import org.apache.qpid.server.model.AuthenticationProvider; +import org.apache.qpid.server.model.Port; +import org.apache.qpid.server.model.Transport; +import org.apache.qpid.server.plugin.AuthenticationManagerFactory; import org.apache.qpid.test.utils.QpidBrokerTestCase; +import org.apache.qpid.test.utils.TestBrokerConfiguration; public class MultipleAuthenticationManagersTest extends QpidBrokerTestCase { @Override protected void setUp() throws Exception { - setConfigurationProperty("connector.ssl.enabled", "true"); - setConfigurationProperty("connector.ssl.sslOnly", "false"); - setConfigurationProperty("security.anonymous-auth-manager", ""); - setConfigurationProperty("security.default-auth-manager", "PrincipalDatabaseAuthenticationManager"); - setConfigurationProperty("security.port-mappings.port-mapping.port", String.valueOf(QpidBrokerTestCase.DEFAULT_SSL_PORT)); - setConfigurationProperty("security.port-mappings.port-mapping.auth-manager", "AnonymousAuthenticationManager"); + TestBrokerConfiguration config = getBrokerConfiguration(); + + Map<String, Object> externalAuthProviderAttributes = new HashMap<String, Object>(); + externalAuthProviderAttributes.put(AuthenticationManagerFactory.ATTRIBUTE_TYPE, AnonymousAuthenticationManagerFactory.PROVIDER_TYPE); + externalAuthProviderAttributes.put(AuthenticationProvider.NAME, TestBrokerConfiguration.ENTRY_NAME_ANONYMOUS_PROVIDER); + config.addAuthenticationProviderConfiguration(externalAuthProviderAttributes); + + Map<String, Object> sslPortAttributes = new HashMap<String, Object>(); + sslPortAttributes.put(Port.TRANSPORTS, Collections.singleton(Transport.SSL)); + sslPortAttributes.put(Port.PORT, DEFAULT_SSL_PORT); + sslPortAttributes.put(Port.NAME, TestBrokerConfiguration.ENTRY_NAME_SSL_PORT); + sslPortAttributes.put(Port.AUTHENTICATION_MANAGER, TestBrokerConfiguration.ENTRY_NAME_ANONYMOUS_PROVIDER); + config.addPortConfiguration(sslPortAttributes); // set the ssl system properties setSystemProperty("javax.net.ssl.keyStore", KEYSTORE); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java index 1e61ff9382..0feec67459 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java @@ -27,7 +27,9 @@ import org.apache.qpid.client.AMQQueue; import org.apache.qpid.client.AMQSession; import org.apache.qpid.exchange.ExchangeDefaults; import org.apache.qpid.framing.AMQShortString; +import org.apache.qpid.server.model.Broker; import org.apache.qpid.test.utils.QpidBrokerTestCase; +import org.apache.qpid.test.utils.TestBrokerConfiguration; import org.apache.qpid.util.LogMonitor; import java.util.List; @@ -60,16 +62,15 @@ public class StatisticsReportingTest extends QpidBrokerTestCase @Override public void setUp() throws Exception { - createTestVirtualHost(VHOST_NAME1); - createTestVirtualHost(VHOST_NAME2); - createTestVirtualHost(VHOST_NAME3); - - setConfigurationProperty("statistics.generation.broker", "true"); - setConfigurationProperty("statistics.generation.virtualhosts", "true"); + createTestVirtualHost(0, VHOST_NAME1); + createTestVirtualHost(0, VHOST_NAME2); + createTestVirtualHost(0, VHOST_NAME3); if (getName().equals("testEnabledStatisticsReporting")) { - setConfigurationProperty("statistics.reporting.period", "10"); + TestBrokerConfiguration config = getBrokerConfiguration(); + config.removeObjectConfiguration(TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST); + config.setBrokerAttribute(Broker.STATISTICS_REPORTING_PERIOD, 10); } _monitor = new LogMonitor(_outputFile); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java index 9fb1db3a4f..61ca6d9c28 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java @@ -60,9 +60,9 @@ public class StoreOverfullTest extends QpidBrokerTestCase public void setUp() throws Exception { - setConfigurationProperty("virtualhosts.virtualhost.test.store.class", QuotaMessageStore.class.getName()); - setConfigurationProperty("virtualhosts.virtualhost.test.store.overfull-size", String.valueOf(OVERFULL_SIZE)); - setConfigurationProperty("virtualhosts.virtualhost.test.store.underfull-size", String.valueOf(UNDERFULL_SIZE)); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost.test.store.class", QuotaMessageStore.class.getName()); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost.test.store.overfull-size", String.valueOf(OVERFULL_SIZE)); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost.test.store.underfull-size", String.valueOf(UNDERFULL_SIZE)); super.setUp(); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/ManagementLoggingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/ManagementLoggingTest.java index 5ac06981d5..4063442a9b 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/ManagementLoggingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/ManagementLoggingTest.java @@ -24,11 +24,14 @@ package org.apache.qpid.systest.management.jmx; import org.apache.qpid.server.configuration.BrokerProperties; import org.apache.qpid.server.configuration.ServerConfiguration; import org.apache.qpid.server.logging.AbstractTestLogging; +import org.apache.qpid.server.model.Port; +import org.apache.qpid.server.model.Transport; import org.apache.qpid.test.utils.JMXTestUtils; +import org.apache.qpid.test.utils.TestBrokerConfiguration; import org.apache.qpid.test.utils.TestSSLConstants; import org.apache.qpid.util.LogMonitor; -import java.io.File; +import java.util.Collections; import java.util.List; /** @@ -247,7 +250,7 @@ public class ManagementLoggingTest extends AbstractTestLogging // Validate the keystore path is as expected assertTrue("SSL Keystore entry expected.:" + getMessageString(log), - getMessageString(log).endsWith(new File(getConfigurationStringProperty("management.ssl.keyStorePath")).getName())); + getMessageString(log).endsWith(TestSSLConstants.BROKER_KEYSTORE)); } } @@ -304,13 +307,17 @@ public class ManagementLoggingTest extends AbstractTestLogging private void startBrokerAndCreateMonitor(boolean managementEnabled, boolean useManagementSSL) throws Exception { - //Ensure management is on - setConfigurationProperty("management.enabled", String.valueOf(managementEnabled)); + TestBrokerConfiguration config = getBrokerConfiguration(); + + if (managementEnabled) + { + config.addJmxManagementConfiguration(); + } if(useManagementSSL) { // This test requires we have an ssl connection - setConfigurationProperty("management.ssl.enabled", "true"); + config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_JMX_PORT, Port.TRANSPORTS, Collections.singleton(Transport.SSL)); setSystemProperty("javax.net.ssl.keyStore", "test-profiles/test_resources/ssl/java_broker_keystore.jks"); setSystemProperty("javax.net.ssl.keyStorePassword", "password"); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/StatisticsTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/StatisticsTest.java index 49207e2d7a..72fbd65acc 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/StatisticsTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/StatisticsTest.java @@ -53,8 +53,8 @@ public class StatisticsTest extends QpidBrokerTestCase @Override public void setUp() throws Exception { - createTestVirtualHost(TEST_VIRTUALHOST1); - createTestVirtualHost(TEST_VIRTUALHOST2); + createTestVirtualHost(0, TEST_VIRTUALHOST1); + createTestVirtualHost(0, TEST_VIRTUALHOST2); _jmxUtils = new JMXTestUtils(this, TEST_USER, TEST_PASSWORD); _jmxUtils.setUp(); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementTest.java index 62b1b554a9..7eff1c89ee 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementTest.java @@ -23,15 +23,23 @@ import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; import javax.jms.Connection; import javax.jms.JMSException; import org.apache.qpid.management.common.mbeans.UserManagement; -import org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase; -import org.apache.qpid.server.security.auth.database.PrincipalDatabase; +import org.apache.qpid.server.model.Port; +import org.apache.qpid.server.model.Protocol; +import org.apache.qpid.server.model.Transport; +import org.apache.qpid.server.plugin.AuthenticationManagerFactory; +import org.apache.qpid.server.security.auth.manager.AbstractPrincipalDatabaseAuthManagerFactory; +import org.apache.qpid.server.security.auth.manager.PlainPasswordFileAuthenticationManagerFactory; import org.apache.qpid.test.utils.JMXTestUtils; import org.apache.qpid.test.utils.QpidBrokerTestCase; +import org.apache.qpid.test.utils.TestBrokerConfiguration; import org.apache.qpid.tools.security.Passwd; /** @@ -53,9 +61,10 @@ public class UserManagementTest extends QpidBrokerTestCase _passwd = createPasswordEncodingUtility(); _passwordFile = createTemporaryPasswordFileWithJmxAdminUser(); - setConfigurationProperty("security.pd-auth-manager.principal-database.class", getPrincipalDatabaseImplClass().getName()); - setConfigurationProperty("security.pd-auth-manager.principal-database.attributes.attribute.name", "passwordFile"); - setConfigurationProperty("security.pd-auth-manager.principal-database.attributes.attribute.value", _passwordFile.getAbsolutePath()); + Map<String, Object> newAttributes = new HashMap<String, Object>(); + newAttributes.put(AuthenticationManagerFactory.ATTRIBUTE_TYPE, getAuthenticationManagerType()); + newAttributes.put(AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_PATH, _passwordFile.getAbsolutePath()); + getBrokerConfiguration().setObjectAttributes(TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER, newAttributes); _jmxUtils = new JMXTestUtils(this); _jmxUtils.setUp(); @@ -163,9 +172,9 @@ public class UserManagementTest extends QpidBrokerTestCase }; } - protected Class<? extends PrincipalDatabase> getPrincipalDatabaseImplClass() + protected String getAuthenticationManagerType() { - return PlainPasswordFilePrincipalDatabase.class; + return PlainPasswordFileAuthenticationManagerFactory.PROVIDER_TYPE; } private File createTemporaryPasswordFileWithJmxAdminUser() throws Exception diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementWithBase64MD5PasswordsTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementWithBase64MD5PasswordsTest.java index 84a66232ce..1423bc557e 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementWithBase64MD5PasswordsTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementWithBase64MD5PasswordsTest.java @@ -18,8 +18,7 @@ */ package org.apache.qpid.systest.management.jmx; -import org.apache.qpid.server.security.auth.database.Base64MD5PasswordFilePrincipalDatabase; -import org.apache.qpid.server.security.auth.database.PrincipalDatabase; +import org.apache.qpid.server.security.auth.manager.Base64MD5PasswordFileAuthenticationManagerFactory; import org.apache.qpid.tools.security.Passwd; public class UserManagementWithBase64MD5PasswordsTest extends UserManagementTest @@ -31,9 +30,8 @@ public class UserManagementWithBase64MD5PasswordsTest extends UserManagementTest } @Override - protected Class<? extends PrincipalDatabase> getPrincipalDatabaseImplClass() + protected String getAuthenticationManagerType() { - return Base64MD5PasswordFilePrincipalDatabase.class; + return Base64MD5PasswordFileAuthenticationManagerFactory.PROVIDER_TYPE; } - } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BasicAuthRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BasicAuthRestTest.java index 74b773c1fa..0574b6cc24 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BasicAuthRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BasicAuthRestTest.java @@ -25,10 +25,14 @@ import static org.apache.qpid.test.utils.TestSSLConstants.TRUSTSTORE_PASSWORD; import java.io.IOException; import java.net.HttpURLConnection; +import java.util.Collections; import javax.servlet.http.HttpServletResponse; import org.apache.commons.configuration.ConfigurationException; +import org.apache.qpid.server.model.Port; +import org.apache.qpid.server.model.Protocol; +import org.apache.qpid.test.utils.TestBrokerConfiguration; public class BasicAuthRestTest extends QpidRestTestCase { @@ -51,11 +55,11 @@ public class BasicAuthRestTest extends QpidRestTestCase private void configure(boolean useSsl) throws ConfigurationException, IOException { getRestTestHelper().setUseSsl(useSsl); - setConfigurationProperty("management.http.enabled", String.valueOf(!useSsl)); - setConfigurationProperty("management.http.port", Integer.toString(getRestTestHelper().getHttpPort())); - setConfigurationProperty("management.https.enabled", String.valueOf(useSsl)); - setConfigurationProperty("management.https.port", Integer.toString(getRestTestHelper().getHttpPort())); - setConfigurationProperty("management.enabled", "false"); //JMX + if (useSsl) + { + getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_PORT, Port.PROTOCOLS, Collections.singleton(Protocol.HTTPS)); + } + super.customizeConfiguration(); } private void verifyGetBrokerAttempt(int responseCode) throws IOException @@ -91,7 +95,8 @@ public class BasicAuthRestTest extends QpidRestTestCase public void testEnablingForHttp() throws Exception { configure(false); - setConfigurationProperty("management.http.basic-auth", "true"); + + getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpBasicAuthenticationEnabled", true); super.setUp(); // Try the attempt with authentication, it should succeed because @@ -103,7 +108,7 @@ public class BasicAuthRestTest extends QpidRestTestCase public void testDisablingForHttps() throws Exception { configure(true); - setConfigurationProperty("management.https.basic-auth", "false"); + getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpsBasicAuthenticationEnabled", false); super.setUp(); setSystemProperty("javax.net.ssl.trustStore", TRUSTSTORE); setSystemProperty("javax.net.ssl.trustStorePassword", TRUSTSTORE_PASSWORD); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BindingRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BindingRestTest.java index 7daac0eb46..372db8f560 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BindingRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BindingRestTest.java @@ -34,7 +34,8 @@ public class BindingRestTest extends QpidRestTestCase { List<Map<String, Object>> bindings = getRestTestHelper().getJsonAsList("/rest/binding"); assertNotNull("Bindings cannot be null", bindings); - assertTrue("Unexpected number of bindings", bindings.size() >= EXPECTED_VIRTUALHOSTS.length * EXPECTED_QUEUES.length); + assertTrue("Unexpected number of bindings: " + bindings.size(), + bindings.size() >= EXPECTED_VIRTUALHOSTS.length * EXPECTED_QUEUES.length); for (Map<String, Object> binding : bindings) { Asserts.assertBinding((String) binding.get(Binding.NAME), (String) binding.get(Binding.EXCHANGE), binding); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsTest.java index 7165ae4f18..13e0c1e819 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsTest.java @@ -24,10 +24,16 @@ import static org.apache.qpid.test.utils.TestSSLConstants.TRUSTSTORE; import static org.apache.qpid.test.utils.TestSSLConstants.TRUSTSTORE_PASSWORD; import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; import java.util.Map; import org.apache.commons.configuration.ConfigurationException; import org.apache.qpid.server.model.Broker; +import org.apache.qpid.server.model.Port; +import org.apache.qpid.server.model.Protocol; +import org.apache.qpid.server.model.Transport; +import org.apache.qpid.test.utils.TestBrokerConfiguration; public class BrokerRestHttpsTest extends QpidRestTestCase { @@ -43,11 +49,12 @@ public class BrokerRestHttpsTest extends QpidRestTestCase @Override protected void customizeConfiguration() throws ConfigurationException, IOException { + super.customizeConfiguration(); getRestTestHelper().setUseSsl(true); - setConfigurationProperty("management.enabled", "true"); - setConfigurationProperty("management.http.enabled", "false"); - setConfigurationProperty("management.https.enabled", "true"); - setConfigurationProperty("management.https.port", Integer.toString(getRestTestHelper().getHttpPort())); + Map<String, Object> newAttributes = new HashMap<String, Object>(); + newAttributes.put(Port.PROTOCOLS, Collections.singleton(Protocol.HTTPS)); + newAttributes.put(Port.TRANSPORTS, Collections.singleton(Transport.SSL)); + getBrokerConfiguration().setObjectAttributes(TestBrokerConfiguration.ENTRY_NAME_HTTP_PORT,newAttributes); } public void testGetWithHttps() throws Exception diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java index 796421b4f4..d479d39287 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java @@ -32,6 +32,7 @@ import org.apache.qpid.server.model.LifetimePolicy; import org.apache.qpid.server.model.Port; import org.apache.qpid.server.model.State; import org.apache.qpid.server.model.VirtualHost; +import org.apache.qpid.test.utils.TestBrokerConfiguration; public class BrokerRestTest extends QpidRestTestCase { @@ -61,15 +62,15 @@ public class BrokerRestTest extends QpidRestTestCase @SuppressWarnings("unchecked") List<Map<String, Object>> ports = (List<Map<String, Object>>) brokerDetails.get(BROKER_PORTS_ATTRIBUTE); - assertEquals("Unexpected number of ports", 2, ports.size()); + assertEquals("Unexpected number of ports", 4, ports.size()); for (Map<String, Object> port : ports) { Asserts.assertPortAttributes(port); } - Map<String, Object> amqpPort = getRestTestHelper().find(Port.NAME, getPort() +"-AMQP", ports); - Map<String, Object> httpPort = getRestTestHelper().find(Port.NAME, getRestTestHelper().getHttpPort() + "-HTTP", ports); + Map<String, Object> amqpPort = getRestTestHelper().find(Port.NAME, TestBrokerConfiguration.ENTRY_NAME_AMQP_PORT, ports); + Map<String, Object> httpPort = getRestTestHelper().find(Port.NAME, TestBrokerConfiguration.ENTRY_NAME_HTTP_PORT, ports); assertEquals("Unexpected binding address", "*", amqpPort.get(Port.BINDING_ADDRESS)); assertNotNull("Cannot find AMQP port", amqpPort); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java index 2852de6fb3..861bf8cb71 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java @@ -26,6 +26,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; +import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.model.Group; import org.apache.qpid.server.model.GroupProvider; import org.apache.qpid.server.model.LifetimePolicy; @@ -42,8 +43,7 @@ public class GroupProviderRestTest extends QpidRestTestCase { _groupFile = createTemporaryGroupFile(); - setConfigurationProperty("security.file-group-manager.attributes.attribute.name", "groupFile"); - setConfigurationProperty("security.file-group-manager.attributes.attribute.value", _groupFile.getAbsolutePath()); + getBrokerConfiguration().setBrokerAttribute(Broker.GROUP_FILE, _groupFile.getAbsolutePath()); super.setUp(); } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupRestTest.java index cbfd943f8f..d3f93cc0fe 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupRestTest.java @@ -26,6 +26,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; +import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.model.GroupMember; public class GroupRestTest extends QpidRestTestCase @@ -42,8 +43,7 @@ public class GroupRestTest extends QpidRestTestCase { _groupFile = createTemporaryGroupFile(); - setConfigurationProperty("security.file-group-manager.attributes.attribute.name", "groupFile"); - setConfigurationProperty("security.file-group-manager.attributes.attribute.value", _groupFile.getAbsolutePath()); + getBrokerConfiguration().setBrokerAttribute(Broker.GROUP_FILE, _groupFile.getAbsolutePath()); super.setUp(); } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PortRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PortRestTest.java index 4a12b475af..578565be05 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PortRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PortRestTest.java @@ -25,6 +25,7 @@ import java.util.List; import java.util.Map; import org.apache.qpid.server.model.Port; +import org.apache.qpid.test.utils.TestBrokerConfiguration; public class PortRestTest extends QpidRestTestCase { @@ -32,14 +33,14 @@ public class PortRestTest extends QpidRestTestCase { List<Map<String, Object>> ports = getRestTestHelper().getJsonAsList("/rest/port/"); assertNotNull("Port data cannot be null", ports); - assertEquals("Unexpected number of ports", 2, ports.size()); + assertEquals("Unexpected number of ports", 4, ports.size()); - String httpPortName = getRestTestHelper().getHttpPort() + "-HTTP"; + String httpPortName = TestBrokerConfiguration.ENTRY_NAME_HTTP_PORT; Map<String, Object> portData = getRestTestHelper().find(Port.NAME, httpPortName, ports); assertNotNull("Http port " + httpPortName + " is not found", portData); Asserts.assertPortAttributes(portData); - String amqpPortName = getPort() + "-AMQP"; + String amqpPortName = TestBrokerConfiguration.ENTRY_NAME_AMQP_PORT; Map<String, Object> amqpPortData = getRestTestHelper().find(Port.NAME, amqpPortName, ports); assertNotNull("Amqp port " + amqpPortName + " is not found", amqpPortData); Asserts.assertPortAttributes(amqpPortData); @@ -49,7 +50,7 @@ public class PortRestTest extends QpidRestTestCase { List<Map<String, Object>> ports = getRestTestHelper().getJsonAsList("/rest/port/"); assertNotNull("Ports data cannot be null", ports); - assertEquals("Unexpected number of ports", 2, ports.size()); + assertEquals("Unexpected number of ports", 4, ports.size()); for (Map<String, Object> portMap : ports) { String portName = (String) portMap.get(Port.NAME); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QpidRestTestCase.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QpidRestTestCase.java index d63d17f6e5..671bdd7eb8 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QpidRestTestCase.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QpidRestTestCase.java @@ -23,6 +23,8 @@ package org.apache.qpid.systest.rest; import java.io.IOException; import org.apache.commons.configuration.ConfigurationException; +import org.apache.qpid.server.model.Port; +import org.apache.qpid.test.utils.TestBrokerConfiguration; import org.apache.qpid.test.utils.QpidBrokerTestCase; public class QpidRestTestCase extends QpidBrokerTestCase @@ -43,11 +45,11 @@ public class QpidRestTestCase extends QpidBrokerTestCase // Set up virtualhost config with queues and bindings to the amq.direct for (String virtualhost : EXPECTED_VIRTUALHOSTS) { - createTestVirtualHost(virtualhost); + createTestVirtualHost(0, virtualhost); for (String queue : EXPECTED_QUEUES) { - setConfigurationProperty("virtualhosts.virtualhost." + virtualhost + ".queues.exchange", "amq.direct"); - setConfigurationProperty("virtualhosts.virtualhost." + virtualhost + ".queues.queue(-1).name", queue); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + virtualhost + ".queues.exchange", "amq.direct"); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + virtualhost + ".queues.queue(-1).name", queue); } } @@ -70,10 +72,9 @@ public class QpidRestTestCase extends QpidBrokerTestCase protected void customizeConfiguration() throws ConfigurationException, IOException { - setConfigurationProperty("management.enabled", "false"); - setConfigurationProperty("management.http.enabled", "true"); - setConfigurationProperty("management.https.enabled", "false"); - setConfigurationProperty("management.http.port", Integer.toString(_restTestHelper.getHttpPort())); + TestBrokerConfiguration config = getBrokerConfiguration(); + config.addHttpManagementConfiguration(); + config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_PORT, Port.PORT, _restTestHelper.getHttpPort()); } public RestTestHelper getRestTestHelper() diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/RestTestHelper.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/RestTestHelper.java index 4de603ae6e..0db1f7e50d 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/RestTestHelper.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/RestTestHelper.java @@ -51,8 +51,10 @@ import junit.framework.Assert; import org.apache.commons.codec.binary.Base64; import org.apache.commons.configuration.ConfigurationException; import org.apache.log4j.Logger; +import org.apache.qpid.server.security.auth.manager.AbstractPrincipalDatabaseAuthManagerFactory; import org.apache.qpid.ssl.SSLContextFactory; import org.apache.qpid.test.utils.QpidBrokerTestCase; +import org.apache.qpid.test.utils.TestBrokerConfiguration; import org.codehaus.jackson.JsonGenerationException; import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.map.JsonMappingException; @@ -292,6 +294,7 @@ public class RestTestHelper public void assertNumberOfGroupMembers(Map<String, Object> data, int expectedNumberOfGroupMembers) { + @SuppressWarnings("unchecked") List<Map<String, Object>> groups = (List<Map<String, Object>>) data.get("groupmembers"); if (groups == null) { @@ -327,7 +330,8 @@ public class RestTestHelper public void createOrUpdateUser(String username, String password, int responseCode) throws IOException { - HttpURLConnection connection = openManagementConnection("/rest/user/PrincipalDatabaseAuthenticationManager/" + username, "PUT"); + HttpURLConnection connection = openManagementConnection("/rest/user/" + + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + username, "PUT"); Map<String, Object> data = new HashMap<String, Object>(); data.put("password", password); @@ -355,14 +359,16 @@ public class RestTestHelper public void removeUserById(String id) throws IOException { - HttpURLConnection connection = openManagementConnection("/rest/user/PrincipalDatabaseAuthenticationManager?id=" + id, "DELETE"); + HttpURLConnection connection = openManagementConnection("/rest/user/" + + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "?id=" + id, "DELETE"); Assert.assertEquals("Unexpected response code", HttpServletResponse.SC_OK, connection.getResponseCode()); connection.disconnect(); } public void removeUser(String username, int responseCode) throws IOException { - HttpURLConnection connection = openManagementConnection("/rest/user/PrincipalDatabaseAuthenticationManager/" + username, "DELETE"); + HttpURLConnection connection = openManagementConnection("/rest/user/" + + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + username, "DELETE"); Assert.assertEquals("Unexpected response code", responseCode, connection.getResponseCode()); connection.disconnect(); } @@ -374,6 +380,7 @@ public class RestTestHelper public void assertNumberOfGroups(Map<String, Object> data, int expectedNumberOfGroups) { + @SuppressWarnings("unchecked") List<Map<String, Object>> groups = (List<Map<String, Object>>) data.get("groups"); if (groups == null) { @@ -400,8 +407,8 @@ public class RestTestHelper { _passwdFile = createTemporaryPasswdFile(users); - testCase.setConfigurationProperty("security.pd-auth-manager.principal-database.attributes.attribute.name", "passwordFile"); - testCase.setConfigurationProperty("security.pd-auth-manager.principal-database.attributes.attribute.value", _passwdFile.getAbsolutePath()); + testCase.getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER, + AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_PATH, _passwdFile.getAbsolutePath()); } public void tearDown() diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/SaslRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/SaslRestTest.java index a775af5dcf..856fda9419 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/SaslRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/SaslRestTest.java @@ -27,6 +27,7 @@ import java.io.OutputStream; import java.net.HttpURLConnection; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -35,6 +36,10 @@ import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Base64; import org.apache.commons.configuration.ConfigurationException; +import org.apache.qpid.server.plugin.AuthenticationManagerFactory; +import org.apache.qpid.server.security.auth.manager.AbstractPrincipalDatabaseAuthManagerFactory; +import org.apache.qpid.server.security.auth.manager.Base64MD5PasswordFileAuthenticationManagerFactory; +import org.apache.qpid.test.utils.TestBrokerConfiguration; import org.apache.qpid.tools.security.Passwd; import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.map.JsonMappingException; @@ -422,9 +427,9 @@ public class SaslRestTest extends QpidRestTestCase } // configure broker to use Base64MD5PasswordFilePrincipalDatabase - setConfigurationProperty("security.pd-auth-manager.principal-database.class", - "org.apache.qpid.server.security.auth.database.Base64MD5PasswordFilePrincipalDatabase"); - setConfigurationProperty("security.pd-auth-manager.principal-database.attributes.attribute.value", passwordFile.getAbsolutePath()); - setConfigurationProperty("management.http.sasl-auth", "true"); + Map<String, Object> newAttributes = new HashMap<String, Object>(); + newAttributes.put(AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_PATH, passwordFile.getAbsolutePath()); + newAttributes.put(AuthenticationManagerFactory.ATTRIBUTE_TYPE, Base64MD5PasswordFileAuthenticationManagerFactory.PROVIDER_TYPE); + getBrokerConfiguration().setObjectAttributes(TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER, newAttributes); } } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/StructureRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/StructureRestTest.java index a84708060a..427934fac2 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/StructureRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/StructureRestTest.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Map; import org.apache.qpid.server.model.Port; +import org.apache.qpid.test.utils.TestBrokerConfiguration; public class StructureRestTest extends QpidRestTestCase { @@ -40,7 +41,7 @@ public class StructureRestTest extends QpidRestTestCase @SuppressWarnings("unchecked") List<Map<String, Object>> ports = (List<Map<String, Object>>) structure.get("ports"); - assertEquals("Unexpected number of ports", 2, ports.size()); + assertEquals("Unexpected number of ports", 4, ports.size()); @SuppressWarnings("unchecked") List<Map<String, Object>> providers = (List<Map<String, Object>>) structure.get("authenticationproviders"); @@ -94,12 +95,12 @@ public class StructureRestTest extends QpidRestTestCase } - String httpPortName = getRestTestHelper().getHttpPort() + "-HTTP"; + String httpPortName = TestBrokerConfiguration.ENTRY_NAME_HTTP_PORT; Map<String, Object> portData = getRestTestHelper().find(Port.NAME, httpPortName, ports); assertNotNull("Http Port " + httpPortName + " is not found", portData); assertNode(portData, httpPortName); - String amqpPortName = getPort() + "-AMQP"; + String amqpPortName = TestBrokerConfiguration.ENTRY_NAME_AMQP_PORT; Map<String, Object> amqpPortData = getRestTestHelper().find(Port.NAME, amqpPortName, ports); assertNotNull("Amqp port " + amqpPortName + " is not found", amqpPortData); assertNode(amqpPortData, amqpPortName); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/UserRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/UserRestTest.java index 159cd8e52d..017467a8be 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/UserRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/UserRestTest.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Map; import org.apache.qpid.server.model.User; +import org.apache.qpid.test.utils.TestBrokerConfiguration; public class UserRestTest extends QpidRestTestCase { @@ -56,8 +57,8 @@ public class UserRestTest extends QpidRestTestCase assertNotNull("Attribute " + User.ID, user.get(User.ID)); String userName = (String) user.get(User.NAME); assertNotNull("Attribute " + User.NAME, userName); - Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList("/rest/user/PrincipalDatabaseAuthenticationManager/" - + userName); + Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList("/rest/user/" + + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + userName); assertUser(userDetails); assertEquals("Unexpected user name", userName, userDetails.get(User.NAME)); } @@ -68,8 +69,8 @@ public class UserRestTest extends QpidRestTestCase String userName = getTestName(); getRestTestHelper().createOrUpdateUser(userName, "newPassword"); - Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList("/rest/user/PrincipalDatabaseAuthenticationManager/" - + userName); + Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList("/rest/user/" + + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + userName); assertUser(userDetails); assertEquals("Unexpected user name", userName, userDetails.get(User.NAME)); } @@ -79,13 +80,14 @@ public class UserRestTest extends QpidRestTestCase String userName = getTestName(); getRestTestHelper().createOrUpdateUser(userName, "newPassword"); - Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList("/rest/user/PrincipalDatabaseAuthenticationManager/" - + userName); + Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList("/rest/user/" + + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + userName); String id = (String) userDetails.get(User.ID); getRestTestHelper().removeUserById(id); - List<Map<String, Object>> users = getRestTestHelper().getJsonAsList("/rest/user/PrincipalDatabaseAuthenticationManager/" + userName); + List<Map<String, Object>> users = getRestTestHelper().getJsonAsList("/rest/user/" + + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + userName); assertEquals("User should be deleted", 0, users.size()); } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java index 7b8ad9141c..40ea723b1e 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java @@ -28,8 +28,11 @@ import java.util.Properties; import javax.servlet.http.HttpServletResponse; +import org.apache.commons.configuration.ConfigurationException; +import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.security.acl.AbstractACLTestCase; import org.apache.qpid.systest.rest.QpidRestTestCase; +import org.apache.qpid.test.utils.TestBrokerConfiguration; public class GroupRestACLTest extends QpidRestTestCase { @@ -49,15 +52,19 @@ public class GroupRestACLTest extends QpidRestTestCase public void setUp() throws Exception { _groupFile = createTemporaryGroupFile(); - - setConfigurationProperty("management.http.basic-auth", "true"); - setConfigurationProperty("security.file-group-manager.attributes.attribute.name", "groupFile"); - setConfigurationProperty("security.file-group-manager.attributes.attribute.value", _groupFile.getAbsolutePath()); + getBrokerConfiguration().setBrokerAttribute(Broker.GROUP_FILE, _groupFile.getAbsolutePath()); //DONT call super.setUp(), the tests will start the broker after configuring it } @Override + protected void customizeConfiguration() throws ConfigurationException, IOException + { + super.customizeConfiguration(); + getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpBasicAuthenticationEnabled", true); + } + + @Override public void tearDown() throws Exception { super.tearDown(); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java index c02dc804db..12973113d8 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java @@ -28,8 +28,11 @@ import java.util.Properties; import javax.servlet.http.HttpServletResponse; +import org.apache.commons.configuration.ConfigurationException; +import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.security.acl.AbstractACLTestCase; import org.apache.qpid.systest.rest.QpidRestTestCase; +import org.apache.qpid.test.utils.TestBrokerConfiguration; import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.map.JsonMappingException; @@ -49,10 +52,7 @@ public class UserRestACLTest extends QpidRestTestCase public void setUp() throws Exception { _groupFile = createTemporaryGroupFile(); - - setConfigurationProperty("management.http.basic-auth", "true"); - setConfigurationProperty("security.file-group-manager.attributes.attribute.name", "groupFile"); - setConfigurationProperty("security.file-group-manager.attributes.attribute.value", _groupFile.getAbsolutePath()); + getBrokerConfiguration().setBrokerAttribute(Broker.GROUP_FILE, _groupFile.getAbsolutePath()); getRestTestHelper().configureTemporaryPasswordFile(this, ALLOWED_USER, DENIED_USER, OTHER_USER); @@ -60,6 +60,13 @@ public class UserRestACLTest extends QpidRestTestCase } @Override + protected void customizeConfiguration() throws ConfigurationException, IOException + { + super.customizeConfiguration(); + getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpBasicAuthenticationEnabled", true); + } + + @Override public void tearDown() throws Exception { super.tearDown(); @@ -163,7 +170,8 @@ public class UserRestACLTest extends QpidRestTestCase private void checkPassword(String username, String password, boolean passwordExpectedToBeCorrect) throws IOException { getRestTestHelper().setUsernameAndPassword(username, password); - HttpURLConnection connection = getRestTestHelper().openManagementConnection("/rest/user/PrincipalDatabaseAuthenticationManager/", "GET"); + HttpURLConnection connection = getRestTestHelper().openManagementConnection("/rest/user/" + + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/", "GET"); boolean passwordIsCorrect = connection.getResponseCode() == HttpServletResponse.SC_OK; @@ -174,14 +182,14 @@ public class UserRestACLTest extends QpidRestTestCase private void assertUserDoesNotExist(String newUser) throws JsonParseException, JsonMappingException, IOException { - String path = "/rest/user/PrincipalDatabaseAuthenticationManager/" + newUser; + String path = "/rest/user/" + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + newUser; List<Map<String, Object>> userDetailsList = getRestTestHelper().getJsonAsList(path); assertTrue(userDetailsList.isEmpty()); } private void assertUserExists(String username) throws IOException { - String path = "/rest/user/PrincipalDatabaseAuthenticationManager/" + username; + String path = "/rest/user/" + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + username; Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList(path); assertEquals( diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/JMSDestinationTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/JMSDestinationTest.java index 5b350d2d89..3cc15d5e9d 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/JMSDestinationTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/JMSDestinationTest.java @@ -63,8 +63,7 @@ public class JMSDestinationTest extends QpidBrokerTestCase public void setUp() throws Exception { - //Ensure JMX management is enabled for MovedToQueue test - setConfigurationProperty("management.enabled", "true"); + getBrokerConfiguration().addJmxManagementConfiguration(); super.setUp(); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java index ee81e7c372..9bf7dbd62a 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java @@ -54,11 +54,9 @@ public class SyncWaitDelayTest extends QpidBrokerTestCase public void setUp() throws Exception { - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST+".store.class", "org.apache.qpid.server.store.SlowMessageStore"); - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST+".store.delays.commitTran.post", String.valueOf(POST_COMMIT_DELAY)); - setConfigurationProperty("management.enabled", "false"); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST+".store.class", "org.apache.qpid.server.store.SlowMessageStore"); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST+".store.delays.commitTran.post", String.valueOf(POST_COMMIT_DELAY)); - super.setUp(); //Set the syncWrite timeout to be just larger than the delay on the commitTran. diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java index bc1eead8b4..da75bb6556 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java @@ -74,14 +74,13 @@ public class MaxDeliveryCountTest extends QpidBrokerTestCase public void setUp() throws Exception { //enable DLQ/maximumDeliveryCount support for all queues at the vhost level - setConfigurationProperty("virtualhosts.virtualhost.test.queues.maximumDeliveryCount", + setVirtualHostConfigurationProperty("virtualhosts.virtualhost.test.queues.maximumDeliveryCount", String.valueOf(MAX_DELIVERY_COUNT)); - setConfigurationProperty("virtualhosts.virtualhost.test.queues.deadLetterQueues", + setVirtualHostConfigurationProperty("virtualhosts.virtualhost.test.queues.deadLetterQueues", String.valueOf(true)); //Ensure management is on - setConfigurationProperty("management.enabled", "true"); - setConfigurationProperty("management.ssl.enabled", "false"); + getBrokerConfiguration().addJmxManagementConfiguration(); // Set client-side flag to allow the server to determine if messages // dead-lettered or requeued. diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java index a07e531b98..a9ac028af6 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java @@ -73,7 +73,7 @@ public class DurableSubscriptionTest extends QpidBrokerTestCase public void setUp() throws Exception { - setConfigurationProperty("management.enabled", "true"); + getBrokerConfiguration().addJmxManagementConfiguration(); _jmxConnected=false; super.setUp(); } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java index fd8beffbe6..d93c7a2e71 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java @@ -29,7 +29,7 @@ public class TransactionTimeoutDisabledTest extends TransactionTimeoutTestCase protected void configure() throws Exception { // Setup housekeeping every second - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", "100"); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", "100"); // No transaction timeout configuration. } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java index b11df5a2a0..89835955cb 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java @@ -40,28 +40,28 @@ public class TransactionTimeoutTest extends TransactionTimeoutTestCase protected void configure() throws Exception { // Setup housekeeping every second - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", "100"); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", "100"); if (getName().contains("ProducerIdle")) { - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openWarn", "0"); - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openClose", "0"); - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleWarn", "500"); - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleClose", "1500"); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openWarn", "0"); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openClose", "0"); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleWarn", "500"); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleClose", "1500"); } else if (getName().contains("ProducerOpen")) { - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openWarn", "1000"); - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openClose", "2000"); - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleWarn", "0"); - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleClose", "0"); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openWarn", "1000"); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openClose", "2000"); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleWarn", "0"); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleClose", "0"); } else { - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openWarn", "1000"); - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openClose", "2000"); - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleWarn", "500"); - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleClose", "1000"); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openWarn", "1000"); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openClose", "2000"); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleWarn", "500"); + setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleClose", "1000"); } } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/JMXTestUtils.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/JMXTestUtils.java index a321cd3887..6e6e3271f0 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/JMXTestUtils.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/JMXTestUtils.java @@ -31,6 +31,8 @@ import org.apache.qpid.management.common.mbeans.ManagedExchange; import org.apache.qpid.management.common.mbeans.ManagedQueue; import org.apache.qpid.management.common.mbeans.ServerInformation; import org.apache.qpid.management.common.mbeans.UserManagement; +import org.apache.qpid.server.model.Plugin; +import org.apache.qpid.server.plugin.PluginFactory; import javax.management.InstanceNotFoundException; import javax.management.JMException; @@ -45,7 +47,9 @@ import javax.management.ObjectName; import javax.management.remote.JMXConnector; import java.io.IOException; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Set; /** @@ -77,7 +81,7 @@ public class JMXTestUtils public void setUp() throws IOException, ConfigurationException, Exception { - _test.setConfigurationProperty("management.enabled", "true"); + _test.getBrokerConfiguration().addJmxManagementConfiguration(); } public void open() throws Exception diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java index 43707e0550..59364bbb04 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java @@ -59,10 +59,10 @@ import org.apache.qpid.jms.BrokerDetails; import org.apache.qpid.jms.ConnectionURL; import org.apache.qpid.server.BrokerLauncher; import org.apache.qpid.server.BrokerOptions; -import org.apache.qpid.server.ProtocolExclusion; -import org.apache.qpid.server.ProtocolInclusion; import org.apache.qpid.server.configuration.BrokerProperties; import org.apache.qpid.server.configuration.ServerConfiguration; +import org.apache.qpid.server.model.Port; +import org.apache.qpid.server.model.VirtualHost; import org.apache.qpid.server.protocol.AmqpProtocolVersion; import org.apache.qpid.server.store.MessageStoreConstants; import org.apache.qpid.server.store.derby.DerbyMessageStore; @@ -85,9 +85,9 @@ public class QpidBrokerTestCase extends QpidTestCase public static final String GUEST_PASSWORD = "guest"; protected final static String QpidHome = System.getProperty("QPID_HOME"); - protected File _configFile = new File(System.getProperty("broker.config")); + protected final File _configFile = new File(System.getProperty("broker.config")); protected File _logConfigFile = new File(System.getProperty("log4j.configuration")); - + protected final String _brokerStoreType = System.getProperty("broker.config-store-type", "json"); protected static final Logger _logger = Logger.getLogger(QpidBrokerTestCase.class); protected static final int LOGMONITOR_TIMEOUT = 5000; @@ -95,7 +95,7 @@ public class QpidBrokerTestCase extends QpidTestCase private Map<String, String> _propertiesSetForBroker = new HashMap<String, String>(); - private XMLConfiguration _testConfiguration = new XMLConfiguration(); + private Map<Integer, TestBrokerConfiguration> _brokerConfigurations; private XMLConfiguration _testVirtualhosts = new XMLConfiguration(); protected static final String INDEX = "index"; @@ -115,12 +115,10 @@ public class QpidBrokerTestCase extends QpidTestCase // system properties private static final String TEST_VIRTUALHOSTS = "test.virtualhosts"; - private static final String TEST_CONFIG = "test.config"; private static final String BROKER_LANGUAGE = "broker.language"; protected static final String BROKER_TYPE = "broker.type"; private static final String BROKER_COMMAND = "broker.command"; 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"; @@ -128,8 +126,6 @@ public class QpidBrokerTestCase extends QpidTestCase private static final String BROKER_LOG_INTERLEAVE = "broker.log.interleave"; private static final String BROKER_LOG_PREFIX = "broker.log.prefix"; private static final String BROKER_PERSITENT = "broker.persistent"; - public static final String BROKER_PROTOCOL_EXCLUDES = "broker.protocol.excludes"; - public static final String BROKER_PROTOCOL_INCLUDES = "broker.protocol.includes"; public static final String PROFILE_USE_SSL = "profile.use_ssl"; // values @@ -138,7 +134,6 @@ public class QpidBrokerTestCase extends QpidTestCase protected static final String QPID_HOME = "QPID_HOME"; - 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 FAILING_PORT = Integer.parseInt(System.getProperty("test.port.alt")); public static final int DEFAULT_MANAGEMENT_PORT = Integer.getInteger("test.mport", ServerConfiguration.DEFAULT_JMXPORT_REGISTRYSERVER); @@ -188,14 +183,49 @@ public class QpidBrokerTestCase extends QpidTestCase } private MessageType _messageType = MessageType.TEXT; - public QpidBrokerTestCase(String name) - { - super(name); - } - + public QpidBrokerTestCase() { super(); + + _brokerConfigurations = new HashMap<Integer, TestBrokerConfiguration>(); + } + + public TestBrokerConfiguration getBrokerConfiguration(int port) + { + int actualPort = getPort(port); + + synchronized (_brokerConfigurations) + { + TestBrokerConfiguration configuration = _brokerConfigurations.get(actualPort); + if (configuration == null) + { + configuration = createBrokerConfiguration(actualPort); + } + return configuration; + } + } + + public TestBrokerConfiguration getBrokerConfiguration() + { + return getBrokerConfiguration(DEFAULT_PORT); + } + + public TestBrokerConfiguration createBrokerConfiguration(int port) + { + int actualPort = getPort(port); + TestBrokerConfiguration configuration = new TestBrokerConfiguration(System.getProperty(_brokerStoreType), _configFile.getAbsolutePath()); + synchronized (_brokerConfigurations) + { + _brokerConfigurations.put(actualPort, configuration); + } + if (actualPort != DEFAULT_PORT) + { + configuration.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_AMQP_PORT, Port.PORT, actualPort); + configuration.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_RMI_PORT, Port.PORT, getManagementPort(actualPort)); + configuration.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_JMX_PORT, Port.PORT, getManagementPort(actualPort) + ServerConfiguration.JMXPORT_CONNECTORSERVER_OFFSET); + } + return configuration; } public Logger getLogger() @@ -287,16 +317,6 @@ public class QpidBrokerTestCase extends QpidTestCase fail("Unable to test without config file:" + _configFile); } - String existingQpidWorkPath = System.getProperty(BROKER_EXISTING_QPID_WORK); - if(existingQpidWorkPath != null && !existingQpidWorkPath.equals("")) - { - - String qpidWork = getQpidWork(_brokerType, getPort()); - File existing = new File(existingQpidWorkPath); - cleanBrokerWork(qpidWork); - FileUtils.copyRecursive(existing, new File(qpidWork)); - } - startBroker(); } @@ -352,20 +372,14 @@ public class QpidBrokerTestCase extends QpidTestCase } } - protected String getBrokerCommand(int port) throws MalformedURLException + protected String getBrokerCommand(int port, String configPath) throws MalformedURLException { - final int sslPort = port-1; - final String protocolExcludesList = getProtocolExcludesList(port, sslPort); - final String protocolIncludesList = getProtocolIncludesList(port, sslPort); - return _brokerCommand - .replace("@PORT", "" + port) - .replace("@SSL_PORT", "" + sslPort) - .replace("@MPORT", "" + getManagementPort(port)) - .replace("@CONFIG_FILE", _configFile.toString()) + .replace("@STORE_PATH", configPath) + .replace("@STORE_TYPE", "json") .replace("@LOG_CONFIG_FILE", _logConfigFile.toString()) - .replace("@EXCLUDES", protocolExcludesList) - .replace("@INCLUDES", protocolIncludesList); + // for cpp profile only + .replace("@PORT", "" + port); } public void startBroker() throws Exception @@ -375,16 +389,18 @@ public class QpidBrokerTestCase extends QpidTestCase public void startBroker(int port) throws Exception { - startBroker(port, _testConfiguration, _testVirtualhosts); + int actualPort = getPort(port); + TestBrokerConfiguration configuration = getBrokerConfiguration(actualPort); + startBroker(actualPort, configuration, _testVirtualhosts); } - public void startBroker(int port, XMLConfiguration testConfiguration, XMLConfiguration virtualHosts) throws Exception + public void startBroker(int port, TestBrokerConfiguration testConfiguration, XMLConfiguration virtualHosts) throws Exception { port = getPort(port); - - // Save any configuration changes that have been made String testConfig = saveTestConfiguration(port, testConfiguration); String virtualHostsConfig = saveTestVirtualhosts(port, virtualHosts); + _logger.info("Set test.virtualhosts property to: " + virtualHostsConfig); + setSystemProperty(TEST_VIRTUALHOSTS, virtualHostsConfig); if(_brokers.get(port) != null) { @@ -396,19 +412,13 @@ public class QpidBrokerTestCase extends QpidTestCase if (_brokerType.equals(BrokerType.INTERNAL) && !existingInternalBroker()) { setSystemProperty(BrokerProperties.PROPERTY_USE_CUSTOM_RMI_SOCKET_FACTORY, "false"); - testConfig = saveTestConfiguration(port, testConfiguration); - _logger.info("Set test.config property to: " + testConfig); - _logger.info("Set test.virtualhosts property to: " + virtualHostsConfig); - setSystemProperty(TEST_CONFIG, testConfig); - setSystemProperty(TEST_VIRTUALHOSTS, virtualHostsConfig); BrokerOptions options = new BrokerOptions(); - options.setConfigFile(_configFile.getAbsolutePath()); - options.addPort(port); - addExcludedPorts(port, DEFAULT_SSL_PORT, options); - addIncludedPorts(port, DEFAULT_SSL_PORT, options); + options.setConfigurationStoreType(_brokerStoreType); + options.setConfigurationStoreLocation(testConfig); + options.addPort(port); options.setJmxPortRegistryServer(getManagementPort(port)); //Set the log config file, relying on the log4j.configuration system property @@ -425,7 +435,7 @@ public class QpidBrokerTestCase extends QpidTestCase { // Add the port to QPID_WORK to ensure unique working dirs for multi broker tests final String qpidWork = getQpidWork(_brokerType, port); - String cmd = getBrokerCommand(port); + String cmd = getBrokerCommand(port, testConfig); _logger.info("starting external broker: " + cmd); ProcessBuilder pb = new ProcessBuilder(cmd.split("\\s+")); pb.redirectErrorStream(true); @@ -461,17 +471,13 @@ public class QpidBrokerTestCase extends QpidTestCase // Add default test logging levels that are used by the log4j-test // Use the convenience methods to push the current logging setting // in to the external broker's QPID_OPTS string. - if (System.getProperty("amqj.protocol.logging.level") != null) - { - setSystemProperty("amqj.protocol.logging.level"); - } - if (System.getProperty("root.logging.level") != null) - { - setSystemProperty("root.logging.level"); - } + setSystemProperty("amqj.protocol.logging.level"); + setSystemProperty("root.logging.level"); + setSystemProperty(BrokerProperties.PROPERTY_BROKER_DEFAULT_AMQP_PROTOCOL_EXCLUDES); + setSystemProperty(BrokerProperties.PROPERTY_BROKER_DEFAULT_AMQP_PROTOCOL_INCLUDES); // set test.config and test.virtualhosts - String qpidOpts = " -D" + TEST_CONFIG + "=" + testConfig + " -D" + TEST_VIRTUALHOSTS + "=" + virtualHostsConfig; + String qpidOpts = " -D" + TEST_VIRTUALHOSTS + "=" + virtualHostsConfig; // Add all the specified system properties to QPID_OPTS if (!_propertiesSetForBroker.isEmpty()) @@ -487,9 +493,6 @@ public class QpidBrokerTestCase extends QpidTestCase } processEnv.put("QPID_OPTS", qpidOpts); - _logger.info("Set test.config property to: " + testConfig); - _logger.info("Set test.virtualhosts property to: " + virtualHostsConfig); - // cpp broker requires that the work directory is created createBrokerWork(qpidWork); @@ -530,64 +533,6 @@ public class QpidBrokerTestCase extends QpidTestCase } } - private void addExcludedPorts(int port, int sslPort, BrokerOptions options) - { - final String protocolExcludesList = getProtocolExcludesList(port, sslPort); - - if (protocolExcludesList.equals("")) - { - return; - } - final String[] toks = protocolExcludesList.split("\\s"); - - if(toks.length % 2 != 0) - { - throw new IllegalArgumentException("Must be an even number of tokens in '" + protocolExcludesList + "'"); - } - for (int i = 0; i < toks.length; i=i+2) - { - String excludeArg = toks[i]; - final int excludedPort = Integer.parseInt(toks[i+1]); - options.addExcludedPort(ProtocolExclusion.lookup(excludeArg), excludedPort); - - _logger.info("Adding protocol exclusion " + excludeArg + " " + excludedPort); - } - } - - protected String getProtocolExcludesList(int port, int sslPort) - { - return System.getProperty(BROKER_PROTOCOL_EXCLUDES,"").replace("@PORT", "" + port).replace("@SSL_PORT", "" + sslPort); - } - - private String getProtocolIncludesList(int port, int sslPort) - { - return System.getProperty(BROKER_PROTOCOL_INCLUDES, "").replace("@PORT", "" + port).replace("@SSL_PORT", "" + sslPort); - } - - private void addIncludedPorts(int port, int sslPort, BrokerOptions options) - { - final String protocolIncludesList = getProtocolIncludesList(port, sslPort); - - if (protocolIncludesList.equals("")) - { - return; - } - final String[] toks = protocolIncludesList.split("\\s"); - - if(toks.length % 2 != 0) - { - throw new IllegalArgumentException("Must be an even number of tokens in '" + protocolIncludesList + "'"); - } - for (int i = 0; i < toks.length; i=i+2) - { - String includeArg = toks[i]; - final int includedPort = Integer.parseInt(toks[i+1]); - options.addIncludedPort(ProtocolInclusion.lookup(includeArg), includedPort); - - _logger.info("Adding protocol inclusion " + includeArg + " " + includedPort); - } - } - private boolean existingInternalBroker() { for(BrokerHolder holder : _brokers.values()) @@ -618,7 +563,7 @@ public class QpidBrokerTestCase extends QpidTestCase public String getTestConfigFile(int port) { - return _output + "/" + getTestQueueName() + "-" + port + "-config.xml"; + return _output + "/" + getTestQueueName() + "-" + port + "-config"; } public String getTestVirtualhostsFile(int port) @@ -631,45 +576,30 @@ public class QpidBrokerTestCase extends QpidTestCase return file.replace(System.getProperty(QPID_HOME,"QPID_HOME") + "/",""); } - protected void saveTestConfiguration() throws ConfigurationException + private String relativeToWorkingDirectory(String file) { - String relative = saveTestConfiguration(getPort(), _testConfiguration); - _logger.info("Set test.config property to: " + relative); - setSystemProperty(TEST_CONFIG, relative); + File configLocation = new File(file); + File workingDirectory = new File(System.getProperty("user.dir")); + return configLocation.getAbsolutePath().replace(workingDirectory.getAbsolutePath(), "").substring(1); } - protected String saveTestConfiguration(int port, XMLConfiguration testConfiguration) throws ConfigurationException + protected String saveTestConfiguration(int port, TestBrokerConfiguration testConfiguration) throws ConfigurationException { // Specify the test config file String testConfig = getTestConfigFile(port); - String relative = relativeToQpidHome(testConfig); - - _logger.info("Saving test virtualhosts file at: " + testConfig); + String relative = relativeToWorkingDirectory(testConfig); + _logger.info("Saving test broker configuration at: " + testConfig); - // Create the file if configuration does not exist - if (testConfiguration.isEmpty()) - { - testConfiguration.addProperty("__ignore", "true"); - } - testConfiguration.save(testConfig); + testConfiguration.save(new File(testConfig)); return relative; } - protected void saveTestVirtualhosts() throws ConfigurationException - { - String relative = saveTestVirtualhosts(getPort(), _testVirtualhosts); - _logger.info("Set test.virtualhosts property to: " + relative); - setSystemProperty(TEST_VIRTUALHOSTS, relative); - } - protected String saveTestVirtualhosts(int port, XMLConfiguration virtualHostConfiguration) throws ConfigurationException { // Specify the test virtualhosts file String testVirtualhosts = getTestVirtualhostsFile(port); String relative = relativeToQpidHome(testVirtualhosts); - _logger.info("Set test.virtualhosts property to: " + testVirtualhosts); - // Create the file if configuration does not exist if (virtualHostConfiguration.isEmpty()) { @@ -817,11 +747,12 @@ public class QpidBrokerTestCase extends QpidTestCase /** * Creates a new virtual host within the test virtualhost file. - * + * @param brokerPort broker port * @param virtualHostName virtual host name + * * @throws ConfigurationException */ - protected void createTestVirtualHost(String virtualHostName) throws ConfigurationException + protected void createTestVirtualHost(int brokerPort, String virtualHostName) throws ConfigurationException { String storeClassName = getTestProfileMessageStoreClassName(); @@ -843,29 +774,13 @@ public class QpidBrokerTestCase extends QpidTestCase { _testVirtualhosts.setProperty("virtualhost." + virtualHostName + ".store." + MessageStoreConstants.ENVIRONMENT_PATH_PROPERTY, storeDir); } - } - - /** - * Get a property value from the current configuration file. - * - * @param property the property to lookup - * - * @return the requested String Value - * - * @throws org.apache.commons.configuration.ConfigurationException - * - */ - protected String getConfigurationStringProperty(String property) throws ConfigurationException - { - // Call save Configuration to be sure we have saved the test specific - // file. As the optional status - saveTestConfiguration(); - saveTestVirtualhosts(); - ServerConfiguration configuration = new ServerConfiguration(_configFile); - // Don't need to configuration.configure() here as we are just pulling - // values directly by String. - return configuration.getConfig().getString(property); + // add new virtual host configuration to the broker store + Map<String, Object> attributes = new HashMap<String, Object>(); + attributes.put(VirtualHost.NAME, virtualHostName); + attributes.put(VirtualHost.CONFIG_PATH, System.getProperty("broker.virtualhosts-config")); + int port = getPort(brokerPort); + getBrokerConfiguration(port).addHostConfiguration(attributes); } /** @@ -882,7 +797,7 @@ public class QpidBrokerTestCase extends QpidTestCase * * @throws ConfigurationException when loading the current config file */ - public void setConfigurationProperty(String property, String value) throws ConfigurationException + public void setVirtualHostConfigurationProperty(String property, String value) throws ConfigurationException { // Choose which file to write the property to based on prefix. if (property.startsWith("virtualhosts")) @@ -891,7 +806,7 @@ public class QpidBrokerTestCase extends QpidTestCase } else { - _testConfiguration.setProperty(property, value); + throw new ConfigurationException("Cannot set broker configuration as property"); } } @@ -926,7 +841,11 @@ public class QpidBrokerTestCase extends QpidTestCase */ protected void setSystemProperty(String property) { - setSystemProperty(property, System.getProperty(property)); + String value = System.getProperty(property); + if (value != null) + { + setSystemProperty(property, value); + } } /** @@ -946,7 +865,14 @@ public class QpidBrokerTestCase extends QpidTestCase protected void setSystemProperty(String property, String value) { // Record the value for the external broker - _propertiesSetForBroker.put(property, value); + if (value == null) + { + _propertiesSetForBroker.remove(property); + } + else + { + _propertiesSetForBroker.put(property, value); + } //Set the value for the test client vm aswell. setTestClientSystemProperty(property, value); @@ -1395,13 +1321,4 @@ public class QpidBrokerTestCase extends QpidTestCase _testVirtualhosts = testVirtualhosts; } - public XMLConfiguration getTestConfiguration() - { - return _testConfiguration; - } - - public void setTestConfiguration(XMLConfiguration testConfiguration) - { - _testConfiguration = testConfiguration; - } } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/TestBrokerConfiguration.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/TestBrokerConfiguration.java new file mode 100644 index 0000000000..a2188f180c --- /dev/null +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/TestBrokerConfiguration.java @@ -0,0 +1,217 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.test.utils; + +import java.io.File; +import java.net.MalformedURLException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.apache.qpid.server.configuration.ConfigurationEntry; +import org.apache.qpid.server.configuration.store.JsonConfigurationEntryStore; +import org.apache.qpid.server.model.AuthenticationProvider; +import org.apache.qpid.server.model.Plugin; +import org.apache.qpid.server.model.Port; +import org.apache.qpid.server.model.UUIDGenerator; +import org.apache.qpid.server.model.VirtualHost; +import org.apache.qpid.server.plugin.PluginFactory; + +public class TestBrokerConfiguration +{ + public static final String ENTRY_NAME_HTTP_PORT = "http"; + public static final String ENTRY_NAME_AMQP_PORT = "amqp"; + public static final String ENTRY_NAME_RMI_PORT = "rmi"; + public static final String ENTRY_NAME_JMX_PORT = "jmx"; + public static final String ENTRY_NAME_VIRTUAL_HOST = "test"; + public static final String ENTRY_NAME_AUTHENTICATION_PROVIDER = "plain"; + public static final String ENTRY_NAME_EXTERNAL_PROVIDER = "external"; + public static final String ENTRY_NAME_SSL_PORT = "sslPort"; + public static final String ENTRY_NAME_HTTP_MANAGEMENT = "MANAGEMENT-HTTP"; + public static final String MANAGEMENT_HTTP_PLUGIN_TYPE = "MANAGEMENT-HTTP"; + public static final String ENTRY_NAME_JMX_MANAGEMENT = "MANAGEMENT-JMX"; + public static final String MANAGEMENT_JMX_PLUGIN_TYPE = "MANAGEMENT-JMX"; + public static final String ENTRY_NAME_ANONYMOUS_PROVIDER = "anonymous"; + + private JsonConfigurationEntryStore _store; + + public TestBrokerConfiguration(String storeType, String intialStoreLocation) + { + // TODO: add support for DERBY store + _store = new JsonConfigurationEntryStore(); + + try + { + // load the initial store data into our store + _store.load(new File(intialStoreLocation).toURI().toURL()); + } + catch (MalformedURLException e) + { + // ignore + } + } + + public boolean setBrokerAttribute(String name, Object value) + { + return setObjectAttribute(_store.getRootEntry(), name, value); + } + + public boolean setObjectAttribute(String objectName, String attributeName, Object value) + { + ConfigurationEntry entry = findObjectByName(objectName); + if (entry == null) + { + return false; + } + return setObjectAttribute(entry, attributeName, value); + } + + public boolean setObjectAttributes(String objectName, Map<String, Object> attributes) + { + ConfigurationEntry entry = findObjectByName(objectName); + if (entry == null) + { + return false; + } + return setObjectAttributes(entry, attributes); + } + + public boolean save(File configFile) + { + _store.saveTo(configFile); + return true; + } + + public UUID[] removeObjectConfiguration(String name) + { + ConfigurationEntry entry = findObjectByName(name); + if (entry != null) + { + return _store.remove(entry.getId()); + } + return null; + } + + public UUID addObjectConfiguration(String name, String type, Map<String, Object> attributes) + { + UUID id = UUIDGenerator.generateBrokerChildUUID(type, name); + addObjectConfiguration(id, type, attributes); + return id; + } + + public UUID addJmxManagementConfiguration() + { + Map<String, Object> attributes = new HashMap<String, Object>(); + attributes.put(PluginFactory.PLUGIN_TYPE, MANAGEMENT_JMX_PLUGIN_TYPE); + attributes.put(Plugin.NAME, ENTRY_NAME_JMX_MANAGEMENT); + return addObjectConfiguration(ENTRY_NAME_JMX_MANAGEMENT, Plugin.class.getSimpleName(), attributes); + } + + public UUID addHttpManagementConfiguration() + { + Map<String, Object> attributes = new HashMap<String, Object>(); + attributes.put(PluginFactory.PLUGIN_TYPE, MANAGEMENT_HTTP_PLUGIN_TYPE); + attributes.put(Plugin.NAME, ENTRY_NAME_HTTP_MANAGEMENT); + return addObjectConfiguration(ENTRY_NAME_HTTP_MANAGEMENT, Plugin.class.getSimpleName(), attributes); + } + + public UUID addPortConfiguration(Map<String, Object> attributes) + { + String name = (String) attributes.get(Port.NAME); + return addObjectConfiguration(name, Port.class.getSimpleName(), attributes); + } + + public UUID addHostConfiguration(Map<String, Object> attributes) + { + String name = (String) attributes.get(VirtualHost.NAME); + return addObjectConfiguration(name, VirtualHost.class.getSimpleName(), attributes); + } + + public UUID addAuthenticationProviderConfiguration(Map<String, Object> attributes) + { + String name = (String) attributes.get(AuthenticationProvider.NAME); + return addObjectConfiguration(name, AuthenticationProvider.class.getSimpleName(), attributes); + } + + private boolean setObjectAttributes(ConfigurationEntry entry, Map<String, Object> attributes) + { + Map<String, Object> newAttributes = new HashMap<String, Object>(entry.getAttributes()); + newAttributes.putAll(attributes); + ConfigurationEntry newEntry = new ConfigurationEntry(entry.getId(), entry.getType(), newAttributes, + entry.getChildrenIds(), _store); + _store.save(newEntry); + return true; + } + + private ConfigurationEntry findObjectByName(String objectName) + { + ConfigurationEntry root = _store.getRootEntry(); + return findObjectByName(root, objectName); + } + + private ConfigurationEntry findObjectByName(ConfigurationEntry entry, String objectName) + { + Map<String, Object> attributes = entry.getAttributes(); + if (attributes != null) + { + String name = (String) attributes.get("name"); + if (objectName.equals(name)) + { + return entry; + } + } + Set<UUID> childrenIds = entry.getChildrenIds(); + for (UUID uuid : childrenIds) + { + ConfigurationEntry child = _store.getEntry(uuid); + ConfigurationEntry result = findObjectByName(child, objectName); + if (result != null) + { + return result; + } + } + return null; + } + + private void addObjectConfiguration(UUID id, String type, Map<String, Object> attributes) + { + ConfigurationEntry entry = new ConfigurationEntry(id, type, attributes, Collections.<UUID> emptySet(), _store); + ConfigurationEntry root = _store.getRootEntry(); + Set<UUID> childrenIds = new HashSet<UUID>(root.getChildrenIds()); + childrenIds.add(id); + ConfigurationEntry newRoot = new ConfigurationEntry(root.getId(), root.getType(), root.getAttributes(), childrenIds, + _store); + _store.save(newRoot, entry); + } + + private boolean setObjectAttribute(ConfigurationEntry entry, String attributeName, Object value) + { + Map<String, Object> attributes = new HashMap<String, Object>(entry.getAttributes()); + attributes.put(attributeName, value); + ConfigurationEntry newEntry = new ConfigurationEntry(entry.getId(), entry.getType(), attributes, entry.getChildrenIds(), + _store); + _store.save(newEntry); + return true; + } +} diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/TestSSLConstants.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/TestSSLConstants.java index 19c9b9fb17..9d5be775dc 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/TestSSLConstants.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/TestSSLConstants.java @@ -24,4 +24,7 @@ public interface TestSSLConstants String KEYSTORE_PASSWORD = "password"; String TRUSTSTORE = "test-profiles/test_resources/ssl/java_client_truststore.jks"; String TRUSTSTORE_PASSWORD = "password"; + + String BROKER_KEYSTORE = "test-profiles/test_resources/ssl/java_broker_keystore.jks"; + String BROKER_KEYSTORE_PASSWORD = "password"; } diff --git a/qpid/java/test-profiles/java-bdb-spawn.0-10.testprofile b/qpid/java/test-profiles/java-bdb-spawn.0-10.testprofile index 35991645d8..78ab05a179 100644 --- a/qpid/java/test-profiles/java-bdb-spawn.0-10.testprofile +++ b/qpid/java/test-profiles/java-bdb-spawn.0-10.testprofile @@ -19,11 +19,11 @@ broker.language=java broker.type=spawned -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.protocol.excludes=--exclude-1-0 @PORT --exclude-1-0 @SSL_PORT -broker.config=build/etc/config-systests-bdb.xml +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-bdb.xml messagestore.class.name=org.apache.qpid.server.store.berkeleydb.BDBMessageStore profile.excludes=JavaExcludes JavaPersistentExcludes Java010Excludes JavaBDBExcludes broker.clean.between.tests=true diff --git a/qpid/java/test-profiles/java-bdb-spawn.0-8.testprofile b/qpid/java/test-profiles/java-bdb-spawn.0-8.testprofile index a4b74748e6..7f6efcbc3d 100644 --- a/qpid/java/test-profiles/java-bdb-spawn.0-8.testprofile +++ b/qpid/java/test-profiles/java-bdb-spawn.0-8.testprofile @@ -19,15 +19,15 @@ broker.language=java broker.type=spawned -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.config=build/etc/config-systests-bdb.xml +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10,AMQP_0_9_1,AMQP_0_9 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-bdb.xml messagestore.class.name=org.apache.qpid.server.store.berkeleydb.BDBMessageStore profile.excludes=JavaExcludes JavaPersistentExcludes XAExcludes JavaPre010Excludes JavaBDBExcludes broker.clean.between.tests=true broker.persistent=true -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT --exclude-0-9-1 @PORT --exclude-0-9-1 @SSL_PORT --exclude-0-9 @PORT --exclude-0-9 @SSL_PORT broker.version=v0_8 # # Do not enable. Allow client to attempt 0-10 and negotiate downwards diff --git a/qpid/java/test-profiles/java-bdb-spawn.0-9-1.testprofile b/qpid/java/test-profiles/java-bdb-spawn.0-9-1.testprofile index 9cd70a4ea7..28668b94f7 100644 --- a/qpid/java/test-profiles/java-bdb-spawn.0-9-1.testprofile +++ b/qpid/java/test-profiles/java-bdb-spawn.0-9-1.testprofile @@ -19,15 +19,15 @@ broker.language=java broker.type=spawned -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.config=build/etc/config-systests-bdb.xml +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-bdb.xml messagestore.class.name=org.apache.qpid.server.store.berkeleydb.BDBMessageStore profile.excludes=JavaExcludes JavaPersistentExcludes XAExcludes JavaPre010Excludes JavaBDBExcludes broker.clean.between.tests=true broker.persistent=true -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT broker.version=v0_9_1 # # Do not enable. Allow client to attempt 0-10 and negotiate downwards diff --git a/qpid/java/test-profiles/java-bdb-spawn.0-9.testprofile b/qpid/java/test-profiles/java-bdb-spawn.0-9.testprofile index 5c0ad2baf3..aa8e6830d4 100644 --- a/qpid/java/test-profiles/java-bdb-spawn.0-9.testprofile +++ b/qpid/java/test-profiles/java-bdb-spawn.0-9.testprofile @@ -19,15 +19,15 @@ broker.language=java broker.type=spawned -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.config=build/etc/config-systests-bdb.xml +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10,AMQP_0_9_1 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-bdb.xml messagestore.class.name=org.apache.qpid.server.store.berkeleydb.BDBMessageStore profile.excludes=JavaExcludes JavaPersistentExcludes XAExcludes JavaPre010Excludes JavaBDBExcludes broker.clean.between.tests=true broker.persistent=true -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT --exclude-0-9-1 @PORT --exclude-0-9-1 @SSL_PORT broker.version=v0_9 # # Do not enable. Allow client to attempt 0-10 and negotiate downwards diff --git a/qpid/java/test-profiles/java-bdb.0-10.testprofile b/qpid/java/test-profiles/java-bdb.0-10.testprofile index 892188aa24..8c4b145e0b 100644 --- a/qpid/java/test-profiles/java-bdb.0-10.testprofile +++ b/qpid/java/test-profiles/java-bdb.0-10.testprofile @@ -20,11 +20,11 @@ broker.language=java broker.type=internal #broker.command only used for the second broker during failover tests in this profile -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.protocol.excludes=--exclude-1-0 @PORT --exclude-1-0 @SSL_PORT -broker.config=build/etc/config-systests-bdb.xml +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-bdb.xml messagestore.class.name=org.apache.qpid.server.store.berkeleydb.BDBMessageStore profile.excludes=JavaExcludes JavaPersistentExcludes Java010Excludes JavaBDBExcludes broker.clean.between.tests=true diff --git a/qpid/java/test-profiles/java-bdb.0-8.testprofile b/qpid/java/test-profiles/java-bdb.0-8.testprofile index 87eea96dda..acf031040e 100644 --- a/qpid/java/test-profiles/java-bdb.0-8.testprofile +++ b/qpid/java/test-profiles/java-bdb.0-8.testprofile @@ -20,15 +20,15 @@ broker.language=java broker.type=internal #broker.command only used for the second broker during failover tests in this profile -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.config=build/etc/config-systests-bdb.xml +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10,AMQP_0_9_1,AMQP_0_9 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-bdb.xml messagestore.class.name=org.apache.qpid.server.store.berkeleydb.BDBMessageStore profile.excludes=JavaExcludes JavaPersistentExcludes XAExcludes JavaPre010Excludes JavaBDBExcludes broker.clean.between.tests=true broker.persistent=true -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT --exclude-0-9-1 @PORT --exclude-0-9-1 @SSL_PORT --exclude-0-9 @PORT --exclude-0-9 @SSL_PORT broker.version=v0_8 # # Do not enable. Allow client to attempt 0-10 and negotiate downwards diff --git a/qpid/java/test-profiles/java-bdb.0-9-1.testprofile b/qpid/java/test-profiles/java-bdb.0-9-1.testprofile index 1339dc1dc7..fa86720bbb 100644 --- a/qpid/java/test-profiles/java-bdb.0-9-1.testprofile +++ b/qpid/java/test-profiles/java-bdb.0-9-1.testprofile @@ -20,15 +20,15 @@ broker.language=java broker.type=internal #broker.command only used for the second broker during failover tests in this profile -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.config=build/etc/config-systests-bdb.xml +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-bdb.xml messagestore.class.name=org.apache.qpid.server.store.berkeleydb.BDBMessageStore profile.excludes=JavaExcludes JavaPersistentExcludes XAExcludes JavaPre010Excludes JavaBDBExcludes broker.clean.between.tests=true broker.persistent=true -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT broker.version=v0_9_1 # # Do not enable. Allow client to attempt 0-10 and negotiate downwards diff --git a/qpid/java/test-profiles/java-bdb.0-9.testprofile b/qpid/java/test-profiles/java-bdb.0-9.testprofile index c097d53c85..ed3d7b2170 100644 --- a/qpid/java/test-profiles/java-bdb.0-9.testprofile +++ b/qpid/java/test-profiles/java-bdb.0-9.testprofile @@ -20,15 +20,15 @@ broker.language=java broker.type=internal #broker.command only used for the second broker during failover tests in this profile -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.config=build/etc/config-systests-bdb.xml +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10,AMQP_0_9_1 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-bdb.xml messagestore.class.name=org.apache.qpid.server.store.berkeleydb.BDBMessageStore profile.excludes=JavaExcludes JavaPersistentExcludes XAExcludes JavaPre010Excludes JavaBDBExcludes broker.clean.between.tests=true broker.persistent=true -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT --exclude-0-9-1 @PORT --exclude-0-9-1 @SSL_PORT broker.version=v0_9 # # Do not enable. Allow client to attempt 0-10 and negotiate downwards diff --git a/qpid/java/test-profiles/java-dby-mem.0-10.testprofile b/qpid/java/test-profiles/java-dby-mem.0-10.testprofile index 33f9527c86..fc58a9021a 100644 --- a/qpid/java/test-profiles/java-dby-mem.0-10.testprofile +++ b/qpid/java/test-profiles/java-dby-mem.0-10.testprofile @@ -20,11 +20,11 @@ broker.language=java broker.version=v0_10 broker.type=internal #broker.command only used for the second broker during failover tests in this profile -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.protocol.excludes=--exclude-1-0 @PORT --exclude-1-0 @SSL_PORT -broker.config=build/etc/config-systests-derby-mem.xml +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-derby-mem.xml messagestorefactory.class.name=org.apache.qpid.server.store.derby.DerbyMessageStoreFactory profile.excludes=JavaPersistentExcludes JavaDerbyExcludes Java010Excludes broker.clean.between.tests=true diff --git a/qpid/java/test-profiles/java-dby-mem.0-8.testprofile b/qpid/java/test-profiles/java-dby-mem.0-8.testprofile index 89bad84769..245eb4e873 100644 --- a/qpid/java/test-profiles/java-dby-mem.0-8.testprofile +++ b/qpid/java/test-profiles/java-dby-mem.0-8.testprofile @@ -20,11 +20,11 @@ broker.version=v0_8 broker.language=java broker.type=internal #broker.command only used for the second broker during failover tests in this profile -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.config=build/etc/config-systests-derby-mem.xml -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT --exclude-0-9-1 @PORT --exclude-0-9-1 @SSL_PORT --exclude-0-9 @PORT --exclude-0-9 @SSL_PORT +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10,AMQP_0_9_1,AMQP_0_9 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-derby-mem.xml messagestorefactory.class.name=org.apache.qpid.server.store.derby.DerbyMessageStoreFactory profile.excludes=JavaPersistentExcludes JavaDerbyExcludes XAExcludes JavaPre010Excludes broker.clean.between.tests=true diff --git a/qpid/java/test-profiles/java-dby-mem.0-9-1.testprofile b/qpid/java/test-profiles/java-dby-mem.0-9-1.testprofile index 8deea281a4..5f7c1ddea7 100644 --- a/qpid/java/test-profiles/java-dby-mem.0-9-1.testprofile +++ b/qpid/java/test-profiles/java-dby-mem.0-9-1.testprofile @@ -20,11 +20,11 @@ broker.version=v0_9_1 broker.language=java broker.type=internal #broker.command only used for the second broker during failover tests in this profile -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.config=build/etc/config-systests-derby-mem.xml -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-derby-mem.xml messagestorefactory.class.name=org.apache.qpid.server.store.derby.DerbyMessageStoreFactory profile.excludes=JavaPersistentExcludes JavaDerbyExcludes XAExcludes JavaPre010Excludes broker.clean.between.tests=true diff --git a/qpid/java/test-profiles/java-dby-mem.0-9.testprofile b/qpid/java/test-profiles/java-dby-mem.0-9.testprofile index b691a7d153..2e3830f4b8 100644 --- a/qpid/java/test-profiles/java-dby-mem.0-9.testprofile +++ b/qpid/java/test-profiles/java-dby-mem.0-9.testprofile @@ -20,11 +20,11 @@ broker.version=v0_9 broker.language=java broker.type=internal #broker.command only used for the second broker during failover tests in this profile -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.config=build/etc/config-systests-derby-mem.xml -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT --exclude-0-9-1 @PORT --exclude-0-9-1 @SSL_PORT +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10,AMQP_0_9_1 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-derby-mem.xml messagestorefactory.class.name=org.apache.qpid.server.store.derby.DerbyMessageStoreFactory profile.excludes=JavaPersistentExcludes JavaDerbyExcludes XAExcludes JavaPre010Excludes broker.clean.between.tests=true diff --git a/qpid/java/test-profiles/java-dby-spawn.0-10.testprofile b/qpid/java/test-profiles/java-dby-spawn.0-10.testprofile index e2e2b44dae..9795533b52 100644 --- a/qpid/java/test-profiles/java-dby-spawn.0-10.testprofile +++ b/qpid/java/test-profiles/java-dby-spawn.0-10.testprofile @@ -19,11 +19,11 @@ broker.language=java broker.version=v0_10 broker.type=spawned -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.protocol.excludes=--exclude-1-0 @PORT --exclude-1-0 @SSL_PORT -broker.config=build/etc/config-systests-derby.xml +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-derby.xml messagestore.class.name=org.apache.qpid.server.store.derby.DerbyMessageStore profile.excludes=JavaPersistentExcludes JavaDerbyExcludes Java010Excludes broker.clean.between.tests=true diff --git a/qpid/java/test-profiles/java-dby-spawn.0-8.testprofile b/qpid/java/test-profiles/java-dby-spawn.0-8.testprofile index 3f609226e3..a980fd181d 100644 --- a/qpid/java/test-profiles/java-dby-spawn.0-8.testprofile +++ b/qpid/java/test-profiles/java-dby-spawn.0-8.testprofile @@ -19,11 +19,11 @@ broker.version=v0_8 broker.language=java broker.type=spawned -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.config=build/etc/config-systests-derby.xml -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT --exclude-0-9-1 @PORT --exclude-0-9-1 @SSL_PORT --exclude-0-9 @PORT --exclude-0-9 @SSL_PORT +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10,AMQP_0_9_1,AMQP_0_9 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-derby.xml messagestore.class.name=org.apache.qpid.server.store.derby.DerbyMessageStore profile.excludes=JavaPersistentExcludes JavaDerbyExcludes XAExcludes JavaPre010Excludes broker.clean.between.tests=true diff --git a/qpid/java/test-profiles/java-dby-spawn.0-9-1.testprofile b/qpid/java/test-profiles/java-dby-spawn.0-9-1.testprofile index 80d40458fd..04428b5021 100644 --- a/qpid/java/test-profiles/java-dby-spawn.0-9-1.testprofile +++ b/qpid/java/test-profiles/java-dby-spawn.0-9-1.testprofile @@ -19,11 +19,11 @@ broker.version=v0_9_1 broker.language=java broker.type=spawned -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.config=build/etc/config-systests-derby.xml -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-derby.xml messagestore.class.name=org.apache.qpid.server.store.derby.DerbyMessageStore profile.excludes=JavaPersistentExcludes JavaDerbyExcludes XAExcludes JavaPre010Excludes broker.clean.between.tests=true diff --git a/qpid/java/test-profiles/java-dby-spawn.0-9.testprofile b/qpid/java/test-profiles/java-dby-spawn.0-9.testprofile index 122eccdca1..4724eba660 100644 --- a/qpid/java/test-profiles/java-dby-spawn.0-9.testprofile +++ b/qpid/java/test-profiles/java-dby-spawn.0-9.testprofile @@ -19,11 +19,11 @@ broker.version=v0_9 broker.language=java broker.type=spawned -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.config=build/etc/config-systests-derby.xml -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT --exclude-0-9-1 @PORT --exclude-0-9-1 @SSL_PORT +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10,AMQP_0_9_1 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-derby.xml messagestore.class.name=org.apache.qpid.server.store.derby.DerbyMessageStore profile.excludes=JavaPersistentExcludes JavaDerbyExcludes XAExcludes JavaPre010Excludes broker.clean.between.tests=true diff --git a/qpid/java/test-profiles/java-dby.0-10.testprofile b/qpid/java/test-profiles/java-dby.0-10.testprofile index d3b03054de..a2b1a41c31 100644 --- a/qpid/java/test-profiles/java-dby.0-10.testprofile +++ b/qpid/java/test-profiles/java-dby.0-10.testprofile @@ -20,11 +20,11 @@ broker.language=java broker.version=v0_10 broker.type=internal #broker.command only used for the second broker during failover tests in this profile -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.protocol.excludes=--exclude-1-0 @PORT --exclude-1-0 @SSL_PORT -broker.config=build/etc/config-systests-derby.xml +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-derby.xml messagestore.class.name=org.apache.qpid.server.store.derby.DerbyMessageStore profile.excludes=JavaPersistentExcludes JavaDerbyExcludes Java010Excludes broker.clean.between.tests=true diff --git a/qpid/java/test-profiles/java-dby.0-8.testprofile b/qpid/java/test-profiles/java-dby.0-8.testprofile index 51580e6c7a..509796331f 100644 --- a/qpid/java/test-profiles/java-dby.0-8.testprofile +++ b/qpid/java/test-profiles/java-dby.0-8.testprofile @@ -20,11 +20,11 @@ broker.version=v0_8 broker.language=java broker.type=internal #broker.command only used for the second broker during failover tests in this profile -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.config=build/etc/config-systests-derby.xml -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT --exclude-0-9-1 @PORT --exclude-0-9-1 @SSL_PORT --exclude-0-9 @PORT --exclude-0-9 @SSL_PORT +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10,AMQP_0_9_1,AMQP_0_9 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-derby.xml messagestore.class.name=org.apache.qpid.server.store.derby.DerbyMessageStore profile.excludes=JavaPersistentExcludes JavaDerbyExcludes XAExcludes JavaPre010Excludes broker.clean.between.tests=true diff --git a/qpid/java/test-profiles/java-dby.0-9-1.testprofile b/qpid/java/test-profiles/java-dby.0-9-1.testprofile index b92397eae7..be087a6344 100644 --- a/qpid/java/test-profiles/java-dby.0-9-1.testprofile +++ b/qpid/java/test-profiles/java-dby.0-9-1.testprofile @@ -20,11 +20,11 @@ broker.version=v0_9_1 broker.language=java broker.type=internal #broker.command only used for the second broker during failover tests in this profile -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.config=build/etc/config-systests-derby.xml -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-derby.xml messagestore.class.name=org.apache.qpid.server.store.derby.DerbyMessageStore profile.excludes=JavaPersistentExcludes JavaDerbyExcludes XAExcludes JavaPre010Excludes broker.clean.between.tests=true diff --git a/qpid/java/test-profiles/java-dby.0-9.testprofile b/qpid/java/test-profiles/java-dby.0-9.testprofile index 17363b7e47..3b5e586ba4 100644 --- a/qpid/java/test-profiles/java-dby.0-9.testprofile +++ b/qpid/java/test-profiles/java-dby.0-9.testprofile @@ -20,11 +20,11 @@ broker.version=v0_9 broker.language=java broker.type=internal #broker.command only used for the second broker during failover tests in this profile -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.config=build/etc/config-systests-derby.xml -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT --exclude-0-9-1 @PORT --exclude-0-9-1 @SSL_PORT +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10,AMQP_0_9_1 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests-derby.xml messagestore.class.name=org.apache.qpid.server.store.derby.DerbyMessageStore profile.excludes=JavaPersistentExcludes JavaDerbyExcludes XAExcludes JavaPre010Excludes broker.clean.between.tests=true diff --git a/qpid/java/test-profiles/java-mms-spawn.0-10.testprofile b/qpid/java/test-profiles/java-mms-spawn.0-10.testprofile index 57af5c4a41..71aaf48562 100644 --- a/qpid/java/test-profiles/java-mms-spawn.0-10.testprofile +++ b/qpid/java/test-profiles/java-mms-spawn.0-10.testprofile @@ -19,10 +19,11 @@ broker.version=v0_10 broker.language=java broker.type=spawned -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.protocol.excludes=--exclude-1-0 @PORT --exclude-1-0 @SSL_PORT +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests.xml # # Do not enable. Allow client to attempt 0-10 and negotiate downwards # diff --git a/qpid/java/test-profiles/java-mms-spawn.0-8.testprofile b/qpid/java/test-profiles/java-mms-spawn.0-8.testprofile index 24f088e0c5..6365fa20f0 100644 --- a/qpid/java/test-profiles/java-mms-spawn.0-8.testprofile +++ b/qpid/java/test-profiles/java-mms-spawn.0-8.testprofile @@ -19,10 +19,11 @@ broker.version=v0_8 broker.language=java broker.type=spawned -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT --exclude-0-9-1 @PORT --exclude-0-9-1 @SSL_PORT --exclude-0-9 @PORT --exclude-0-9 @SSL_PORT +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10,AMQP_0_9_1,AMQP_0_9 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests.xml # # Do not enable. Allow client to attempt 0-10 and negotiate downwards # diff --git a/qpid/java/test-profiles/java-mms-spawn.0-9-1.testprofile b/qpid/java/test-profiles/java-mms-spawn.0-9-1.testprofile index c1f6d10675..fb008a3028 100644 --- a/qpid/java/test-profiles/java-mms-spawn.0-9-1.testprofile +++ b/qpid/java/test-profiles/java-mms-spawn.0-9-1.testprofile @@ -19,10 +19,11 @@ broker.version=v0_9_1 broker.language=java broker.type=spawned -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests.xml # # Do not enable. Allow client to attempt 0-10 and negotiate downwards # diff --git a/qpid/java/test-profiles/java-mms-spawn.0-9.testprofile b/qpid/java/test-profiles/java-mms-spawn.0-9.testprofile index 421ae7476e..4ebce66c05 100644 --- a/qpid/java/test-profiles/java-mms-spawn.0-9.testprofile +++ b/qpid/java/test-profiles/java-mms-spawn.0-9.testprofile @@ -19,10 +19,11 @@ broker.version=v0_9 broker.language=java broker.type=spawned -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT --exclude-0-9-1 @PORT --exclude-0-9-1 @SSL_PORT +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10,AMQP_0_9_1 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests.xml # # Do not enable. Allow client to attempt 0-10 and negotiate downwards # diff --git a/qpid/java/test-profiles/java-mms.0-10.testprofile b/qpid/java/test-profiles/java-mms.0-10.testprofile index 6dd40cff47..0de5ffea09 100644 --- a/qpid/java/test-profiles/java-mms.0-10.testprofile +++ b/qpid/java/test-profiles/java-mms.0-10.testprofile @@ -20,9 +20,10 @@ broker.language=java broker.version=v0_10 broker.type=internal #broker.command only used for the second broker during failover tests in this profile -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.protocol.excludes=--exclude-1-0 @PORT --exclude-1-0 @SSL_PORT +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests.xml profile.excludes=JavaTransientExcludes Java010Excludes diff --git a/qpid/java/test-profiles/java-mms.0-8.testprofile b/qpid/java/test-profiles/java-mms.0-8.testprofile index f82bf8c473..dddad95157 100644 --- a/qpid/java/test-profiles/java-mms.0-8.testprofile +++ b/qpid/java/test-profiles/java-mms.0-8.testprofile @@ -20,10 +20,11 @@ broker.language=java broker.version=v0_8 broker.type=internal #broker.command only used for the second broker during failover tests in this profile -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT --exclude-0-9-1 @PORT --exclude-0-9-1 @SSL_PORT --exclude-0-9 @PORT --exclude-0-9 @SSL_PORT +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10,AMQP_0_9_1,AMQP_0_9 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests.xml # # Do not enable. Allow client to attempt 0-10 and negotiate downwards # diff --git a/qpid/java/test-profiles/java-mms.0-9-1.testprofile b/qpid/java/test-profiles/java-mms.0-9-1.testprofile index 9b8baaa5a3..3c2f68a2c9 100644 --- a/qpid/java/test-profiles/java-mms.0-9-1.testprofile +++ b/qpid/java/test-profiles/java-mms.0-9-1.testprofile @@ -20,10 +20,11 @@ broker.language=java broker.version=v0_9_1 broker.type=internal #broker.command only used for the second broker during failover tests in this profile -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests.xml # # Do not enable. Allow client to attempt 0-10 and negotiate downwards # diff --git a/qpid/java/test-profiles/java-mms.0-9.testprofile b/qpid/java/test-profiles/java-mms.0-9.testprofile index 56ace6d9e1..992168b044 100644 --- a/qpid/java/test-profiles/java-mms.0-9.testprofile +++ b/qpid/java/test-profiles/java-mms.0-9.testprofile @@ -20,10 +20,11 @@ broker.language=java broker.version=v0_9 broker.type=internal #broker.command only used for the second broker during failover tests in this profile -broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES @INCLUDES -c @CONFIG_FILE -l @LOG_CONFIG_FILE +broker.command=build/bin/qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE broker.ready=BRK-1004 broker.stopped=Exception -broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT --exclude-0-9-1 @PORT --exclude-0-9-1 @SSL_PORT +qpid.broker_default_amqp_protocol_excludes=AMQP_1_0,AMQP_0_10,AMQP_0_9_1 +broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests.xml # # Do not enable. Allow client to attempt 0-10 and negotiate downwards # diff --git a/qpid/java/test-profiles/testprofile.defaults b/qpid/java/test-profiles/testprofile.defaults index 47992b9334..a1e9ff0cbb 100644 --- a/qpid/java/test-profiles/testprofile.defaults +++ b/qpid/java/test-profiles/testprofile.defaults @@ -20,7 +20,7 @@ java.naming.factory.initial=org.apache.qpid.jndi.PropertiesFileInitialContextFac java.naming.provider.url=${test.profiles}/test-provider.properties broker.ready=Listening on TCP -broker.config=build/etc/config-systests.xml +broker.config=build/etc/config-systests.json messagestore.class.name=org.apache.qpid.server.store.MemoryMessageStore broker.protocol.excludes= broker.persistent=false @@ -40,6 +40,8 @@ log4j.debug=false # Keep in sync test.port=15672 test.mport=18999 +test.cport=19099 +test.hport=18080 #Note : Management will start open second port on: mport + 100 : 19099 test.port.ssl=15671 test.port.alt=25672 @@ -55,5 +57,7 @@ haltonerror=no exclude.modules=none profile.clustered=false +broker.config-store-type=json +broker.virtualhosts-config="${QPID_HOME}/etc/virtualhosts-systests.xml" |