summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java8
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java76
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java34
-rw-r--r--qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/VirtualHostTest.java118
-rw-r--r--qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackupTest.java9
-rw-r--r--qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java10
-rw-r--r--qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java6
-rw-r--r--qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HAClusterManagementTest.java2
-rw-r--r--qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HAClusterTwoNodeTest.java11
-rw-r--r--qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java131
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/QueueConfiguration.java250
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java301
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/XmlConfigurationUtilities.java93
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/plugins/AbstractConfiguration.java344
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/MemoryConfigurationEntryStore.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java8
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractConfiguredObject.java19
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java277
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/DurableConfigurationStoreFactory.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/JDBCConnectionProviderFactory.java1
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/MessageStoreFactory.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/VirtualHostFactory.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java160
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java196
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java51
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java25
-rwxr-xr-xqpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java5
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/QueueConfigurationTest.java269
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java410
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/plugins/AbstractConfigurationTest.java213
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/startup/VirtualHostRecovererTest.java29
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java14
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ManagementModeStoreHandlerTest.java2
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/messages/AbstractTestMessages.java4
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/VirtualHostTest.java9
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/AMQQueueFactoryTest.java31
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/PriorityQueueListTest.java16
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java6
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestMemoryMessageStoreFactory.java8
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java1
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStoreFactory.java47
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java49
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java12
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/StandardVirtualHostTest.java236
-rw-r--r--qpid/java/broker-core/src/test/resources/META-INF/services/org.apache.qpid.server.plugin.MessageStoreFactory1
-rw-r--r--qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/DefaultAccessControl.java3
-rw-r--r--qpid/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/PlainConfigurationTest.java6
-rw-r--r--qpid/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/plugins/DefaultAccessControlTest.java27
-rw-r--r--qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStoreFactory.java9
-rw-r--r--qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/org/apache/qpid/server/store/jdbc/bonecp/BoneCPConnectionProvider.java1
-rw-r--r--qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/org/apache/qpid/server/store/jdbc/bonecp/BoneCPConnectionProviderFactory.java1
-rw-r--r--qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStoreFactory.java24
-rw-r--r--qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/ManagedObjectRegistry.java4
-rw-r--r--qpid/java/broker-plugins/memory-store/src/main/java/org/apache/qpid/server/store/MemoryMessageStoreFactory.java8
-rw-r--r--qpid/java/module.xml1
-rw-r--r--qpid/java/qpid-test-utils/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java14
-rw-r--r--qpid/java/systests/etc/config-systests.json6
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java23
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java45
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java15
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationTest.java5
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/server/store/MessageStoreTest.java52
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/server/store/QuotaMessageStore.java1
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/server/store/QuotaMessageStoreFactory.java (renamed from qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/ExchangeConfiguration.java)38
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java5
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStoreFactory.java43
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java9
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AccessControlProviderRestTest.java3
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java3
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/Asserts.java4
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BasicAuthRestTest.java6
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BindingRestTest.java20
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsClientCertAuthTest.java25
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsTest.java3
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/ExchangeRestTest.java9
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesProviderRestTest.java3
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesRestTest.java3
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QpidRestTestCase.java10
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QueueRestTest.java6
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/RestTestHelper.java29
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/SaslRestTest.java5
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/StructureRestTest.java75
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/UserPreferencesRestTest.java3
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/VirtualHostRestTest.java77
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java3
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/ExchangeRestACLTest.java26
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java3
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/LogViewerACLTest.java3
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/QueueRestACLTest.java3
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserPreferencesRestACLTest.java3
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java3
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java8
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java20
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java14
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java6
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java28
-rwxr-xr-xqpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java124
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/utils/TestBrokerConfiguration.java6
-rw-r--r--qpid/java/systests/src/main/resources/META-INF/services/org.apache.qpid.server.plugin.MessageStoreFactory1
-rw-r--r--qpid/java/test-profiles/java-bdb-spawn.0-10.testprofile2
-rw-r--r--qpid/java/test-profiles/java-bdb-spawn.0-8.testprofile2
-rw-r--r--qpid/java/test-profiles/java-bdb-spawn.0-9-1.testprofile2
-rw-r--r--qpid/java/test-profiles/java-bdb-spawn.0-9.testprofile2
-rw-r--r--qpid/java/test-profiles/java-bdb.0-10.testprofile1
-rw-r--r--qpid/java/test-profiles/java-bdb.0-8.testprofile2
-rw-r--r--qpid/java/test-profiles/java-bdb.0-9-1.testprofile3
-rw-r--r--qpid/java/test-profiles/java-bdb.0-9.testprofile3
-rw-r--r--qpid/java/test-profiles/java-dby-mem.0-10.testprofile1
-rw-r--r--qpid/java/test-profiles/java-dby-mem.0-8.testprofile2
-rw-r--r--qpid/java/test-profiles/java-dby-mem.0-9-1.testprofile2
-rw-r--r--qpid/java/test-profiles/java-dby-mem.0-9.testprofile2
-rw-r--r--qpid/java/test-profiles/java-dby-spawn.0-10.testprofile1
-rw-r--r--qpid/java/test-profiles/java-dby-spawn.0-8.testprofile2
-rw-r--r--qpid/java/test-profiles/java-dby-spawn.0-9-1.testprofile2
-rw-r--r--qpid/java/test-profiles/java-dby-spawn.0-9.testprofile2
-rw-r--r--qpid/java/test-profiles/java-dby.0-10.testprofile1
-rw-r--r--qpid/java/test-profiles/java-dby.0-8.testprofile2
-rw-r--r--qpid/java/test-profiles/java-dby.0-9-1.testprofile2
-rw-r--r--qpid/java/test-profiles/java-dby.0-9.testprofile2
-rw-r--r--qpid/java/test-profiles/java-mms-spawn.0-10.testprofile1
-rw-r--r--qpid/java/test-profiles/java-mms-spawn.0-8.testprofile1
-rw-r--r--qpid/java/test-profiles/java-mms-spawn.0-9-1.testprofile1
-rw-r--r--qpid/java/test-profiles/java-mms-spawn.0-9.testprofile1
-rw-r--r--qpid/java/test-profiles/java-mms.0-10.testprofile1
-rw-r--r--qpid/java/test-profiles/java-mms.0-8.testprofile1
-rw-r--r--qpid/java/test-profiles/java-mms.0-9-1.testprofile1
-rw-r--r--qpid/java/test-profiles/java-mms.0-9.testprofile1
-rw-r--r--qpid/java/test-profiles/testprofile.defaults2
129 files changed, 876 insertions, 3553 deletions
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java
index 3fdc12ba31..e41b81f846 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java
@@ -21,7 +21,6 @@ package org.apache.qpid.server.store.berkeleydb;
*/
import org.apache.log4j.Logger;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.connection.IConnectionRegistry;
import org.apache.qpid.server.logging.subjects.MessageStoreLogSubject;
import org.apache.qpid.server.model.VirtualHost;
@@ -54,13 +53,12 @@ public class BDBHAVirtualHost extends AbstractVirtualHost
BDBHAVirtualHost(VirtualHostRegistry virtualHostRegistry,
StatisticsGatherer brokerStatisticsGatherer,
org.apache.qpid.server.security.SecurityManager parentSecurityManager,
- VirtualHostConfiguration hostConfig,
VirtualHost virtualHost)
{
- super(virtualHostRegistry, brokerStatisticsGatherer, parentSecurityManager, hostConfig, virtualHost);
+ super(virtualHostRegistry, brokerStatisticsGatherer, parentSecurityManager, virtualHost);
}
- protected void initialiseStorage(VirtualHostConfiguration hostConfig, VirtualHost virtualHost)
+ protected void initialiseStorage(VirtualHost virtualHost)
{
_messageStore = new BDBMessageStore(new ReplicatedEnvironmentFacadeFactory());
@@ -179,7 +177,7 @@ public class BDBHAVirtualHost extends AbstractVirtualHost
@Override
public void event(Event event)
{
- initialiseModel(getConfiguration());
+ initialiseModel();
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java
index 7a308920b3..f5d930dc5a 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java
@@ -19,16 +19,11 @@ package org.apache.qpid.server.store.berkeleydb;/*
*
*/
-import java.util.HashMap;
import java.util.LinkedHashMap;
-import java.util.List;
import java.util.Map;
-import org.apache.commons.configuration.Configuration;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.model.adapter.VirtualHostAdapter;
import org.apache.qpid.server.plugin.VirtualHostFactory;
import org.apache.qpid.server.stats.StatisticsGatherer;
-import org.apache.qpid.server.store.MessageStoreConstants;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
@@ -47,13 +42,11 @@ public class BDBHAVirtualHostFactory implements VirtualHostFactory
public VirtualHost createVirtualHost(VirtualHostRegistry virtualHostRegistry,
StatisticsGatherer brokerStatisticsGatherer,
org.apache.qpid.server.security.SecurityManager parentSecurityManager,
- VirtualHostConfiguration hostConfig,
org.apache.qpid.server.model.VirtualHost virtualHost)
{
return new BDBHAVirtualHost(virtualHostRegistry,
brokerStatisticsGatherer,
parentSecurityManager,
- hostConfig,
virtualHost);
}
@@ -86,73 +79,4 @@ public class BDBHAVirtualHostFactory implements VirtualHostFactory
return convertedMap;
}
- public Map<String, Object> convertVirtualHostConfiguration(Configuration configuration)
- {
-
- LinkedHashMap<String,Object> convertedMap = new LinkedHashMap<String, Object>();
-
- Configuration storeConfiguration = configuration.subset("store");
-
- convertedMap.put(org.apache.qpid.server.model.VirtualHost.STORE_PATH, storeConfiguration.getString(MessageStoreConstants.ENVIRONMENT_PATH_PROPERTY));
- convertedMap.put(MessageStoreConstants.OVERFULL_SIZE_ATTRIBUTE, storeConfiguration.getString(MessageStoreConstants.OVERFULL_SIZE_PROPERTY));
- convertedMap.put(MessageStoreConstants.UNDERFULL_SIZE_ATTRIBUTE, storeConfiguration.getString(MessageStoreConstants.UNDERFULL_SIZE_PROPERTY));
- convertedMap.put("haGroupName", configuration.getString("store.highAvailability.groupName"));
- convertedMap.put("haNodeName", configuration.getString("store.highAvailability.nodeName"));
- convertedMap.put("haNodeAddress", configuration.getString("store.highAvailability.nodeHostPort"));
- convertedMap.put("haHelperAddress", configuration.getString("store.highAvailability.helperHostPort"));
-
- final Object haDurability = configuration.getString("store.highAvailability.durability");
- if(haDurability !=null)
- {
- convertedMap.put("haDurability", haDurability);
- }
-
- final Object designatedPrimary = configuration.getString("store.highAvailability.designatedPrimary");
- if(designatedPrimary!=null)
- {
- convertedMap.put("haDesignatedPrimary", designatedPrimary);
- }
-
- final Object coalescingSync = configuration.getString("store.highAvailability.coalescingSync");
- if(coalescingSync!=null)
- {
- convertedMap.put("haCoalescingSync", coalescingSync);
- }
-
-
- Map<String, String> attributes = getEnvironmentMap(storeConfiguration, "envConfig");
-
- if(!attributes.isEmpty())
- {
- convertedMap.put("bdbEnvironmentConfig",attributes);
- }
-
- attributes = getEnvironmentMap(storeConfiguration, "repConfig");
-
- if(!attributes.isEmpty())
- {
- convertedMap.put("haReplicationConfig",attributes);
- }
-
- return convertedMap;
-
- }
-
- private Map<String, String> getEnvironmentMap(Configuration storeConfiguration, String configName)
- {
- final List<Object> argumentNames = storeConfiguration.getList(configName +".name");
- final List<Object> argumentValues = storeConfiguration.getList(configName +".value");
- final int initialSize = argumentNames.size();
-
- final Map<String,String> attributes = new HashMap<String,String>(initialSize);
-
- for (int i = 0; i < argumentNames.size(); i++)
- {
- final String argName = argumentNames.get(i).toString();
- final String argValue = argumentValues.get(i).toString();
-
- attributes.put(argName, argValue);
- }
- return attributes;
- }
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java
index 4abe81c56c..04efc77b8b 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java
@@ -20,12 +20,7 @@
*/
package org.apache.qpid.server.store.berkeleydb;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
import java.util.Map;
-
-import org.apache.commons.configuration.Configuration;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory;
import org.apache.qpid.server.plugin.MessageStoreFactory;
@@ -54,35 +49,6 @@ public class BDBMessageStoreFactory implements MessageStoreFactory, DurableConfi
}
@Override
- public Map<String, Object> convertStoreConfiguration(Configuration storeConfiguration)
- {
- final List<Object> argumentNames = storeConfiguration.getList("envConfig.name");
- final List<Object> argumentValues = storeConfiguration.getList("envConfig.value");
- final int initialSize = argumentNames.size();
-
- final Map<String,String> attributes = new HashMap<String,String>(initialSize);
-
- for (int i = 0; i < argumentNames.size(); i++)
- {
- final String argName = argumentNames.get(i).toString();
- final String argValue = argumentValues.get(i).toString();
-
- attributes.put(argName, argValue);
- }
-
- if(initialSize != 0)
- {
- return Collections.singletonMap(BDBMessageStore.ENVIRONMENT_CONFIGURATION, (Object)attributes);
- }
- else
- {
- return Collections.emptyMap();
- }
-
-
- }
-
- @Override
public void validateAttributes(Map<String, Object> attributes)
{
if(getType().equals(attributes.get(VirtualHost.STORE_TYPE)))
diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/VirtualHostTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/VirtualHostTest.java
index a05a30b459..488d14bdf4 100644
--- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/VirtualHostTest.java
+++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/VirtualHostTest.java
@@ -27,7 +27,6 @@ import java.io.File;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import java.util.Set;
import java.util.UUID;
import org.apache.qpid.server.configuration.ConfigurationEntry;
@@ -41,24 +40,21 @@ import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.stats.StatisticsGatherer;
import org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacade;
import org.apache.qpid.server.util.BrokerTestHelper;
-import org.apache.qpid.server.virtualhost.StandardVirtualHostFactory;
import org.apache.qpid.test.utils.QpidTestCase;
-import org.apache.qpid.test.utils.TestFileUtils;
import org.apache.qpid.util.FileUtils;
-import com.sleepycat.je.EnvironmentConfig;
import com.sleepycat.je.rep.ReplicatedEnvironment;
import com.sleepycat.je.rep.ReplicationConfig;
public class VirtualHostTest extends QpidTestCase
{
- private Broker _broker;
+ private Broker<?> _broker;
private StatisticsGatherer _statisticsGatherer;
private RecovererProvider _recovererProvider;
private File _configFile;
private File _bdbStorePath;
- private VirtualHost _host;
+ private VirtualHost<?> _host;
private ConfigurationEntryStore _store;
@Override
@@ -103,106 +99,64 @@ public class VirtualHostTest extends QpidTestCase
}
}
-
- public void testCreateBdbVirtualHostFromConfigurationFile()
+ public void testCreateBdbHaVirtualHostFromConfigurationEntry()
{
- String hostName = getName();
- long logFileMax = 2000000;
- _host = createHostFromConfiguration(hostName, logFileMax);
- _host.setDesiredState(State.INITIALISING, State.ACTIVE);
- assertEquals("Unexpected host name", hostName, _host.getName());
- assertEquals("Unexpected host type", StandardVirtualHostFactory.TYPE, _host.getType());
- assertEquals("Unexpected store type", new BDBMessageStoreFactory().getType(), _host.getAttribute(VirtualHost.STORE_TYPE));
- assertEquals("Unexpected store path", _bdbStorePath.getAbsolutePath(), _host.getAttribute(VirtualHost.STORE_PATH));
-
- BDBMessageStore messageStore = (BDBMessageStore) _host.getMessageStore();
- EnvironmentConfig envConfig = messageStore.getEnvironmentFacade().getEnvironment().getConfig();
- assertEquals("Unexpected JE log file max", String.valueOf(logFileMax), envConfig.getConfigParam(EnvironmentConfig.LOG_FILE_MAX));
-
- }
-
- public void testCreateBdbHaVirtualHostFromConfigurationFile()
- {
- String hostName = getName();
-
String repStreamTimeout = "2 h";
String nodeName = "node";
String groupName = "group";
String nodeHostPort = "localhost:" + findFreePort();
String helperHostPort = nodeHostPort;
String durability = "NO_SYNC,SYNC,NONE";
- _host = createHaHostFromConfiguration(hostName, groupName, nodeName, nodeHostPort, helperHostPort, durability, repStreamTimeout);
+ String hostName = getName();
+
+ Map<String, Object> virtualHostAttributes = new HashMap<String, Object>();
+ virtualHostAttributes.put("haNodeName", nodeName);
+ virtualHostAttributes.put("haGroupName", groupName);
+ virtualHostAttributes.put("haNodeAddress", nodeHostPort);
+ virtualHostAttributes.put("haHelperAddress", helperHostPort);
+ virtualHostAttributes.put("haDurability", durability);
+ virtualHostAttributes.put(VirtualHost.STORE_PATH, _bdbStorePath.getAbsolutePath());
+ virtualHostAttributes.put("haReplicationConfig",
+ Collections.singletonMap(ReplicationConfig.REP_STREAM_TIMEOUT, repStreamTimeout));
+ virtualHostAttributes.put(VirtualHost.NAME, hostName);
+ virtualHostAttributes.put(VirtualHost.TYPE, BDBHAVirtualHostFactory.TYPE);
+
+ _host = createHost(virtualHostAttributes);
_host.setDesiredState(State.INITIALISING, State.ACTIVE);
+
assertEquals("Unexpected host name", hostName, _host.getName());
assertEquals("Unexpected host type", BDBHAVirtualHostFactory.TYPE, _host.getType());
assertEquals("Unexpected store type", ReplicatedEnvironmentFacade.TYPE, _host.getAttribute(VirtualHost.STORE_TYPE));
+
+ assertEquals(nodeName, _host.getAttribute("haNodeName"));
+ assertEquals(groupName, _host.getAttribute("haGroupName"));
+ assertEquals(nodeHostPort, _host.getAttribute("haNodeAddress"));
+ assertEquals(helperHostPort, _host.getAttribute("haHelperAddress"));
+ assertEquals(durability, _host.getAttribute("haDurability"));
assertEquals("Unexpected store path", _bdbStorePath.getAbsolutePath(), _host.getAttribute(VirtualHost.STORE_PATH));
BDBMessageStore messageStore = (BDBMessageStore) _host.getMessageStore();
ReplicatedEnvironment environment = (ReplicatedEnvironment) messageStore.getEnvironmentFacade().getEnvironment();
- ReplicationConfig repConfig = environment.getRepConfig();
- assertEquals("Unexpected JE replication groupName", groupName, repConfig.getConfigParam(ReplicationConfig.GROUP_NAME));
- assertEquals("Unexpected JE replication nodeName", nodeName, repConfig.getConfigParam(ReplicationConfig.NODE_NAME));
- assertEquals("Unexpected JE replication nodeHostPort", nodeHostPort, repConfig.getConfigParam(ReplicationConfig.NODE_HOST_PORT));
- assertEquals("Unexpected JE replication nodeHostPort", helperHostPort, repConfig.getConfigParam(ReplicationConfig.HELPER_HOSTS));
- assertEquals("Unexpected JE replication nodeHostPort", "false", repConfig.getConfigParam(ReplicationConfig.DESIGNATED_PRIMARY));
- assertEquals("Unexpected JE replication stream timeout", repStreamTimeout, repConfig.getConfigParam(ReplicationConfig.REP_STREAM_TIMEOUT));
- }
+ ReplicationConfig replicationConfig = environment.getRepConfig();
- private VirtualHost createHost(Map<String, Object> attributes, Set<UUID> children)
- {
- ConfigurationEntry entry = new ConfigurationEntry(UUID.randomUUID(), VirtualHost.class.getSimpleName(), attributes,
- children, _store);
+ assertEquals(nodeName, environment.getNodeName());
+ assertEquals(groupName, environment.getGroup().getName());
+ assertEquals(nodeHostPort, replicationConfig.getNodeHostPort());
+ assertEquals(helperHostPort, replicationConfig.getHelperHosts());
+ assertEquals(durability, environment.getConfig().getDurability().toString());
+ assertEquals("Unexpected JE replication stream timeout", repStreamTimeout, replicationConfig.getConfigParam(ReplicationConfig.REP_STREAM_TIMEOUT));
- return new VirtualHostRecoverer(_statisticsGatherer).create(_recovererProvider, entry, _broker);
}
- private VirtualHost createHost(Map<String, Object> attributes)
- {
- return createHost(attributes, Collections.<UUID> emptySet());
- }
- private VirtualHost createHostFromConfiguration(String hostName, long logFileMax)
+ private VirtualHost<?> createHost(Map<String, Object> attributes)
{
- String content = "<virtualhosts><virtualhost><name>" + hostName + "</name><" + hostName + ">"
- + "<store><class>" + BDBMessageStore.class.getName() + "</class>"
- + "<environment-path>" + _bdbStorePath.getAbsolutePath() + "</environment-path>"
- + "<envConfig><name>" + EnvironmentConfig.LOG_FILE_MAX + "</name><value>" + logFileMax + "</value></envConfig>"
- + "</store>"
- + "</" + hostName + "></virtualhost></virtualhosts>";
- Map<String, Object> attributes = writeConfigAndGenerateAttributes(content);
- return createHost(attributes);
- }
-
+ ConfigurationEntry entry = new ConfigurationEntry(UUID.randomUUID(), VirtualHost.class.getSimpleName(), attributes,
+ Collections.<UUID>emptySet(), _store);
- private VirtualHost createHaHostFromConfiguration(String hostName, String groupName, String nodeName, String nodeHostPort, String helperHostPort, String durability, String repStreamTimeout)
- {
- String content = "<virtualhosts><virtualhost><name>" + hostName + "</name><" + hostName + ">"
- + "<type>" + BDBHAVirtualHostFactory.TYPE + "</type>"
- + "<store><class>" + BDBMessageStore.class.getName() + "</class>"
- + "<environment-path>" + _bdbStorePath.getAbsolutePath() + "</environment-path>"
- + "<highAvailability>"
- + "<groupName>" + groupName + "</groupName>"
- + "<nodeName>" + nodeName + "</nodeName>"
- + "<nodeHostPort>" + nodeHostPort + "</nodeHostPort>"
- + "<helperHostPort>" + helperHostPort + "</helperHostPort>"
- + "<durability>" + durability.replaceAll(",", "\\\\,") + "</durability>"
- + "</highAvailability>"
- + "<repConfig><name>" + ReplicationConfig.REP_STREAM_TIMEOUT + "</name><value>" + repStreamTimeout + "</value></repConfig>"
- + "</store>"
- + "</" + hostName + "></virtualhost></virtualhosts>";
- Map<String, Object> attributes = writeConfigAndGenerateAttributes(content);
- return createHost(attributes);
+ return new VirtualHostRecoverer(_statisticsGatherer).create(_recovererProvider, entry, _broker);
}
- private Map<String, Object> writeConfigAndGenerateAttributes(String content)
- {
- _configFile = TestFileUtils.createTempFile(this, ".virtualhost.xml", content);
- Map<String, Object> attributes = new HashMap<String, Object>();
- attributes.put(VirtualHost.NAME, getName());
- attributes.put(VirtualHost.CONFIG_PATH, _configFile.getAbsolutePath());
- return attributes;
- }
}
\ No newline at end of file
diff --git a/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackupTest.java b/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackupTest.java
index 1b9fa0be9c..b6a178ac8a 100644
--- a/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackupTest.java
+++ b/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackupTest.java
@@ -31,6 +31,7 @@ import javax.jms.MessageConsumer;
import javax.jms.Session;
import org.apache.log4j.Logger;
+import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.test.utils.Piper;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
import org.apache.qpid.util.FileUtils;
@@ -59,12 +60,8 @@ public class BDBBackupTest extends QpidBrokerTestCase
super.setUp();
_backupToDir = new File(SYSTEM_TMP_DIR + File.separator + getTestName());
_backupToDir.mkdirs();
-
- final String qpidWork = getBroker(DEFAULT_PORT).getWorkingDirectory();
-
- // It would be preferable to lookup the store path using #getConfigurationStringProperty("virtualhosts...")
- // but the config as known to QBTC does not pull-in the virtualhost section from its separate source file
- _backupFromDir = new File(qpidWork + File.separator + TEST_VHOST + "-store");
+ Map<String, Object> virtualHostAttributes = getBrokerConfiguration().getObjectAttributes(TEST_VHOST);
+ _backupFromDir = new File((String)virtualHostAttributes.get(VirtualHost.STORE_PATH));
boolean fromDirExistsAndIsDir = _backupFromDir.isDirectory();
assertTrue("backupFromDir " + _backupFromDir + " should already exist", fromDirExistsAndIsDir);
}
diff --git a/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java b/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java
index 04817ad36c..835deb4a4c 100644
--- a/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java
+++ b/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java
@@ -29,7 +29,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.UUID;
-import org.apache.qpid.server.store.StoreException;
import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.framing.BasicContentHeaderProperties;
import org.apache.qpid.framing.ContentHeaderBody;
@@ -38,18 +37,19 @@ import org.apache.qpid.framing.ProtocolVersion;
import org.apache.qpid.framing.abstraction.MessagePublishInfo;
import org.apache.qpid.server.message.AMQMessageHeader;
import org.apache.qpid.server.message.EnqueueableMessage;
-import org.apache.qpid.server.protocol.v0_10.MessageMetaDataType_0_10;
-import org.apache.qpid.server.protocol.v0_8.MessageMetaData;
-import org.apache.qpid.server.protocol.v0_10.MessageMetaData_0_10;
import org.apache.qpid.server.message.MessageReference;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.model.UUIDGenerator;
+import org.apache.qpid.server.protocol.v0_10.MessageMetaDataType_0_10;
+import org.apache.qpid.server.protocol.v0_10.MessageMetaData_0_10;
+import org.apache.qpid.server.protocol.v0_8.MessageMetaData;
import org.apache.qpid.server.protocol.v0_8.MessageMetaDataType_0_8;
+import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.MessageStoreRecoveryHandler;
import org.apache.qpid.server.store.MessageStoreRecoveryHandler.StoredMessageRecoveryHandler;
import org.apache.qpid.server.store.MessageStoreTest;
-import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.StorableMessageMetaData;
+import org.apache.qpid.server.store.StoreException;
import org.apache.qpid.server.store.StoredMessage;
import org.apache.qpid.server.store.Transaction;
import org.apache.qpid.server.store.TransactionLogResource;
diff --git a/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java b/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java
index 755168ca9c..3d6a2bac67 100644
--- a/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java
+++ b/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java
@@ -22,6 +22,7 @@ package org.apache.qpid.server.store.berkeleydb;
import java.io.File;
import java.io.InputStream;
+import java.util.Map;
import javax.jms.Connection;
import javax.jms.DeliveryMode;
@@ -43,8 +44,10 @@ import javax.management.openmbean.TabularDataSupport;
import org.apache.qpid.management.common.mbeans.ManagedExchange;
import org.apache.qpid.management.common.mbeans.ManagedQueue;
+import org.apache.qpid.server.model.VirtualHost;
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.util.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -80,7 +83,8 @@ public class BDBUpgradeTest extends QpidBrokerTestCase
public void setUp() throws Exception
{
assertNotNull("QPID_WORK must be set", QPID_WORK_ORIG);
- _storeLocation = getWorkDirBaseDir() + File.separator + "test-store";
+ Map<String, Object> virtualHostAttributes = getBrokerConfiguration().getObjectAttributes(TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST);
+ _storeLocation = (String)virtualHostAttributes.get(VirtualHost.STORE_PATH);
//Clear the two target directories if they exist.
File directory = new File(_storeLocation);
diff --git a/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HAClusterManagementTest.java b/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HAClusterManagementTest.java
index e8d18971ad..bef35e163f 100644
--- a/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HAClusterManagementTest.java
+++ b/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HAClusterManagementTest.java
@@ -184,7 +184,7 @@ public class HAClusterManagementTest extends QpidBrokerTestCase
final int oldBdbPort = _clusterCreator.getBdbPortForBrokerPort(brokerPortNumberToBeMoved);
final int newBdbPort = getNextAvailable(oldBdbPort + 1);
- storeBean.updateAddress(_clusterCreator.getNodeNameForNodeAt(oldBdbPort), _clusterCreator.getIpAddressOfBrokerHost(), newBdbPort);
+ storeBean.updateAddress(_clusterCreator.getNodeNameForNodeAt(oldBdbPort), "localhost", newBdbPort);
_clusterCreator.modifyClusterNodeBdbAddress(brokerPortNumberToBeMoved, newBdbPort);
diff --git a/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HAClusterTwoNodeTest.java b/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HAClusterTwoNodeTest.java
index 95626f7fa5..cf4a6c87e3 100644
--- a/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HAClusterTwoNodeTest.java
+++ b/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HAClusterTwoNodeTest.java
@@ -34,8 +34,6 @@ import org.apache.qpid.server.store.berkeleydb.jmx.ManagedBDBHAMessageStore;
import org.apache.qpid.test.utils.JMXTestUtils;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
-import com.sleepycat.je.rep.ReplicationConfig;
-
public class HAClusterTwoNodeTest extends QpidBrokerTestCase
{
private static final long RECEIVE_TIMEOUT = 5000l;
@@ -83,15 +81,6 @@ public class HAClusterTwoNodeTest extends QpidBrokerTestCase
private void startCluster(boolean designedPrimary) throws Exception
{
setSystemProperty("java.util.logging.config.file", "etc" + File.separator + "log.properties");
-
- String storeConfigKeyPrefix = _clusterCreator.getStoreConfigKeyPrefix();
-
- setVirtualHostConfigurationProperty(storeConfigKeyPrefix + ".repConfig(0).name", ReplicationConfig.INSUFFICIENT_REPLICAS_TIMEOUT);
- setVirtualHostConfigurationProperty(storeConfigKeyPrefix + ".repConfig(0).value", "2 s");
-
- setVirtualHostConfigurationProperty(storeConfigKeyPrefix + ".repConfig(1).name", ReplicationConfig.ELECTIONS_PRIMARY_RETRIES);
- setVirtualHostConfigurationProperty(storeConfigKeyPrefix + ".repConfig(1).value", "0");
-
_clusterCreator.configureClusterNodes();
_clusterCreator.setDesignatedPrimaryOnFirstBroker(designedPrimary);
_brokerFailoverUrl = _clusterCreator.getConnectionUrlForAllClusterNodes();
diff --git a/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java b/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java
index 353c3a0ec5..1a65b095b4 100644
--- a/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java
+++ b/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java
@@ -19,6 +19,7 @@
*/
package org.apache.qpid.server.store.berkeleydb;
+import java.io.File;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.HashMap;
@@ -26,7 +27,6 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import java.util.concurrent.Callable;
@@ -38,15 +38,17 @@ import java.util.concurrent.TimeUnit;
import javax.jms.Connection;
-import org.apache.commons.configuration.XMLConfiguration;
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.server.model.VirtualHost;
import org.apache.qpid.test.utils.TestBrokerConfiguration;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
import org.apache.qpid.url.URLSyntaxException;
+import com.sleepycat.je.rep.ReplicationConfig;
+
public class HATestClusterCreator
{
protected static final Logger LOGGER = Logger.getLogger(HATestClusterCreator.class);
@@ -65,17 +67,14 @@ public class HATestClusterCreator
private static final int CONNECTDELAY = 75;
private final QpidBrokerTestCase _testcase;
- private final Map<Integer, Integer> _brokerPortToBdbPortMap = new HashMap<Integer, Integer>();
- private final Map<Integer, BrokerConfigHolder> _brokerConfigurations = new TreeMap<Integer, BrokerConfigHolder>();
+ private final Map<Integer, Integer> _brokerPortToBdbPortMap = new TreeMap<Integer, Integer>();
private final String _virtualHostName;
- private final String _vhostStoreConfigKeyPrefix;
private final String _ipAddressOfBroker;
private final String _groupName ;
private final int _numberOfNodes;
private int _bdbHelperPort;
private int _primaryBrokerPort;
- private String _vhostConfigKeyPrefix;
public HATestClusterCreator(QpidBrokerTestCase testcase, String virtualHostName, int numberOfNodes)
{
@@ -84,8 +83,6 @@ public class HATestClusterCreator
_groupName = "group" + _testcase.getName();
_ipAddressOfBroker = getIpAddressOfBrokerHost();
_numberOfNodes = numberOfNodes;
- _vhostConfigKeyPrefix = "virtualhosts.virtualhost." + _virtualHostName + ".";
- _vhostStoreConfigKeyPrefix = _vhostConfigKeyPrefix + "store.";
_bdbHelperPort = 0;
}
@@ -104,13 +101,23 @@ public class HATestClusterCreator
_bdbHelperPort = bdbPort;
}
- configureClusterNode(brokerPort, bdbPort);
TestBrokerConfiguration brokerConfiguration = _testcase.getBrokerConfiguration(brokerPort);
brokerConfiguration.addJmxManagementConfiguration();
- collectConfig(brokerPort, brokerConfiguration, _testcase.getTestVirtualhosts());
+ String nodeName = getNodeNameForNodeAt(bdbPort);
+ brokerConfiguration.setObjectAttribute(_virtualHostName, VirtualHost.TYPE, BDBHAVirtualHostFactory.TYPE);
+ brokerConfiguration.setObjectAttribute(_virtualHostName, VirtualHost.STORE_PATH, System.getProperty("QPID_WORK") + File.separator + brokerPort);
+ brokerConfiguration.setObjectAttribute(_virtualHostName, "haGroupName", _groupName);
+ brokerConfiguration.setObjectAttribute(_virtualHostName, "haNodeName", nodeName);
+ brokerConfiguration.setObjectAttribute(_virtualHostName, "haNodeAddress", getNodeHostPortForNodeAt(bdbPort));
+ brokerConfiguration.setObjectAttribute(_virtualHostName, "haHelperAddress", getHelperHostPort());
+ Map<String, String> repSettings = new HashMap<String, String>();
+ repSettings.put(ReplicationConfig.INSUFFICIENT_REPLICAS_TIMEOUT, "2 s");
+ repSettings.put(ReplicationConfig.ELECTIONS_PRIMARY_RETRIES, "0");
+ brokerConfiguration.setObjectAttribute(_virtualHostName, "haReplicationConfig", repSettings );
brokerPort = _testcase.getNextAvailable(bdbPort + 1);
}
+ _primaryBrokerPort = getPrimaryBrokerPort();
}
public void setDesignatedPrimaryOnFirstBroker(boolean designatedPrimary) throws Exception
@@ -119,35 +126,24 @@ public class HATestClusterCreator
{
throw new IllegalArgumentException("Only two nodes groups have the concept of primary");
}
-
- final Entry<Integer, BrokerConfigHolder> brokerConfigEntry = _brokerConfigurations.entrySet().iterator().next();
- final String configKey = getConfigKey("highAvailability.designatedPrimary");
- brokerConfigEntry.getValue().getTestVirtualhosts().setProperty(configKey, Boolean.toString(designatedPrimary));
- _primaryBrokerPort = brokerConfigEntry.getKey();
+ TestBrokerConfiguration config = _testcase.getBrokerConfiguration(_primaryBrokerPort);
+ config.setObjectAttribute("test", "haDesignatedPrimary", designatedPrimary);
+ config.setSaved(false);
}
- /**
- * @param configKeySuffix "highAvailability.designatedPrimary", for example
- * @return "virtualhost.test.store.highAvailability.designatedPrimary", for example
- */
- private String getConfigKey(String configKeySuffix)
+ private int getPrimaryBrokerPort()
{
- final String configKey = StringUtils.substringAfter(_vhostStoreConfigKeyPrefix + configKeySuffix, "virtualhosts.");
- return configKey;
+ return _brokerPortToBdbPortMap.keySet().iterator().next();
}
public void startNode(final int brokerPortNumber) throws Exception
{
- final BrokerConfigHolder brokerConfigHolder = _brokerConfigurations.get(brokerPortNumber);
-
- _testcase.setTestVirtualhosts(brokerConfigHolder.getTestVirtualhosts());
-
_testcase.startBroker(brokerPortNumber);
}
public void startCluster() throws Exception
{
- for (final Integer brokerPortNumber : _brokerConfigurations.keySet())
+ for (final Integer brokerPortNumber : _brokerPortToBdbPortMap.keySet())
{
startNode(brokerPortNumber);
}
@@ -155,21 +151,20 @@ public class HATestClusterCreator
public void startClusterParallel() throws Exception
{
- final ExecutorService executor = Executors.newFixedThreadPool(_brokerConfigurations.size());
+ final ExecutorService executor = Executors.newFixedThreadPool(_brokerPortToBdbPortMap.size());
try
{
List<Future<Object>> brokers = new CopyOnWriteArrayList<Future<Object>>();
- for (final Integer brokerPortNumber : _brokerConfigurations.keySet())
+ for (final Integer brokerPortNumber : _brokerPortToBdbPortMap.keySet())
{
- final BrokerConfigHolder brokerConfigHolder = _brokerConfigurations.get(brokerPortNumber);
+ final TestBrokerConfiguration brokerConfig = _testcase.getBrokerConfiguration(brokerPortNumber);
Future<Object> future = executor.submit(new Callable<Object>()
{
public Object call()
{
try
{
- _testcase.startBroker(brokerPortNumber, brokerConfigHolder.getTestConfiguration(),
- brokerConfigHolder.getTestVirtualhosts());
+ _testcase.startBroker(brokerPortNumber, brokerConfig);
return "OK";
}
catch (Exception e)
@@ -213,7 +208,7 @@ public class HATestClusterCreator
public void stopCluster() throws Exception
{
- for (final Integer brokerPortNumber : _brokerConfigurations.keySet())
+ for (final Integer brokerPortNumber : _brokerPortToBdbPortMap.keySet())
{
try
{
@@ -345,22 +340,9 @@ public class HATestClusterCreator
public Set<Integer> getBrokerPortNumbersForNodes()
{
- return new HashSet<Integer>(_brokerConfigurations.keySet());
+ return new HashSet<Integer>(_brokerPortToBdbPortMap.keySet());
}
- private void configureClusterNode(final int brokerPort, final int bdbPort) throws Exception
- {
- final String nodeName = getNodeNameForNodeAt(bdbPort);
-
-
- _testcase.setVirtualHostConfigurationProperty(_vhostConfigKeyPrefix + "type", BDBHAVirtualHostFactory.TYPE);
- _testcase.setVirtualHostConfigurationProperty(_vhostStoreConfigKeyPrefix + "class", "org.apache.qpid.server.store.berkeleydb.BDBHAMessageStore");
-
- _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()
{
@@ -375,55 +357,16 @@ public class HATestClusterCreator
}
}
- private void collectConfig(final int brokerPortNumber, TestBrokerConfiguration testConfiguration, XMLConfiguration testVirtualhosts)
- {
- _brokerConfigurations.put(brokerPortNumber, new BrokerConfigHolder(testConfiguration,
- (XMLConfiguration) testVirtualhosts.clone()));
- }
-
- public class BrokerConfigHolder
- {
- private final TestBrokerConfiguration _testConfiguration;
- private final XMLConfiguration _testVirtualhosts;
-
- public BrokerConfigHolder(TestBrokerConfiguration testConfiguration, XMLConfiguration testVirtualhosts)
- {
- _testConfiguration = testConfiguration;
- _testVirtualhosts = testVirtualhosts;
- }
-
- public TestBrokerConfiguration getTestConfiguration()
- {
- return _testConfiguration;
- }
-
- public XMLConfiguration getTestVirtualhosts()
- {
- return _testVirtualhosts;
- }
- }
-
public void modifyClusterNodeBdbAddress(int brokerPortNumberToBeMoved, int newBdbPort)
{
- final BrokerConfigHolder brokerConfigHolder = _brokerConfigurations.get(brokerPortNumberToBeMoved);
- final XMLConfiguration virtualHostConfig = brokerConfigHolder.getTestVirtualhosts();
-
- final String configKey = getConfigKey("highAvailability.nodeHostPort");
- final String oldBdbHostPort = virtualHostConfig.getString(configKey);
-
- final String[] oldHostAndPort = StringUtils.split(oldBdbHostPort, ":");
- final String oldHost = oldHostAndPort[0];
-
- final String newBdbHostPort = oldHost + ":" + newBdbPort;
-
- virtualHostConfig.setProperty(configKey, newBdbHostPort);
- collectConfig(brokerPortNumberToBeMoved, brokerConfigHolder.getTestConfiguration(), virtualHostConfig);
+ TestBrokerConfiguration config = _testcase.getBrokerConfiguration(brokerPortNumberToBeMoved);
+ config.setObjectAttribute(_virtualHostName, "haNodeAddress", "localhost:" + newBdbPort);
+ String oldBdbHostPort = (String)config.getObjectAttributes(_virtualHostName).get("haNodeAddress");
+ String[] oldHostAndPort = StringUtils.split(oldBdbHostPort, ":");
+ String oldHost = oldHostAndPort[0];
+ String newBdbHostPort = oldHost + ":" + newBdbPort;
+ config.setObjectAttribute(_virtualHostName, "haNodeAddress", newBdbHostPort);
+ config.setSaved(false);
}
- public String getStoreConfigKeyPrefix()
- {
- return _vhostStoreConfigKeyPrefix;
- }
-
-
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/QueueConfiguration.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/QueueConfiguration.java
deleted file mode 100644
index 8f77de56b8..0000000000
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/QueueConfiguration.java
+++ /dev/null
@@ -1,250 +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 java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Map;
-import org.apache.commons.configuration.CompositeConfiguration;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
-
-import org.apache.qpid.exchange.ExchangeDefaults;
-import org.apache.qpid.server.configuration.plugins.AbstractConfiguration;
-
-import java.util.List;
-
-public class QueueConfiguration extends AbstractConfiguration
-{
- private String _name;
- private VirtualHostConfiguration _vHostConfig;
-
- public QueueConfiguration(String name, VirtualHostConfiguration virtualHostConfiguration) throws ConfigurationException
- {
- _vHostConfig = virtualHostConfiguration;
- _name = name;
-
- CompositeConfiguration mungedConf = new CompositeConfiguration();
- mungedConf.addConfiguration(_vHostConfig.getConfig().subset("queues.queue." + escapeTagName(name)));
-
- setConfiguration("virtualhosts.virtualhost.queues.queue", mungedConf);
- }
-
- public String[] getElementsProcessed()
- {
- return new String[]{"maximumMessageSize",
- "maximumQueueDepth",
- "maximumMessageCount",
- "maximumMessageAge",
- "minimumAlertRepeatGap",
- "durable",
- "exchange",
- "exclusive",
- "queue",
- "autodelete",
- "priority",
- "priorities",
- "routingKey",
- "capacity",
- "flowResumeCapacity",
- "lvq",
- "lvqKey",
- "sortKey",
- "maximumDeliveryCount",
- "deadLetterQueues",
- "argument"
- };
- }
-
- @Override
- public void validateConfiguration() throws ConfigurationException
- {
- //Currently doesn't do validation
- }
-
- public VirtualHostConfiguration getVirtualHostConfiguration()
- {
- return _vHostConfig;
- }
-
- private boolean getDefaultedBoolean(String attribute)
- {
- final Configuration config = _vHostConfig.getConfig();
- if(config.containsKey("queues."+attribute))
- {
- final boolean defaultValue = config.getBoolean("queues." + attribute);
- return getBooleanValue(attribute, defaultValue);
- }
- else
- {
- return getBooleanValue(attribute);
- }
- }
-
- public boolean getDurable()
- {
- return getDefaultedBoolean("durable");
- }
-
- public boolean getExclusive()
- {
- return getDefaultedBoolean("exclusive");
- }
-
- public boolean getAutoDelete()
- {
- return getDefaultedBoolean("autodelete");
- }
-
- public String getOwner()
- {
- return getStringValue("owner", null);
- }
-
- public boolean getPriority()
- {
- return getDefaultedBoolean("priority");
- }
-
- public int getPriorities()
- {
- final Configuration config = _vHostConfig.getConfig();
-
- int defaultValue;
- if(config.containsKey("queues.priorities"))
- {
- defaultValue = config.getInt("queues.priorities");
- }
- else
- {
- defaultValue = -1;
- }
- return getIntValue("priorities", defaultValue);
- }
-
- public String getExchange()
- {
- final Configuration config = _vHostConfig.getConfig();
-
- String defaultValue;
-
- if(config.containsKey("queues.exchange"))
- {
- defaultValue = config.getString("queues.exchange");
- }
- else
- {
- defaultValue = "";
- }
-
- return getStringValue("exchange", defaultValue);
- }
-
- public List getRoutingKeys()
- {
- return getListValue("routingKey");
- }
-
- public String getName()
- {
- return _name;
- }
-
- public String getDescription()
- {
- return getStringValue("description");
- }
-
- public int getMaximumMessageAge()
- {
- return getIntValue("maximumMessageAge");
- }
-
- public long getMaximumQueueDepth()
- {
- return getLongValue("maximumQueueDepth");
- }
-
- public long getMaximumMessageSize()
- {
- return getLongValue("maximumMessageSize");
- }
-
- public long getMaximumMessageCount()
- {
- return getLongValue("maximumMessageCount");
- }
-
- public long getMinimumAlertRepeatGap()
- {
- return getLongValue("minimumAlertRepeatGap");
- }
-
- public long getCapacity()
- {
- return getLongValue("capacity");
- }
-
- public long getFlowResumeCapacity()
- {
- return getLongValue("flowResumeCapacity");
- }
-
- public boolean isLVQ()
- {
- return getBooleanValue("lvq");
- }
-
- public String getLVQKey()
- {
- return getStringValue("lvqKey", null);
- }
-
- public String getQueueSortKey()
- {
- return getStringValue("sortKey", null);
- }
-
- public int getMaxDeliveryCount()
- {
- return getIntValue("maximumDeliveryCount", _vHostConfig.getMaxDeliveryCount());
- }
-
- /**
- * Check if dead letter queue delivery is enabled, deferring to the virtualhost configuration if not set.
- */
- public boolean isDeadLetterQueueEnabled()
- {
- return getBooleanValue("deadLetterQueues", _vHostConfig.isDeadLetterQueueEnabled());
- }
-
- public Map<String,String> getArguments()
- {
- return getMap("argument");
- }
-
- public Map<String,String> getBindingArguments(String routingKey)
- {
-
- return getConfig().containsKey(routingKey+".bindingArgument") ? getMap(routingKey+".bindingArgument") : null;
- }
-}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java
deleted file mode 100644
index 189f5916e0..0000000000
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java
+++ /dev/null
@@ -1,301 +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.CompositeConfiguration;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
-
-import org.apache.qpid.server.configuration.plugins.AbstractConfiguration;
-import org.apache.qpid.server.model.Broker;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-public class VirtualHostConfiguration extends AbstractConfiguration
-{
- private final String _name;
- private final Map<String, QueueConfiguration> _queues = new HashMap<String, QueueConfiguration>();
- private final Map<String, ExchangeConfiguration> _exchanges = new HashMap<String, ExchangeConfiguration>();
- private final Broker _broker;
- private final long _defaultHouseKeepingCheckPeriod;
-
- public VirtualHostConfiguration(String name, Configuration config, Broker broker) throws ConfigurationException
- {
- _name = name;
- _broker = broker;
-
- // store value of this attribute for running life of virtual host since updating of this value has no run-time effect
- _defaultHouseKeepingCheckPeriod = ((Number)_broker.getAttribute(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD)).longValue();
- setConfiguration(config);
- }
-
- public VirtualHostConfiguration(String name, File configurationFile, Broker broker) throws ConfigurationException
- {
- this(name, loadConfiguration(name, configurationFile), broker);
- }
-
- private static Configuration loadConfiguration(String name, File configurationFile) throws ConfigurationException
- {
- Configuration configuration = null;
- if (configurationFile == null)
- {
- throw new IllegalConfigurationException("Virtualhost configuration file must be supplied!");
- }
- else
- {
- Configuration virtualHostConfig = XmlConfigurationUtilities.parseConfig(configurationFile);
-
- // check for the element with the same name as virtual host
- Configuration config = virtualHostConfig.subset("virtualhost." + XmlConfigurationUtilities.escapeTagName(name));
- if (config.isEmpty())
- {
- throw new IllegalConfigurationException("No configuration found for virtual host '" + name + "' in " + configurationFile.getAbsolutePath());
- }
- else
- {
- configuration = config;
- }
- }
- return configuration;
- }
-
- /**
- * Apply the given configuration to this VirtualHostConfiguration
- *
- * @param config the config to apply
- * @throws ConfigurationException if a problem occurs with configuration
- */
- public void setConfiguration(Configuration config) throws ConfigurationException
- {
- setConfiguration("virtualhosts.virtualhost", config);
-
- Iterator i = getListValue("queues.queue.name").iterator();
-
- while (i.hasNext())
- {
- String queueName = (String) i.next();
- _queues.put(queueName, new QueueConfiguration(queueName, this));
- }
-
- i = getListValue("exchanges.exchange.name").iterator();
- int count = 0;
- while (i.hasNext())
- {
- CompositeConfiguration mungedConf = new CompositeConfiguration();
- mungedConf.addConfiguration(config.subset("exchanges.exchange(" + count++ + ")"));
- mungedConf.addConfiguration(getConfig().subset("exchanges"));
- String exchName = (String) i.next();
- _exchanges.put(exchName, new ExchangeConfiguration(exchName, mungedConf));
- }
- }
-
- public String getName()
- {
- return _name;
- }
-
- public long getHousekeepingCheckPeriod()
- {
- return getLongValue("housekeeping.checkPeriod", _defaultHouseKeepingCheckPeriod);
- }
-
- public Configuration getStoreConfiguration()
- {
- return getConfig().subset("store");
- }
-
- public String getMessageStoreClass()
- {
- return getStringValue("store.class", null);
- }
-
- public void setMessageStoreClass(String storeFactoryClass)
- {
- getConfig().setProperty("store.class", storeFactoryClass);
- }
-
- public List getExchanges()
- {
- return getListValue("exchanges.exchange.name");
- }
-
- public String[] getQueueNames()
- {
- return _queues.keySet().toArray(new String[_queues.size()]);
- }
-
- public ExchangeConfiguration getExchangeConfiguration(String exchangeName)
- {
- return _exchanges.get(exchangeName);
- }
-
- public QueueConfiguration getQueueConfiguration(String queueName)
- {
- // We might be asked for the config for a queue we don't know about,
- // such as one that's been dynamically created. Those get the defaults by default.
- if (_queues.containsKey(queueName))
- {
- return _queues.get(queueName);
- }
- else
- {
- try
- {
- return new QueueConfiguration(queueName, this);
- }
- catch (ConfigurationException e)
- {
- // The configuration is empty so there can't be an error.
- return null;
- }
- }
- }
-
- public int getMaximumMessageAge()
- {
- return getIntValue("queues.maximumMessageAge", getBrokerAttributeAsInt(Broker.QUEUE_ALERT_THRESHOLD_MESSAGE_AGE));
- }
-
- public Long getMaximumQueueDepth()
- {
- return getLongValue("queues.maximumQueueDepth", getBrokerAttributeAsLong(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_BYTES));
- }
-
- public Long getMaximumMessageSize()
- {
- return getLongValue("queues.maximumMessageSize", getBrokerAttributeAsLong(Broker.QUEUE_ALERT_THRESHOLD_MESSAGE_SIZE));
- }
-
- public Long getMaximumMessageCount()
- {
- return getLongValue("queues.maximumMessageCount", getBrokerAttributeAsLong(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES));
- }
-
- public Long getMinimumAlertRepeatGap()
- {
- return getLongValue("queues.minimumAlertRepeatGap", getBrokerAttributeAsLong(Broker.QUEUE_ALERT_REPEAT_GAP));
- }
-
- public long getCapacity()
- {
- return getLongValue("queues.capacity", getBrokerAttributeAsLong(Broker.QUEUE_FLOW_CONTROL_SIZE_BYTES));
- }
-
- public long getFlowResumeCapacity()
- {
- return getLongValue("queues.flowResumeCapacity", getBrokerAttributeAsLong(Broker.QUEUE_FLOW_CONTROL_RESUME_SIZE_BYTES));
- }
-
- public String[] getElementsProcessed()
- {
- return new String[]{"queues", "exchanges", "custom-exchanges", "store", "housekeeping"};
-
- }
-
- @Override
- public void validateConfiguration() throws ConfigurationException
- {
- // QPID-3249. Support for specifying authentication name at vhost level is no longer supported.
- if (getListValue("security.authentication.name").size() > 0)
- {
- String message = "Validation error : security/authentication/name is no longer a supported element within the configuration xml."
- + " It appears in virtual host definition : " + _name;
- throw new ConfigurationException(message);
- }
-
- // QPID-3266. Tidy up housekeeping configuration option for scheduling frequency
- if (contains("housekeeping.expiredMessageCheckPeriod"))
- {
- String message = "Validation error : housekeeping/expiredMessageCheckPeriod must be replaced by housekeeping/checkPeriod."
- + " It appears in virtual host definition : " + _name;
- throw new ConfigurationException(message);
- }
- }
-
- public int getHouseKeepingThreadCount()
- {
- return getIntValue("housekeeping.poolSize", Runtime.getRuntime().availableProcessors());
- }
-
- public long getTransactionTimeoutOpenWarn()
- {
- return getLongValue("transactionTimeout.openWarn",
- getBrokerAttributeAsLong(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_WARN));
- }
-
- public long getTransactionTimeoutOpenClose()
- {
- return getLongValue("transactionTimeout.openClose",
- getBrokerAttributeAsLong(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_CLOSE));
- }
-
- public long getTransactionTimeoutIdleWarn()
- {
- return getLongValue("transactionTimeout.idleWarn",
- getBrokerAttributeAsLong(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_WARN));
- }
-
- public long getTransactionTimeoutIdleClose()
- {
- return getLongValue("transactionTimeout.idleClose",
- getBrokerAttributeAsLong(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_CLOSE));
- }
-
- public int getMaxDeliveryCount()
- {
- return getIntValue("queues.maximumDeliveryCount", getBrokerAttributeAsInt(Broker.QUEUE_MAXIMUM_DELIVERY_ATTEMPTS));
- }
-
- /**
- * Check if dead letter queue delivery is enabled, deferring to the broker configuration if not set.
- */
- public boolean isDeadLetterQueueEnabled()
- {
- return getBooleanValue("queues.deadLetterQueues", getBrokerAttributeAsBoolean(Broker.QUEUE_DEAD_LETTER_QUEUE_ENABLED));
- }
-
- private long getBrokerAttributeAsLong(String name)
- {
- Number brokerValue = (Number)_broker.getAttribute(name);
- return brokerValue == null? 0 : brokerValue.longValue();
- }
-
- private int getBrokerAttributeAsInt(String name)
- {
- Number brokerValue = (Number)_broker.getAttribute(name);
- return brokerValue == null? 0 : brokerValue.intValue();
- }
-
- private boolean getBrokerAttributeAsBoolean(String name)
- {
- Boolean brokerValue = (Boolean)_broker.getAttribute(name);
- return brokerValue == null? false : brokerValue.booleanValue();
- }
-
- public String getType()
- {
- return getStringValue("type", "org.apache.qpid.server.store.berkeleydb.BDBHAMessageStore".equals(getMessageStoreClass()) ? "BDB_HA": "STANDARD");
- }
-}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/XmlConfigurationUtilities.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/XmlConfigurationUtilities.java
deleted file mode 100644
index 84972c1e0a..0000000000
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/XmlConfigurationUtilities.java
+++ /dev/null
@@ -1,93 +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 java.io.File;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.commons.configuration.CompositeConfiguration;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.ConfigurationFactory;
-import org.apache.commons.configuration.SystemConfiguration;
-import org.apache.commons.configuration.XMLConfiguration;
-
-public class XmlConfigurationUtilities
-{
-
- // Our configuration class needs to make the interpolate method
- // public so it can be called below from the config method.
- public static class MyConfiguration extends CompositeConfiguration
- {
- public String interpolate(String obj)
- {
- return super.interpolate(obj);
- }
- }
-
- public static Configuration parseConfig(File file) throws ConfigurationException
- {
- ConfigurationFactory factory = new ConfigurationFactory();
- factory.setConfigurationFileName(file.getAbsolutePath());
- Configuration conf = factory.getConfiguration();
-
- Iterator<?> keys = conf.getKeys();
- if (!keys.hasNext())
- {
- keys = null;
- conf = flatConfig(file);
- }
-
- return conf;
- }
-
- public final static Configuration flatConfig(File file) throws ConfigurationException
- {
- // We have to override the interpolate methods so that
- // interpolation takes place across the entirety of the
- // composite configuration. Without doing this each
- // configuration object only interpolates variables defined
- // inside itself.
- final MyConfiguration conf = new MyConfiguration();
- conf.addConfiguration(new SystemConfiguration()
- {
- protected String interpolate(String o)
- {
- return conf.interpolate(o);
- }
- });
- conf.addConfiguration(new XMLConfiguration(file)
- {
- protected String interpolate(String o)
- {
- return conf.interpolate(o);
- }
- });
- return conf;
- }
-
- public static String escapeTagName(String name)
- {
- return name.replaceAll("\\.", "\\.\\.");
- }
-}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/plugins/AbstractConfiguration.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/plugins/AbstractConfiguration.java
deleted file mode 100644
index c28ea726c0..0000000000
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/plugins/AbstractConfiguration.java
+++ /dev/null
@@ -1,344 +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.plugins;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.ConversionException;
-import org.apache.log4j.Logger;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.Set;
-
-public abstract class AbstractConfiguration
-{
- protected static final Logger _logger = Logger.getLogger(AbstractConfiguration.class);
-
- private Configuration _config;
-
- /**
- * The Elements that this Plugin can process.
- *
- * For a Queues plugin that would be a list containing:
- * <ul>
- * <li>queue - the queue entries
- * <li>the alerting values for defaults
- * <li>exchange - the default exchange
- * <li>durable - set the default durability
- * </ul>
- */
- abstract public String[] getElementsProcessed();
-
- /** Performs configuration validation. */
- public void validateConfiguration() throws ConfigurationException
- {
- // Override in sub-classes
- }
-
- public Configuration getConfig()
- {
- return _config;
- }
-
- /**
- * Sets the configuration for this plugin
- *
- * @param path
- * @param configuration the configuration for this plugin.
- */
- public void setConfiguration(String path, Configuration configuration) throws ConfigurationException
- {
- _config = configuration;
-
- // Extract a list of elements for processing
- Iterator<?> keys = configuration.getKeys();
-
- Set<String> elements = new HashSet<String>();
- while (keys.hasNext())
- {
- String key = (String) keys.next();
-
- int elementNameIndex = key.indexOf(".");
-
- String element = key.trim();
- if (elementNameIndex != -1)
- {
- element = key.substring(0, elementNameIndex).trim();
- }
-
- // Trim any element properties
- elementNameIndex = element.indexOf("[");
- if (elementNameIndex > 0)
- {
- element = element.substring(0, elementNameIndex).trim();
- }
-
- elements.add(element);
- }
-
- //Remove the items we already expect in the configuration
- for (String tag : getElementsProcessed())
- {
-
- // Work round the issue with Commons configuration.
- // With an XMLConfiguration the key will be [@property]
- // but with a CompositeConfiguration it will be @property].
- // Hide this issue from our users so when/if we change the
- // configuration they don't have to.
- int bracketIndex = tag.indexOf("[");
- if (bracketIndex != -1)
- {
- tag = tag.substring(bracketIndex + 1, tag.length());
- }
-
- elements.remove(tag);
- }
-
- if (_logger.isInfoEnabled())
- {
- if (!elements.isEmpty())
- {
- _logger.info("Elements to lookup:" + path);
- for (String tag : elements)
- {
- _logger.info("Tag:'" + tag + "'");
- }
- }
- }
-
- validateConfiguration();
- }
-
- /** Helper method to print out list of keys in a {@link Configuration}. */
- public static final void showKeys(Configuration config)
- {
- if (config.isEmpty())
- {
- _logger.info("Configuration is empty");
- }
- else
- {
- Iterator<?> keys = config.getKeys();
- while (keys.hasNext())
- {
- String key = (String) keys.next();
- _logger.info("Configuration key: " + key);
- }
- }
- }
-
- protected boolean hasConfiguration()
- {
- return _config != null;
- }
-
- /// Getters
-
- protected double getDoubleValue(String property)
- {
- return getDoubleValue(property, 0.0);
- }
-
- protected double getDoubleValue(String property, double defaultValue)
- {
- return _config.getDouble(property, defaultValue);
- }
-
- protected long getLongValue(String property)
- {
- return getLongValue(property, 0);
- }
-
- protected long getLongValue(String property, long defaultValue)
- {
- return _config.getLong(property, defaultValue);
- }
-
- protected int getIntValue(String property)
- {
- return getIntValue(property, 0);
- }
-
- protected int getIntValue(String property, int defaultValue)
- {
- return _config.getInt(property, defaultValue);
- }
-
- protected String getStringValue(String property)
- {
- return getStringValue(property, null);
- }
-
- protected String getStringValue(String property, String defaultValue)
- {
- return _config.getString(property, defaultValue);
- }
-
- protected boolean getBooleanValue(String property)
- {
- return getBooleanValue(property, false);
- }
-
- protected boolean getBooleanValue(String property, boolean defaultValue)
- {
- return _config.getBoolean(property, defaultValue);
- }
-
- protected List getListValue(String property)
- {
- return getListValue(property, Collections.EMPTY_LIST);
- }
-
- protected List getListValue(String property, List defaultValue)
- {
- return _config.getList(property, defaultValue);
- }
-
- /// Validation Helpers
-
- protected boolean contains(String property)
- {
- return _config.getProperty(property) != null;
- }
-
- /**
- * Provide mechanism to validate Configuration contains a Positive Long Value
- *
- * @param property
- *
- * @throws ConfigurationException
- */
- protected void validatePositiveLong(String property) throws ConfigurationException
- {
- try
- {
- if (!containsPositiveLong(property))
- {
- throw new ConfigurationException(this.getClass().getSimpleName()
- + ": '" + property +
- "' must be a Positive Long value.");
- }
- }
- catch (Exception e)
- {
- Throwable last = e;
-
- // Find the first cause
- if (e instanceof ConversionException)
- {
- Throwable t = e.getCause();
- while (t != null)
- {
- last = t;
- t = last.getCause();
- }
- }
-
- throw new ConfigurationException(this.getClass().getSimpleName() +
- ": unable to configure invalid " +
- property + ":" +
- _config.getString(property),
- last);
- }
- }
-
- protected boolean containsLong(String property)
- {
- try
- {
- _config.getLong(property);
- return true;
- }
- catch (NoSuchElementException e)
- {
- return false;
- }
- }
-
- protected boolean containsPositiveLong(String property)
- {
- try
- {
- long value = _config.getLong(property);
- return value > 0;
- }
- catch (NoSuchElementException e)
- {
- return false;
- }
-
- }
-
- protected boolean containsInt(String property)
- {
- try
- {
- _config.getInt(property);
- return true;
- }
- catch (NoSuchElementException e)
- {
- return false;
- }
- }
-
- protected boolean containsBoolean(String property)
- {
- try
- {
- _config.getBoolean(property);
- return true;
- }
- catch (NoSuchElementException e)
- {
- return false;
- }
- }
-
- public static String escapeTagName(String name)
- {
- return name.replaceAll("\\.", "\\.\\.");
- }
-
- protected void setConfig(Configuration config)
- {
- _config = config;
- }
-
- protected Map<String,String> getMap(String name)
- {
- List elements = getListValue(name,Collections.emptyList());
-
- Map<String,String> map = new LinkedHashMap();
- for(Object item : elements)
- {
- String[] keyValue = String.valueOf(item).split("=",2);
- map.put(keyValue[0].trim(), keyValue.length > 1 ? keyValue[1].trim() : null);
- }
- return map;
- }
-}
-
-
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/MemoryConfigurationEntryStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/MemoryConfigurationEntryStore.java
index cc591b695e..010d74eb7f 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/MemoryConfigurationEntryStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/MemoryConfigurationEntryStore.java
@@ -545,7 +545,7 @@ public class MemoryConfigurationEntryStore implements ConfigurationEntryStore
}
else if (fieldNode.isObject())
{
- // ignore, in-line objects are not supported yet
+ attributes.put(fieldName, toObject(fieldNode) );
}
else
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java
index d63a765144..928ea26819 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java
@@ -22,8 +22,6 @@ package org.apache.qpid.server.model;
import java.util.Collection;
-import org.apache.qpid.server.message.MessageInstance;
-import org.apache.qpid.server.queue.QueueEntry;
import org.apache.qpid.server.queue.QueueEntryVisitor;
@ManagedObject
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java
index 4aec9b38a0..827c01f70f 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java
@@ -56,7 +56,8 @@ public interface VirtualHost<X extends VirtualHost<X>> extends ConfiguredObject<
String SUPPORTED_QUEUE_TYPES = "supportedQueueTypes";
String DURABLE = "durable";
String LIFETIME_POLICY = "lifetimePolicy";
- String CONFIG_PATH = "configPath";
+ String SECURITY_ACL = "securityAcl";
+ String HOUSE_KEEPING_THREAD_COUNT = "houseKeepingThreadCount";
// Attributes
@@ -123,7 +124,10 @@ public interface VirtualHost<X extends VirtualHost<X>> extends ConfiguredObject<
long getQueue_alertThresholdQueueDepthMessages();
@ManagedAttribute
- String getConfigPath();
+ String getSecurityAcl();
+
+ @ManagedAttribute
+ int getHouseKeepingThreadCount();
@ManagedStatistic
long getQueueCount();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractConfiguredObject.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractConfiguredObject.java
index eda61f92b0..a498e3e59e 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractConfiguredObject.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractConfiguredObject.java
@@ -377,6 +377,25 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im
}
}
+ <T extends ConfiguredObject<?>> Object getAttribute(String name, T parent, String parentAttributeName)
+ {
+ Object value = getActualAttribute(name);
+ if (value != null )
+ {
+ return value;
+ }
+ if (parent != null)
+ {
+ value = parent.getAttribute(parentAttributeName);
+ if (value != null)
+ {
+ return value;
+ }
+ }
+ return getDefaultAttribute(name);
+ }
+
+
@Override
public String getDescription()
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java
index 72b316c784..82051c3a41 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.model.adapter;
-import java.io.File;
import java.lang.reflect.Type;
import java.security.AccessControlException;
import java.util.ArrayList;
@@ -31,15 +30,9 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.apache.commons.configuration.CompositeConfiguration;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.commons.configuration.SystemConfiguration;
import org.apache.log4j.Logger;
import org.apache.qpid.server.exchange.AMQUnknownExchangeType;
import org.apache.qpid.server.configuration.IllegalConfigurationException;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
-import org.apache.qpid.server.configuration.XmlConfigurationUtilities.MyConfiguration;
import org.apache.qpid.server.exchange.ExchangeImpl;
import org.apache.qpid.server.message.MessageInstance;
import org.apache.qpid.server.message.ServerMessage;
@@ -75,8 +68,32 @@ public final class VirtualHostAdapter extends AbstractConfiguredObject<VirtualHo
put(TYPE, String.class);
put(STORE_PATH, String.class);
put(STORE_TYPE, String.class);
- put(CONFIG_PATH, String.class);
put(STATE, State.class);
+
+ put(QUEUE_ALERT_REPEAT_GAP, Long.class);
+ put(QUEUE_ALERT_THRESHOLD_MESSAGE_AGE, Long.class);
+ put(QUEUE_ALERT_THRESHOLD_MESSAGE_SIZE, Long.class);
+ put(QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_BYTES, Long.class);
+ put(QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES, Long.class);
+ put(QUEUE_DEAD_LETTER_QUEUE_ENABLED, Boolean.class);
+ put(QUEUE_MAXIMUM_DELIVERY_ATTEMPTS, Integer.class);
+ put(QUEUE_FLOW_CONTROL_SIZE_BYTES, Long.class);
+ put(QUEUE_FLOW_RESUME_SIZE_BYTES, Long.class);
+
+ put(HOUSEKEEPING_CHECK_PERIOD, Long.class);
+ put(STORE_TRANSACTION_IDLE_TIMEOUT_CLOSE, Long.class);
+ put(STORE_TRANSACTION_IDLE_TIMEOUT_WARN, Long.class);
+ put(STORE_TRANSACTION_OPEN_TIMEOUT_CLOSE, Long.class);
+ put(STORE_TRANSACTION_OPEN_TIMEOUT_WARN, Long.class);
+
+ put(CONFIG_STORE_TYPE, String.class);
+ put(CONFIG_STORE_PATH, String.class);
+
+ }});
+
+ @SuppressWarnings("serial")
+ private static final Map<String, Object> DEFAULTS = Collections.unmodifiableMap(new HashMap<String, Object>(){{
+ put(HOUSE_KEEPING_THREAD_COUNT, Runtime.getRuntime().availableProcessors());
}});
private org.apache.qpid.server.virtualhost.VirtualHost _virtualHost;
@@ -90,7 +107,7 @@ public final class VirtualHostAdapter extends AbstractConfiguredObject<VirtualHo
public VirtualHostAdapter(UUID id, Map<String, Object> attributes, Broker<?> broker, StatisticsGatherer brokerStatisticsGatherer, TaskExecutor taskExecutor)
{
- super(id, Collections.<String,Object>emptyMap(), MapValueConverter.convert(attributes, ATTRIBUTE_TYPES, false), taskExecutor, false);
+ super(id, DEFAULTS, MapValueConverter.convert(attributes, ATTRIBUTE_TYPES, false), taskExecutor, false);
_broker = broker;
_brokerStatisticsGatherer = brokerStatisticsGatherer;
validateAttributes();
@@ -104,43 +121,10 @@ public final class VirtualHostAdapter extends AbstractConfiguredObject<VirtualHo
{
throw new IllegalConfigurationException("Virtual host name must be specified");
}
-
- String configurationFile = (String) getAttribute(CONFIG_PATH);
- String type = (String) getAttribute(TYPE);
-
- boolean invalidAttributes = false;
- if (configurationFile == null)
- {
- if (type == null)
- {
- invalidAttributes = true;
- }
- else
- {
- validateAttributes(type);
- }
- }/*
- else
- {
- if (type != null)
- {
- invalidAttributes = true;
- }
-
- }*/
- if (invalidAttributes)
- {
- throw new IllegalConfigurationException("Please specify either the 'configPath' attribute or 'type' attributes");
- }
-
- // pre-load the configuration in order to validate
- try
- {
- createVirtualHostConfiguration(name);
- }
- catch(ConfigurationException e)
+ String type = getType();
+ if (type == null || "".equals(type.trim()))
{
- throw new IllegalConfigurationException("Failed to validate configuration", e);
+ throw new IllegalConfigurationException("Virtual host type must be specified");
}
}
@@ -682,95 +666,96 @@ public final class VirtualHostAdapter extends AbstractConfiguredObject<VirtualHo
{
return LifetimePolicy.PERMANENT;
}
- else if (_virtualHost != null)
+ else if(QUEUE_ALERT_REPEAT_GAP.equals(name))
{
- return getAttributeFromVirtualHostImplementation(name);
+ return getAttribute(QUEUE_ALERT_REPEAT_GAP, Broker.QUEUE_ALERT_REPEAT_GAP);
}
- return super.getAttribute(name);
- }
-
- private Object getAttributeFromVirtualHostImplementation(String name)
- {
- if(SUPPORTED_EXCHANGE_TYPES.equals(name))
+ else if(QUEUE_ALERT_THRESHOLD_MESSAGE_AGE.equals(name))
{
- List<String> types = new ArrayList<String>();
- for(@SuppressWarnings("rawtypes") ExchangeType type : _virtualHost.getExchangeTypes())
- {
- types.add(type.getType());
- }
- return Collections.unmodifiableCollection(types);
+ return getAttribute(QUEUE_ALERT_THRESHOLD_MESSAGE_AGE, Broker.QUEUE_ALERT_THRESHOLD_MESSAGE_AGE);
}
- else if(SUPPORTED_QUEUE_TYPES.equals(name))
+ else if(QUEUE_ALERT_THRESHOLD_MESSAGE_SIZE.equals(name))
{
- // TODO
+ return getAttribute(QUEUE_ALERT_THRESHOLD_MESSAGE_SIZE, Broker.QUEUE_ALERT_THRESHOLD_MESSAGE_SIZE);
}
- else if(QUEUE_DEAD_LETTER_QUEUE_ENABLED.equals(name))
+ else if(QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_BYTES.equals(name))
{
- return _virtualHost.getConfiguration().isDeadLetterQueueEnabled();
+ return getAttribute(QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_BYTES, Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_BYTES);
}
- else if(HOUSEKEEPING_CHECK_PERIOD.equals(name))
+ else if(QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES.equals(name))
+ {
+ return getAttribute(QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES, Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES);
+ }
+ else if(QUEUE_DEAD_LETTER_QUEUE_ENABLED.equals(name))
{
- return _virtualHost.getConfiguration().getHousekeepingCheckPeriod();
+ return getAttribute(QUEUE_DEAD_LETTER_QUEUE_ENABLED, Broker.QUEUE_DEAD_LETTER_QUEUE_ENABLED);
}
else if(QUEUE_MAXIMUM_DELIVERY_ATTEMPTS.equals(name))
{
- return _virtualHost.getConfiguration().getMaxDeliveryCount();
+ return getAttribute(QUEUE_MAXIMUM_DELIVERY_ATTEMPTS, Broker.QUEUE_MAXIMUM_DELIVERY_ATTEMPTS);
}
else if(QUEUE_FLOW_CONTROL_SIZE_BYTES.equals(name))
{
- return _virtualHost.getConfiguration().getCapacity();
+ return getAttribute(QUEUE_FLOW_CONTROL_SIZE_BYTES, Broker.QUEUE_FLOW_CONTROL_SIZE_BYTES);
}
else if(QUEUE_FLOW_RESUME_SIZE_BYTES.equals(name))
{
- return _virtualHost.getConfiguration().getFlowResumeCapacity();
- }
- else if(STORE_TYPE.equals(name))
- {
- return _virtualHost.getMessageStore().getStoreType();
+ return getAttribute(QUEUE_FLOW_RESUME_SIZE_BYTES, Broker.QUEUE_FLOW_CONTROL_RESUME_SIZE_BYTES);
}
- else if(STORE_PATH.equals(name))
+ else if(HOUSEKEEPING_CHECK_PERIOD.equals(name))
{
- return _virtualHost.getMessageStore().getStoreLocation();
+ return getAttribute(HOUSEKEEPING_CHECK_PERIOD, Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD);
}
else if(STORE_TRANSACTION_IDLE_TIMEOUT_CLOSE.equals(name))
{
- return _virtualHost.getConfiguration().getTransactionTimeoutIdleClose();
+ return getAttribute(STORE_TRANSACTION_IDLE_TIMEOUT_CLOSE, Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_CLOSE);
}
else if(STORE_TRANSACTION_IDLE_TIMEOUT_WARN.equals(name))
{
- return _virtualHost.getConfiguration().getTransactionTimeoutIdleWarn();
+ return getAttribute(STORE_TRANSACTION_IDLE_TIMEOUT_WARN, Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_WARN);
}
else if(STORE_TRANSACTION_OPEN_TIMEOUT_CLOSE.equals(name))
{
- return _virtualHost.getConfiguration().getTransactionTimeoutOpenClose();
+ return getAttribute(STORE_TRANSACTION_OPEN_TIMEOUT_CLOSE, Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_CLOSE);
}
else if(STORE_TRANSACTION_OPEN_TIMEOUT_WARN.equals(name))
{
- return _virtualHost.getConfiguration().getTransactionTimeoutOpenWarn();
- }
- else if(QUEUE_ALERT_REPEAT_GAP.equals(name))
- {
- return _virtualHost.getConfiguration().getMinimumAlertRepeatGap();
- }
- else if(QUEUE_ALERT_THRESHOLD_MESSAGE_AGE.equals(name))
- {
- return _virtualHost.getConfiguration().getMaximumMessageAge();
- }
- else if(QUEUE_ALERT_THRESHOLD_MESSAGE_SIZE.equals(name))
- {
- return _virtualHost.getConfiguration().getMaximumMessageSize();
- }
- else if(QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_BYTES.equals(name))
- {
- return _virtualHost.getConfiguration().getMaximumQueueDepth();
+ return getAttribute(STORE_TRANSACTION_OPEN_TIMEOUT_CLOSE, Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_WARN);
}
- else if(QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES.equals(name))
+ else if (_virtualHost != null)
{
- return _virtualHost.getConfiguration().getMaximumMessageCount();
+ if(SUPPORTED_EXCHANGE_TYPES.equals(name))
+ {
+ List<String> types = new ArrayList<String>();
+ for(@SuppressWarnings("rawtypes") ExchangeType type : _virtualHost.getExchangeTypes())
+ {
+ types.add(type.getType());
+ }
+ return Collections.unmodifiableCollection(types);
+ }
+ else if(SUPPORTED_QUEUE_TYPES.equals(name))
+ {
+ // TODO
+ }
+ else if(STORE_TYPE.equals(name))
+ {
+ return _virtualHost.getMessageStore().getStoreType();
+ }
+ else if(STORE_PATH.equals(name))
+ {
+ return _virtualHost.getMessageStore().getStoreLocation();
+ }
}
return super.getAttribute(name);
}
+
+ Object getAttribute(String name, String brokerAttributeName)
+ {
+ return getAttribute(name, _broker, brokerAttributeName);
+ }
+
+
@Override
public Collection<String> getAttributeNames()
{
@@ -807,31 +792,31 @@ public final class VirtualHostAdapter extends AbstractConfiguredObject<VirtualHo
@Override
public boolean isQueue_deadLetterQueueEnabled()
{
- return _virtualHost.getConfiguration().isDeadLetterQueueEnabled();
+ return (Boolean)getAttribute(VirtualHost.QUEUE_DEAD_LETTER_QUEUE_ENABLED);
}
@Override
public long getHousekeepingCheckPeriod()
{
- return _virtualHost.getConfiguration().getHousekeepingCheckPeriod();
+ return (Long)getAttribute(VirtualHost.HOUSEKEEPING_CHECK_PERIOD);
}
@Override
public int getQueue_maximumDeliveryAttempts()
{
- return _virtualHost.getConfiguration().getMaxDeliveryCount();
+ return (Integer)getAttribute(VirtualHost.QUEUE_MAXIMUM_DELIVERY_ATTEMPTS);
}
@Override
public long getQueue_flowControlSizeBytes()
{
- return _virtualHost.getConfiguration().getCapacity();
+ return (Long)getAttribute(VirtualHost.QUEUE_FLOW_CONTROL_SIZE_BYTES);
}
@Override
public long getQueue_flowResumeSizeBytes()
{
- return _virtualHost.getConfiguration().getFlowResumeCapacity();
+ return (Long)getAttribute(VirtualHost.QUEUE_FLOW_RESUME_SIZE_BYTES);
}
@Override
@@ -843,7 +828,7 @@ public final class VirtualHostAdapter extends AbstractConfiguredObject<VirtualHo
@Override
public String getConfigStorePath()
{
- return (String) getAttribute(CONFIG_PATH);
+ return (String) getAttribute(CONFIG_STORE_PATH);
}
@Override
@@ -861,61 +846,55 @@ public final class VirtualHostAdapter extends AbstractConfiguredObject<VirtualHo
@Override
public long getStoreTransactionIdleTimeoutClose()
{
- return _virtualHost.getConfiguration().getTransactionTimeoutIdleClose();
+ return (Long)getAttribute(VirtualHost.STORE_TRANSACTION_IDLE_TIMEOUT_CLOSE);
}
@Override
public long getStoreTransactionIdleTimeoutWarn()
{
- return _virtualHost.getConfiguration().getTransactionTimeoutIdleWarn();
+ return (Long)getAttribute(VirtualHost.STORE_TRANSACTION_IDLE_TIMEOUT_WARN);
}
@Override
public long getStoreTransactionOpenTimeoutClose()
{
- return _virtualHost.getConfiguration().getTransactionTimeoutOpenClose();
+ return (Long)getAttribute(VirtualHost.STORE_TRANSACTION_OPEN_TIMEOUT_CLOSE);
}
@Override
public long getStoreTransactionOpenTimeoutWarn()
{
- return _virtualHost.getConfiguration().getTransactionTimeoutOpenWarn();
+ return (Long)getAttribute(VirtualHost.STORE_TRANSACTION_OPEN_TIMEOUT_WARN);
}
@Override
public long getQueue_alertRepeatGap()
{
- return _virtualHost.getConfiguration().getMinimumAlertRepeatGap();
+ return (Long)getAttribute(VirtualHost.QUEUE_ALERT_REPEAT_GAP);
}
@Override
public long getQueue_alertThresholdMessageAge()
{
- return _virtualHost.getConfiguration().getMaximumMessageAge();
+ return (Long)getAttribute(VirtualHost.QUEUE_ALERT_THRESHOLD_MESSAGE_AGE);
}
@Override
public long getQueue_alertThresholdMessageSize()
{
- return _virtualHost.getConfiguration().getMaximumMessageSize();
+ return (Long)getAttribute(VirtualHost.QUEUE_ALERT_THRESHOLD_MESSAGE_SIZE);
}
@Override
public long getQueue_alertThresholdQueueDepthBytes()
{
- return _virtualHost.getConfiguration().getMaximumQueueDepth();
+ return (Long)getAttribute(VirtualHost.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_BYTES);
}
@Override
public long getQueue_alertThresholdQueueDepthMessages()
{
- return _virtualHost.getConfiguration().getMaximumMessageCount();
- }
-
- @Override
- public String getConfigPath()
- {
- return (String) getAttribute(CONFIG_PATH);
+ return (Long)getAttribute(VirtualHost.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES);
}
@Override
@@ -960,6 +939,17 @@ public final class VirtualHostAdapter extends AbstractConfiguredObject<VirtualHo
return _virtualHost.getMessageDeliveryStatistics().getTotal();
}
+ @Override
+ public String getSecurityAcl()
+ {
+ return (String)getAttribute(SECURITY_ACL);
+ }
+
+ @Override
+ public int getHouseKeepingThreadCount()
+ {
+ return (Integer)getAttribute(HOUSE_KEEPING_THREAD_COUNT);
+ }
@Override
protected boolean setState(State currentState, State desiredState)
@@ -1041,8 +1031,7 @@ public final class VirtualHostAdapter extends AbstractConfiguredObject<VirtualHo
String virtualHostName = getName();
try
{
- VirtualHostConfiguration configuration = createVirtualHostConfiguration(virtualHostName);
- String type = configuration.getType();
+ String type = (String) getAttribute(TYPE);
final VirtualHostFactory factory = VirtualHostFactory.FACTORIES.get(type);
if(factory == null)
{
@@ -1053,11 +1042,10 @@ public final class VirtualHostAdapter extends AbstractConfiguredObject<VirtualHo
_virtualHost = factory.createVirtualHost(_broker.getVirtualHostRegistry(),
_brokerStatisticsGatherer,
_broker.getSecurityManager(),
- configuration,
this);
}
}
- catch (ConfigurationException e)
+ catch (Exception e)
{
throw new ServerScopedRuntimeException("Failed to create virtual host " + virtualHostName, e);
}
@@ -1078,53 +1066,6 @@ public final class VirtualHostAdapter extends AbstractConfiguredObject<VirtualHo
}
}
- private VirtualHostConfiguration createVirtualHostConfiguration(String virtualHostName) throws ConfigurationException
- {
- VirtualHostConfiguration configuration;
- String configurationFile = (String)getAttribute(CONFIG_PATH);
- if (configurationFile == null)
- {
- final MyConfiguration basicConfiguration = new MyConfiguration();
- PropertiesConfiguration config = new PropertiesConfiguration();
- final String type = (String) getAttribute(TYPE);
- config.addProperty("type", type);
- VirtualHostFactory factory = VirtualHostFactory.FACTORIES.get(type);
- if(factory != null)
- {
- for(Map.Entry<String,Object> entry : factory.createVirtualHostConfiguration(this).entrySet())
- {
- config.addProperty(entry.getKey(), entry.getValue());
- }
- }
- basicConfiguration.addConfiguration(config);
-
- CompositeConfiguration compositeConfiguration = new CompositeConfiguration();
- compositeConfiguration.addConfiguration(new SystemConfiguration());
- compositeConfiguration.addConfiguration(basicConfiguration);
- configuration = new VirtualHostConfiguration(virtualHostName, compositeConfiguration , _broker);
- }
- else
- {
- if (!new File(configurationFile).exists())
- {
- throw new IllegalConfigurationException("Configuration file '" + configurationFile + "' does not exist");
- }
- configuration = new VirtualHostConfiguration(virtualHostName, new File(configurationFile) , _broker);
- String type = configuration.getType();
- changeAttribute(TYPE,null,type);
- VirtualHostFactory factory = VirtualHostFactory.FACTORIES.get(type);
- if(factory != null)
- {
- for(Map.Entry<String,Object> entry : factory.convertVirtualHostConfiguration(configuration.getConfig()).entrySet())
- {
- changeAttribute(entry.getKey(), getAttribute(entry.getKey()), entry.getValue());
- }
- }
-
- }
- return configuration;
- }
-
@Override
public SecurityManager getSecurityManager()
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/DurableConfigurationStoreFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/DurableConfigurationStoreFactory.java
index 94a029ced3..b83222f798 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/DurableConfigurationStoreFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/DurableConfigurationStoreFactory.java
@@ -21,9 +21,7 @@
package org.apache.qpid.server.plugin;
import java.util.Map;
-import org.apache.commons.configuration.Configuration;
import org.apache.qpid.server.store.DurableConfigurationStore;
-import org.apache.qpid.server.store.MessageStore;
public interface DurableConfigurationStoreFactory extends Pluggable
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/JDBCConnectionProviderFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/JDBCConnectionProviderFactory.java
index 12fb9224bb..546f2fa05d 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/JDBCConnectionProviderFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/JDBCConnectionProviderFactory.java
@@ -25,7 +25,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
-import org.apache.commons.configuration.Configuration;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.store.jdbc.ConnectionProvider;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/MessageStoreFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/MessageStoreFactory.java
index 81404dcba8..779dd06e9e 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/MessageStoreFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/MessageStoreFactory.java
@@ -21,7 +21,6 @@
package org.apache.qpid.server.plugin;
import java.util.Map;
-import org.apache.commons.configuration.Configuration;
import org.apache.qpid.server.store.MessageStore;
public interface MessageStoreFactory extends Pluggable
@@ -30,7 +29,5 @@ public interface MessageStoreFactory extends Pluggable
MessageStore createMessageStore();
- public Map<String, Object> convertStoreConfiguration(Configuration configuration);
-
void validateAttributes(Map<String, Object> attributes);
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/VirtualHostFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/VirtualHostFactory.java
index a073c89a1b..8c5a39797a 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/VirtualHostFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/VirtualHostFactory.java
@@ -25,8 +25,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
-import org.apache.commons.configuration.Configuration;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.model.adapter.VirtualHostAdapter;
import org.apache.qpid.server.security.SecurityManager;
import org.apache.qpid.server.stats.StatisticsGatherer;
@@ -40,15 +38,12 @@ public interface VirtualHostFactory extends Pluggable
VirtualHost createVirtualHost(VirtualHostRegistry virtualHostRegistry,
StatisticsGatherer brokerStatisticsGatherer,
SecurityManager parentSecurityManager,
- VirtualHostConfiguration hostConfig,
org.apache.qpid.server.model.VirtualHost virtualHost);
void validateAttributes(Map<String, Object> attributes);
Map<String, Object> createVirtualHostConfiguration(VirtualHostAdapter virtualHostAdapter);
- Map<String,Object> convertVirtualHostConfiguration(Configuration configuration);
-
static final class TYPES
{
private TYPES()
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java
index dd82dfd681..3098572e39 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java
@@ -26,11 +26,9 @@ import java.util.UUID;
import org.apache.qpid.server.exchange.AMQUnknownExchangeType;
import org.apache.qpid.server.exchange.ExchangeImpl;
-import org.apache.qpid.server.model.ExclusivityPolicy;
import org.apache.qpid.server.model.LifetimePolicy;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.configuration.BrokerProperties;
-import org.apache.qpid.server.configuration.QueueConfiguration;
import org.apache.qpid.server.exchange.DefaultExchangeFactory;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.model.UUIDGenerator;
@@ -74,50 +72,10 @@ public class AMQQueueFactory implements QueueFactory
return createOrRestoreQueue(attributes, true);
}
- private AMQQueue createOrRestoreQueue(Map<String, Object> attributes,
- boolean createInStore)
+ private AMQQueue createOrRestoreQueue(Map<String, Object> attributes, boolean createInStore)
{
-
-
String queueName = MapValueConverter.getStringAttribute(Queue.NAME,attributes);
-
- QueueConfiguration config = _virtualHost.getConfiguration().getQueueConfiguration(queueName);
-
- if (!attributes.containsKey(Queue.ALERT_THRESHOLD_MESSAGE_AGE) && config.getMaximumMessageAge() != 0)
- {
- attributes.put(Queue.ALERT_THRESHOLD_MESSAGE_AGE, config.getMaximumMessageAge());
- }
- if (!attributes.containsKey(Queue.ALERT_THRESHOLD_QUEUE_DEPTH_BYTES) && config.getMaximumQueueDepth() != 0)
- {
- attributes.put(Queue.ALERT_THRESHOLD_QUEUE_DEPTH_BYTES, config.getMaximumQueueDepth());
- }
- if (!attributes.containsKey(Queue.ALERT_THRESHOLD_MESSAGE_SIZE) && config.getMaximumMessageSize() != 0)
- {
- attributes.put(Queue.ALERT_THRESHOLD_MESSAGE_SIZE, config.getMaximumMessageSize());
- }
- if (!attributes.containsKey(Queue.ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES) && config.getMaximumMessageCount() != 0)
- {
- attributes.put(Queue.ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES, config.getMaximumMessageCount());
- }
- if (!attributes.containsKey(Queue.ALERT_REPEAT_GAP) && config.getMinimumAlertRepeatGap() != 0)
- {
- attributes.put(Queue.ALERT_REPEAT_GAP, config.getMinimumAlertRepeatGap());
- }
- if (config.getMaxDeliveryCount() != 0 && !attributes.containsKey(Queue.MAXIMUM_DELIVERY_ATTEMPTS))
- {
- attributes.put(Queue.MAXIMUM_DELIVERY_ATTEMPTS, config.getMaxDeliveryCount());
- }
- if (!attributes.containsKey(Queue.QUEUE_FLOW_CONTROL_SIZE_BYTES) && config.getCapacity() != 0)
- {
- attributes.put(Queue.QUEUE_FLOW_CONTROL_SIZE_BYTES, config.getCapacity());
- }
- if (!attributes.containsKey(Queue.QUEUE_FLOW_RESUME_SIZE_BYTES) && config.getFlowResumeCapacity() != 0)
- {
- attributes.put(Queue.QUEUE_FLOW_RESUME_SIZE_BYTES, config.getFlowResumeCapacity());
- }
-
-
- boolean createDLQ = createDLQ(attributes, config);
+ boolean createDLQ = shouldCreateDLQ(attributes, _virtualHost.getDefaultDeadLetterQueueEnabled());
if (createDLQ)
{
validateDLNames(queueName);
@@ -259,30 +217,7 @@ public class AMQQueueFactory implements QueueFactory
queue.setAlternateExchange(dlExchange);
}
- public AMQQueue createAMQQueueImpl(QueueConfiguration config)
- {
-
- Map<String, Object> arguments = createQueueAttributesFromConfig(_virtualHost, config);
-
- AMQQueue q = createOrRestoreQueue(arguments, false);
- return q;
- }
-
- /**
- * Validates DLQ and DLE names
- * <p>
- * DLQ name and DLQ exchange name need to be validated in order to keep
- * integrity in cases when queue name passes validation check but DLQ name
- * or DL exchange name fails to pass it. Otherwise, we might have situations
- * when queue is created but DL exchange or/and DLQ creation fail.
- * <p>
- *
- * @param name
- * queue name
- * @throws IllegalArgumentException
- * thrown if length of queue name or exchange name exceed 255
- */
- protected static void validateDLNames(String name)
+ private static void validateDLNames(String name)
{
// check if DLQ name and DLQ exchange name do not exceed 255
String exchangeName = getDeadLetterExchangeName(name);
@@ -299,16 +234,7 @@ public class AMQQueueFactory implements QueueFactory
}
}
- /**
- * Checks if DLQ is enabled for the queue.
- *
- * @param arguments
- * queue arguments
- * @param qConfig
- * queue configuration
- * @return true if DLQ enabled
- */
- protected static boolean createDLQ(Map<String, Object> arguments, QueueConfiguration qConfig)
+ private static boolean shouldCreateDLQ(Map<String, Object> arguments, boolean virtualHostDefaultDeadLetterQueueEnabled)
{
boolean autoDelete = MapValueConverter.getEnumAttribute(LifetimePolicy.class,
Queue.LIFETIME_POLICY,
@@ -320,7 +246,7 @@ public class AMQQueueFactory implements QueueFactory
{
boolean dlqArgumentPresent = arguments != null
&& arguments.containsKey(Queue.CREATE_DLQ_ON_CREATION);
- if (dlqArgumentPresent || qConfig.isDeadLetterQueueEnabled())
+ if (dlqArgumentPresent)
{
boolean dlqEnabled = true;
if (dlqArgumentPresent)
@@ -329,89 +255,21 @@ public class AMQQueueFactory implements QueueFactory
dlqEnabled = (argument instanceof Boolean && ((Boolean)argument).booleanValue())
|| (argument instanceof String && Boolean.parseBoolean(argument.toString()));
}
- return dlqEnabled ;
+ return dlqEnabled;
}
+ return virtualHostDefaultDeadLetterQueueEnabled;
}
return false;
}
- /**
- * Generates a dead letter queue name for a given queue name
- *
- * @param name
- * queue name
- * @return DLQ name
- */
- protected static String getDeadLetterQueueName(String name)
+ private static String getDeadLetterQueueName(String name)
{
return name + System.getProperty(BrokerProperties.PROPERTY_DEAD_LETTER_QUEUE_SUFFIX, DEFAULT_DLQ_NAME_SUFFIX);
}
- /**
- * Generates a dead letter exchange name for a given queue name
- *
- * @param name
- * queue name
- * @return DL exchange name
- */
- protected static String getDeadLetterExchangeName(String name)
+ private static String getDeadLetterExchangeName(String name)
{
return name + System.getProperty(BrokerProperties.PROPERTY_DEAD_LETTER_EXCHANGE_SUFFIX, DefaultExchangeFactory.DEFAULT_DLE_NAME_SUFFIX);
}
- private static Map<String, Object> createQueueAttributesFromConfig(final VirtualHost virtualHost,
- QueueConfiguration config)
- {
- Map<String,Object> attributes = new HashMap<String,Object>();
-
- if(config.getArguments() != null && !config.getArguments().isEmpty())
- {
- attributes.putAll(QueueArgumentsConverter.convertWireArgsToModel(new HashMap<String, Object>(config.getArguments())));
- }
-
- if(config.isLVQ() || config.getLVQKey() != null)
- {
- attributes.put(Queue.LVQ_KEY,
- config.getLVQKey() == null ? ConflationQueue.DEFAULT_LVQ_KEY : config.getLVQKey());
- }
- else if (config.getPriority() || config.getPriorities() > 0)
- {
- attributes.put(Queue.PRIORITIES, config.getPriorities() < 0 ? 10 : config.getPriorities());
- }
- else if (config.getQueueSortKey() != null && !"".equals(config.getQueueSortKey()))
- {
- attributes.put(Queue.SORT_KEY, config.getQueueSortKey());
- }
-
- if (!config.getAutoDelete() && config.isDeadLetterQueueEnabled())
- {
- attributes.put(Queue.CREATE_DLQ_ON_CREATION, true);
- }
-
- if (config.getDescription() != null && !"".equals(config.getDescription()))
- {
- attributes.put(Queue.DESCRIPTION, config.getDescription());
- }
-
- attributes.put(Queue.DURABLE, config.getDurable());
- attributes.put(Queue.LIFETIME_POLICY,
- config.getAutoDelete() ? LifetimePolicy.DELETE_ON_NO_OUTBOUND_LINKS : LifetimePolicy.PERMANENT);
- if(config.getExclusive())
- {
- attributes.put(Queue.EXCLUSIVE, ExclusivityPolicy.CONTAINER);
- }
- if(config.getOwner() != null)
- {
- attributes.put(Queue.OWNER, config.getOwner());
- }
-
- attributes.put(Queue.NAME, config.getName());
-
- // we need queues that are defined in config to have deterministic ids.
- attributes.put(Queue.ID, UUIDGenerator.generateQueueUUID(config.getName(), virtualHost.getName()));
-
-
- return attributes;
- }
-
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
index a4719f6058..3ffa34f4fa 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
@@ -24,7 +24,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
-import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.BlockingQueue;
@@ -32,7 +31,6 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.log4j.Logger;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.configuration.updater.TaskExecutor;
@@ -41,9 +39,6 @@ import org.apache.qpid.server.exchange.ExchangeImpl;
import org.apache.qpid.server.logging.EventLogger;
import org.apache.qpid.server.model.LifetimePolicy;
import org.apache.qpid.server.model.Queue;
-import org.apache.qpid.server.configuration.ExchangeConfiguration;
-import org.apache.qpid.server.configuration.QueueConfiguration;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.connection.ConnectionRegistry;
import org.apache.qpid.server.connection.IConnectionRegistry;
import org.apache.qpid.server.exchange.DefaultExchangeFactory;
@@ -75,7 +70,6 @@ import org.apache.qpid.server.store.Event;
import org.apache.qpid.server.store.EventListener;
import org.apache.qpid.server.txn.DtxRegistry;
import org.apache.qpid.server.util.MapValueConverter;
-import org.apache.qpid.server.util.ServerScopedRuntimeException;
public abstract class AbstractVirtualHost implements VirtualHost, IConnectionRegistry.RegistryChangeListener, EventListener
{
@@ -97,8 +91,6 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
private final SecurityManager _securityManager;
- private final VirtualHostConfiguration _vhostConfig;
-
private final QueueRegistry _queueRegistry;
private final ExchangeRegistry _exchangeRegistry;
@@ -131,23 +123,11 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
public AbstractVirtualHost(VirtualHostRegistry virtualHostRegistry,
StatisticsGatherer brokerStatisticsGatherer,
SecurityManager parentSecurityManager,
- VirtualHostConfiguration hostConfig,
org.apache.qpid.server.model.VirtualHost virtualHost)
{
- if (hostConfig == null)
- {
- throw new IllegalArgumentException("HostConfig cannot be null");
- }
-
- if (hostConfig.getName() == null || hostConfig.getName().length() == 0)
- {
- throw new IllegalArgumentException("Illegal name (" + hostConfig.getName() + ") for virtualhost.");
- }
-
_virtualHostRegistry = virtualHostRegistry;
_brokerStatisticsGatherer = brokerStatisticsGatherer;
- _vhostConfig = hostConfig;
- _name = _vhostConfig.getName();
+ _name = virtualHost.getName();
_dtxRegistry = new DtxRegistry();
_model = virtualHost;
_eventLogger = virtualHostRegistry.getEventLogger();
@@ -156,12 +136,12 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
_eventLogger.message(VirtualHostMessages.CREATED(_name));
- _securityManager = new SecurityManager(parentSecurityManager, _vhostConfig.getConfig().getString("security.acl"), _name);
+ _securityManager = new SecurityManager(parentSecurityManager, virtualHost.getSecurityAcl(), _name);
_connectionRegistry = new ConnectionRegistry();
_connectionRegistry.addRegistryChangeListener(this);
- _houseKeepingTasks = new ScheduledThreadPoolExecutor(_vhostConfig.getHouseKeepingThreadCount());
+ _houseKeepingTasks = new ScheduledThreadPoolExecutor(virtualHost.getHouseKeepingThreadCount());
_queueRegistry = new DefaultQueueRegistry(this);
@@ -176,7 +156,7 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
initialiseStatistics();
- initialiseStorage(hostConfig, virtualHost);
+ initialiseStorage(virtualHost);
getMessageStore().addEventListener(this, Event.PERSISTENT_MESSAGE_SIZE_OVERFULL);
getMessageStore().addEventListener(this, Event.PERSISTENT_MESSAGE_SIZE_UNDERFULL);
@@ -192,19 +172,13 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
}
}
- abstract protected void initialiseStorage(VirtualHostConfiguration hostConfig,
- org.apache.qpid.server.model.VirtualHost virtualHost);
+ abstract protected void initialiseStorage(org.apache.qpid.server.model.VirtualHost<?> virtualHost);
public IConnectionRegistry getConnectionRegistry()
{
return _connectionRegistry;
}
- public VirtualHostConfiguration getConfiguration()
- {
- return _vhostConfig;
- }
-
public UUID getId()
{
return _id;
@@ -306,135 +280,11 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
}
- protected void initialiseModel(VirtualHostConfiguration config)
+ protected void initialiseModel()
{
- _logger.debug("Loading configuration for virtualhost: " + config.getName());
-
+ _logger.debug("Loading configuration for virtualhost: " + _model.getName());
_exchangeRegistry.initialise(_exchangeFactory);
-
- List<String> exchangeNames = config.getExchanges();
-
- for (String exchangeName : exchangeNames)
- {
- try
- {
- configureExchange(config.getExchangeConfiguration(exchangeName));
- }
- catch (UnknownExchangeException e)
- {
- throw new ServerScopedRuntimeException("Could not configure exchange " + exchangeName, e);
- }
- catch (ReservedExchangeNameException e)
- {
- throw new ServerScopedRuntimeException("Could not configure exchange " + exchangeName, e);
- }
- catch (AMQUnknownExchangeType e)
- {
- throw new ServerScopedRuntimeException("Could not configure exchange " + exchangeName, e);
- }
- }
-
- String[] queueNames = config.getQueueNames();
-
- for (Object queueNameObj : queueNames)
- {
- String queueName = String.valueOf(queueNameObj);
- try
- {
- configureQueue(config.getQueueConfiguration(queueName));
- }
- catch (ConfigurationException e)
- {
- throw new ServerScopedRuntimeException("Could not configure queue " + queueName, e);
- }
- }
- }
-
- private void configureExchange(ExchangeConfiguration exchangeConfiguration)
- throws UnknownExchangeException, ReservedExchangeNameException,
- AMQUnknownExchangeType
- {
- boolean durable = exchangeConfiguration.getDurable();
- boolean autodelete = exchangeConfiguration.getAutoDelete();
- try
- {
- Map<String,Object> attributes = new HashMap<String, Object>();
-
- attributes.put(org.apache.qpid.server.model.Exchange.ID, null);
- attributes.put(org.apache.qpid.server.model.Exchange.NAME, exchangeConfiguration.getName());
- attributes.put(org.apache.qpid.server.model.Exchange.TYPE, exchangeConfiguration.getType());
- attributes.put(org.apache.qpid.server.model.Exchange.DURABLE, durable);
- attributes.put(org.apache.qpid.server.model.Exchange.LIFETIME_POLICY,
- autodelete ? LifetimePolicy.DELETE_ON_NO_LINKS : LifetimePolicy.PERMANENT);
- attributes.put(org.apache.qpid.server.model.Exchange.ALTERNATE_EXCHANGE, null);
- ExchangeImpl newExchange = createExchange(attributes);
- }
- catch(ExchangeExistsException e)
- {
- _logger.info("Exchange " + exchangeConfiguration.getName() + " already defined. Configuration in XML file ignored");
- }
-
- }
-
- private void configureQueue(QueueConfiguration queueConfiguration)
- throws ConfigurationException
- {
- AMQQueue queue = _queueFactory.createAMQQueueImpl(queueConfiguration);
- String queueName = queue.getName();
-
- if (queue.isDurable())
- {
- DurableConfigurationStoreHelper.createQueue(getDurableConfigurationStore(), queue);
- }
-
- //get the exchange name (returns empty String if none was specified)
- String exchangeName = queueConfiguration.getExchange();
-
-
- if(ExchangeDefaults.DEFAULT_EXCHANGE_NAME.equals(exchangeName))
- {
- //get routing keys in configuration (returns empty list if none are defined)
- List<?> routingKeys = queueConfiguration.getRoutingKeys();
- if(!(routingKeys.isEmpty() || (routingKeys.size()==1 && routingKeys.contains(queueName))))
- {
- throw new ConfigurationException("Attempt to bind queue '" + queueName + "' with binding key(s) " +
- routingKeys + " without specifying an exchange");
- }
- }
- else
- {
- ExchangeImpl exchange = _exchangeRegistry.getExchange(exchangeName);
- if (exchange == null)
- {
- throw new ConfigurationException("Attempt to bind queue '" + queueName + "' to unknown exchange:" + exchangeName);
- }
-
- //get routing keys in configuration (returns empty list if none are defined)
- List<?> routingKeys = queueConfiguration.getRoutingKeys();
-
- for (Object routingKeyNameObj : routingKeys)
- {
- String routingKey = String.valueOf(routingKeyNameObj);
-
- configureBinding(queue, exchange, routingKey, (Map) queueConfiguration.getBindingArguments(routingKey));
- }
-
- if (!routingKeys.contains(queueName))
- {
- //bind the queue to the named exchange using its name
- configureBinding(queue, exchange, queueName, null);
- }
- }
- }
-
- private void configureBinding(AMQQueue queue, ExchangeImpl exchange, String routingKey, Map<String,Object> arguments)
- {
- if (_logger.isInfoEnabled())
- {
- _logger.info("Binding queue:" + queue + " with routing key '" + routingKey + "' to exchange:" + exchange.getName());
- }
- exchange.addBinding(routingKey, queue, arguments);
}
public String getName()
@@ -907,7 +757,7 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
try
{
- initialiseHouseKeeping(_vhostConfig.getHousekeepingCheckPeriod());
+ initialiseHouseKeeping(_model.getHousekeepingCheckPeriod());
finalState = State.ACTIVE;
}
finally
@@ -981,10 +831,10 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
}
try
{
- session.checkTransactionStatus(_vhostConfig.getTransactionTimeoutOpenWarn(),
- _vhostConfig.getTransactionTimeoutOpenClose(),
- _vhostConfig.getTransactionTimeoutIdleWarn(),
- _vhostConfig.getTransactionTimeoutIdleClose());
+ session.checkTransactionStatus(_model.getStoreTransactionOpenTimeoutWarn(),
+ _model.getStoreTransactionOpenTimeoutClose(),
+ _model.getStoreTransactionIdleTimeoutWarn(),
+ _model.getStoreTransactionIdleTimeoutClose());
} catch (Exception e)
{
_logger.error("Exception in housekeeping for connection: " + connection.toString(), e);
@@ -1039,49 +889,55 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
@Override
public long getDefaultAlertThresholdMessageAge()
{
- return getConfiguration().getMaximumMessageAge();
+ return _model.getQueue_alertThresholdMessageAge();
}
@Override
public long getDefaultAlertThresholdMessageSize()
{
- return getConfiguration().getMaximumMessageSize();
+ return _model.getQueue_alertThresholdMessageSize();
}
@Override
public long getDefaultAlertThresholdQueueDepthMessages()
{
- return getConfiguration().getMaximumMessageCount();
+ return _model.getQueue_alertThresholdQueueDepthMessages();
}
@Override
public long getDefaultAlertThresholdQueueDepthBytes()
{
- return getConfiguration().getMaximumQueueDepth();
+ return _model.getQueue_alertThresholdQueueDepthBytes();
}
@Override
public long getDefaultAlertRepeatGap()
{
- return getConfiguration().getMinimumAlertRepeatGap();
+ return _model.getQueue_alertRepeatGap();
}
@Override
public long getDefaultQueueFlowControlSizeBytes()
{
- return getConfiguration().getCapacity();
+ return _model.getQueue_flowControlSizeBytes();
}
@Override
public long getDefaultQueueFlowResumeSizeBytes()
{
- return getConfiguration().getFlowResumeCapacity();
+ return _model.getQueue_flowResumeSizeBytes();
}
@Override
public int getDefaultMaximumDeliveryAttempts()
{
- return getConfiguration().getMaxDeliveryCount();
+ return _model.getQueue_maximumDeliveryAttempts();
+ }
+
+ @Override
+ public boolean getDefaultDeadLetterQueueEnabled()
+ {
+ return _model.isQueue_deadLetterQueueEnabled();
}
@Override
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java
index 9b576bf41f..f1bfb39eb8 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java
@@ -19,7 +19,6 @@ package org.apache.qpid.server.virtualhost;/*
*
*/
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.logging.subjects.MessageStoreLogSubject;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.stats.StatisticsGatherer;
@@ -29,7 +28,6 @@ import org.apache.qpid.server.store.DurableConfigurationStoreCreator;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.MessageStoreCreator;
import org.apache.qpid.server.store.OperationalLoggingListener;
-import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class StandardVirtualHost extends AbstractVirtualHost
{
@@ -40,54 +38,19 @@ public class StandardVirtualHost extends AbstractVirtualHost
StandardVirtualHost(VirtualHostRegistry virtualHostRegistry,
StatisticsGatherer brokerStatisticsGatherer,
org.apache.qpid.server.security.SecurityManager parentSecurityManager,
- VirtualHostConfiguration hostConfig, VirtualHost virtualHost)
+ VirtualHost virtualHost)
{
- super(virtualHostRegistry, brokerStatisticsGatherer, parentSecurityManager, hostConfig, virtualHost);
+ super(virtualHostRegistry, brokerStatisticsGatherer, parentSecurityManager, virtualHost);
}
- private MessageStore initialiseMessageStore(VirtualHostConfiguration hostConfig, VirtualHost virtualHost)
+ private MessageStore initialiseMessageStore(VirtualHost virtualHost)
{
final Object storeTypeAttr = virtualHost.getAttribute(VirtualHost.STORE_TYPE);
String storeType = storeTypeAttr == null ? null : String.valueOf(storeTypeAttr);
- MessageStore messageStore = null;
- if (storeType == null)
- {
- try
- {
- final Class<?> clazz = Class.forName(hostConfig.getMessageStoreClass());
- final Object o = clazz.newInstance();
-
- if (!(o instanceof MessageStore))
- {
- throw new ClassCastException(clazz + " does not implement " + MessageStore.class);
- }
-
- messageStore = (MessageStore) o;
- }
- catch (ClassNotFoundException e)
- {
- throw new ServerScopedRuntimeException("Failed to fina virtual host message store implementation, " +
- "check the classpath and the configuration", e);
- }
- catch (InstantiationException e)
- {
- throw new ServerScopedRuntimeException("Failed to initialise virtual host store, " +
- "check the configuration", e);
- }
- catch (IllegalAccessException e)
- {
- throw new ServerScopedRuntimeException("Failed to initialise virtual host store, " +
- "check the configuration", e);
- }
- }
- else
- {
- messageStore = new MessageStoreCreator().createMessageStore(storeType);
- }
+ MessageStore messageStore = new MessageStoreCreator().createMessageStore(storeType);
- final
MessageStoreLogSubject
storeLogSubject = new MessageStoreLogSubject(getName(), messageStore.getClass().getSimpleName());
OperationalLoggingListener.listen(messageStore, storeLogSubject, getEventLogger());
@@ -118,9 +81,9 @@ public class StandardVirtualHost extends AbstractVirtualHost
}
- protected void initialiseStorage(VirtualHostConfiguration hostConfig, VirtualHost virtualHost)
+ protected void initialiseStorage(VirtualHost virtualHost)
{
- _messageStore = initialiseMessageStore(hostConfig, virtualHost);
+ _messageStore = initialiseMessageStore(virtualHost);
_durableConfigurationStore = initialiseConfigurationStore(virtualHost);
@@ -132,7 +95,7 @@ public class StandardVirtualHost extends AbstractVirtualHost
VirtualHostConfigRecoveryHandler recoveryHandler = new VirtualHostConfigRecoveryHandler(this);
_messageStore.configureMessageStore(virtualHost, recoveryHandler, recoveryHandler);
- initialiseModel(hostConfig);
+ initialiseModel();
_messageStore.activate();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java
index c28bcb977f..5ae3623baa 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java
@@ -21,13 +21,10 @@ package org.apache.qpid.server.virtualhost;/*
import java.util.LinkedHashMap;
import java.util.Map;
-import org.apache.commons.configuration.Configuration;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.model.adapter.VirtualHostAdapter;
import org.apache.qpid.server.plugin.MessageStoreFactory;
import org.apache.qpid.server.plugin.VirtualHostFactory;
import org.apache.qpid.server.stats.StatisticsGatherer;
-import org.apache.qpid.server.store.MessageStoreConstants;
import org.apache.qpid.server.store.MessageStoreCreator;
public class StandardVirtualHostFactory implements VirtualHostFactory
@@ -45,10 +42,9 @@ public class StandardVirtualHostFactory implements VirtualHostFactory
public VirtualHost createVirtualHost(VirtualHostRegistry virtualHostRegistry,
StatisticsGatherer brokerStatisticsGatherer,
org.apache.qpid.server.security.SecurityManager parentSecurityManager,
- VirtualHostConfiguration hostConfig,
org.apache.qpid.server.model.VirtualHost virtualHost)
{
- return new StandardVirtualHost(virtualHostRegistry, brokerStatisticsGatherer, parentSecurityManager, hostConfig, virtualHost);
+ return new StandardVirtualHost(virtualHostRegistry, brokerStatisticsGatherer, parentSecurityManager, virtualHost);
}
@@ -96,23 +92,4 @@ public class StandardVirtualHostFactory implements VirtualHostFactory
return convertedMap;
}
- @Override
- public Map<String, Object> convertVirtualHostConfiguration(Configuration configuration)
- {
- Map<String,Object> convertedMap = new LinkedHashMap<String, Object>();
- Configuration storeConfiguration = configuration.subset("store");
- convertedMap.put(org.apache.qpid.server.model.VirtualHost.STORE_TYPE, storeConfiguration.getString("type"));
- convertedMap.put(org.apache.qpid.server.model.VirtualHost.STORE_PATH, storeConfiguration.getString(MessageStoreConstants.ENVIRONMENT_PATH_PROPERTY));
-
- convertedMap.put(MessageStoreConstants.OVERFULL_SIZE_ATTRIBUTE, storeConfiguration.getString(MessageStoreConstants.OVERFULL_SIZE_PROPERTY));
- convertedMap.put(MessageStoreConstants.UNDERFULL_SIZE_ATTRIBUTE, storeConfiguration.getString(MessageStoreConstants.UNDERFULL_SIZE_PROPERTY));
-
- for(MessageStoreFactory mf : new MessageStoreCreator().getFactories())
- {
- convertedMap.putAll(mf.convertStoreConfiguration(storeConfiguration));
- }
-
- return convertedMap;
-
- }
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
index a06056de8f..f113abb25a 100755
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
@@ -28,7 +28,6 @@ import java.util.concurrent.ScheduledFuture;
import org.apache.qpid.server.configuration.updater.TaskExecutor;
import org.apache.qpid.server.exchange.AMQUnknownExchangeType;
import org.apache.qpid.common.Closeable;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.connection.IConnectionRegistry;
import org.apache.qpid.server.exchange.ExchangeImpl;
import org.apache.qpid.server.logging.EventLogger;
@@ -49,8 +48,6 @@ public interface VirtualHost extends DurableConfigurationStore.Source, Closeable
{
IConnectionRegistry getConnectionRegistry();
- VirtualHostConfiguration getConfiguration();
-
String getName();
AMQQueue getQueue(String name);
@@ -137,6 +134,8 @@ public interface VirtualHost extends DurableConfigurationStore.Source, Closeable
int getDefaultMaximumDeliveryAttempts();
+ boolean getDefaultDeadLetterQueueEnabled();
+
TaskExecutor getTaskExecutor();
org.apache.qpid.server.model.VirtualHost getModel();
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/QueueConfigurationTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/QueueConfigurationTest.java
deleted file mode 100644
index 2c3420a718..0000000000
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/QueueConfigurationTest.java
+++ /dev/null
@@ -1,269 +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 static org.mockito.Mockito.when;
-
-import java.util.Collections;
-import junit.framework.TestCase;
-import org.apache.commons.configuration.CompositeConfiguration;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.PropertiesConfiguration;
-
-import org.apache.qpid.server.model.Broker;
-import org.apache.qpid.server.queue.QueueArgumentsConverter;
-import org.apache.qpid.server.util.BrokerTestHelper;
-
-public class QueueConfigurationTest extends TestCase
-{
- private VirtualHostConfiguration _emptyConf;
- private PropertiesConfiguration _env;
- private VirtualHostConfiguration _fullHostConf;
- private Broker _broker;
-
- @Override
- public void setUp() throws Exception
- {
- super.setUp();
- BrokerTestHelper.setUp();
- _broker = BrokerTestHelper.createBrokerMock();
- _env = new PropertiesConfiguration();
- _emptyConf = new VirtualHostConfiguration("test", _env, _broker);
-
- PropertiesConfiguration fullEnv = new PropertiesConfiguration();
- fullEnv.setProperty("queues.maximumMessageAge", 1);
- fullEnv.setProperty("queues.maximumQueueDepth", 1);
- fullEnv.setProperty("queues.maximumMessageSize", 1);
- fullEnv.setProperty("queues.maximumMessageCount", 1);
- fullEnv.setProperty("queues.minimumAlertRepeatGap", 1);
- fullEnv.setProperty("queues.deadLetterQueues", true);
- fullEnv.setProperty("queues.maximumDeliveryCount", 5);
-
- _fullHostConf = new VirtualHostConfiguration("test", fullEnv, _broker);
-
- }
-
- @Override
- public void tearDown() throws Exception
- {
- BrokerTestHelper.tearDown();
- super.tearDown();
- }
-
- public void testMaxDeliveryCount() throws Exception
- {
- // broker MAXIMUM_DELIVERY_ATTEMPTS attribute is not set
- when(_broker.getAttribute(Broker.QUEUE_MAXIMUM_DELIVERY_ATTEMPTS)).thenReturn(null);
-
- // Check default value
- QueueConfiguration qConf = new QueueConfiguration("test", _emptyConf);
- assertEquals("Unexpected default server configuration for max delivery count ", 0, qConf.getMaxDeliveryCount());
-
- // set broker MAXIMUM_DELIVERY_ATTEMPTS attribute to 2
- when(_broker.getAttribute(Broker.QUEUE_MAXIMUM_DELIVERY_ATTEMPTS)).thenReturn(2);
-
- // Check that queue inherits the MAXIMUM_DELIVERY_ATTEMPTS value from broker
- qConf = new QueueConfiguration("test", _emptyConf);
- assertEquals("Unexpected default server configuration for max delivery count ", 2, qConf.getMaxDeliveryCount());
-
- // Check explicit value
- VirtualHostConfiguration vhostConfig = overrideConfiguration("maximumDeliveryCount", 7);
- qConf = new QueueConfiguration("test", vhostConfig);
- assertEquals("Unexpected host configuration for max delivery count", 7, qConf.getMaxDeliveryCount());
-
- // Check inherited value
- qConf = new QueueConfiguration("test", _fullHostConf);
- assertEquals("Unexpected queue configuration for max delivery count", 5, qConf.getMaxDeliveryCount());
- }
-
- /**
- * Tests that the default setting for DLQ configuration is disabled, and verifies that it can be overridden
- * at a broker or virtualhost level.
- * @throws Exception
- */
- public void testIsDeadLetterQueueEnabled() throws Exception
- {
- // enable dead letter queues broker wide
- when(_broker.getAttribute(Broker.QUEUE_DEAD_LETTER_QUEUE_ENABLED)).thenReturn(true);
-
- // Check that queue inherits the broker setting
- QueueConfiguration qConf = new QueueConfiguration("test", _emptyConf);
- assertTrue("Unexpected queue configuration for dead letter enabled attribute", qConf.isDeadLetterQueueEnabled());
-
- // broker DEAD_LETTER_QUEUE_ENABLED is not set
- when(_broker.getAttribute(Broker.QUEUE_DEAD_LETTER_QUEUE_ENABLED)).thenReturn(null);
-
- // Check that queue dead letter queue is not enabled
- qConf = new QueueConfiguration("test", _emptyConf);
- assertFalse("Unexpected queue configuration for dead letter enabled attribute", qConf.isDeadLetterQueueEnabled());
-
- // Check explicit value
- VirtualHostConfiguration vhostConfig = overrideConfiguration("deadLetterQueues", true);
- qConf = new QueueConfiguration("test", vhostConfig);
- assertTrue("Unexpected queue configuration for dead letter enabled attribute", qConf.isDeadLetterQueueEnabled());
-
- // Check inherited value
- qConf = new QueueConfiguration("test", _fullHostConf);
- assertTrue("Unexpected queue configuration for dead letter enabled attribute", qConf.isDeadLetterQueueEnabled());
- }
-
- public void testGetMaximumMessageAge() throws ConfigurationException
- {
- // Check default value
- QueueConfiguration qConf = new QueueConfiguration("test", _emptyConf);
- assertEquals(0, qConf.getMaximumMessageAge());
-
- // Check explicit value
- VirtualHostConfiguration vhostConfig = overrideConfiguration("maximumMessageAge", 2);
-
- qConf = new QueueConfiguration("test", vhostConfig);
- assertEquals(2, qConf.getMaximumMessageAge());
-
- }
-
- public void testGetMaximumQueueDepth() throws ConfigurationException
- {
- // Check default value
- QueueConfiguration qConf = new QueueConfiguration("test", _emptyConf);
- assertEquals(0, qConf.getMaximumQueueDepth());
-
- // Check explicit value
- VirtualHostConfiguration vhostConfig = overrideConfiguration("maximumQueueDepth", 2);
- qConf = new QueueConfiguration("test", vhostConfig);
- assertEquals(2, qConf.getMaximumQueueDepth());
-
- }
-
- public void testGetMaximumMessageSize() throws ConfigurationException
- {
- // Check default value
- QueueConfiguration qConf = new QueueConfiguration("test", _emptyConf);
- assertEquals(0, qConf.getMaximumMessageSize());
-
- // Check explicit value
- VirtualHostConfiguration vhostConfig = overrideConfiguration("maximumMessageSize", 2);
- qConf = new QueueConfiguration("test", vhostConfig);
- assertEquals(2, qConf.getMaximumMessageSize());
-
- }
-
- public void testGetMaximumMessageCount() throws ConfigurationException
- {
- // Check default value
- QueueConfiguration qConf = new QueueConfiguration("test", _emptyConf);
- assertEquals(0, qConf.getMaximumMessageCount());
-
- // Check explicit value
- VirtualHostConfiguration vhostConfig = overrideConfiguration("maximumMessageCount", 2);
- qConf = new QueueConfiguration("test", vhostConfig);
- assertEquals(2, qConf.getMaximumMessageCount());
-
- }
-
- public void testGetMinimumAlertRepeatGap() throws Exception
- {
- QueueConfiguration qConf = new QueueConfiguration("test", _emptyConf);
-
- // Check default value
- qConf = new QueueConfiguration("test", _emptyConf);
- assertEquals(0, qConf.getMinimumAlertRepeatGap());
-
- // Check explicit value
- VirtualHostConfiguration vhostConfig = overrideConfiguration("minimumAlertRepeatGap", 2);
- qConf = new QueueConfiguration("test", vhostConfig);
- assertEquals(2, qConf.getMinimumAlertRepeatGap());
-
- }
-
- public void testSortQueueConfiguration() throws ConfigurationException
- {
- //Check default value
- QueueConfiguration qConf = new QueueConfiguration("test", _emptyConf);
- assertNull(qConf.getQueueSortKey());
-
- // Check explicit value
- final VirtualHostConfiguration vhostConfig = overrideConfiguration("sortKey", "test-sort-key");
- qConf = new QueueConfiguration("test", vhostConfig);
- assertEquals("test-sort-key", qConf.getQueueSortKey());
- }
-
- public void testQueueDescription() throws ConfigurationException
- {
- //Check default value
- QueueConfiguration qConf = new QueueConfiguration("test", _emptyConf);
- assertNull(qConf.getDescription());
-
- // Check explicit value
- final VirtualHostConfiguration vhostConfig = overrideConfiguration("description", "mydescription");
- qConf = new QueueConfiguration("test", vhostConfig);
- assertEquals("mydescription", qConf.getDescription());
- }
-
-
- public void testQueueSingleArgument() throws ConfigurationException
- {
- //Check default value
- QueueConfiguration qConf = new QueueConfiguration("test", _emptyConf);
- assertTrue(qConf.getArguments().isEmpty());
-
- // Check explicit value
- final VirtualHostConfiguration vhostConfig = overrideConfiguration("argument", QueueArgumentsConverter.QPID_GROUP_HEADER_KEY + "=mykey");
- qConf = new QueueConfiguration("test", vhostConfig);
- assertEquals(Collections.singletonMap(QueueArgumentsConverter.QPID_GROUP_HEADER_KEY,"mykey"), qConf.getArguments());
- }
-
-
- public void testQueueMultipleArguments() throws ConfigurationException
- {
- //Check default value
- QueueConfiguration qConf = new QueueConfiguration("test", _emptyConf);
- assertTrue(qConf.getArguments().isEmpty());
-
-
- PropertiesConfiguration queueConfig = new PropertiesConfiguration();
- queueConfig.addProperty("queues.queue.test.argument", QueueArgumentsConverter.QPID_GROUP_HEADER_KEY + "=mykey");
- queueConfig.addProperty("queues.queue.test.argument", QueueArgumentsConverter.QPID_SHARED_MSG_GROUP + "=1");
-
- CompositeConfiguration config = new CompositeConfiguration();
- config.addConfiguration(_fullHostConf.getConfig());
- config.addConfiguration(queueConfig);
-
- final VirtualHostConfiguration vhostConfig = new VirtualHostConfiguration("test", config, _broker);;
- qConf = new QueueConfiguration("test", vhostConfig);
- assertEquals(2, qConf.getArguments().size());
- assertEquals("mykey", qConf.getArguments().get(QueueArgumentsConverter.QPID_GROUP_HEADER_KEY));
- assertEquals("1", qConf.getArguments().get(QueueArgumentsConverter.QPID_SHARED_MSG_GROUP));
- }
-
-
- private VirtualHostConfiguration overrideConfiguration(String property, Object value)
- throws ConfigurationException
- {
- PropertiesConfiguration queueConfig = new PropertiesConfiguration();
- queueConfig.setProperty("queues.queue.test." + property, value);
-
- CompositeConfiguration config = new CompositeConfiguration();
- config.addConfiguration(_fullHostConf.getConfig());
- config.addConfiguration(queueConfig);
-
- return new VirtualHostConfiguration("test", config, _broker);
- }
-}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java
deleted file mode 100644
index bd11f7192b..0000000000
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java
+++ /dev/null
@@ -1,410 +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 static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.XMLConfiguration;
-
-import org.apache.qpid.server.logging.EventLogger;
-import org.apache.qpid.server.logging.NullMessageLogger;
-import org.apache.qpid.server.model.Broker;
-import org.apache.qpid.server.queue.PriorityQueue;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.store.TestableMemoryMessageStore;
-import org.apache.qpid.server.util.BrokerTestHelper;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
-import org.apache.qpid.test.utils.QpidTestCase;
-
-public class VirtualHostConfigurationTest extends QpidTestCase
-{
- private VirtualHostRegistry _virtualHostRegistry;
- private XMLConfiguration _configXml;
- private Broker _broker;
-
- @Override
- public void setUp() throws Exception
- {
- super.setUp();
- BrokerTestHelper.setUp();
- _configXml = new XMLConfiguration();
- _configXml.addProperty("virtualhosts.virtualhost(-1).name", getName());
- _configXml.addProperty("virtualhosts.virtualhost(-1)."+getName()+".store.class", TestableMemoryMessageStore.class.getName());
- EventLogger eventLogger = new EventLogger();
- _virtualHostRegistry = new VirtualHostRegistry(eventLogger);
- _broker = mock(Broker.class);
- when(_broker.getAttribute(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD)).thenReturn(30000l);
- }
-
- @Override
- public void tearDown() throws Exception
- {
- try
- {
- if (_virtualHostRegistry != null)
- {
- _virtualHostRegistry.close();
- }
- }
- finally
- {
- BrokerTestHelper.tearDown();
- super.tearDown();
- }
- }
-
- private XMLConfiguration getConfigXml()
- {
- return _configXml;
- }
-
- private VirtualHost createVirtualHost(String hostName) throws Exception
- {
- Configuration config = getConfigXml().subset("virtualhosts.virtualhost." + XmlConfigurationUtilities.escapeTagName(hostName));
- VirtualHostConfiguration virtualHostConfiguration = new VirtualHostConfiguration(hostName, config, _broker);
- return BrokerTestHelper.createVirtualHost(virtualHostConfiguration, _virtualHostRegistry);
- }
-
- public void testQueuePriority() throws Exception
- {
- // Set up queue with 5 priorities
- getConfigXml().addProperty("virtualhosts.virtualhost.testQueuePriority.queues(-1).queue(-1).name(-1)",
- "atest");
- getConfigXml().addProperty("virtualhosts.virtualhost.testQueuePriority.queues.queue.atest(-1).exchange",
- "amq.direct");
- getConfigXml().addProperty("virtualhosts.virtualhost.testQueuePriority.queues.queue.atest.priorities",
- "5");
-
- // Set up queue with JMS style priorities
- getConfigXml().addProperty("virtualhosts.virtualhost.testQueuePriority.queues(-1).queue(-1).name(-1)",
- "ptest");
- getConfigXml().addProperty("virtualhosts.virtualhost.testQueuePriority.queues.queue.ptest(-1).exchange",
- "amq.direct");
- getConfigXml().addProperty("virtualhosts.virtualhost.testQueuePriority.queues.queue.ptest.priority",
- "true");
-
- // Set up queue with no priorities
- getConfigXml().addProperty("virtualhosts.virtualhost.testQueuePriority.queues(-1).queue(-1).name(-1)",
- "ntest");
- getConfigXml().addProperty("virtualhosts.virtualhost.testQueuePriority.queues.queue.ntest(-1).exchange",
- "amq.direct");
- getConfigXml().addProperty("virtualhosts.virtualhost.testQueuePriority.queues.queue.ntest.priority",
- "false");
-
- VirtualHost vhost = createVirtualHost(getName());
-
- // Check that atest was a priority queue with 5 priorities
- AMQQueue atest = vhost.getQueue("atest");
- assertTrue(atest instanceof PriorityQueue);
- assertEquals(5, ((PriorityQueue) atest).getPriorities());
-
- // Check that ptest was a priority queue with 10 priorities
- AMQQueue ptest = vhost.getQueue("ptest");
- assertTrue(ptest instanceof PriorityQueue);
- assertEquals(10, ((PriorityQueue) ptest).getPriorities());
-
- // Check that ntest wasn't a priority queue
- AMQQueue ntest = vhost.getQueue("ntest");
- assertFalse(ntest instanceof PriorityQueue);
- }
-
- public void testQueueAlerts() throws Exception
- {
- // Set up queue with 5 priorities
- getConfigXml().addProperty("virtualhosts.virtualhost.testQueueAlerts.queues.exchange", "amq.topic");
- getConfigXml().addProperty("virtualhosts.virtualhost.testQueueAlerts.queues.maximumQueueDepth", "1");
- getConfigXml().addProperty("virtualhosts.virtualhost.testQueueAlerts.queues.maximumMessageSize", "2");
- getConfigXml().addProperty("virtualhosts.virtualhost.testQueueAlerts.queues.maximumMessageAge", "3");
-
- getConfigXml().addProperty("virtualhosts.virtualhost.testQueueAlerts.queues(-1).queue(1).name(1)", "atest");
- getConfigXml().addProperty("virtualhosts.virtualhost.testQueueAlerts.queues.queue.atest(-1).exchange", "amq.direct");
- getConfigXml().addProperty("virtualhosts.virtualhost.testQueueAlerts.queues.queue.atest(-1).maximumQueueDepth", "4");
- getConfigXml().addProperty("virtualhosts.virtualhost.testQueueAlerts.queues.queue.atest(-1).maximumMessageSize", "5");
- getConfigXml().addProperty("virtualhosts.virtualhost.testQueueAlerts.queues.queue.atest(-1).maximumMessageAge", "6");
-
- getConfigXml().addProperty("virtualhosts.virtualhost.testQueueAlerts.queues(-1).queue(-1).name(-1)", "btest");
-
- VirtualHost vhost = createVirtualHost(getName());
-
- // Check specifically configured values
- AMQQueue aTest = vhost.getQueue("atest");
- assertEquals(4, aTest.getAlertThresholdQueueDepthBytes());
- assertEquals(5, aTest.getAlertThresholdMessageSize());
- assertEquals(6, aTest.getAlertThresholdMessageAge());
-
- // Check default values
- AMQQueue bTest = vhost.getQueue("btest");
- assertEquals(1, bTest.getAlertThresholdQueueDepthBytes());
- assertEquals(2, bTest.getAlertThresholdMessageSize());
- assertEquals(3, bTest.getAlertThresholdMessageAge());
- }
-
- public void testMaxDeliveryCount() throws Exception
- {
- // Set up vhosts and queues
- getConfigXml().addProperty("virtualhosts.virtualhost." + getName() + ".queues.maximumDeliveryCount", 5);
- getConfigXml().addProperty("virtualhosts.virtualhost." + getName() + ".queues(-1).queue(-1).name", "biggles");
- getConfigXml().addProperty("virtualhosts.virtualhost." + getName() + ".queues.queue.biggles.maximumDeliveryCount", 4);
- getConfigXml().addProperty("virtualhosts.virtualhost." + getName() + ".queues(-1).queue(-1).name", "beetle");
-
- VirtualHost test = createVirtualHost(getName());
-
- // Enabled specifically
- assertEquals("Test vhost MDC was configured as enabled", 5 ,test.getConfiguration().getMaxDeliveryCount());
-
- // Enabled by test vhost default
- assertEquals("beetle queue DLQ was configured as enabled", test.getConfiguration().getMaxDeliveryCount(), test.getConfiguration().getQueueConfiguration("beetle").getMaxDeliveryCount());
-
- // Disabled specifically
- assertEquals("Biggles queue DLQ was configured as disabled", 4, test.getConfiguration().getQueueConfiguration("biggles").getMaxDeliveryCount());
- }
-
- /**
- * Tests the full set of configuration options for enabling DLQs in the broker configuration.
- */
- public void testIsDeadLetterQueueEnabled() throws Exception
- {
- // Set up vhosts and queues
- getConfigXml().addProperty("virtualhosts.virtualhost." + getName() + ".queues.deadLetterQueues", "true");
- getConfigXml().addProperty("virtualhosts.virtualhost." + getName() + ".queues(-1).queue(-1).name", "biggles");
- getConfigXml().addProperty("virtualhosts.virtualhost." + getName() + ".queues.queue.biggles.deadLetterQueues", "false");
- getConfigXml().addProperty("virtualhosts.virtualhost." + getName() + ".queues(-1).queue(-1).name", "beetle");
-
-
- getConfigXml().addProperty("virtualhosts.virtualhost.name", getName() + "Extra");
- getConfigXml().addProperty("virtualhosts.virtualhost." + getName() + "Extra.queues(-1).queue(-1).name", "r2d2");
- getConfigXml().addProperty("virtualhosts.virtualhost." + getName() + "Extra.queues.queue.r2d2.deadLetterQueues", "true");
- getConfigXml().addProperty("virtualhosts.virtualhost." + getName() + "Extra.queues(-1).queue(-1).name", "c3p0");
- getConfigXml().addProperty("virtualhosts.virtualhost." + getName() + "Extra.store.class", TestableMemoryMessageStore.class.getName());
-
- VirtualHost test = createVirtualHost(getName());
- VirtualHost extra = createVirtualHost(getName() + "Extra");
-
- // Enabled specifically
- assertTrue("Test vhost DLQ was configured as enabled", test.getConfiguration().isDeadLetterQueueEnabled());
- assertTrue("r2d2 queue DLQ was configured as enabled", extra.getConfiguration().getQueueConfiguration("r2d2").isDeadLetterQueueEnabled());
-
- // Enabled by test vhost default
- assertTrue("beetle queue DLQ was configured as enabled", test.getConfiguration().getQueueConfiguration("beetle").isDeadLetterQueueEnabled());
-
- // Disabled specifically
- assertFalse("Biggles queue DLQ was configured as disabled", test.getConfiguration().getQueueConfiguration("biggles").isDeadLetterQueueEnabled());
-
- // Using broker default of disabled
- assertFalse("Extra vhost DLQ disabled, using broker default", extra.getConfiguration().isDeadLetterQueueEnabled());
- assertFalse("c3p0 queue DLQ was configured as disabled", extra.getConfiguration().getQueueConfiguration("c3p0").isDeadLetterQueueEnabled());
-
- // Get queues
- AMQQueue biggles = test.getQueue("biggles");
- AMQQueue beetle = test.getQueue("beetle");
- AMQQueue r2d2 = extra.getQueue("r2d2");
- AMQQueue c3p0 = extra.getQueue("c3p0");
-
- // Disabled specifically for this queue, overriding virtualhost setting
- assertNull("Biggles queue should not have alt exchange as DLQ should be configured as disabled: " + biggles.getAlternateExchange(), biggles.getAlternateExchange());
-
- // Enabled for all queues on the virtualhost
- assertNotNull("Beetle queue should have an alt exchange as DLQ should be enabled, using test vhost default", beetle.getAlternateExchange());
-
- // Enabled specifically for this queue, overriding the default broker setting of disabled
- assertNotNull("R2D2 queue should have an alt exchange as DLQ should be configured as enabled", r2d2.getAlternateExchange());
-
- // Disabled by the default broker setting
- assertNull("C3PO queue should not have an alt exchange as DLQ should be disabled, using broker default", c3p0.getAlternateExchange());
- }
-
- /**
- * Test that the house keeping pool sizes is correctly processed
- *
- * @throws Exception
- */
- public void testHouseKeepingThreadCount() throws Exception
- {
- int initialPoolSize = 10;
-
- getConfigXml().addProperty("virtualhosts.virtualhost.testHouseKeepingThreadCount.housekeeping.poolSize",
- initialPoolSize);
-
- VirtualHost vhost = createVirtualHost(getName());
-
- assertEquals("HouseKeeping PoolSize not set correctly.",
- initialPoolSize, vhost.getHouseKeepingPoolSize());
- }
-
- /**
- * Test that we can dynamically change the thread pool size
- *
- * @throws Exception
- */
- public void testDynamicHouseKeepingPoolSizeChange() throws Exception
- {
- int initialPoolSize = 10;
-
- getConfigXml().addProperty("virtualhosts.virtualhost.testDynamicHouseKeepingPoolSizeChange.housekeeping.poolSize",
- initialPoolSize);
-
- VirtualHost vhost = createVirtualHost(getName());
-
- assertEquals("HouseKeeping PoolSize not set correctly.",
- initialPoolSize, vhost.getHouseKeepingPoolSize());
-
- vhost.setHouseKeepingPoolSize(1);
-
- assertEquals("HouseKeeping PoolSize not correctly change.",
- 1, vhost.getHouseKeepingPoolSize());
-
- }
-
- /**
- * Tests that the old element security.authentication.name is rejected. This element
- * was never supported properly as authentication is performed before the virtual host
- * is considered.
- */
- public void testSecurityAuthenticationNameRejected() throws Exception
- {
- getConfigXml().addProperty("virtualhosts.virtualhost.testSecurityAuthenticationNameRejected.security.authentication.name",
- "testdb");
-
- try
- {
- createVirtualHost(getName());
- fail("Exception not thrown");
- }
- catch(ConfigurationException ce)
- {
- assertEquals("Incorrect error message",
- "Validation error : security/authentication/name is no longer a supported element within the configuration xml." +
- " It appears in virtual host definition : " + getName(),
- ce.getMessage());
- }
- }
-
- /*
- * Tests that the old element housekeeping.expiredMessageCheckPeriod. ... (that was
- * replaced by housekeeping.checkPeriod) is rejected.
- */
- public void testExpiredMessageCheckPeriodRejected() throws Exception
- {
- getConfigXml().addProperty("virtualhosts.virtualhost.testExpiredMessageCheckPeriodRejected.housekeeping.expiredMessageCheckPeriod",
- 5);
-
- try
- {
- createVirtualHost(getName());
- fail("Exception not thrown");
- }
- catch (ConfigurationException ce)
- {
- assertEquals("Incorrect error message",
- "Validation error : housekeeping/expiredMessageCheckPeriod must be replaced by housekeeping/checkPeriod." +
- " It appears in virtual host definition : " + getName(),
- ce.getMessage());
- }
- }
-
- /*
- * Tests that the queues with dots in the names are fully supported. The XML configuration
- * had problems with handling the tags containing dots due to the design of the Apache Commons
- * Configuration library. The dots need to be escaped when accessing the XML configuration.
- */
- public void testDotsInQueueName() throws Exception
- {
- // Set up vhosts and queue
- getConfigXml().addProperty("virtualhosts.virtualhost." + getName() + ".queues(-1).queue(-1).name", "dot.in.a.name");
- // Add a single property which is inside the <dot.in.a.name> queue tag - the maximum delivery count
- getConfigXml().addProperty("virtualhosts.virtualhost." + getName() + ".queues.queue.dot..in..a..name.maximumDeliveryCount", 5);
-
- VirtualHost test = createVirtualHost(getName());
-
- // Check, that the property stored within the <dot.in.a.name> tag has been properly loaded
- assertEquals("queue with dots in its name has been properly loaded", 5, test.getConfiguration().getQueueConfiguration("dot.in.a.name").getMaxDeliveryCount());
- }
-
- /*
- * Tests that the virtual hosts with dots in the names are fully supported. The XML
- * configuration had problems with handling the tags containing dots due to the design
- * of the Apache Commons Configuration library. The dots need to be escaped when
- * accessing the XML configuration.
- */
- public void testDotsInVirtualHostName() throws Exception
- {
- // Set up vhosts
- getConfigXml().addProperty("virtualhosts.virtualhost.name", "dot.in.a.name");
- // Add a single property which is inside the <dot.in.a.name> virtual host tag - the message store
- getConfigXml().addProperty("virtualhosts.virtualhost.dot..in..a..name.store.class", TestableMemoryMessageStore.class.getName());
-
- VirtualHost test = createVirtualHost("dot.in.a.name");
-
- // Check, that the property stored within the <dot.in.a.name> tag has been properly loaded
- assertEquals("virtual host with dots in the name has been properly loaded", TestableMemoryMessageStore.class.getName(), test.getMessageStore().getClass().getName());
- }
-
- public void testStoreTransactionIdleTimeoutClose() throws Exception
- {
- VirtualHost vhost = createVirtualHost(getName());
- assertEquals("Unexpected StoreTransactionIdleTimeoutClose value", 0, vhost.getConfiguration().getTransactionTimeoutIdleClose());
-
- when(_broker.getAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_CLOSE)).thenReturn(1000l);
- assertEquals("Unexpected StoreTransactionIdleTimeoutClose value", 1000l, vhost.getConfiguration().getTransactionTimeoutIdleClose());
-
- vhost.getConfiguration().getConfig().setProperty("transactionTimeout.idleClose", 2000l);
- assertEquals("Unexpected StoreTransactionIdleTimeoutClose value", 2000l, vhost.getConfiguration().getTransactionTimeoutIdleClose());
- }
-
- public void testStoreTransactionIdleTimeoutWarn() throws Exception
- {
- VirtualHost vhost = createVirtualHost(getName());
- assertEquals("Unexpected StoreTransactionIdleTimeoutWarn value", 0, vhost.getConfiguration().getTransactionTimeoutIdleWarn());
-
- when(_broker.getAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_WARN)).thenReturn(1000l);
- assertEquals("Unexpected StoreTransactionIdleTimeoutWarn value", 1000l, vhost.getConfiguration().getTransactionTimeoutIdleWarn());
-
- vhost.getConfiguration().getConfig().setProperty("transactionTimeout.idleWarn", 2000l);
- assertEquals("Unexpected StoreTransactionIdleTimeoutWarn value", 2000l, vhost.getConfiguration().getTransactionTimeoutIdleWarn());
- }
-
- public void testStoreTransactionOpenTimeoutClose() throws Exception
- {
- VirtualHost vhost = createVirtualHost(getName());
- assertEquals("Unexpected StoreTransactionOpenTimeoutClose value", 0, vhost.getConfiguration().getTransactionTimeoutOpenClose());
-
- when(_broker.getAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_CLOSE)).thenReturn(1000l);
- assertEquals("Unexpected StoreTransactionOpenTimeoutClose value", 1000l, vhost.getConfiguration().getTransactionTimeoutOpenClose());
-
- vhost.getConfiguration().getConfig().setProperty("transactionTimeout.openClose", 2000l);
- assertEquals("Unexpected StoreTransactionOpenTimeoutClose value", 2000l, vhost.getConfiguration().getTransactionTimeoutOpenClose());
- }
-
- public void testStoreTransactionOpenTimeoutWarn() throws Exception
- {
- VirtualHost vhost = createVirtualHost(getName());
- assertEquals("Unexpected StoreTransactionOpenTimeoutWarn value", 0, vhost.getConfiguration().getTransactionTimeoutOpenWarn());
-
- when(_broker.getAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_WARN)).thenReturn(1000l);
- assertEquals("Unexpected StoreTransactionOpenTimeoutWarn value", 1000l, vhost.getConfiguration().getTransactionTimeoutOpenWarn());
-
- vhost.getConfiguration().getConfig().setProperty("transactionTimeout.openWarn", 2000l);
- assertEquals("Unexpected StoreTransactionOpenTimeoutWarn value", 2000l, vhost.getConfiguration().getTransactionTimeoutOpenWarn());
- }
-}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/plugins/AbstractConfigurationTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/plugins/AbstractConfigurationTest.java
deleted file mode 100644
index 79abae85cd..0000000000
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/plugins/AbstractConfigurationTest.java
+++ /dev/null
@@ -1,213 +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.plugins;
-
-import org.apache.commons.configuration.CompositeConfiguration;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.XMLConfiguration;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.test.utils.QpidTestCase;
-
-import java.util.List;
-
-/**
- * Test that verifies that given a Configuration a ConfigurationPlugin can
- * process and validate that data.
- */
-public class AbstractConfigurationTest extends QpidTestCase
-{
- private static final Logger _logger = Logger.getLogger(AbstractConfigurationTest.class);
-
- private static final double DOUBLE = 3.14;
- private static final long POSITIVE_LONG = 1000;
- private static final long NEGATIVE_LONG = -1000;
- private static final int LIST_SIZE = 3;
-
- class TestConfigPlugin extends AbstractConfiguration
- {
- @Override
- public String[] getElementsProcessed()
- {
- return new String[]{"[@property]", "name",
- "positiveLong", "negativeLong",
- "true", "list", "double"};
- }
-
- @Override
- public void validateConfiguration() throws ConfigurationException
- {
- // no validation required
- }
-
- public String getName()
- {
- return getStringValue("name");
- }
-
- public String getProperty()
- {
- return getStringValue("[@property]");
- }
-
-
- }
-
- private TestConfigPlugin _plugin;
-
- @Override
- public void setUp() throws Exception
- {
- // Test does not directly use the AppRegistry but the configured broker
- // is required for the correct ConfigurationPlugin processing
- super.setUp();
- XMLConfiguration xmlConfig = new XMLConfiguration();
- xmlConfig.addProperty("base.element[@property]", "property");
- xmlConfig.addProperty("base.element.name", "name");
- // We make these strings as that is how they will be read from the file.
- xmlConfig.addProperty("base.element.positiveLong", String.valueOf(POSITIVE_LONG));
- xmlConfig.addProperty("base.element.negativeLong", String.valueOf(NEGATIVE_LONG));
- xmlConfig.addProperty("base.element.boolean", String.valueOf(true));
- xmlConfig.addProperty("base.element.double", String.valueOf(DOUBLE));
- for (int i = 0; i < LIST_SIZE; i++)
- {
- xmlConfig.addProperty("base.element.list", i);
- }
-
- //Use a composite configuration as this is what our broker code uses.
- CompositeConfiguration composite = new CompositeConfiguration();
- composite.addConfiguration(xmlConfig);
-
- _plugin = new TestConfigPlugin();
-
- try
- {
- _plugin.setConfiguration("base.element", composite.subset("base.element"));
- }
- catch (ConfigurationException e)
- {
- _logger.error("Error setting up plugin configuration", e);
- fail(e.toString());
- }
-
- }
-
- public void testHasConfiguration()
- {
- assertTrue("Plugin has no configuration ", _plugin.hasConfiguration());
- _plugin = new TestConfigPlugin();
- assertFalse("Plugins has configuration", _plugin.hasConfiguration());
- }
-
- public void testValuesRetrieved()
- {
- assertEquals("Name not correct", "name", _plugin.getName());
- assertEquals("Property not correct", "property", _plugin.getProperty());
- }
-
- public void testContainsPositiveLong()
- {
- assertTrue("positiveLong is not positive", _plugin.containsPositiveLong("positiveLong"));
- assertFalse("NonExistentValue was found", _plugin.containsPositiveLong("NonExistentValue"));
-
- try
- {
- _plugin.validatePositiveLong("positiveLong");
- }
- catch (ConfigurationException e)
- {
- fail(e.getMessage());
- }
-
- try
- {
- _plugin.validatePositiveLong("negativeLong");
- fail("negativeLong should not be positive");
- }
- catch (ConfigurationException e)
- {
- assertEquals("negativeLong should not be reported as positive",
- "TestConfigPlugin: unable to configure invalid negativeLong:" + NEGATIVE_LONG, e.getMessage());
- }
-
- }
-
- public void testDouble()
- {
- assertEquals("Double value not returned", DOUBLE, _plugin.getDoubleValue("double"));
- assertEquals("default Double value not returned", 0.0, _plugin.getDoubleValue("NonExistent"));
- assertEquals("set default Double value not returned", DOUBLE, _plugin.getDoubleValue("NonExistent", DOUBLE));
- }
-
- public void testLong()
- {
- assertTrue("Long value not returned", _plugin.containsLong("positiveLong"));
- assertFalse("Long value returned", _plugin.containsLong("NonExistent"));
- assertEquals("Long value not returned", POSITIVE_LONG, _plugin.getLongValue("positiveLong"));
- assertEquals("default Long value not returned", 0, _plugin.getLongValue("NonExistent"));
- assertEquals("set default Long value not returned", NEGATIVE_LONG, _plugin.getLongValue("NonExistent", NEGATIVE_LONG));
- }
-
- public void testInt()
- {
- assertTrue("Int value not returned", _plugin.containsInt("positiveLong"));
- assertFalse("Int value returned", _plugin.containsInt("NonExistent"));
- assertEquals("Int value not returned", (int) POSITIVE_LONG, _plugin.getIntValue("positiveLong"));
- assertEquals("default Int value not returned", 0, _plugin.getIntValue("NonExistent"));
- assertEquals("set default Int value not returned", (int) NEGATIVE_LONG, _plugin.getIntValue("NonExistent", (int) NEGATIVE_LONG));
- }
-
- public void testString()
- {
- assertEquals("String value not returned", "name", _plugin.getStringValue("name"));
- assertNull("Null default String value not returned", _plugin.getStringValue("NonExistent", null));
- assertNull("default String value not returned", _plugin.getStringValue("NonExistent"));
- assertEquals("default String value not returned", "Default", _plugin.getStringValue("NonExistent", "Default"));
- }
-
- public void testBoolean()
- {
- assertTrue("Boolean value not returned", _plugin.containsBoolean("boolean"));
- assertFalse("Boolean value not returned", _plugin.containsBoolean("NonExistent"));
- assertTrue("Boolean value not returned", _plugin.getBooleanValue("boolean"));
- assertFalse("default String value not returned", _plugin.getBooleanValue("NonExistent"));
- assertTrue("set default String value not returned", _plugin.getBooleanValue("NonExistent", true));
- }
-
- public void testList()
- {
- assertTrue("list not found in plugin", _plugin.contains("list"));
- List list = _plugin.getListValue("list");
- assertNotNull("Returned list should not be null", list);
- assertEquals("List should not be empty", LIST_SIZE, list.size());
-
- list = _plugin.getListValue("NonExistent");
- assertNotNull("Returned list should not be null", list);
- assertEquals("List is not empty", 0, list.size());
- }
-
- public void testContains()
- {
- assertTrue("list not found in plugin", _plugin.contains("list"));
- assertFalse("NonExistent found in plugin", _plugin.contains("NonExistent"));
- }
-
-}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/startup/VirtualHostRecovererTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/startup/VirtualHostRecovererTest.java
index 9649838b00..0cf89842a1 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/startup/VirtualHostRecovererTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/startup/VirtualHostRecovererTest.java
@@ -23,7 +23,6 @@ package org.apache.qpid.server.configuration.startup;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import java.io.File;
import java.util.HashMap;
import java.util.Map;
@@ -36,33 +35,9 @@ import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.security.SecurityManager;
import org.apache.qpid.server.stats.StatisticsGatherer;
import org.apache.qpid.server.virtualhost.StandardVirtualHostFactory;
-import org.apache.qpid.test.utils.TestFileUtils;
public class VirtualHostRecovererTest extends TestCase
{
- public void testCreate()
- {
- StatisticsGatherer statisticsGatherer = mock(StatisticsGatherer.class);
- SecurityManager securityManager = mock(SecurityManager.class);
- ConfigurationEntry entry = mock(ConfigurationEntry.class);
- Broker parent = mock(Broker.class);
- when(parent.getAttribute(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD)).thenReturn(3000l);
- when(parent.getSecurityManager()).thenReturn(securityManager);
-
- VirtualHostRecoverer recoverer = new VirtualHostRecoverer(statisticsGatherer);
- Map<String, Object> attributes = new HashMap<String, Object>();
- String name = getName();
- attributes.put(VirtualHost.NAME, name);
- File file = TestFileUtils.createTempFile(this, ".xml", "<virtualhosts><virtualhost><name>" + name + "</name><" + name
- + "></" + name + "></virtualhost></virtualhosts>");
- attributes.put(VirtualHost.CONFIG_PATH, file.getAbsolutePath());
- when(entry.getAttributes()).thenReturn(attributes);
-
- VirtualHost host = recoverer.create(null, entry, parent);
-
- assertNotNull("Null is returned", host);
- assertEquals("Unexpected name", getName(), host.getName());
- }
public void testCreateVirtualHostFromStoreConfigAttributes()
{
@@ -91,8 +66,8 @@ public class VirtualHostRecovererTest extends TestCase
{
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put(VirtualHost.NAME, getName());
- attributes.put(VirtualHost.CONFIG_PATH, "/path/to/virtualhost.xml");
- String[] mandatoryAttributes = {VirtualHost.NAME, VirtualHost.CONFIG_PATH};
+ attributes.put(VirtualHost.TYPE, "STANDARD");
+ String[] mandatoryAttributes = {VirtualHost.NAME, VirtualHost.TYPE};
checkMandatoryAttributesAreValidated(mandatoryAttributes, attributes);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java
index 133eb94e43..fdf3ec24a1 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java
@@ -79,7 +79,7 @@ public abstract class ConfigurationEntryStoreTestCase extends QpidTestCase
_virtualHostId = UUID.randomUUID();
_virtualHostAttributes = new HashMap<String, Object>();
_virtualHostAttributes.put(VirtualHost.NAME, "test");
- _virtualHostAttributes.put(VirtualHost.CONFIG_PATH, "/path/to/phantom/test");
+ _virtualHostAttributes.put(VirtualHost.TYPE, "STANDARD");
_authenticationProviderId = UUID.randomUUID();
_authenticationProviderAttributes = new HashMap<String, Object>();
@@ -135,7 +135,7 @@ public abstract class ConfigurationEntryStoreTestCase extends QpidTestCase
{
Map<String, Object> virtualHostAttributes = new HashMap<String, Object>();
virtualHostAttributes.put(VirtualHost.NAME, getName());
- virtualHostAttributes.put(VirtualHost.CONFIG_PATH, "/path/to/phantom/virtualhost/config");
+ virtualHostAttributes.put(VirtualHost.TYPE, "STANDARD");
UUID virtualHostId = UUID.randomUUID();
addConfiguration(virtualHostId, VirtualHost.class.getSimpleName(), virtualHostAttributes);
@@ -149,13 +149,13 @@ public abstract class ConfigurationEntryStoreTestCase extends QpidTestCase
{
Map<String, Object> virtualHost1Attributes = new HashMap<String, Object>();
virtualHost1Attributes.put(VirtualHost.NAME, "test1");
- virtualHost1Attributes.put(VirtualHost.CONFIG_PATH, "/path/to/phantom/virtualhost/config1");
+ virtualHost1Attributes.put(VirtualHost.TYPE, "STANDARD");
UUID virtualHost1Id = UUID.randomUUID();
addConfiguration(virtualHost1Id, VirtualHost.class.getSimpleName(), virtualHost1Attributes);
Map<String, Object> virtualHost2Attributes = new HashMap<String, Object>();
virtualHost2Attributes.put(VirtualHost.NAME, "test1");
- virtualHost2Attributes.put(VirtualHost.CONFIG_PATH, "/path/to/phantom/virtualhost/config2");
+ virtualHost2Attributes.put(VirtualHost.TYPE, "STANDARD");
UUID virtualHost2Id = UUID.randomUUID();
addConfiguration(virtualHost2Id, VirtualHost.class.getSimpleName(), virtualHost2Attributes);
@@ -207,7 +207,7 @@ public abstract class ConfigurationEntryStoreTestCase extends QpidTestCase
{
Map<String, Object> virtualHostAttributes = new HashMap<String, Object>();
virtualHostAttributes.put(VirtualHost.NAME, "test1");
- virtualHostAttributes.put(VirtualHost.CONFIG_PATH, "/path/to/phantom/virtualhost/config1");
+ virtualHostAttributes.put(VirtualHost.TYPE, "STANDARD");
UUID virtualHostId = UUID.randomUUID();
ConfigurationEntry hostEntry = new ConfigurationEntry(virtualHostId, VirtualHost.class.getSimpleName(), virtualHostAttributes,
Collections.<UUID> emptySet(), _store);
@@ -228,7 +228,7 @@ public abstract class ConfigurationEntryStoreTestCase extends QpidTestCase
Map<String, Object> virtualHostAttributes = new HashMap<String, Object>();
virtualHostAttributes.put(VirtualHost.NAME, "test");
- virtualHostAttributes.put(VirtualHost.CONFIG_PATH, "/path/to/new/phantom/test/configuration");
+ virtualHostAttributes.put(VirtualHost.TYPE, "STANDARD");
ConfigurationEntry updatedEntry = new ConfigurationEntry(_virtualHostId, VirtualHost.class.getSimpleName(), virtualHostAttributes,
hostEntry.getChildrenIds(), _store);
@@ -372,7 +372,7 @@ public abstract class ConfigurationEntryStoreTestCase extends QpidTestCase
UUID virtualHostId = UUID.randomUUID();
Map<String, Object> virtualHostAttributes = new HashMap<String, Object>();
virtualHostAttributes.put(VirtualHost.NAME, "test1");
- virtualHostAttributes.put(VirtualHost.CONFIG_PATH, "/path/to/phantom/virtualhost/config1");
+ virtualHostAttributes.put(VirtualHost.TYPE, "STANDARD");
ConfigurationEntry hostEntry = new ConfigurationEntry(virtualHostId, VirtualHost.class.getSimpleName(), virtualHostAttributes,
Collections.<UUID> emptySet(), _store);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ManagementModeStoreHandlerTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ManagementModeStoreHandlerTest.java
index 34b4fbf1ab..bcdfce1d0a 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ManagementModeStoreHandlerTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ManagementModeStoreHandlerTest.java
@@ -213,7 +213,7 @@ public class ManagementModeStoreHandlerTest extends QpidTestCase
when(virtualHost.getId()).thenReturn(virtualHostId);
when(virtualHost.getType()).thenReturn(VirtualHost.class.getSimpleName());
Map<String, Object> attributes = new HashMap<String, Object>();
- attributes.put(VirtualHost.CONFIG_PATH, "/path/to/host.xml");
+ attributes.put(VirtualHost.TYPE, "STANDARD");
when(virtualHost.getAttributes()).thenReturn(attributes);
when(_store.getEntry(virtualHostId)).thenReturn(virtualHost);
when(_root.getChildrenIds()).thenReturn(new HashSet<UUID>(Arrays.asList(_portEntryId, virtualHostId)));
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/messages/AbstractTestMessages.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/messages/AbstractTestMessages.java
index db52bb0e29..d0a282c20f 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/messages/AbstractTestMessages.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/messages/AbstractTestMessages.java
@@ -20,9 +20,6 @@
*/
package org.apache.qpid.server.logging.messages;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.PropertiesConfiguration;
-
import org.apache.qpid.server.logging.EventLogger;
import org.apache.qpid.server.logging.LogMessage;
import org.apache.qpid.server.logging.LogSubject;
@@ -35,7 +32,6 @@ import java.util.List;
public abstract class AbstractTestMessages extends QpidTestCase
{
- protected Configuration _config = new PropertiesConfiguration();
protected LogMessage _logMessage = null;
protected UnitTestMessageLogger _logger;
protected LogSubject _logSubject = new TestBlankSubject();
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/VirtualHostTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/VirtualHostTest.java
index b8ecc4a2c0..2410df1fe0 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/VirtualHostTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/VirtualHostTest.java
@@ -54,6 +54,15 @@ public class VirtualHostTest extends QpidTestCase
TaskExecutor taskExecutor = mock(TaskExecutor.class);
when(taskExecutor.isTaskExecutorThread()).thenReturn(true);
when(_broker.getTaskExecutor()).thenReturn(taskExecutor);
+ when(_broker.getAttribute(Broker.QUEUE_ALERT_THRESHOLD_MESSAGE_AGE)).thenReturn(0l);
+ when(_broker.getAttribute(Broker.QUEUE_ALERT_THRESHOLD_MESSAGE_SIZE)).thenReturn(0l);
+ when(_broker.getAttribute(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_BYTES)).thenReturn(0l);
+ when(_broker.getAttribute(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES)).thenReturn(0l);
+ when(_broker.getAttribute(Broker.QUEUE_ALERT_REPEAT_GAP)).thenReturn(10000l);
+ when(_broker.getAttribute(Broker.QUEUE_MAXIMUM_DELIVERY_ATTEMPTS)).thenReturn(0);
+ when(_broker.getAttribute(Broker.QUEUE_FLOW_CONTROL_RESUME_SIZE_BYTES)).thenReturn(0l);
+ when(_broker.getAttribute(Broker.QUEUE_FLOW_CONTROL_SIZE_BYTES)).thenReturn(0l);
+ when(_broker.getAttribute(Broker.QUEUE_DEAD_LETTER_QUEUE_ENABLED)).thenReturn(false);
_recovererProvider = mock(RecovererProvider.class);
_statisticsGatherer = mock(StatisticsGatherer.class);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/AMQQueueFactoryTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/AMQQueueFactoryTest.java
index 31a0b9d358..02921f987c 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/AMQQueueFactoryTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/AMQQueueFactoryTest.java
@@ -33,8 +33,6 @@ import java.util.UUID;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.configuration.BrokerProperties;
-import org.apache.qpid.server.configuration.QueueConfiguration;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.exchange.DefaultExchangeFactory;
import org.apache.qpid.server.exchange.ExchangeImpl;
import org.apache.qpid.server.logging.EventLogger;
@@ -56,7 +54,6 @@ public class AMQQueueFactoryTest extends QpidTestCase
private VirtualHost _virtualHost;
private AMQQueueFactory _queueFactory;
private List<AMQQueue> _queues;
- private QueueConfiguration _queueConfiguration;
@Override
public void setUp() throws Exception
@@ -67,12 +64,8 @@ public class AMQQueueFactoryTest extends QpidTestCase
_virtualHost = mock(VirtualHost.class);
when(_virtualHost.getSecurityManager()).thenReturn(mock(SecurityManager.class));
-
- VirtualHostConfiguration vhostConfig = mock(VirtualHostConfiguration.class);
- when(_virtualHost.getConfiguration()).thenReturn(vhostConfig);
when(_virtualHost.getEventLogger()).thenReturn(new EventLogger());
- _queueConfiguration = mock(QueueConfiguration.class);
- when(vhostConfig.getQueueConfiguration(anyString())).thenReturn(_queueConfiguration);
+
DurableConfigurationStore store = mock(DurableConfigurationStore.class);
when(_virtualHost.getDurableConfigurationStore()).thenReturn(store);
@@ -284,15 +277,14 @@ public class AMQQueueFactoryTest extends QpidTestCase
String dlExchangeName = queueName + DefaultExchangeFactory.DEFAULT_DLE_NAME_SUFFIX;
String dlQueueName = queueName + AMQQueueFactory.DEFAULT_DLQ_NAME_SUFFIX;
- when(_queueConfiguration.getMaxDeliveryCount()).thenReturn(5);
- when(_queueConfiguration.isDeadLetterQueueEnabled()).thenReturn(true);
-
assertNull("The DLQ should not yet exist", _virtualHost.getQueue(dlQueueName));
assertNull("The alternate exchange should not yet exist", _virtualHost.getExchange(dlExchangeName));
Map<String,Object> attributes = new HashMap<String, Object>();
attributes.put(Queue.ID, UUID.randomUUID());
attributes.put(Queue.NAME, queueName);
+ attributes.put(Queue.CREATE_DLQ_ON_CREATION, true);
+ attributes.put(Queue.MAXIMUM_DELIVERY_ATTEMPTS, 5);
AMQQueue queue = _queueFactory.createQueue(attributes);
@@ -501,19 +493,16 @@ public class AMQQueueFactoryTest extends QpidTestCase
}
}
- public void testMessageGroupFromConfig() throws Exception
+ public void testMessageGroupQueue() throws Exception
{
- Map<String,String> arguments = new HashMap<String, String>();
-
- arguments.put(QueueArgumentsConverter.QPID_GROUP_HEADER_KEY,"mykey");
- arguments.put(QueueArgumentsConverter.QPID_SHARED_MSG_GROUP,"1");
-
- QueueConfiguration qConf = mock(QueueConfiguration.class);
- when(qConf.getArguments()).thenReturn(arguments);
- when(qConf.getName()).thenReturn("test");
+ Map<String,Object> attributes = new HashMap<String, Object>();
+ attributes.put(Queue.ID, UUID.randomUUID());
+ attributes.put(Queue.NAME, getTestName());
+ attributes.put(Queue.MESSAGE_GROUP_KEY,"mykey");
+ attributes.put(Queue.MESSAGE_GROUP_SHARED_GROUPS, true);
- AMQQueue queue = _queueFactory.createAMQQueueImpl(qConf);
+ AMQQueue queue = _queueFactory.createQueue(attributes);
assertEquals("mykey", queue.getAttribute(Queue.MESSAGE_GROUP_KEY));
assertEquals(Boolean.TRUE, queue.getAttribute(Queue.MESSAGE_GROUP_SHARED_GROUPS));
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/PriorityQueueListTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/PriorityQueueListTest.java
index 7eda8ea4fa..34371b1b11 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/PriorityQueueListTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/PriorityQueueListTest.java
@@ -28,8 +28,8 @@ import org.apache.qpid.server.message.AMQMessageHeader;
import org.apache.qpid.server.message.MessageReference;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.model.Queue;
-
import org.apache.qpid.server.security.SecurityManager;
+import org.apache.qpid.server.util.BrokerTestHelper;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.test.utils.QpidTestCase;
@@ -49,6 +49,7 @@ public class PriorityQueueListTest extends QpidTestCase
protected void setUp()
{
+ BrokerTestHelper.setUp();
QueueEntry[] entries = new QueueEntry[PRIORITIES.length];
Map<String,Object> queueAttributes = new HashMap<String, Object>();
queueAttributes.put(Queue.ID, UUID.randomUUID());
@@ -81,6 +82,19 @@ public class PriorityQueueListTest extends QpidTestCase
_priority5message2 = entries[2];
}
+ @Override
+ public void tearDown() throws Exception
+ {
+ try
+ {
+ super.tearDown();
+ }
+ finally
+ {
+ BrokerTestHelper.tearDown();
+ }
+ }
+
public void testPriorityQueueEntryCompareToItself()
{
//check messages compare to themselves properly
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java
index 11c2451118..a9036a49a4 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java
@@ -36,7 +36,6 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
-import org.apache.commons.configuration.Configuration;
import org.apache.qpid.common.AMQPFilterTypes;
import org.apache.qpid.server.binding.BindingImpl;
import org.apache.qpid.server.exchange.ExchangeImpl;
@@ -69,7 +68,6 @@ public abstract class AbstractDurableConfigurationStoreTestCase extends QpidTest
private String _storePath;
private String _storeName;
private MessageStore _messageStore;
- private Configuration _configuration;
private VirtualHost _virtualHost;
private ConfigurationRecoveryHandler _recoveryHandler;
@@ -98,7 +96,7 @@ public abstract class AbstractDurableConfigurationStoreTestCase extends QpidTest
_storePath = TMP_FOLDER + File.separator + _storeName;
FileUtils.delete(new File(_storePath), true);
setTestSystemProperty("QPID_WORK", TMP_FOLDER);
- _configuration = mock(Configuration.class);
+
_recoveryHandler = mock(ConfigurationRecoveryHandler.class);
_storedMessageRecoveryHandler = mock(StoredMessageRecoveryHandler.class);
_logRecoveryHandler = mock(TransactionLogRecoveryHandler.class);
@@ -116,8 +114,6 @@ public abstract class AbstractDurableConfigurationStoreTestCase extends QpidTest
when(_exchange.getId()).thenReturn(_exchangeId);
when(_exchange.getExchangeType()).thenReturn(mock(ExchangeType.class));
when(_exchange.getEventLogger()).thenReturn(new EventLogger());
- when(_configuration.getString(eq(MessageStoreConstants.ENVIRONMENT_PATH_PROPERTY), anyString())).thenReturn(
- _storePath);
when(_virtualHost.getAttribute(eq(VirtualHost.STORE_PATH))).thenReturn(_storePath);
_bindingArgs = new HashMap<String, Object>();
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestMemoryMessageStoreFactory.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestMemoryMessageStoreFactory.java
index fd2d4215ab..e2fb96bfef 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestMemoryMessageStoreFactory.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestMemoryMessageStoreFactory.java
@@ -21,9 +21,7 @@
package org.apache.qpid.server.store;
-import java.util.Collections;
import java.util.Map;
-import org.apache.commons.configuration.Configuration;
import org.apache.qpid.server.plugin.MessageStoreFactory;
public class TestMemoryMessageStoreFactory implements MessageStoreFactory
@@ -42,12 +40,6 @@ public class TestMemoryMessageStoreFactory implements MessageStoreFactory
}
@Override
- public Map<String, Object> convertStoreConfiguration(Configuration configuration)
- {
- return Collections.emptyMap();
- }
-
- @Override
public void validateAttributes(Map<String, Object> attributes)
{
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java
index 6b9bb08aa9..7d4dcd0280 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java
@@ -33,6 +33,7 @@ import java.util.concurrent.atomic.AtomicInteger;
*/
public class TestableMemoryMessageStore extends TestMemoryMessageStore
{
+ public static final String TYPE = "TestableMemory";
private final Map<Long, AMQQueue> _messages = new HashMap<Long, AMQQueue>();
private final AtomicInteger _messageCount = new AtomicInteger(0);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStoreFactory.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStoreFactory.java
new file mode 100644
index 0000000000..ba9b7c155e
--- /dev/null
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStoreFactory.java
@@ -0,0 +1,47 @@
+/*
+ *
+ * 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.store;
+
+import java.util.Map;
+
+import org.apache.qpid.server.plugin.MessageStoreFactory;
+
+public class TestableMemoryMessageStoreFactory implements MessageStoreFactory
+{
+ @Override
+ public String getType()
+ {
+ return TestableMemoryMessageStore.TYPE;
+ }
+
+ @Override
+ public MessageStore createMessageStore()
+ {
+ return new TestableMemoryMessageStore();
+ }
+
+ @Override
+ public void validateAttributes(Map<String, Object> attributes)
+ {
+ }
+
+}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java
index 857cc60a7e..0dc25a2ad2 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java
@@ -29,14 +29,11 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.qpid.server.exchange.ExchangeImpl;
import org.apache.qpid.server.logging.EventLogger;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.protocol.AMQConnectionModel;
import org.apache.qpid.server.protocol.AMQSessionModel;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.configuration.store.JsonConfigurationEntryStore;
import org.apache.qpid.server.exchange.DefaultExchangeFactory;
import org.apache.qpid.server.model.Broker;
@@ -45,9 +42,11 @@ import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.security.SecurityManager;
import org.apache.qpid.server.security.SubjectCreator;
import org.apache.qpid.server.stats.StatisticsGatherer;
+import org.apache.qpid.server.store.TestMemoryMessageStore;
import org.apache.qpid.server.store.TestableMemoryMessageStore;
import org.apache.qpid.server.virtualhost.StandardVirtualHostFactory;
import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.plugin.PluggableFactoryLoader;
import org.apache.qpid.server.plugin.VirtualHostFactory;
import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
import org.apache.qpid.server.virtualhost.QueueExistsException;
@@ -82,23 +81,14 @@ public class BrokerTestHelper
{
}
- public static VirtualHost createVirtualHost(VirtualHostConfiguration virtualHostConfiguration, VirtualHostRegistry virtualHostRegistry)
+ public static VirtualHost createVirtualHost(VirtualHostRegistry virtualHostRegistry, org.apache.qpid.server.model.VirtualHost modelVHost)
throws Exception
{
- return createVirtualHost(virtualHostConfiguration, virtualHostRegistry, mock(org.apache.qpid.server.model.VirtualHost.class));
- }
-
- public static VirtualHost createVirtualHost(VirtualHostConfiguration virtualHostConfiguration, VirtualHostRegistry virtualHostRegistry, org.apache.qpid.server.model.VirtualHost modelVHost)
- throws Exception
- {
- StatisticsGatherer statisticsGatherer = mock(StatisticsGatherer.class);
- final VirtualHostFactory factory =
- virtualHostConfiguration == null ? new StandardVirtualHostFactory()
- : VirtualHostFactory.FACTORIES.get(virtualHostConfiguration.getType());
+ String hostType = modelVHost.getType();
+ VirtualHostFactory factory = new PluggableFactoryLoader<VirtualHostFactory>(VirtualHostFactory.class).get(hostType);
VirtualHost host = factory.createVirtualHost(virtualHostRegistry,
- statisticsGatherer,
+ mock(StatisticsGatherer.class),
new SecurityManager(mock(Broker.class), false),
- virtualHostConfiguration,
modelVHost);
if(virtualHostRegistry != null)
{
@@ -107,29 +97,21 @@ public class BrokerTestHelper
return host;
}
- public static VirtualHost createVirtualHost(VirtualHostConfiguration virtualHostConfiguration) throws Exception
+ public static VirtualHost createVirtualHost(String name) throws Exception
{
-
- return createVirtualHost(virtualHostConfiguration, new VirtualHostRegistry(new EventLogger()));
+ return createVirtualHost(name, new VirtualHostRegistry(new EventLogger()));
}
public static VirtualHost createVirtualHost(String name, VirtualHostRegistry virtualHostRegistry) throws Exception
{
- VirtualHostConfiguration vhostConfig = createVirtualHostConfiguration(name);
- return createVirtualHost(vhostConfig, virtualHostRegistry);
- }
+ org.apache.qpid.server.model.VirtualHost virtualHost = mock(org.apache.qpid.server.model.VirtualHost.class);
+ when(virtualHost.getType()).thenReturn(StandardVirtualHostFactory.TYPE);
+ when(virtualHost.getAttribute(org.apache.qpid.server.model.VirtualHost.TYPE)).thenReturn(StandardVirtualHostFactory.TYPE);
- public static VirtualHost createVirtualHost(String name) throws Exception
- {
- VirtualHostConfiguration configuration = createVirtualHostConfiguration(name);
- return createVirtualHost(configuration);
- }
-
- private static VirtualHostConfiguration createVirtualHostConfiguration(String name) throws ConfigurationException
- {
- VirtualHostConfiguration vhostConfig = new VirtualHostConfiguration(name, new PropertiesConfiguration(), createBrokerMock());
- vhostConfig.setMessageStoreClass(TestableMemoryMessageStore.class.getName());
- return vhostConfig;
+ when(virtualHost.getStoreType()).thenReturn(TestableMemoryMessageStore.TYPE);
+ when(virtualHost.getAttribute(org.apache.qpid.server.model.VirtualHost.STORE_TYPE)).thenReturn(TestableMemoryMessageStore.TYPE);
+ when(virtualHost.getName()).thenReturn(name);
+ return createVirtualHost(virtualHostRegistry, virtualHost);
}
public static AMQSessionModel createSession(int channelId, AMQConnectionModel connection)
@@ -189,5 +171,4 @@ public class BrokerTestHelper
return queue;
}
-
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java
index f3f4b0d06e..04a218d024 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java
@@ -23,7 +23,6 @@ package org.apache.qpid.server.virtualhost;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ScheduledFuture;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.configuration.updater.TaskExecutor;
import org.apache.qpid.server.connection.IConnectionRegistry;
import org.apache.qpid.server.exchange.ExchangeImpl;
@@ -73,11 +72,6 @@ public class MockVirtualHost implements VirtualHost
return null;
}
- public VirtualHostConfiguration getConfiguration()
- {
- return null;
- }
-
public IConnectionRegistry getConnectionRegistry()
{
return null;
@@ -370,4 +364,10 @@ public class MockVirtualHost implements VirtualHost
{
return null;
}
+
+ @Override
+ public boolean getDefaultDeadLetterQueueEnabled()
+ {
+ return false;
+ }
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/StandardVirtualHostTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/StandardVirtualHostTest.java
index f081268337..570e748d7a 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/StandardVirtualHostTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/StandardVirtualHostTest.java
@@ -20,45 +20,46 @@
*/
package org.apache.qpid.server.virtualhost;
-import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.PropertiesConfiguration;
+import java.io.File;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
import org.apache.qpid.server.binding.BindingImpl;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.exchange.AbstractExchange;
import org.apache.qpid.server.exchange.ExchangeImpl;
+import org.apache.qpid.server.configuration.IllegalConfigurationException;
import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.Model;
+import org.apache.qpid.server.model.UUIDGenerator;
import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.security.SecurityManager;
import org.apache.qpid.server.stats.StatisticsGatherer;
+import org.apache.qpid.server.store.ConfigurationRecoveryHandler;
+import org.apache.qpid.server.store.JsonFileConfigStore;
import org.apache.qpid.server.store.TestMemoryMessageStore;
import org.apache.qpid.server.util.BrokerTestHelper;
-import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.test.utils.QpidTestCase;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
+import org.apache.qpid.test.utils.TestFileUtils;
+import org.apache.qpid.util.FileUtils;
+import org.codehaus.jackson.map.ObjectMapper;
public class StandardVirtualHostTest extends QpidTestCase
{
private VirtualHostRegistry _virtualHostRegistry;
+ private File _storeFolder;
@Override
public void setUp() throws Exception
{
super.setUp();
BrokerTestHelper.setUp();
+ _storeFolder = TestFileUtils.createTestDirectory(".tmp.store", true);
}
@Override
@@ -75,6 +76,7 @@ public class StandardVirtualHostTest extends QpidTestCase
{
BrokerTestHelper.tearDown();
super.tearDown();
+ FileUtils.delete(_storeFolder, false);
}
}
@@ -106,25 +108,23 @@ public class StandardVirtualHostTest extends QpidTestCase
{
final String queueName = getName();
final String customBinding = "custom-binding";
- File config = writeConfigFile(queueName, queueName, null, false, new String[]{customBinding});
+ writeConfigFile(queueName, queueName, null, false, new String[]{customBinding});
try
{
- createVirtualHost(queueName, config);
+ createVirtualHost(queueName);
fail("virtualhost creation should have failed due to illegal configuration");
}
- catch (ServerScopedRuntimeException e)
+ catch (IllegalConfigurationException e)
{
- Throwable cause = e.getCause();
- assertNotNull(cause);
- assertEquals("Attempt to bind queue '" + queueName + "' with binding key(s) [" + customBinding + "] without specifying an exchange", cause.getMessage());
+ // pass
}
}
public void testVirtualHostBecomesActive() throws Exception
{
- File config = writeConfigFile(getName(), getName(), getName() +".direct", false, new String[0]);
- VirtualHost vhost = createVirtualHost(getName(), config);
+ writeConfigFile(getName(), getName(), getName() +".direct", false, new String[0]);
+ VirtualHost vhost = createVirtualHost(getName());
assertNotNull(vhost);
assertEquals(State.ACTIVE, vhost.getState());
}
@@ -132,15 +132,15 @@ public class StandardVirtualHostTest extends QpidTestCase
public void testVirtualHostHavingStoreSetAsTypeBecomesActive() throws Exception
{
String virtualHostName = getName();
- VirtualHost host = createVirtualHostUsingStoreType(virtualHostName);
+ VirtualHost host = createVirtualHost(virtualHostName);
assertNotNull(host);
assertEquals(State.ACTIVE, host.getState());
}
public void testVirtualHostBecomesStoppedOnClose() throws Exception
{
- File config = writeConfigFile(getName(), getName(), getName() +".direct", false, new String[0]);
- VirtualHost vhost = createVirtualHost(getName(), config);
+ writeConfigFile(getName(), getName(), getName() +".direct", false, new String[0]);
+ VirtualHost vhost = createVirtualHost(getName());
assertNotNull(vhost);
assertEquals(State.ACTIVE, vhost.getState());
vhost.close();
@@ -151,7 +151,7 @@ public class StandardVirtualHostTest extends QpidTestCase
public void testVirtualHostHavingStoreSetAsTypeBecomesStoppedOnClose() throws Exception
{
String virtualHostName = getName();
- VirtualHost host = createVirtualHostUsingStoreType(virtualHostName);
+ VirtualHost host = createVirtualHost(virtualHostName);
assertNotNull(host);
assertEquals(State.ACTIVE, host.getState());
host.close();
@@ -166,33 +166,16 @@ public class StandardVirtualHostTest extends QpidTestCase
{
final String queueName = getName();
final String exchangeName = "made-up-exchange";
- File config = writeConfigFile(queueName, queueName, exchangeName, true, new String[0]);
-
- try
- {
- createVirtualHost(queueName, config);
- fail("virtualhost creation should have failed due to illegal configuration");
- }
- catch (ServerScopedRuntimeException e)
- {
- Throwable cause = e.getCause();
- assertNotNull(cause);
- assertEquals("Attempt to bind queue '" + queueName + "' to unknown exchange:" + exchangeName, cause.getMessage());
- }
- }
+ writeConfigFile(queueName, queueName, exchangeName, true, new String[0]);
- public void testCreateVirtualHostWithoutConfigurationInConfigFile() throws Exception
- {
- File config = writeConfigFile(getName(), getName(), getName() +".direct", false, new String[0]);
- String hostName = getName() + "-not-existing";
try
{
- createVirtualHost(hostName, config);
+ createVirtualHost(queueName);
fail("virtualhost creation should have failed due to illegal configuration");
}
- catch (RuntimeException e)
+ catch (IllegalConfigurationException e)
{
- assertEquals("No configuration found for virtual host '" + hostName + "' in " + config.getAbsolutePath(), e.getMessage());
+ // pass
}
}
@@ -205,8 +188,8 @@ public class StandardVirtualHostTest extends QpidTestCase
Map<String, String[]> bindingArguments = new HashMap<String, String[]>();
bindingArguments.put("ping", new String[]{"x-filter-jms-selector=select=1", "x-qpid-no-local"});
bindingArguments.put("pong", new String[]{"x-filter-jms-selector=select='pong'"});
- File config = writeConfigFile(vhostName, queueName, exchangeName, false, new String[]{"ping","pong"}, bindingArguments);
- VirtualHost vhost = createVirtualHost(vhostName, config);
+ writeConfigFile(vhostName, queueName, exchangeName, false, new String[]{"ping","pong"}, bindingArguments);
+ VirtualHost vhost = createVirtualHost(vhostName);
ExchangeImpl exch = vhost.getExchange(getName() +".direct");
Collection<BindingImpl> bindings = ((AbstractExchange)exch).getBindings();
@@ -246,8 +229,8 @@ public class StandardVirtualHostTest extends QpidTestCase
String vhostName = getName();
String queueName = getName();
- File config = writeConfigFile(vhostName, queueName, exchangeName, false, routingKeys);
- VirtualHost vhost = createVirtualHost(vhostName, config);
+ writeConfigFile(vhostName, queueName, exchangeName, false, routingKeys);
+ VirtualHost vhost = createVirtualHost(vhostName);
assertNotNull("virtualhost should exist", vhost);
AMQQueue queue = vhost.getQueue(queueName);
@@ -263,16 +246,19 @@ public class StandardVirtualHostTest extends QpidTestCase
}
- private VirtualHost createVirtualHost(String vhostName, File config) throws Exception
+ private VirtualHost createVirtualHost(String virtualHostName) throws Exception
{
- Broker broker = BrokerTestHelper.createBrokerMock();
+ Broker<?> broker = BrokerTestHelper.createBrokerMock();
_virtualHostRegistry = broker.getVirtualHostRegistry();
- VirtualHostConfiguration configuration = new VirtualHostConfiguration(vhostName, config, broker);
- VirtualHost host = new StandardVirtualHostFactory().createVirtualHost(_virtualHostRegistry, mock(StatisticsGatherer.class), new SecurityManager(mock(Broker.class), false), configuration,
- mock(org.apache.qpid.server.model.VirtualHost.class));
+ org.apache.qpid.server.model.VirtualHost<?> model = mock(org.apache.qpid.server.model.VirtualHost.class);
+ when(model.getAttribute(org.apache.qpid.server.model.VirtualHost.CONFIG_STORE_TYPE)).thenReturn(JsonFileConfigStore.TYPE);
+ when(model.getAttribute(org.apache.qpid.server.model.VirtualHost.CONFIG_STORE_PATH)).thenReturn(_storeFolder.getAbsolutePath());
+ when(model.getAttribute(org.apache.qpid.server.model.VirtualHost.STORE_TYPE)).thenReturn(TestMemoryMessageStore.TYPE);
+ when(model.getName()).thenReturn(virtualHostName);
+ VirtualHost host = new StandardVirtualHostFactory().createVirtualHost(_virtualHostRegistry, mock(StatisticsGatherer.class),
+ new SecurityManager(broker, false), model);
_virtualHostRegistry.registerVirtualHost(host);
-
return host;
}
@@ -285,95 +271,79 @@ public class StandardVirtualHostTest extends QpidTestCase
* @param dontDeclare if true then don't declare the exchange, even if its name is non-null
* @param routingKeys routingKeys to bind the queue with (empty array = none)
* @return
+ * @throws Exception
*/
- private File writeConfigFile(String vhostName, String queueName, String exchangeName, boolean dontDeclare, String[] routingKeys)
+ private void writeConfigFile(String vhostName, String queueName, String exchangeName, boolean dontDeclare, String[] routingKeys) throws Exception
{
- return writeConfigFile(vhostName, queueName, exchangeName, dontDeclare, routingKeys, null);
+ writeConfigFile(vhostName, queueName, exchangeName, dontDeclare, routingKeys, null);
}
- private File writeConfigFile(String vhostName, String queueName, String exchangeName, boolean dontDeclare, String[] routingKeys, Map<String, String[]> bindingArguments)
+ private void writeConfigFile(String vhostName, String queueName, String exchangeName, boolean dontDeclare,
+ String[] routingKeys, Map<String, String[]> bindingArguments) throws Exception
{
- File tmpFile = null;
- try
+ Map<String, Object> data = new HashMap<String, Object>();
+ data.put("modelVersion", Model.MODEL_VERSION);
+ data.put("configVersion", org.apache.qpid.server.model.VirtualHost.CURRENT_CONFIG_VERSION);
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper.writeValue(new File(_storeFolder, vhostName + ".json"), data);
+
+ JsonFileConfigStore store = new JsonFileConfigStore();
+ org.apache.qpid.server.model.VirtualHost<?> virtualHost = mock(org.apache.qpid.server.model.VirtualHost.class);
+ when(virtualHost.getName()).thenReturn(vhostName);
+ when(virtualHost.getAttribute(org.apache.qpid.server.model.VirtualHost.CONFIG_STORE_PATH)).thenReturn(_storeFolder.getAbsolutePath());
+ ConfigurationRecoveryHandler recoveryHandler = mock(ConfigurationRecoveryHandler.class);
+ when(recoveryHandler.completeConfigurationRecovery()).thenReturn(org.apache.qpid.server.model.VirtualHost.CURRENT_CONFIG_VERSION);
+ store.configureConfigStore(virtualHost , recoveryHandler );
+
+ UUID exchangeId = UUIDGenerator.generateExchangeUUID(exchangeName == null? "amq.direct" : exchangeName, vhostName);
+ if(exchangeName != null && !dontDeclare)
{
- tmpFile = File.createTempFile(getName(), ".tmp");
- tmpFile.deleteOnExit();
-
- FileWriter fstream = new FileWriter(tmpFile);
- BufferedWriter writer = new BufferedWriter(fstream);
-
- //extra outer tag to please Commons Configuration
-
- writer.write("<virtualhosts>");
- writer.write(" <default>" + vhostName + "</default>");
- writer.write(" <virtualhost>");
- writer.write(" <name>" + vhostName + "</name>");
- writer.write(" <" + vhostName + ">");
- writer.write(" <type>" + StandardVirtualHostFactory.TYPE + "</type>");
- writer.write(" <store>");
- writer.write(" <class>" + TestMemoryMessageStore.class.getName() + "</class>");
- writer.write(" </store>");
- if(exchangeName != null && !dontDeclare)
- {
- writer.write(" <exchanges>");
- writer.write(" <exchange>");
- writer.write(" <type>direct</type>");
- writer.write(" <name>" + exchangeName + "</name>");
- writer.write(" </exchange>");
- writer.write(" </exchanges>");
- }
- writer.write(" <queues>");
- writer.write(" <queue>");
- writer.write(" <name>" + queueName + "</name>");
- writer.write(" <" + queueName + ">");
- if(exchangeName != null)
- {
- writer.write(" <exchange>" + exchangeName + "</exchange>");
- }
- for(String routingKey: routingKeys)
+ Map<String, Object> exchangeAttributes = new HashMap<String, Object>();
+ exchangeAttributes.put(org.apache.qpid.server.model.Exchange.NAME, exchangeName);
+ exchangeAttributes.put(org.apache.qpid.server.model.Exchange.TYPE, "direct");
+ exchangeAttributes.put(org.apache.qpid.server.model.Exchange.DURABLE, true);
+ store.create(exchangeId, org.apache.qpid.server.model.Exchange.class.getSimpleName(), exchangeAttributes);
+ }
+
+ UUID queueId = UUID.randomUUID();
+ Map<String, Object> queueAttributes = new HashMap<String, Object>();
+ queueAttributes.put(org.apache.qpid.server.model.Queue.NAME, queueName);
+ queueAttributes.put(org.apache.qpid.server.model.Queue.DURABLE, true);
+ store.create(queueId, org.apache.qpid.server.model.Queue.class.getSimpleName(), queueAttributes);
+
+ Map<String, Object> bindingAttributes = new HashMap<String, Object>();
+ bindingAttributes.put(org.apache.qpid.server.model.Binding.NAME, queueName);
+ bindingAttributes.put(org.apache.qpid.server.model.Binding.QUEUE, queueId);
+ bindingAttributes.put(org.apache.qpid.server.model.Binding.EXCHANGE, exchangeId );
+ store.create(UUID.randomUUID(), org.apache.qpid.server.model.Binding.class.getSimpleName(), bindingAttributes);
+
+ for (int i = 0; i < routingKeys.length; i++)
+ {
+ Map<String, Object> attributes = new HashMap<String, Object>();
+ attributes.put(org.apache.qpid.server.model.Binding.NAME, routingKeys[i]);
+ attributes.put(org.apache.qpid.server.model.Binding.QUEUE, queueId);
+ attributes.put(org.apache.qpid.server.model.Binding.EXCHANGE, exchangeId );
+ if (bindingArguments != null && bindingArguments.containsKey(routingKeys[i]))
{
- writer.write(" <routingKey>" + routingKey + "</routingKey>\n");
- if (bindingArguments!= null && bindingArguments.containsKey(routingKey))
+ String[] args = (String[])bindingArguments.get(routingKeys[i]);
+ Map<String, Object> arguments = new HashMap<String, Object>();
+ for (int j = 0; j < args.length; j++)
{
- writer.write(" <" + routingKey + ">\n");
- String[] arguments = (String[])bindingArguments.get(routingKey);
- for (String argument : arguments)
+ int pos = args[j].indexOf('=');
+ if (pos == -1)
+ {
+ arguments.put(args[j], null);
+ }
+ else
{
- writer.write(" <bindingArgument>" + argument + "</bindingArgument>\n");
+ arguments.put(args[j].substring(0, pos), args[j].substring(pos + 1));
}
- writer.write(" </" + routingKey + ">\n");
}
+ attributes.put(org.apache.qpid.server.model.Binding.ARGUMENTS, arguments );
}
- writer.write(" </" + queueName + ">");
- writer.write(" </queue>");
- writer.write(" </queues>");
- writer.write(" </" + vhostName + ">");
- writer.write(" </virtualhost>");
- writer.write("</virtualhosts>");
-
- writer.flush();
- writer.close();
- }
- catch (IOException e)
- {
- fail("Unable to create virtualhost configuration");
+ store.create(UUID.randomUUID(), org.apache.qpid.server.model.Binding.class.getSimpleName(), attributes);
}
-
- return tmpFile;
+ store.close();
}
- private VirtualHost createVirtualHostUsingStoreType(String virtualHostName) throws ConfigurationException, Exception
- {
- Broker broker = BrokerTestHelper.createBrokerMock();
- _virtualHostRegistry = broker.getVirtualHostRegistry();
-
- Configuration config = new PropertiesConfiguration();
- VirtualHostConfiguration configuration = new VirtualHostConfiguration(virtualHostName, config, broker);
- final org.apache.qpid.server.model.VirtualHost virtualHost = mock(org.apache.qpid.server.model.VirtualHost.class);
- when(virtualHost.getAttribute(eq(org.apache.qpid.server.model.VirtualHost.STORE_TYPE))).thenReturn(TestMemoryMessageStore.TYPE);
- VirtualHost host = new StandardVirtualHostFactory().createVirtualHost(_virtualHostRegistry, mock(StatisticsGatherer.class), new SecurityManager(mock(Broker.class), false), configuration,
- virtualHost);
- _virtualHostRegistry.registerVirtualHost(host);
- return host;
- }
}
diff --git a/qpid/java/broker-core/src/test/resources/META-INF/services/org.apache.qpid.server.plugin.MessageStoreFactory b/qpid/java/broker-core/src/test/resources/META-INF/services/org.apache.qpid.server.plugin.MessageStoreFactory
index 9512fb8117..48241614d8 100644
--- a/qpid/java/broker-core/src/test/resources/META-INF/services/org.apache.qpid.server.plugin.MessageStoreFactory
+++ b/qpid/java/broker-core/src/test/resources/META-INF/services/org.apache.qpid.server.plugin.MessageStoreFactory
@@ -17,3 +17,4 @@
# under the License.
#
org.apache.qpid.server.store.TestMemoryMessageStoreFactory
+org.apache.qpid.server.store.TestableMemoryMessageStoreFactory \ No newline at end of file
diff --git a/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/DefaultAccessControl.java b/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/DefaultAccessControl.java
index f6d8b04880..5f5e12d435 100644
--- a/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/DefaultAccessControl.java
+++ b/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/DefaultAccessControl.java
@@ -29,7 +29,6 @@ import java.util.Set;
import javax.security.auth.Subject;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.lang.ObjectUtils;
import org.apache.log4j.Logger;
import org.apache.qpid.server.configuration.IllegalConfigurationException;
@@ -64,7 +63,7 @@ public class DefaultAccessControl implements AccessControl
_aclFile = new File(fileName);
}
- DefaultAccessControl(RuleSet rs) throws ConfigurationException
+ DefaultAccessControl(RuleSet rs)
{
_ruleSet = rs;
_eventLogger = rs;
diff --git a/qpid/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/PlainConfigurationTest.java b/qpid/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/PlainConfigurationTest.java
index 1440904c74..6ac21f856a 100644
--- a/qpid/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/PlainConfigurationTest.java
+++ b/qpid/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/PlainConfigurationTest.java
@@ -36,12 +36,6 @@ import org.apache.qpid.server.security.access.Operation;
import static org.mockito.Mockito.mock;
-/**
- * These tests check that the ACL file parsing works correctly.
- *
- * For each message that can be returned in a {@link ConfigurationException}, an ACL file is created that should trigger this
- * particular message.
- */
public class PlainConfigurationTest extends TestCase
{
private PlainConfiguration writeACLConfig(String...aclData) throws Exception
diff --git a/qpid/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/plugins/DefaultAccessControlTest.java b/qpid/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/plugins/DefaultAccessControlTest.java
index 74ea7639ff..3a36ddef2c 100644
--- a/qpid/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/plugins/DefaultAccessControlTest.java
+++ b/qpid/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/plugins/DefaultAccessControlTest.java
@@ -31,7 +31,6 @@ import javax.security.auth.Subject;
import junit.framework.TestCase;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.server.connection.ConnectionPrincipal;
import org.apache.qpid.server.logging.EventLogger;
import org.apache.qpid.server.logging.EventLoggerProvider;
@@ -68,12 +67,12 @@ public class DefaultAccessControlTest extends TestCase
_plugin = null;
}
- private void setUpGroupAccessControl() throws ConfigurationException
+ private void setUpGroupAccessControl()
{
configureAccessControl(createGroupRuleSet());
}
- private void configureAccessControl(final RuleSet rs) throws ConfigurationException
+ private void configureAccessControl(final RuleSet rs)
{
_plugin = new DefaultAccessControl(rs);
}
@@ -98,7 +97,7 @@ public class DefaultAccessControlTest extends TestCase
/**
* ACL plugin must always abstain if there is no subject attached to the thread.
*/
- public void testNoSubjectAlwaysAbstains() throws ConfigurationException
+ public void testNoSubjectAlwaysAbstains()
{
setUpGroupAccessControl();
final Result result = _plugin.authorise(Operation.ACCESS, ObjectType.VIRTUALHOST, ObjectProperties.EMPTY);
@@ -109,7 +108,7 @@ public class DefaultAccessControlTest extends TestCase
* Tests that an allow rule expressed with a username allows an operation performed by a thread running
* with the same username.
*/
- public void testUsernameAllowsOperation() throws ConfigurationException
+ public void testUsernameAllowsOperation()
{
setUpGroupAccessControl();
Subject.doAs(TestPrincipalUtils.createTestSubject("user1"), new PrivilegedAction<Object>()
@@ -128,7 +127,7 @@ public class DefaultAccessControlTest extends TestCase
* Tests that an allow rule expressed with an <b>ACL groupname</b> allows an operation performed by a thread running
* by a user who belongs to the same group..
*/
- public void testGroupMembershipAllowsOperation() throws ConfigurationException
+ public void testGroupMembershipAllowsOperation()
{
setUpGroupAccessControl();
@@ -141,7 +140,7 @@ public class DefaultAccessControlTest extends TestCase
* Tests that a deny rule expressed with a <b>groupname</b> denies an operation performed by a thread running
* by a user who belongs to the same group.
*/
- public void testGroupMembershipDeniesOperation() throws ConfigurationException
+ public void testGroupMembershipDeniesOperation()
{
setUpGroupAccessControl();
authoriseAndAssertResult(Result.DENIED, "user3", DENIED_GROUP);
@@ -150,7 +149,7 @@ public class DefaultAccessControlTest extends TestCase
/**
* Tests that the catch all deny denies the operation and logs with the logging actor.
*/
- public void testCatchAllRuleDeniesUnrecognisedUsername() throws ConfigurationException
+ public void testCatchAllRuleDeniesUnrecognisedUsername()
{
setUpGroupAccessControl();
Subject.doAs(TestPrincipalUtils.createTestSubject("unknown", "unkgroup1", "unkgroup2"),
@@ -177,7 +176,7 @@ public class DefaultAccessControlTest extends TestCase
/**
* Tests that a grant access method rule allows any access operation to be performed on any component
*/
- public void testAuthoriseAccessMethodWhenAllAccessOperationsAllowedOnAllComponents() throws ConfigurationException
+ public void testAuthoriseAccessMethodWhenAllAccessOperationsAllowedOnAllComponents()
{
final RuleSet rs = new RuleSet(mock(EventLoggerProvider.class));
@@ -203,7 +202,7 @@ public class DefaultAccessControlTest extends TestCase
/**
* Tests that a grant access method rule allows any access operation to be performed on a specified component
*/
- public void testAuthoriseAccessMethodWhenAllAccessOperationsAllowedOnSpecifiedComponent() throws ConfigurationException
+ public void testAuthoriseAccessMethodWhenAllAccessOperationsAllowedOnSpecifiedComponent()
{
final RuleSet rs = new RuleSet(mock(EventLoggerProvider.class));
@@ -303,7 +302,7 @@ public class DefaultAccessControlTest extends TestCase
/**
* Tests that a grant access method rule allows any access operation to be performed on a specified component
*/
- public void testAuthoriseAccessMethodWhenSpecifiedAccessOperationsAllowedOnSpecifiedComponent() throws ConfigurationException
+ public void testAuthoriseAccessMethodWhenSpecifiedAccessOperationsAllowedOnSpecifiedComponent()
{
final RuleSet rs = new RuleSet(mock(EventLoggerProvider.class));
@@ -340,7 +339,7 @@ public class DefaultAccessControlTest extends TestCase
/**
* Tests that granting of all method rights on a method allows a specified operation to be performed on any component
*/
- public void testAuthoriseAccessUpdateMethodWhenAllRightsGrantedOnSpecifiedMethodForAllComponents() throws ConfigurationException
+ public void testAuthoriseAccessUpdateMethodWhenAllRightsGrantedOnSpecifiedMethodForAllComponents()
{
final RuleSet rs = new RuleSet(mock(EventLoggerProvider.class));
@@ -379,7 +378,7 @@ public class DefaultAccessControlTest extends TestCase
/**
* Tests that granting of all method rights allows any operation to be performed on any component
*/
- public void testAuthoriseAccessUpdateMethodWhenAllRightsGrantedOnAllMethodsInAllComponents() throws ConfigurationException
+ public void testAuthoriseAccessUpdateMethodWhenAllRightsGrantedOnAllMethodsInAllComponents()
{
final RuleSet rs = new RuleSet(mock(EventLoggerProvider.class));
@@ -417,7 +416,7 @@ public class DefaultAccessControlTest extends TestCase
/**
* Tests that granting of access method rights with mask allows matching operations to be performed on the specified component
*/
- public void testAuthoriseAccessMethodWhenMatchingAccessOperationsAllowedOnSpecifiedComponent() throws ConfigurationException
+ public void testAuthoriseAccessMethodWhenMatchingAccessOperationsAllowedOnSpecifiedComponent()
{
final RuleSet rs = new RuleSet(mock(EventLoggerProvider.class));
diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStoreFactory.java b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStoreFactory.java
index 47a451ccf6..8a3c5683ac 100644
--- a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStoreFactory.java
+++ b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStoreFactory.java
@@ -20,9 +20,7 @@
*/
package org.apache.qpid.server.store.derby;
-import java.util.Collections;
import java.util.Map;
-import org.apache.commons.configuration.Configuration;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory;
import org.apache.qpid.server.plugin.MessageStoreFactory;
@@ -51,13 +49,6 @@ public class DerbyMessageStoreFactory implements MessageStoreFactory, DurableCon
}
@Override
- public Map<String, Object> convertStoreConfiguration(Configuration configuration)
- {
- return Collections.emptyMap();
- }
-
-
- @Override
public void validateAttributes(Map<String, Object> attributes)
{
if(getType().equals(attributes.get(VirtualHost.STORE_TYPE)))
diff --git a/qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/org/apache/qpid/server/store/jdbc/bonecp/BoneCPConnectionProvider.java b/qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/org/apache/qpid/server/store/jdbc/bonecp/BoneCPConnectionProvider.java
index 1cde6f130d..1d9ff9a8e1 100644
--- a/qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/org/apache/qpid/server/store/jdbc/bonecp/BoneCPConnectionProvider.java
+++ b/qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/org/apache/qpid/server/store/jdbc/bonecp/BoneCPConnectionProvider.java
@@ -24,7 +24,6 @@ import com.jolbox.bonecp.BoneCP;
import com.jolbox.bonecp.BoneCPConfig;
import java.sql.Connection;
import java.sql.SQLException;
-import org.apache.commons.configuration.Configuration;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.store.jdbc.ConnectionProvider;
diff --git a/qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/org/apache/qpid/server/store/jdbc/bonecp/BoneCPConnectionProviderFactory.java b/qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/org/apache/qpid/server/store/jdbc/bonecp/BoneCPConnectionProviderFactory.java
index 73876eceb4..b95ad1166c 100644
--- a/qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/org/apache/qpid/server/store/jdbc/bonecp/BoneCPConnectionProviderFactory.java
+++ b/qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/org/apache/qpid/server/store/jdbc/bonecp/BoneCPConnectionProviderFactory.java
@@ -21,7 +21,6 @@
package org.apache.qpid.server.store.jdbc.bonecp;
import java.sql.SQLException;
-import org.apache.commons.configuration.Configuration;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.plugin.JDBCConnectionProviderFactory;
import org.apache.qpid.server.store.jdbc.ConnectionProvider;
diff --git a/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStoreFactory.java b/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStoreFactory.java
index 1144eaaf18..c0ece88692 100644
--- a/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStoreFactory.java
+++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStoreFactory.java
@@ -20,9 +20,7 @@
*/
package org.apache.qpid.server.store.jdbc;
-import java.util.HashMap;
import java.util.Map;
-import org.apache.commons.configuration.Configuration;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory;
import org.apache.qpid.server.plugin.MessageStoreFactory;
@@ -51,28 +49,6 @@ public class JDBCMessageStoreFactory implements MessageStoreFactory, DurableConf
}
@Override
- public Map<String, Object> convertStoreConfiguration(Configuration storeConfiguration)
- {
- Map<String,Object> convertedMap = new HashMap<String,Object>();
- convertedMap.put("jdbcBlobType", storeConfiguration.getString("sqlBlobType"));
- convertedMap.put("jdbcVarbinaryType", storeConfiguration.getString("sqlVarbinaryType"));
- if(storeConfiguration.containsKey("useBytesForBlob"))
- {
- convertedMap.put("jdbcUseBytesForBlob", storeConfiguration.getBoolean("useBytesForBlob"));
- }
- convertedMap.put("jdbcBigIntType", storeConfiguration.getString("sqlBigIntType"));
- convertedMap.put("connectionPool", storeConfiguration.getString("pool.type"));
- convertedMap.put("minConnectionsPerPartition", storeConfiguration.getInteger("pool.minConnectionsPerPartition",
- null));
- convertedMap.put("maxConnectionsPerPartition", storeConfiguration.getInteger("pool.maxConnectionsPerPartition",
- null));
- convertedMap.put("partitionCount", storeConfiguration.getInteger("pool.partitionCount", null));
-
- return convertedMap;
- }
-
-
- @Override
public void validateAttributes(Map<String, Object> attributes)
{
if(getType().equals(attributes.get(VirtualHost.STORE_TYPE)))
diff --git a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/ManagedObjectRegistry.java b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/ManagedObjectRegistry.java
index d8aea03b36..26608d4309 100644
--- a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/ManagedObjectRegistry.java
+++ b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/ManagedObjectRegistry.java
@@ -20,10 +20,10 @@
*/
package org.apache.qpid.server.jmx;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.common.Closeable;
import javax.management.JMException;
+
import java.io.IOException;
/**
@@ -40,7 +40,7 @@ import java.io.IOException;
*/
public interface ManagedObjectRegistry extends Closeable
{
- void start() throws IOException, ConfigurationException;
+ void start() throws IOException;
void registerObject(ManagedObject managedObject) throws JMException;
diff --git a/qpid/java/broker-plugins/memory-store/src/main/java/org/apache/qpid/server/store/MemoryMessageStoreFactory.java b/qpid/java/broker-plugins/memory-store/src/main/java/org/apache/qpid/server/store/MemoryMessageStoreFactory.java
index 49f823e7ee..a715073b7e 100644
--- a/qpid/java/broker-plugins/memory-store/src/main/java/org/apache/qpid/server/store/MemoryMessageStoreFactory.java
+++ b/qpid/java/broker-plugins/memory-store/src/main/java/org/apache/qpid/server/store/MemoryMessageStoreFactory.java
@@ -20,9 +20,7 @@
*/
package org.apache.qpid.server.store;
-import java.util.Collections;
import java.util.Map;
-import org.apache.commons.configuration.Configuration;
import org.apache.qpid.server.plugin.MessageStoreFactory;
public class MemoryMessageStoreFactory implements MessageStoreFactory
@@ -41,12 +39,6 @@ public class MemoryMessageStoreFactory implements MessageStoreFactory
}
@Override
- public Map<String, Object> convertStoreConfiguration(Configuration configuration)
- {
- return Collections.emptyMap();
- }
-
- @Override
public void validateAttributes(Map<String, Object> attributes)
{
}
diff --git a/qpid/java/module.xml b/qpid/java/module.xml
index 6d3f08a386..d598517a95 100644
--- a/qpid/java/module.xml
+++ b/qpid/java/module.xml
@@ -418,6 +418,7 @@
<propertyref name="java.naming.factory.initial"/>
<propertyref name="java.naming.provider.url"/>
<propertyref name="messagestore.class.name" />
+ <propertyref name="messagestore.type" />
<propertyref name="max_prefetch"/>
<propertyref name="QPID_HOME"/>
diff --git a/qpid/java/qpid-test-utils/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java b/qpid/java/qpid-test-utils/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java
index 20d5dd5453..7113f79829 100644
--- a/qpid/java/qpid-test-utils/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java
+++ b/qpid/java/qpid-test-utils/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java
@@ -22,6 +22,7 @@ package org.apache.qpid.test.utils;
import junit.framework.TestCase;
import junit.framework.TestResult;
+
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
@@ -124,10 +125,7 @@ public class QpidTestCase extends TestCase
}
}
- protected static final String MESSAGE_STORE_CLASS_NAME_KEY = "messagestore.class.name";
- protected static final String CONFIGURATION_STORE_CLASS_NAME_KEY = "configurationstore.class.name";
-
- protected static final String MEMORY_STORE_CLASS_NAME = "org.apache.qpid.server.store.MemoryMessageStore";
+ protected static final String MESSAGE_STORE_TYPE = "messagestore.type";
private static List<String> _exclusionList;
@@ -151,12 +149,12 @@ public class QpidTestCase extends TestCase
}
}
- public String getTestProfileMessageStoreClassName()
+ public String getTestProfileMessageStoreType()
{
- final String storeClass = System.getProperty(MESSAGE_STORE_CLASS_NAME_KEY);
- _logger.debug("MESSAGE_STORE_CLASS_NAME_KEY " + storeClass);
+ final String storeType = System.getProperty(MESSAGE_STORE_TYPE);
+ _logger.debug(MESSAGE_STORE_TYPE + "=" + storeType);
- return storeClass != null ? storeClass : MEMORY_STORE_CLASS_NAME ;
+ return storeType != null ? storeType : "TestableMemory";
}
diff --git a/qpid/java/systests/etc/config-systests.json b/qpid/java/systests/etc/config-systests.json
index 12a8a5c5a6..60f3f7f174 100644
--- a/qpid/java/systests/etc/config-systests.json
+++ b/qpid/java/systests/etc/config-systests.json
@@ -22,7 +22,7 @@
"name": "Broker",
"defaultVirtualHost" : "test",
"storeVersion": 1,
- "modelVersion": "1.0",
+ "modelVersion": "1.3",
"authenticationproviders" : [ {
"name" : "plain",
"type" : "PlainPasswordFile",
@@ -59,6 +59,8 @@
}],
"virtualhosts" : [ {
"name" : "test",
- "configPath" : "${broker.virtualhosts-config}"
+ "type" : "STANDARD",
+ "storeType": "${messagestore.type}",
+ "storePath" : "${QPID_WORK}/test"
} ]
}
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 a19ba21c5c..7d5690b1bd 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
@@ -25,9 +25,17 @@ 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.io.ByteArrayOutputStream;
+import java.io.PrintStream;
import java.util.Arrays;
-import javax.net.ssl.SSLSocket;
-import org.apache.commons.configuration.ConfigurationException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.Session;
+
import org.apache.qpid.client.AMQConnectionURL;
import org.apache.qpid.client.AMQTestConnection_0_10;
import org.apache.qpid.jms.ConnectionURL;
@@ -36,15 +44,6 @@ 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
{
private static final String CERT_ALIAS_APP1 = "app1";
@@ -402,7 +401,7 @@ public class SSLTest extends QpidBrokerTestCase
boolean sslOnly,
boolean needClientAuth,
boolean wantClientAuth,
- boolean samePort) throws ConfigurationException
+ boolean samePort) throws Exception
{
if(isJavaBroker())
{
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 68ec101245..d3d952ea8c 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
@@ -20,8 +20,19 @@
*/
package org.apache.qpid.server.logging;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
import org.apache.qpid.client.AMQDestination;
import org.apache.qpid.client.AMQSession;
+import org.apache.qpid.server.management.plugin.HttpManagement;
+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.security.auth.manager.AnonymousAuthenticationManagerFactory;
+import org.apache.qpid.systest.rest.RestTestHelper;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
import javax.jms.Connection;
import javax.jms.Queue;
@@ -29,7 +40,7 @@ import javax.jms.Session;
public class AlertingTest extends AbstractTestLogging
{
- private String VIRTUALHOST = "test";
+
private Session _session;
private Connection _connection;
private Queue _destination;
@@ -41,9 +52,9 @@ public class AlertingTest extends AbstractTestLogging
public void setUp() throws Exception
{
_numMessages = 50;
-
- setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", String.valueOf(ALERT_LOG_WAIT_PERIOD));
- setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".queues.maximumMessageCount", String.valueOf(_numMessages));
+ TestBrokerConfiguration brokerConfiguration = getBrokerConfiguration();
+ brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD, String.valueOf(ALERT_LOG_WAIT_PERIOD));
+ brokerConfiguration.setBrokerAttribute(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES, _numMessages);
// Then we do the normal setup stuff like starting the broker, getting a connection etc.
super.setUp();
@@ -140,8 +151,24 @@ 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
- setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".queues.maximumMessageCount", "5");
+ RestTestHelper restTestHelper = new RestTestHelper(findFreePort());
+ TestBrokerConfiguration config = getBrokerConfiguration();
+ config.addHttpManagementConfiguration();
+ config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_PORT, Port.PORT, restTestHelper.getHttpPort());
+ config.removeObjectConfiguration(TestBrokerConfiguration.ENTRY_NAME_JMX_PORT);
+ config.removeObjectConfiguration(TestBrokerConfiguration.ENTRY_NAME_RMI_PORT);
+
+ Map<String, Object> anonymousProviderAttributes = new HashMap<String, Object>();
+ anonymousProviderAttributes.put(AuthenticationProvider.TYPE, AnonymousAuthenticationManagerFactory.PROVIDER_TYPE);
+ anonymousProviderAttributes.put(AuthenticationProvider.NAME, "testAnonymous");
+ config.addAuthenticationProviderConfiguration(anonymousProviderAttributes);
+
+ // set password authentication provider on http port for the tests
+ config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_PORT, Port.AUTHENTICATION_PROVIDER,
+ TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER);
+ config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
+ config.setSaved(false);
+ restTestHelper.setUsernameAndPassword("webadmin", "webadmin");
startBroker();
@@ -154,6 +181,12 @@ public class AlertingTest extends AbstractTestLogging
// Ensure the alert has not occurred yet
assertLoggingNotYetOccured(MESSAGE_COUNT_ALERT);
+ // Change max message count to 5, start broker and make sure that that's triggered at the right time
+ TestBrokerConfiguration brokerConfiguration = getBrokerConfiguration();
+ brokerConfiguration.setBrokerAttribute(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES, 5);
+ brokerConfiguration.setSaved(false);
+
+ restTestHelper.submitRequest("/rest/queue/test/" + getTestQueueName(), "PUT", Collections.<String, Object>singletonMap(org.apache.qpid.server.model.Queue.ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES, 5));
// Trigger the new value
sendMessage(_session, _destination, 3);
_session.commit();
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 7a3edd316f..72626e5089 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
@@ -18,22 +18,22 @@
*/
package org.apache.qpid.server.security.acl;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.lang.StringUtils;
-
import org.apache.qpid.AMQException;
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.server.model.VirtualHost;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
import org.apache.qpid.url.URLSyntaxException;
import javax.jms.Connection;
import javax.jms.ExceptionListener;
import javax.jms.JMSException;
import javax.naming.NamingException;
+
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
@@ -98,23 +98,24 @@ public abstract class AbstractACLTestCase extends QpidBrokerTestCase implements
}
}
- public void writeACLFile(final String vhost, final String...rules) throws ConfigurationException, IOException
+ public void writeACLFile(final String vhost, final String...rules) throws IOException
{
writeACLFileUtil(this, vhost, rules);
}
- public static void writeACLFileUtil(QpidBrokerTestCase testcase, String vhost, String...rules) throws ConfigurationException, IOException
+ public static void writeACLFileUtil(QpidBrokerTestCase testcase, String vhost, String...rules) throws IOException
{
File aclFile = File.createTempFile(testcase.getClass().getSimpleName(), testcase.getName());
aclFile.deleteOnExit();
+ TestBrokerConfiguration config = testcase.getBrokerConfiguration();
if (vhost == null)
{
- testcase.getBrokerConfiguration().addAclFileConfiguration(aclFile.getAbsolutePath());
+ config.addAclFileConfiguration(aclFile.getAbsolutePath());
}
else
{
- testcase.setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + vhost + ".security.acl", aclFile.getAbsolutePath());
+ config.setObjectAttribute(vhost, VirtualHost.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/auth/manager/ExternalAuthenticationTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationTest.java
index e076415146..85d3fc0cdc 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
@@ -38,7 +38,6 @@ 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.management.common.mbeans.ManagedConnection;
import org.apache.qpid.server.model.AuthenticationProvider;
@@ -328,12 +327,12 @@ public class ExternalAuthenticationTest extends QpidBrokerTestCase
return getConnection(new AMQConnectionURL(url));
}
- private void setCommonBrokerSSLProperties(boolean needClientAuth) throws ConfigurationException
+ private void setCommonBrokerSSLProperties(boolean needClientAuth)
{
setCommonBrokerSSLProperties(needClientAuth, Collections.singleton(TestBrokerConfiguration.ENTRY_NAME_SSL_TRUSTSTORE));
}
- private void setCommonBrokerSSLProperties(boolean needClientAuth, Collection<String> trustStoreNames) throws ConfigurationException
+ private void setCommonBrokerSSLProperties(boolean needClientAuth, Collection<String> trustStoreNames)
{
TestBrokerConfiguration config = getBrokerConfiguration();
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/MessageStoreTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/MessageStoreTest.java
index 1d7c2ffa46..9dc981a358 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/MessageStoreTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/MessageStoreTest.java
@@ -21,10 +21,15 @@
package org.apache.qpid.server.store;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
-
-import org.apache.commons.configuration.PropertiesConfiguration;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.qpid.common.AMQPFilterTypes;
@@ -34,41 +39,34 @@ import org.apache.qpid.framing.ContentHeaderBody;
import org.apache.qpid.framing.FieldTable;
import org.apache.qpid.framing.abstraction.MessagePublishInfo;
import org.apache.qpid.framing.amqp_8_0.BasicConsumeBodyImpl;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.exchange.DirectExchange;
import org.apache.qpid.server.exchange.ExchangeImpl;
import org.apache.qpid.server.exchange.TopicExchange;
+import org.apache.qpid.server.logging.EventLogger;
import org.apache.qpid.server.message.InstanceProperties;
import org.apache.qpid.server.message.MessageSource;
import org.apache.qpid.server.model.Binding;
+import org.apache.qpid.server.model.Broker;
import org.apache.qpid.server.model.ExclusivityPolicy;
import org.apache.qpid.server.model.LifetimePolicy;
import org.apache.qpid.server.model.Queue;
-import org.apache.qpid.server.protocol.v0_8.AMQMessage;
-import org.apache.qpid.server.protocol.v0_8.MessageMetaData;
-import org.apache.qpid.server.model.Broker;
import org.apache.qpid.server.model.UUIDGenerator;
import org.apache.qpid.server.plugin.ExchangeType;
-import org.apache.qpid.server.queue.PriorityQueue;
+import org.apache.qpid.server.protocol.v0_8.AMQMessage;
+import org.apache.qpid.server.protocol.v0_8.MessageMetaData;
import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.queue.ConflationQueue;
+import org.apache.qpid.server.queue.PriorityQueue;
import org.apache.qpid.server.queue.StandardQueue;
import org.apache.qpid.server.txn.AutoCommitTransaction;
import org.apache.qpid.server.txn.ServerTransaction;
import org.apache.qpid.server.util.BrokerTestHelper;
+import org.apache.qpid.server.virtualhost.StandardVirtualHostFactory;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
import org.apache.qpid.test.utils.QpidTestCase;
import org.apache.qpid.util.FileUtils;
-import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
/**
* This tests the MessageStores by using the available interfaces.
*
@@ -104,8 +102,6 @@ public class MessageStoreTest extends QpidTestCase
private String queueOwner = "MST";
- private PropertiesConfiguration _config;
-
private VirtualHost _virtualHost;
private org.apache.qpid.server.model.VirtualHost _virtualHostModel;
private Broker _broker;
@@ -116,15 +112,16 @@ public class MessageStoreTest extends QpidTestCase
super.setUp();
BrokerTestHelper.setUp();
- _storePath = System.getProperty("QPID_WORK") + File.separator + getName();
+ String hostName = getName();
+ _storePath = System.getProperty("QPID_WORK", TMP_FOLDER + File.separator + getTestName()) + File.separator + hostName;
- _config = new PropertiesConfiguration();
- _config.addProperty("store.class", getTestProfileMessageStoreClassName());
- _config.addProperty("store.environment-path", _storePath);
_virtualHostModel = mock(org.apache.qpid.server.model.VirtualHost.class);
when(_virtualHostModel.getAttribute(eq(org.apache.qpid.server.model.VirtualHost.STORE_PATH))).thenReturn(_storePath);
-
-
+ when(_virtualHostModel.getAttribute(eq(org.apache.qpid.server.model.VirtualHost.STORE_TYPE))).thenReturn(getTestProfileMessageStoreType());
+ when(_virtualHostModel.getAttribute(eq(org.apache.qpid.server.model.VirtualHost.TYPE))).thenReturn(StandardVirtualHostFactory.TYPE);
+ when(_virtualHostModel.getAttribute(eq(org.apache.qpid.server.model.VirtualHost.NAME))).thenReturn(hostName);
+ when(_virtualHostModel.getType()).thenReturn(StandardVirtualHostFactory.TYPE);
+ when(_virtualHostModel.getName()).thenReturn(hostName);
cleanup(new File(_storePath));
@@ -138,7 +135,7 @@ public class MessageStoreTest extends QpidTestCase
return _storePath;
}
- protected org.apache.qpid.server.model.VirtualHost getVirtualHostModel()
+ protected org.apache.qpid.server.model.VirtualHost<?> getVirtualHostModel()
{
return _virtualHostModel;
}
@@ -165,11 +162,6 @@ public class MessageStoreTest extends QpidTestCase
return _virtualHost;
}
- public PropertiesConfiguration getConfig()
- {
- return _config;
- }
-
protected void reloadVirtualHost()
{
VirtualHost original = getVirtualHost();
@@ -189,7 +181,7 @@ public class MessageStoreTest extends QpidTestCase
try
{
- _virtualHost = BrokerTestHelper.createVirtualHost(new VirtualHostConfiguration(getClass().getName(), _config, _broker),new VirtualHostRegistry(_broker.getEventLogger()),getVirtualHostModel());
+ _virtualHost = BrokerTestHelper.createVirtualHost(new VirtualHostRegistry(new EventLogger()), getVirtualHostModel());
}
catch (Exception e)
{
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/QuotaMessageStore.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/QuotaMessageStore.java
index 19e258d060..9bc1a57261 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/QuotaMessageStore.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/QuotaMessageStore.java
@@ -30,6 +30,7 @@ import org.apache.qpid.server.model.VirtualHost;
public class
QuotaMessageStore extends NullMessageStore
{
+ public static final String TYPE = "QuotaMessageStore";
private final AtomicLong _messageId = new AtomicLong(1);
private final AtomicBoolean _closed = new AtomicBoolean(false);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/ExchangeConfiguration.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/QuotaMessageStoreFactory.java
index 6cbaf26480..b4f81e2ad6 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/ExchangeConfiguration.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/QuotaMessageStoreFactory.java
@@ -7,9 +7,9 @@
* 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
@@ -18,41 +18,31 @@
* under the License.
*
*/
-package org.apache.qpid.server.configuration;
-
-import org.apache.commons.configuration.Configuration;
+package org.apache.qpid.server.store;
-public class ExchangeConfiguration
-{
-
- private Configuration _config;
- private String _name;
+import java.util.Map;
- public ExchangeConfiguration(String name, Configuration subset)
- {
- _name = name;
- _config = subset;
- }
+import org.apache.qpid.server.plugin.MessageStoreFactory;
- public String getName()
- {
- return _name;
- }
+public class QuotaMessageStoreFactory implements MessageStoreFactory
+{
+ @Override
public String getType()
{
- return _config.getString("type","direct");
+ return QuotaMessageStore.TYPE;
}
- public boolean getDurable()
+ @Override
+ public MessageStore createMessageStore()
{
- return _config.getBoolean("durable", false);
+ return new QuotaMessageStore();
}
- public boolean getAutoDelete()
+ @Override
+ public void validateAttributes(Map<String, Object> attributes)
{
- return _config.getBoolean("autodelete",false);
}
}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java
index db1d5d9327..8d375508bc 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java
@@ -23,8 +23,8 @@ package org.apache.qpid.server.store;
import java.util.Collections;
import java.util.Map;
import java.util.UUID;
-import org.apache.log4j.Logger;
+import org.apache.log4j.Logger;
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.model.VirtualHost;
@@ -44,6 +44,7 @@ public class SlowMessageStore implements MessageStore, DurableConfigurationStore
private DurableConfigurationStore _durableConfigurationStore = (DurableConfigurationStore) _realStore;
private static final String PRE = "pre";
private static final String POST = "post";
+ public static final String TYPE = "SLOW";
private String DEFAULT_DELAY = "default";
// ***** MessageStore Interface.
@@ -340,7 +341,7 @@ public class SlowMessageStore implements MessageStore, DurableConfigurationStore
@Override
public String getStoreType()
{
- return "SLOW";
+ return TYPE;
}
@Override
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStoreFactory.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStoreFactory.java
index 80ef79ae71..62714a75fe 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStoreFactory.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStoreFactory.java
@@ -19,10 +19,8 @@ package org.apache.qpid.server.store;/*
*
*/
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
-import org.apache.commons.configuration.Configuration;
+
import org.apache.qpid.server.plugin.MessageStoreFactory;
public class SlowMessageStoreFactory implements MessageStoreFactory
@@ -30,7 +28,7 @@ public class SlowMessageStoreFactory implements MessageStoreFactory
@Override
public String getType()
{
- return "SLOW";
+ return SlowMessageStore.TYPE;
}
@Override
@@ -40,43 +38,6 @@ public class SlowMessageStoreFactory implements MessageStoreFactory
}
@Override
- public Map<String, Object> convertStoreConfiguration(Configuration storeConfiguration)
- {
- Map<String, Object> convertedMap = new HashMap<String, Object>();
- Configuration delaysConfig = storeConfiguration.subset("delays");
-
- @SuppressWarnings("unchecked")
- Iterator<String> delays = delaysConfig.getKeys();
-
- Map<String,Long> delaysMap = new HashMap<String, Long>();
-
- while (delays.hasNext())
- {
- String key = delays.next();
-
- if (key.endsWith("pre"))
- {
- delaysMap.put("pre"+key.substring(0, key.length() - 4), delaysConfig.getLong(key));
- }
- else if (key.endsWith("post"))
- {
- delaysMap.put("post"+key.substring(0, key.length() - 5), delaysConfig.getLong(key));
- }
- }
-
- if(!delaysMap.isEmpty())
- {
- convertedMap.put("slowMessageStoreDelays",delaysMap);
- }
-
-
- convertedMap.put("realStore", storeConfiguration.getString("realStore", null));
-
-
- return convertedMap;
- }
-
- @Override
public void validateAttributes(Map<String, Object> attributes)
{
}
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 31e6a5613f..eca91c2b5e 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
@@ -37,7 +37,9 @@ import org.apache.qpid.client.AMQDestination;
import org.apache.qpid.client.AMQQueue;
import org.apache.qpid.client.AMQSession;
import org.apache.qpid.exchange.ExchangeDefaults;
+import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
public class StoreOverfullTest extends QpidBrokerTestCase
{
@@ -60,9 +62,10 @@ public class StoreOverfullTest extends QpidBrokerTestCase
public void setUp() throws Exception
{
- 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));
+ TestBrokerConfiguration config = getBrokerConfiguration();
+ config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST, VirtualHost.STORE_TYPE, QuotaMessageStore.TYPE);
+ config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST, MessageStoreConstants.OVERFULL_SIZE_ATTRIBUTE, OVERFULL_SIZE);
+ config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST, MessageStoreConstants.UNDERFULL_SIZE_ATTRIBUTE, UNDERFULL_SIZE);
super.setUp();
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AccessControlProviderRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AccessControlProviderRestTest.java
index 312443cfa7..f87113465c 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AccessControlProviderRestTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AccessControlProviderRestTest.java
@@ -27,7 +27,6 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.server.BrokerOptions;
import org.apache.qpid.server.management.plugin.HttpManagement;
import org.apache.qpid.server.model.AccessControlProvider;
@@ -54,7 +53,7 @@ public class AccessControlProviderRestTest extends QpidRestTestCase
"ACL DENY-LOG ALL ALL";
@Override
- protected void customizeConfiguration() throws ConfigurationException, IOException
+ protected void customizeConfiguration() throws IOException
{
super.customizeConfiguration();
getRestTestHelper().configureTemporaryPasswordFile(this, ALLOWED_USER, DENIED_USER, OTHER_USER);
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java
index d227460e6a..9bf815adf7 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java
@@ -24,7 +24,6 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.server.management.plugin.HttpManagement;
import org.apache.qpid.server.model.AuthenticationProvider;
import org.apache.qpid.server.model.Broker;
@@ -46,7 +45,7 @@ public class AnonymousAccessRestTest extends QpidRestTestCase
}
@Override
- protected void customizeConfiguration() throws ConfigurationException, IOException
+ protected void customizeConfiguration() throws IOException
{
super.customizeConfiguration();
TestBrokerConfiguration config = getBrokerConfiguration();
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/Asserts.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/Asserts.java
index c749318595..18774941e8 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/Asserts.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/Asserts.java
@@ -51,10 +51,10 @@ public class Asserts
ConfiguredObject.DESCRIPTION,
VirtualHost.SUPPORTED_QUEUE_TYPES,
VirtualHost.STORE_PATH,
- VirtualHost.CONFIG_PATH,
VirtualHost.TYPE,
VirtualHost.CONFIG_STORE_PATH,
- VirtualHost.CONFIG_STORE_TYPE);
+ VirtualHost.CONFIG_STORE_TYPE,
+ VirtualHost.SECURITY_ACL);
assertEquals("Unexpected value of attribute " + VirtualHost.NAME,
virtualHostName,
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 c8320a6d82..81177b8c08 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
@@ -29,10 +29,8 @@ import java.util.Collections;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.server.management.plugin.HttpManagement;
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;
@@ -49,12 +47,12 @@ public class BasicAuthRestTest extends QpidRestTestCase
}
@Override
- protected void customizeConfiguration() throws ConfigurationException, IOException
+ protected void customizeConfiguration() throws IOException
{
//do nothing, we will configure this locally
}
- private void configure(boolean useSsl) throws ConfigurationException, IOException
+ private void configure(boolean useSsl) throws IOException
{
getRestTestHelper().setUseSsl(useSsl);
if (useSsl)
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 666c78f070..6ba8df075b 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
@@ -30,12 +30,18 @@ import org.apache.qpid.server.model.Binding;
public class BindingRestTest extends QpidRestTestCase
{
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ getRestTestHelper().createTestQueues();
+ }
+
public void testGetAllBindings() throws Exception
{
- List<Map<String, Object>> bindings = getRestTestHelper().getJsonAsList("/rest/binding");
+ List<Map<String, Object>> bindings = getRestTestHelper().getJsonAsList("/rest/binding/test");
assertNotNull("Bindings cannot be null", bindings);
- assertTrue("Unexpected number of bindings: " + bindings.size(),
- bindings.size() >= EXPECTED_VIRTUALHOSTS.length * EXPECTED_QUEUES.length);
+ assertEquals("Unexpected number of bindings", RestTestHelper.EXPECTED_QUEUES.length, bindings.size());
for (Map<String, Object> binding : bindings)
{
Asserts.assertBinding((String) binding.get(Binding.NAME), (String) binding.get(Binding.EXCHANGE), binding);
@@ -46,8 +52,8 @@ public class BindingRestTest extends QpidRestTestCase
{
List<Map<String, Object>> bindings = getRestTestHelper().getJsonAsList("/rest/binding/test");
assertNotNull("Bindings cannot be null", bindings);
- assertEquals("Unexpected number of bindings", EXPECTED_QUEUES.length, bindings.size());
- for (String queueName : EXPECTED_QUEUES)
+ assertEquals("Unexpected number of bindings", RestTestHelper.EXPECTED_QUEUES.length, bindings.size());
+ for (String queueName : RestTestHelper.EXPECTED_QUEUES)
{
Map<String, Object> searchAttributes = new HashMap<String, Object>();
searchAttributes.put(Binding.NAME, queueName);
@@ -62,8 +68,8 @@ public class BindingRestTest extends QpidRestTestCase
{
List<Map<String, Object>> bindings = getRestTestHelper().getJsonAsList("/rest/binding/test/amq.direct");
assertNotNull("Bindings cannot be null", bindings);
- assertEquals("Unexpected number of bindings", EXPECTED_QUEUES.length, bindings.size());
- for (String queueName : EXPECTED_QUEUES)
+ assertEquals("Unexpected number of bindings", RestTestHelper.EXPECTED_QUEUES.length, bindings.size());
+ for (String queueName : RestTestHelper.EXPECTED_QUEUES)
{
Map<String, Object> binding = getRestTestHelper().find(Binding.NAME, queueName, bindings);
Asserts.assertBinding(queueName, "amq.direct", binding);
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsClientCertAuthTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsClientCertAuthTest.java
index e92b38b4e0..3a85ad5431 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsClientCertAuthTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsClientCertAuthTest.java
@@ -20,25 +20,22 @@
*/
package org.apache.qpid.systest.rest;
-import org.apache.commons.configuration.ConfigurationException;
-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.Protocol;
-import org.apache.qpid.server.model.Transport;
-import org.apache.qpid.server.security.auth.manager.AnonymousAuthenticationManagerFactory;
-import org.apache.qpid.server.security.auth.manager.ExternalAuthenticationManagerFactory;
-import org.apache.qpid.test.utils.TestBrokerConfiguration;
+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.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-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 org.apache.qpid.server.model.AuthenticationProvider;
+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.security.auth.manager.ExternalAuthenticationManagerFactory;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
public class BrokerRestHttpsClientCertAuthTest extends QpidRestTestCase
{
@@ -56,7 +53,7 @@ public class BrokerRestHttpsClientCertAuthTest extends QpidRestTestCase
}
@Override
- protected void customizeConfiguration() throws ConfigurationException, IOException
+ protected void customizeConfiguration() throws IOException
{
super.customizeConfiguration();
getRestTestHelper().setUseSslAuth(true);
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 ad789e6fa1..b7846bb09c 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
@@ -28,7 +28,6 @@ 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.ConfiguredObject;
import org.apache.qpid.server.model.Port;
@@ -49,7 +48,7 @@ public class BrokerRestHttpsTest extends QpidRestTestCase
}
@Override
- protected void customizeConfiguration() throws ConfigurationException, IOException
+ protected void customizeConfiguration() throws IOException
{
super.customizeConfiguration();
getRestTestHelper().setUseSsl(true);
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/ExchangeRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/ExchangeRestTest.java
index 1da1c6394e..962c71583c 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/ExchangeRestTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/ExchangeRestTest.java
@@ -30,6 +30,13 @@ import org.apache.qpid.server.model.Exchange;
public class ExchangeRestTest extends QpidRestTestCase
{
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ getRestTestHelper().createTestQueues();
+ }
+
public void testGet() throws Exception
{
List<Map<String, Object>> exchanges = getRestTestHelper().getJsonAsList("/rest/exchange");
@@ -98,7 +105,7 @@ public class ExchangeRestTest extends QpidRestTestCase
{
@SuppressWarnings("unchecked")
List<Map<String, Object>> bindings = (List<Map<String, Object>>) exchange.get("bindings");
- for (String queueName : EXPECTED_QUEUES)
+ for (String queueName : RestTestHelper.EXPECTED_QUEUES)
{
Map<String, Object> binding = getRestTestHelper().find(Binding.NAME, queueName, bindings);
Asserts.assertBinding(queueName, (String) exchange.get(Exchange.NAME), binding);
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesProviderRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesProviderRestTest.java
index 85a50c4ce8..80dd7e11a4 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesProviderRestTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesProviderRestTest.java
@@ -27,7 +27,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.server.model.AuthenticationProvider;
import org.apache.qpid.server.model.ConfiguredObject;
import org.apache.qpid.server.model.LifetimePolicy;
@@ -71,7 +70,7 @@ public class PreferencesProviderRestTest extends QpidRestTestCase
}
@Override
- protected void customizeConfiguration() throws ConfigurationException, IOException
+ protected void customizeConfiguration() throws IOException
{
super.customizeConfiguration();
Map<String, Object> anonymousAuthProviderAttributes = new HashMap<String, Object>();
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesRestTest.java
index 46acd9e77b..c4b182da1a 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesRestTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesRestTest.java
@@ -25,7 +25,6 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.server.model.PreferencesProvider;
import org.apache.qpid.server.model.adapter.FileSystemPreferencesProvider;
import org.apache.qpid.test.utils.TestBrokerConfiguration;
@@ -58,7 +57,7 @@ public class PreferencesRestTest extends QpidRestTestCase
}
@Override
- protected void customizeConfiguration() throws ConfigurationException, IOException
+ protected void customizeConfiguration() throws IOException
{
super.customizeConfiguration();
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 ce501adeb6..de5c2f561f 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
@@ -24,7 +24,6 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.server.management.plugin.HttpManagement;
import org.apache.qpid.server.model.AuthenticationProvider;
import org.apache.qpid.server.model.Port;
@@ -42,7 +41,6 @@ public class QpidRestTestCase extends QpidBrokerTestCase
public static final String TEST3_VIRTUALHOST = "test3";
public static final String[] EXPECTED_VIRTUALHOSTS = { TEST1_VIRTUALHOST, TEST2_VIRTUALHOST, TEST3_VIRTUALHOST};
- public static final String[] EXPECTED_QUEUES = { "queue", "ping" };
public static final String[] EXPECTED_EXCHANGES = { "amq.fanout", "amq.match", "amq.direct","amq.topic" };
private RestTestHelper _restTestHelper = new RestTestHelper(findFreePort());
@@ -60,12 +58,6 @@ public class QpidRestTestCase extends QpidBrokerTestCase
for (String virtualhost : EXPECTED_VIRTUALHOSTS)
{
createTestVirtualHost(0, virtualhost);
-
- for (String queue : EXPECTED_QUEUES)
- {
- setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + virtualhost + ".queues.exchange", "amq.direct");
- setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + virtualhost + ".queues.queue(-1).name", queue);
- }
}
customizeConfiguration();
@@ -85,7 +77,7 @@ public class QpidRestTestCase extends QpidBrokerTestCase
}
}
- protected void customizeConfiguration() throws ConfigurationException, IOException
+ protected void customizeConfiguration() throws IOException
{
TestBrokerConfiguration config = getBrokerConfiguration();
config.addHttpManagementConfiguration();
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QueueRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QueueRestTest.java
index faccca9e9d..297d15db13 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QueueRestTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QueueRestTest.java
@@ -83,10 +83,8 @@ public class QueueRestTest extends QpidRestTestCase
{
String queueName = getTestQueueName();
List<Map<String, Object>> queues = getRestTestHelper().getJsonAsList("/rest/queue/test");
- assertEquals("Unexpected number of queues", EXPECTED_QUEUES.length + 1, queues.size());
- String[] expectedQueues = new String[EXPECTED_QUEUES.length + 1];
- System.arraycopy(EXPECTED_QUEUES, 0, expectedQueues, 0, EXPECTED_QUEUES.length);
- expectedQueues[EXPECTED_QUEUES.length] = queueName;
+ assertEquals("Unexpected number of queues", 1, queues.size());
+ String[] expectedQueues = new String[]{queueName};
for (String name : expectedQueues)
{
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 ef87457925..49e07e92e8 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
@@ -52,9 +52,10 @@ import javax.servlet.http.HttpServletResponse;
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.BrokerOptions;
+import org.apache.qpid.server.model.Binding;
+import org.apache.qpid.server.model.Queue;
import org.apache.qpid.ssl.SSLContextFactory;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
import org.apache.qpid.test.utils.TestBrokerConfiguration;
@@ -80,6 +81,7 @@ public class RestTestHelper
private File _passwdFile;
private boolean _useSslAuth;
+ static final String[] EXPECTED_QUEUES = { "queue", "ping" };
public RestTestHelper(int httpPort)
{
@@ -226,6 +228,11 @@ public class RestTestHelper
public Map<String, Object> find(String name, Object value, List<Map<String, Object>> data)
{
+ if (data == null)
+ {
+ return null;
+ }
+
for (Map<String, Object> map : data)
{
Object mapValue = map.get(name);
@@ -437,7 +444,7 @@ public class RestTestHelper
/**
* Create password file that follows the convention username=password, which is deleted by {@link #tearDown()}
*/
- public void configureTemporaryPasswordFile(QpidBrokerTestCase testCase, String... users) throws ConfigurationException, IOException
+ public void configureTemporaryPasswordFile(QpidBrokerTestCase testCase, String... users) throws IOException
{
_passwdFile = createTemporaryPasswdFile(users);
@@ -509,4 +516,22 @@ public class RestTestHelper
_useSslAuth = useSslAuth;
_useSsl = true;
}
+
+ public void createTestQueues() throws IOException, JsonGenerationException, JsonMappingException
+ {
+ for (int i = 0; i < EXPECTED_QUEUES.length; i++)
+ {
+ String queueName = EXPECTED_QUEUES[i];
+ Map<String, Object> queueData = new HashMap<String, Object>();
+ queueData.put(Queue.NAME, queueName);
+ queueData.put(Queue.DURABLE, Boolean.TRUE);
+ submitRequest("/rest/queue/test/" + queueName, "PUT", queueData);
+
+ Map<String, Object> bindingData = new HashMap<String, Object>();
+ bindingData.put(Binding.NAME, queueName);
+ bindingData.put(Binding.QUEUE, queueName);
+ bindingData.put(Binding.EXCHANGE, "amq.direct");
+ submitRequest("/rest/binding/test/amq.direct/" + queueName + "/" + queueName, "PUT", queueData);
+ }
+ }
}
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 590858fbf5..6ec2a02ba1 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
@@ -35,7 +35,6 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.server.model.AuthenticationProvider;
import org.apache.qpid.server.security.auth.manager.Base64MD5PasswordFileAuthenticationManagerFactory;
import org.apache.qpid.test.utils.TestBrokerConfiguration;
@@ -347,7 +346,7 @@ public class SaslRestTest extends QpidRestTestCase
}
}
- private void configureBase64MD5FilePrincipalDatabase() throws IOException, ConfigurationException
+ private void configureBase64MD5FilePrincipalDatabase() throws IOException
{
// generate user password entry
String passwordFileEntry;
@@ -357,7 +356,7 @@ public class SaslRestTest extends QpidRestTestCase
}
catch (NoSuchAlgorithmException e)
{
- throw new ConfigurationException(e);
+ throw new RuntimeException(e);
}
// store the entry in the file
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 da72dd6f05..cf551ae315 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
@@ -30,6 +30,13 @@ import org.apache.qpid.test.utils.TestBrokerConfiguration;
public class StructureRestTest extends QpidRestTestCase
{
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ getRestTestHelper().createTestQueues();
+ }
+
public void testGet() throws Exception
{
Map<String, Object> structure = getRestTestHelper().getJsonAsMap("/rest/structure");
@@ -53,50 +60,52 @@ public class StructureRestTest extends QpidRestTestCase
Map<String, Object> host = getRestTestHelper().find("name", hostName, virtualhosts);
assertNotNull("Host " + hostName + " is not found ", host);
assertNode(host, hostName);
+ }
+
+ String hostName = "test";
+ Map<String, Object> host = getRestTestHelper().find("name", hostName, virtualhosts);
+
+ @SuppressWarnings("unchecked")
+ List<Map<String, Object>> queues = (List<Map<String, Object>>) host.get("queues");
+ assertNotNull("Host " + hostName + " queues are not found ", queues);
+ for (String queueName : RestTestHelper.EXPECTED_QUEUES)
+ {
+ Map<String, Object> queue = getRestTestHelper().find("name", queueName, queues);
+ assertNotNull(hostName + " queue " + queueName + " is not found ", queue);
+ assertNode(queue, queueName);
@SuppressWarnings("unchecked")
- List<Map<String, Object>> queues = (List<Map<String, Object>>) host.get("queues");
- assertNotNull("Host " + hostName + " queues are not found ", queues);
- for (String queueName : EXPECTED_QUEUES)
+ List<Map<String, Object>> bindings = (List<Map<String, Object>>) queue.get("bindings");
+ assertNotNull(hostName + " queue " + queueName + " bindings are not found ", queues);
+ for (Map<String, Object> binding : bindings)
{
- Map<String, Object> queue = getRestTestHelper().find("name", queueName, queues);
- assertNotNull(hostName + " queue " + queueName + " is not found ", queue);
- assertNode(queue, queueName);
-
- @SuppressWarnings("unchecked")
- List<Map<String, Object>> bindings = (List<Map<String, Object>>) queue.get("bindings");
- assertNotNull(hostName + " queue " + queueName + " bindings are not found ", queues);
- for (Map<String, Object> binding : bindings)
- {
- assertNode(binding, queueName);
- }
+ assertNode(binding, queueName);
}
+ }
- @SuppressWarnings("unchecked")
- List<Map<String, Object>> exchanges = (List<Map<String, Object>>) host.get("exchanges");
- assertNotNull("Host " + hostName + " exchanges are not found ", exchanges);
- for (String exchangeName : EXPECTED_EXCHANGES)
+ @SuppressWarnings("unchecked")
+ List<Map<String, Object>> exchanges = (List<Map<String, Object>>) host.get("exchanges");
+ assertNotNull("Host " + hostName + " exchanges are not found ", exchanges);
+ for (String exchangeName : EXPECTED_EXCHANGES)
+ {
+ Map<String, Object> exchange = getRestTestHelper().find("name", exchangeName, exchanges);
+ assertNotNull("Exchange " + exchangeName + " is not found ", exchange);
+ assertNode(exchange, exchangeName);
+ if (ExchangeDefaults.DIRECT_EXCHANGE_NAME.equalsIgnoreCase(exchangeName) ||
+ ExchangeDefaults.DEFAULT_EXCHANGE_NAME.equalsIgnoreCase(exchangeName))
{
- Map<String, Object> exchange = getRestTestHelper().find("name", exchangeName, exchanges);
- assertNotNull("Exchange " + exchangeName + " is not found ", exchange);
- assertNode(exchange, exchangeName);
- if (ExchangeDefaults.DIRECT_EXCHANGE_NAME.equalsIgnoreCase(exchangeName) ||
- ExchangeDefaults.DEFAULT_EXCHANGE_NAME.equalsIgnoreCase(exchangeName))
+ @SuppressWarnings("unchecked")
+ List<Map<String, Object>> bindings = (List<Map<String, Object>>) exchange.get("bindings");
+ assertNotNull(hostName + " exchange " + exchangeName + " bindings are not found ", bindings);
+ for (String queueName : RestTestHelper.EXPECTED_QUEUES)
{
- @SuppressWarnings("unchecked")
- List<Map<String, Object>> bindings = (List<Map<String, Object>>) exchange.get("bindings");
- assertNotNull(hostName + " exchange " + exchangeName + " bindings are not found ", bindings);
- for (String queueName : EXPECTED_QUEUES)
- {
- Map<String, Object> binding = getRestTestHelper().find("name", queueName, bindings);
- assertNotNull(hostName + " exchange " + exchangeName + " binding " + queueName + " is not found", binding);
- assertNode(binding, queueName);
- }
+ Map<String, Object> binding = getRestTestHelper().find("name", queueName, bindings);
+ assertNotNull(hostName + " exchange " + exchangeName + " binding " + queueName + " is not found", binding);
+ assertNode(binding, queueName);
}
}
}
-
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);
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/UserPreferencesRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/UserPreferencesRestTest.java
index 9965587343..296ccf9221 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/UserPreferencesRestTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/UserPreferencesRestTest.java
@@ -28,7 +28,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.server.model.PreferencesProvider;
import org.apache.qpid.server.model.User;
import org.apache.qpid.server.model.adapter.FileSystemPreferencesProvider;
@@ -63,7 +62,7 @@ public class UserPreferencesRestTest extends QpidRestTestCase
}
@Override
- protected void customizeConfiguration() throws ConfigurationException, IOException
+ protected void customizeConfiguration() throws IOException
{
super.customizeConfiguration();
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/VirtualHostRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/VirtualHostRestTest.java
index eac43e70a4..6bc515dcef 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/VirtualHostRestTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/VirtualHostRestTest.java
@@ -30,15 +30,12 @@ import java.util.Map;
import javax.jms.Session;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.XMLConfiguration;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.server.model.Exchange;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.queue.ConflationQueue;
import org.apache.qpid.server.virtualhost.StandardVirtualHostFactory;
-import org.apache.qpid.test.utils.TestFileUtils;
import org.apache.qpid.util.FileUtils;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
@@ -67,16 +64,18 @@ public class VirtualHostRestTest extends QpidRestTestCase
{
// create AMQP connection to get connection JSON details
_connection = (AMQConnection) getConnection();
- _connection.createSession(true, Session.SESSION_TRANSACTED);
+ Session session = _connection.createSession(true, Session.SESSION_TRANSACTED);
+ session.createConsumer(getTestQueue());
Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("/rest/virtualhost/test");
Asserts.assertVirtualHost("test", hostDetails);
@SuppressWarnings("unchecked")
Map<String, Object> statistics = (Map<String, Object>) hostDetails.get(Asserts.STATISTICS_ATTRIBUTE);
+
assertEquals("Unexpected number of exchanges in statistics", EXPECTED_EXCHANGES.length, statistics.get(
"exchangeCount"));
- assertEquals("Unexpected number of queues in statistics", EXPECTED_QUEUES.length, statistics.get("queueCount"));
+ assertEquals("Unexpected number of queues in statistics", 1, statistics.get("queueCount"));
assertEquals("Unexpected number of connections in statistics", 1, statistics.get("connectionCount"));
@SuppressWarnings("unchecked")
@@ -89,13 +88,10 @@ public class VirtualHostRestTest extends QpidRestTestCase
@SuppressWarnings("unchecked")
List<Map<String, Object>> queues = (List<Map<String, Object>>) hostDetails.get(VIRTUALHOST_QUEUES_ATTRIBUTE);
- assertEquals("Unexpected number of queues", EXPECTED_QUEUES.length, queues.size());
- Map<String, Object> queue = getRestTestHelper().find(Queue.NAME, "queue", queues);
- Map<String, Object> ping = getRestTestHelper().find(Queue.NAME, "ping", queues);
- Asserts.assertQueue("queue", "standard", queue);
- Asserts.assertQueue("ping", "standard", ping);
- assertEquals("Unexpected value of queue attribute " + Queue.DURABLE, Boolean.FALSE, queue.get(Queue.DURABLE));
- assertEquals("Unexpected value of queue attribute " + Queue.DURABLE, Boolean.FALSE, ping.get(Queue.DURABLE));
+ assertEquals("Unexpected number of queues", 1, queues.size());
+ Map<String, Object> queue = getRestTestHelper().find(Queue.NAME, getTestQueueName(), queues);
+ Asserts.assertQueue(getTestQueueName(), "standard", queue);
+ assertEquals("Unexpected value of queue attribute " + Queue.DURABLE, Boolean.TRUE, queue.get(Queue.DURABLE));
@SuppressWarnings("unchecked")
List<Map<String, Object>> connections = (List<Map<String, Object>>) hostDetails
@@ -128,34 +124,6 @@ public class VirtualHostRestTest extends QpidRestTestCase
}
}
- public void testPutCreateVirtualHostUsingConfigPath() throws Exception
- {
- String hostName = getName();
- File configFile = TestFileUtils.createTempFile(this, hostName + "-config.xml");
- String configPath = configFile.getAbsolutePath();
- String storeLocation = getStoreLocation(hostName);
- createAndSaveVirtualHostConfiguration(hostName, configFile, storeLocation);
- createHost(hostName, null, configPath);
- try
- {
- // make sure that the host is saved in the broker store
- restartBroker();
- Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("/rest/virtualhost/" + hostName);
- Asserts.assertVirtualHost(hostName, hostDetails);
- assertEquals("Unexpected config path", configPath, hostDetails.get(VirtualHost.CONFIG_PATH));
-
- assertNewVirtualHost(hostDetails);
- }
- finally
- {
- if (storeLocation != null)
- {
- FileUtils.delete(new File(storeLocation), true);
- }
- configFile.delete();
- }
- }
-
public void testDeleteHost() throws Exception
{
String hostToDelete = TEST3_VIRTUALHOST;
@@ -187,8 +155,7 @@ public class VirtualHostRestTest extends QpidRestTestCase
String hostToUpdate = TEST3_VIRTUALHOST;
Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("/rest/virtualhost/" + hostToUpdate);
Asserts.assertVirtualHost(hostToUpdate, hostDetails);
- String configPath = (String)hostDetails.get(VirtualHost.CONFIG_PATH);
- assertNotNull("Unexpected host configuration", configPath);
+ String configPath = (String)hostDetails.get(VirtualHost.STORE_PATH);
String storeType = getTestProfileMessageStoreType();
String storeLocation = getStoreLocation(hostToUpdate);
@@ -204,7 +171,7 @@ public class VirtualHostRestTest extends QpidRestTestCase
hostDetails = getRestTestHelper().getJsonAsSingletonList("/rest/virtualhost/" + hostToUpdate);
Asserts.assertVirtualHost(hostToUpdate, hostDetails);
- assertEquals("Unexpected config path", configPath, hostDetails.get(VirtualHost.CONFIG_PATH));
+ assertEquals("Unexpected config path", configPath, hostDetails.get(VirtualHost.STORE_PATH));
}
public void testPutCreateQueue() throws Exception
@@ -560,31 +527,13 @@ public class VirtualHostRestTest extends QpidRestTestCase
Map<String, Object> hostData = new HashMap<String, Object>();
hostData.put(VirtualHost.NAME, hostName);
- if (storeType == null)
- {
- hostData.put(VirtualHost.CONFIG_PATH, configPath);
- }
- else
- {
- hostData.put(VirtualHost.TYPE, StandardVirtualHostFactory.TYPE);
- hostData.put(VirtualHost.STORE_PATH, storePath);
- hostData.put(VirtualHost.STORE_TYPE, storeType);
- }
+ hostData.put(VirtualHost.TYPE, StandardVirtualHostFactory.TYPE);
+ hostData.put(VirtualHost.STORE_PATH, storePath);
+ hostData.put(VirtualHost.STORE_TYPE, storeType);
return getRestTestHelper().submitRequest("/rest/virtualhost/" + hostName, "PUT", hostData);
}
- private XMLConfiguration createAndSaveVirtualHostConfiguration(String hostName, File configFile, String storeLocation)
- throws ConfigurationException
- {
- XMLConfiguration testConfiguration = new XMLConfiguration();
- testConfiguration.setProperty("virtualhost." + hostName + ".store.class",
- getTestProfileMessageStoreClassName());
- testConfiguration.setProperty("virtualhost." + hostName + ".store.environment-path", storeLocation);
- testConfiguration.save(configFile);
- return testConfiguration;
- }
-
private void assertNewVirtualHost(Map<String, Object> hostDetails)
{
@SuppressWarnings("unchecked")
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java
index 7f41a8eb2e..b2119ff79f 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java
@@ -27,7 +27,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.server.management.plugin.HttpManagement;
import org.apache.qpid.server.model.AccessControlProvider;
import org.apache.qpid.server.model.AuthenticationProvider;
@@ -58,7 +57,7 @@ public class BrokerACLTest extends QpidRestTestCase
private String _secondaryAclFileContent = "";
@Override
- protected void customizeConfiguration() throws ConfigurationException, IOException
+ protected void customizeConfiguration() throws IOException
{
super.customizeConfiguration();
getRestTestHelper().configureTemporaryPasswordFile(this, ALLOWED_USER, DENIED_USER);
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/ExchangeRestACLTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/ExchangeRestACLTest.java
index b39d994198..b63df34b98 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/ExchangeRestACLTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/ExchangeRestACLTest.java
@@ -25,10 +25,10 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.server.management.plugin.HttpManagement;
import org.apache.qpid.server.model.Binding;
import org.apache.qpid.server.model.Exchange;
+import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.security.acl.AbstractACLTestCase;
import org.apache.qpid.systest.rest.QpidRestTestCase;
import org.apache.qpid.test.utils.TestBrokerConfiguration;
@@ -39,15 +39,17 @@ public class ExchangeRestACLTest extends QpidRestTestCase
{
private static final String ALLOWED_USER = "user1";
private static final String DENIED_USER = "user2";
+ private String _queueName;
@Override
- protected void customizeConfiguration() throws ConfigurationException, IOException
+ protected void customizeConfiguration() throws IOException
{
super.customizeConfiguration();
getRestTestHelper().configureTemporaryPasswordFile(this, ALLOWED_USER, DENIED_USER);
AbstractACLTestCase.writeACLFileUtil(this, null,
"ACL ALLOW-LOG ALL ACCESS MANAGEMENT",
+ "ACL ALLOW-LOG " + ALLOWED_USER + " CREATE QUEUE",
"ACL ALLOW-LOG " + ALLOWED_USER + " CREATE EXCHANGE",
"ACL DENY-LOG " + DENIED_USER + " CREATE EXCHANGE",
"ACL ALLOW-LOG " + ALLOWED_USER + " UPDATE EXCHANGE",
@@ -64,6 +66,20 @@ public class ExchangeRestACLTest extends QpidRestTestCase
HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
}
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ _queueName = getTestQueueName();
+ getRestTestHelper().setUsernameAndPassword(ALLOWED_USER, ALLOWED_USER);
+ Map<String, Object> queueData = new HashMap<String, Object>();
+ queueData.put(Queue.NAME, _queueName);
+ queueData.put(Queue.DURABLE, Boolean.TRUE);
+ int status = getRestTestHelper().submitRequest("/rest/queue/test/" + _queueName, "PUT", queueData);
+ assertEquals("Unexpected status", 201, status);
+
+ }
+
public void testCreateExchangeAllowed() throws Exception
{
getRestTestHelper().setUsernameAndPassword(ALLOWED_USER, ALLOWED_USER);
@@ -210,10 +226,10 @@ public class ExchangeRestACLTest extends QpidRestTestCase
{
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put(Binding.NAME, bindingName);
- attributes.put(Binding.QUEUE, "queue");
+ attributes.put(Binding.QUEUE, _queueName);
attributes.put(Binding.EXCHANGE, "amq.direct");
- int responseCode = getRestTestHelper().submitRequest("/rest/binding/test/amq.direct/queue/" + bindingName, "PUT", attributes);
+ int responseCode = getRestTestHelper().submitRequest("/rest/binding/test/amq.direct/" + _queueName + "/" + bindingName, "PUT", attributes);
return responseCode;
}
@@ -229,7 +245,7 @@ public class ExchangeRestACLTest extends QpidRestTestCase
private void assertBindingExistence(String bindingName, boolean exists) throws Exception
{
- List<Map<String, Object>> bindings = getRestTestHelper().getJsonAsList("/rest/binding/test/amq.direct/queue/" + bindingName);
+ List<Map<String, Object>> bindings = getRestTestHelper().getJsonAsList("/rest/binding/test/amq.direct/" + _queueName + "/" + bindingName);
assertEquals("Unexpected result", exists, !bindings.isEmpty());
}
}
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 9a578d01fb..aff1eac9cf 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,7 +28,6 @@ import java.util.Properties;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.server.management.plugin.HttpManagement;
import org.apache.qpid.server.security.acl.AbstractACLTestCase;
import org.apache.qpid.systest.rest.QpidRestTestCase;
@@ -58,7 +57,7 @@ public class GroupRestACLTest extends QpidRestTestCase
}
@Override
- protected void customizeConfiguration() throws ConfigurationException, IOException
+ protected void customizeConfiguration() throws IOException
{
super.customizeConfiguration();
getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/LogViewerACLTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/LogViewerACLTest.java
index 96ea5c92b3..7d94ee27ad 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/LogViewerACLTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/LogViewerACLTest.java
@@ -22,7 +22,6 @@ package org.apache.qpid.systest.rest.acl;
import java.io.IOException;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.server.management.plugin.HttpManagement;
import org.apache.qpid.server.security.acl.AbstractACLTestCase;
import org.apache.qpid.systest.rest.QpidRestTestCase;
@@ -34,7 +33,7 @@ public class LogViewerACLTest extends QpidRestTestCase
private static final String DENIED_USER = "user2";
@Override
- protected void customizeConfiguration() throws ConfigurationException, IOException
+ protected void customizeConfiguration() throws IOException
{
super.customizeConfiguration();
getRestTestHelper().configureTemporaryPasswordFile(this, ALLOWED_USER, DENIED_USER);
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/QueueRestACLTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/QueueRestACLTest.java
index b187ca955a..52f70a5dd2 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/QueueRestACLTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/QueueRestACLTest.java
@@ -25,7 +25,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.server.management.plugin.HttpManagement;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.security.acl.AbstractACLTestCase;
@@ -38,7 +37,7 @@ public class QueueRestACLTest extends QpidRestTestCase
private static final String DENIED_USER = "user2";
@Override
- protected void customizeConfiguration() throws ConfigurationException, IOException
+ protected void customizeConfiguration() throws IOException
{
super.customizeConfiguration();
getRestTestHelper().configureTemporaryPasswordFile(this, ALLOWED_USER, DENIED_USER);
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserPreferencesRestACLTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserPreferencesRestACLTest.java
index 6ed84ac95a..b23e44a4d3 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserPreferencesRestACLTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserPreferencesRestACLTest.java
@@ -28,7 +28,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.server.management.plugin.HttpManagement;
import org.apache.qpid.server.model.PreferencesProvider;
import org.apache.qpid.server.model.adapter.FileSystemPreferencesProvider;
@@ -72,7 +71,7 @@ public class UserPreferencesRestACLTest extends QpidRestTestCase
}
@Override
- protected void customizeConfiguration() throws ConfigurationException, IOException
+ protected void customizeConfiguration() throws IOException
{
super.customizeConfiguration();
getRestTestHelper().configureTemporaryPasswordFile(this, ALLOWED_USER, DENIED_USER);
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 4c4e219695..d2f0401db5 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,7 +28,6 @@ import java.util.Properties;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.server.management.plugin.HttpManagement;
import org.apache.qpid.server.security.acl.AbstractACLTestCase;
import org.apache.qpid.systest.rest.QpidRestTestCase;
@@ -60,7 +59,7 @@ public class UserRestACLTest extends QpidRestTestCase
}
@Override
- protected void customizeConfiguration() throws ConfigurationException, IOException
+ protected void customizeConfiguration() throws IOException
{
super.customizeConfiguration();
getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java
index bd826259bc..ee3a8c7260 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java
@@ -22,7 +22,6 @@ package org.apache.qpid.test.client.destination;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import org.apache.qpid.client.AMQAnyDestination;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQDestination;
@@ -31,13 +30,15 @@ import org.apache.qpid.client.AMQSession_0_10;
import org.apache.qpid.client.message.QpidMessageProperties;
import org.apache.qpid.jndi.PropertiesFileInitialContextFactory;
import org.apache.qpid.messaging.Address;
+import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
import org.apache.qpid.transport.ExecutionErrorCode;
import javax.jms.*;
import javax.naming.Context;
import javax.naming.InitialContext;
-import java.util.Collections;
+
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
@@ -53,6 +54,9 @@ public class AddressBasedDestinationTest extends QpidBrokerTestCase
@Override
public void setUp() throws Exception
{
+ TestBrokerConfiguration config = getBrokerConfiguration();
+ config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST, VirtualHost.QUEUE_MAXIMUM_DELIVERY_ATTEMPTS, 0);
+
super.setUp();
_connection = getConnection() ;
_connection.start();
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 74afbf7903..85e62f8dae 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
@@ -20,11 +20,15 @@
*/
package org.apache.qpid.test.client.timeouts;
-import org.apache.qpid.server.virtualhost.StandardVirtualHostFactory;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.store.SlowMessageStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import org.apache.qpid.test.utils.QpidBrokerTestCase;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
import javax.jms.Connection;
import javax.jms.JMSException;
@@ -43,7 +47,6 @@ public class SyncWaitDelayTest extends QpidBrokerTestCase
{
protected static final Logger _logger = LoggerFactory.getLogger(SyncWaitDelayTest.class);
- private String VIRTUALHOST = "test";
protected long POST_COMMIT_DELAY = 1000L;
protected long SYNC_WRITE_TIMEOUT = POST_COMMIT_DELAY + 1000;
@@ -54,12 +57,11 @@ public class SyncWaitDelayTest extends QpidBrokerTestCase
public void setUp() throws Exception
{
-
- final String prefix = "virtualhosts.virtualhost." + VIRTUALHOST;
- setVirtualHostConfigurationProperty(prefix + ".type", StandardVirtualHostFactory.TYPE);
- setVirtualHostConfigurationProperty(prefix + ".store.class", org.apache.qpid.server.store.SlowMessageStore.class.getName());
- setVirtualHostConfigurationProperty(prefix + ".store.delays.commitTran.post", String.valueOf(POST_COMMIT_DELAY));
-
+ Map<String, Object> slowMessageStoreDelays = new HashMap<String,Object>();
+ slowMessageStoreDelays.put("postcommitTran", POST_COMMIT_DELAY);
+ TestBrokerConfiguration config = getBrokerConfiguration();
+ config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST, VirtualHost.STORE_TYPE, SlowMessageStore.TYPE);
+ config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST, "slowMessageStoreDelays", slowMessageStoreDelays);
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 6473a77855..6909a3cbbf 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
@@ -21,15 +21,16 @@
package org.apache.qpid.test.unit.client;
import org.apache.log4j.Logger;
-
import org.apache.qpid.AMQException;
import org.apache.qpid.client.AMQDestination;
import org.apache.qpid.client.AMQQueue;
import org.apache.qpid.client.AMQSession;
import org.apache.qpid.client.RejectBehaviour;
import org.apache.qpid.configuration.ClientProperties;
+import org.apache.qpid.server.model.Broker;
import org.apache.qpid.server.queue.AMQQueueFactory;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
import javax.jms.Connection;
import javax.jms.Destination;
@@ -41,6 +42,7 @@ import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -75,13 +77,13 @@ public class MaxDeliveryCountTest extends QpidBrokerTestCase
public void setUp() throws Exception
{
//enable DLQ/maximumDeliveryCount support for all queues at the vhost level
- setVirtualHostConfigurationProperty("virtualhosts.virtualhost.test.queues.maximumDeliveryCount",
- String.valueOf(MAX_DELIVERY_COUNT));
- setVirtualHostConfigurationProperty("virtualhosts.virtualhost.test.queues.deadLetterQueues",
- String.valueOf(true));
+
+ TestBrokerConfiguration brokerConfiguration = getBrokerConfiguration();
+ brokerConfiguration.setBrokerAttribute(Broker.QUEUE_DEAD_LETTER_QUEUE_ENABLED, true);
+ brokerConfiguration.setBrokerAttribute(Broker.QUEUE_MAXIMUM_DELIVERY_ATTEMPTS, MAX_DELIVERY_COUNT);
//Ensure management is on
- getBrokerConfiguration().addJmxManagementConfiguration();
+ brokerConfiguration.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/transacted/TransactionTimeoutDisabledTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java
index d93c7a2e71..2b914393f2 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
@@ -20,6 +20,9 @@
*/
package org.apache.qpid.test.unit.transacted;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
+
/**
* This verifies that the default behaviour is not to time out transactions.
*/
@@ -29,7 +32,8 @@ public class TransactionTimeoutDisabledTest extends TransactionTimeoutTestCase
protected void configure() throws Exception
{
// Setup housekeeping every second
- setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", "100");
+ TestBrokerConfiguration brokerConfiguration = getBrokerConfiguration();
+ brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD, 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 f5a234163d..366cf11c4e 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
@@ -27,6 +27,7 @@ import javax.jms.MessageProducer;
import javax.jms.Queue;
import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
/**
* This tests the behaviour of transactional sessions when the {@code transactionTimeout} configuration
@@ -45,28 +46,29 @@ public class TransactionTimeoutTest extends TransactionTimeoutTestCase
getBrokerConfiguration().setBrokerAttribute(Broker.CONNECTION_CLOSE_WHEN_NO_ROUTE, false);
// Setup housekeeping every 100ms
- setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", "100");
+ TestBrokerConfiguration brokerConfiguration = getBrokerConfiguration();
+ brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD, 100);
if (getName().contains("ProducerIdle"))
{
- 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");
+ brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_WARN, 0);
+ brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_CLOSE, 0);
+ brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_WARN, 500);
+ brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_CLOSE, 1500);
}
else if (getName().contains("ProducerOpen"))
{
- 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");
+ brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_WARN, 1000);
+ brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_CLOSE, 2000);
+ brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_WARN, 0);
+ brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_CLOSE, 0);
}
else
{
- 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");
+ brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_WARN, 1000);
+ brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_CLOSE, 2000);
+ brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_WARN, 500);
+ brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_CLOSE, 1500);
}
}
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 91dcf48001..00d34dcd7d 100755
--- 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
@@ -48,8 +48,6 @@ import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.XMLConfiguration;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.apache.qpid.AMQException;
@@ -68,8 +66,8 @@ import org.apache.qpid.server.model.Port;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.plugin.MessageStoreFactory;
import org.apache.qpid.server.protocol.AmqpProtocolVersion;
-import org.apache.qpid.server.store.MessageStoreConstants;
import org.apache.qpid.server.store.MessageStoreCreator;
+import org.apache.qpid.server.virtualhost.StandardVirtualHostFactory;
import org.apache.qpid.url.URLSyntaxException;
import org.apache.qpid.util.FileUtils;
import org.apache.qpid.util.SystemUtils;
@@ -101,7 +99,6 @@ public class QpidBrokerTestCase extends QpidTestCase
private Map<String, String> _propertiesSetForBroker = new HashMap<String, String>();
private Map<Integer, TestBrokerConfiguration> _brokerConfigurations;
- private XMLConfiguration _testVirtualhosts = new XMLConfiguration();
protected static final String INDEX = "index";
protected static final String CONTENT = "content";
@@ -128,7 +125,6 @@ public class QpidBrokerTestCase extends QpidTestCase
}
// system properties
- private static final String TEST_VIRTUALHOSTS = "test.virtualhosts";
private static final String BROKER_LANGUAGE = "broker.language";
protected static final String BROKER_TYPE = "broker.type";
private static final String BROKER_COMMAND = "broker.command";
@@ -420,7 +416,7 @@ public class QpidBrokerTestCase extends QpidTestCase
{
int actualPort = getPort(port);
TestBrokerConfiguration configuration = getBrokerConfiguration(actualPort);
- startBroker(actualPort, configuration, _testVirtualhosts, managementMode);
+ startBroker(actualPort, configuration, managementMode);
}
protected File getBrokerCommandLog4JFile()
@@ -434,16 +430,14 @@ public class QpidBrokerTestCase extends QpidTestCase
_logger.info("Modified log config file to: " + file);
}
- public void startBroker(int port, TestBrokerConfiguration testConfiguration, XMLConfiguration virtualHosts) throws Exception
+ public void startBroker(int port, TestBrokerConfiguration testConfiguration) throws Exception
{
- startBroker(port, testConfiguration, virtualHosts, false);
+ startBroker(port, testConfiguration, false);
}
- public void startBroker(int port, TestBrokerConfiguration testConfiguration, XMLConfiguration virtualHosts, boolean managementMode) throws Exception
+ public void startBroker(int port, TestBrokerConfiguration testConfiguration, boolean managementMode) throws Exception
{
port = getPort(port);
- String testConfig = saveTestConfiguration(port, testConfiguration);
- String virtualHostsConfig = saveTestVirtualhosts(port, virtualHosts);
if(_brokers.get(port) != null)
{
@@ -454,8 +448,7 @@ public class QpidBrokerTestCase extends QpidTestCase
if (_brokerType.equals(BrokerType.INTERNAL) && !existingInternalBroker())
{
- _logger.info("Set test.virtualhosts property to: " + virtualHostsConfig);
- setSystemProperty(TEST_VIRTUALHOSTS, virtualHostsConfig);
+ String testConfig = saveTestConfiguration(port, testConfiguration);
setSystemProperty(BrokerProperties.PROPERTY_USE_CUSTOM_RMI_SOCKET_FACTORY, "false");
BrokerOptions options = new BrokerOptions();
@@ -479,6 +472,9 @@ public class QpidBrokerTestCase extends QpidTestCase
}
else if (!_brokerType.equals(BrokerType.EXTERNAL))
{
+ String workDir = System.getProperty("QPID_WORK") + File.separator + "work" + File.separator + port;
+ testConfiguration.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST, VirtualHost.STORE_PATH, workDir);
+ String testConfig = saveTestConfiguration(port, testConfiguration);
// Add the port to QPID_WORK to ensure unique working dirs for multi broker tests
final String qpidWork = getQpidWork(_brokerType, port);
@@ -549,7 +545,6 @@ public class QpidBrokerTestCase extends QpidTestCase
setSystemProperty("root.logging.level");
setSystemProperty(BrokerProperties.PROPERTY_BROKER_DEFAULT_AMQP_PROTOCOL_EXCLUDES);
setSystemProperty(BrokerProperties.PROPERTY_BROKER_DEFAULT_AMQP_PROTOCOL_INCLUDES);
- setSystemProperty(TEST_VIRTUALHOSTS, virtualHostsConfig);
// Add all the specified system properties to QPID_OPTS
if (!_propertiesSetForBroker.isEmpty())
@@ -656,20 +651,6 @@ public class QpidBrokerTestCase extends QpidTestCase
return _output + File.separator + getTestQueueName() + "-" + port + "-virtualhosts.xml";
}
- private String relativeToQpidHome(String file)
- {
- _logger.debug("Converting path to be relative to QPID_HOME: " + file);
-
- final String qpidHome = System.getProperty(QPID_HOME,"QPID_HOME");
- _logger.debug("QPID_HOME is: " + qpidHome);
-
- if(!file.startsWith(qpidHome)) {
- throw new RuntimeException("Provided path is not a child of the QPID_HOME directory: " + qpidHome);
- }
-
- return file.replace(qpidHome + File.separator,"");
- }
-
protected String getPathRelativeToWorkingDirectory(String file)
{
File configLocation = new File(file);
@@ -715,23 +696,6 @@ public class QpidBrokerTestCase extends QpidTestCase
return 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("Path to virtualhosts configuration: " + testVirtualhosts);
-
- // Create the file if configuration does not exist
- if (virtualHostConfiguration.isEmpty())
- {
- virtualHostConfiguration.addProperty("__ignore", "true");
- }
- virtualHostConfiguration.save(testVirtualhosts);
- return relative;
- }
-
protected void cleanBrokerWork(final String qpidWork)
{
if (qpidWork != null)
@@ -872,68 +836,32 @@ 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(int brokerPort, String virtualHostName) throws ConfigurationException
+ protected void createTestVirtualHost(int brokerPort, String virtualHostName)
{
- String storeClassName = getTestProfileMessageStoreClassName();
-
- _testVirtualhosts.setProperty("virtualhost.name(-1)", virtualHostName);
- _testVirtualhosts.setProperty("virtualhost." + virtualHostName + ".store.class", storeClassName);
-
+ String storeType = getTestProfileMessageStoreType();
String storeDir = null;
if (System.getProperty("profile", "").startsWith("java-dby-mem"))
{
storeDir = ":memory:";
}
- else if (!MEMORY_STORE_CLASS_NAME.equals(storeClassName))
+ else if (!"Memory".equals(storeType))
{
- storeDir = "${QPID_WORK}" + File.separator + virtualHostName + "-store";
- }
-
- if (storeDir != null)
- {
- _testVirtualhosts.setProperty("virtualhost." + virtualHostName + ".store." + MessageStoreConstants.ENVIRONMENT_PATH_PROPERTY, storeDir);
+ storeDir = "${QPID_WORK}" + File.separator + virtualHostName + File.separator + brokerPort;
}
// 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"));
+ attributes.put(VirtualHost.TYPE, StandardVirtualHostFactory.TYPE);
+ attributes.put(VirtualHost.STORE_TYPE, storeType);
+ attributes.put(VirtualHost.STORE_PATH, storeDir);
int port = getPort(brokerPort);
getBrokerConfiguration(port).addVirtualHostConfiguration(attributes);
}
/**
- * Set a configuration Property for this test run.
- *
- * This creates a new configuration based on the current configuration
- * with the specified property change.
- *
- * Multiple calls to this method will result in multiple temporary
- * configuration files being created.
- *
- * @param property the configuration property to set
- * @param value the new value
- *
- * @throws ConfigurationException when loading the current config file
- */
- public void setVirtualHostConfigurationProperty(String property, String value) throws ConfigurationException
- {
- // Choose which file to write the property to based on prefix.
- if (property.startsWith("virtualhosts"))
- {
- _testVirtualhosts.setProperty(StringUtils.substringAfter(property, "virtualhosts."), value);
- }
- else
- {
- throw new ConfigurationException("Cannot set broker configuration as property");
- }
- }
-
- /**
* Set a System property that is to be applied only to the external test
* broker.
*
@@ -1468,24 +1396,4 @@ public class QpidBrokerTestCase extends QpidTestCase
return FAILING_PORT;
}
- public XMLConfiguration getTestVirtualhosts()
- {
- return _testVirtualhosts;
- }
-
- public void setTestVirtualhosts(XMLConfiguration testVirtualhosts)
- {
- _testVirtualhosts = testVirtualhosts;
- }
-
- public String getTestProfileMessageStoreType()
- {
- final String storeClass = getTestProfileMessageStoreClassName();
- /* if (storeClass == null)
- {
- return "Memory";
- }*/
- return supportedStoresClassToTypeMapping.get(storeClass);
- }
-
}
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
index 9e893bb7bb..31a650baad 100644
--- 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
@@ -20,6 +20,7 @@
*/
package org.apache.qpid.test.utils;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.util.Collection;
import java.util.Collections;
@@ -45,6 +46,7 @@ import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.plugin.PluginFactory;
import org.apache.qpid.server.security.access.FileAccessControlProviderConstants;
import org.apache.qpid.server.security.group.FileGroupManagerFactory;
+import org.apache.qpid.util.FileUtils;
public class TestBrokerConfiguration
{
@@ -308,4 +310,8 @@ public class TestBrokerConfiguration
_store.save(newAp, pp);
}
+ public Map<String, Object> getObjectAttributes(String name)
+ {
+ return findObjectByName(name).getAttributes();
+ }
}
diff --git a/qpid/java/systests/src/main/resources/META-INF/services/org.apache.qpid.server.plugin.MessageStoreFactory b/qpid/java/systests/src/main/resources/META-INF/services/org.apache.qpid.server.plugin.MessageStoreFactory
index fdd7a904c3..9e2efc1031 100644
--- a/qpid/java/systests/src/main/resources/META-INF/services/org.apache.qpid.server.plugin.MessageStoreFactory
+++ b/qpid/java/systests/src/main/resources/META-INF/services/org.apache.qpid.server.plugin.MessageStoreFactory
@@ -17,3 +17,4 @@
# under the License.
#
org.apache.qpid.server.store.SlowMessageStoreFactory
+org.apache.qpid.server.store.QuotaMessageStoreFactory
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 4230888a21..ed58a7d3b5 100644
--- a/qpid/java/test-profiles/java-bdb-spawn.0-10.testprofile
+++ b/qpid/java/test-profiles/java-bdb-spawn.0-10.testprofile
@@ -30,4 +30,4 @@ profile.excludes=JavaExcludes JavaPersistentExcludes Java010Excludes JavaBDBExcl
broker.clean.between.tests=true
broker.persistent=true
broker.version=v0_10
-
+messagestore.type=BDB
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 054eb9c1b6..32243cea61 100644
--- a/qpid/java/test-profiles/java-bdb-spawn.0-8.testprofile
+++ b/qpid/java/test-profiles/java-bdb-spawn.0-8.testprofile
@@ -34,4 +34,4 @@ broker.version=v0_8
# Do not enable. Allow client to attempt 0-10 and negotiate downwards
#
#qpid.amqp.version=0-8
-
+messagestore.type=BDB
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 65d86d9310..354bf6c131 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
@@ -34,4 +34,4 @@ broker.version=v0_9_1
# Do not enable. Allow client to attempt 0-10 and negotiate downwards
#
#qpid.amqp.version=0-91
-
+messagestore.type=BDB
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 4818cfff28..e07d1ca339 100644
--- a/qpid/java/test-profiles/java-bdb-spawn.0-9.testprofile
+++ b/qpid/java/test-profiles/java-bdb-spawn.0-9.testprofile
@@ -34,4 +34,4 @@ broker.version=v0_9
# Do not enable. Allow client to attempt 0-10 and negotiate downwards
#
#qpid.amqp.version=0-9
-
+messagestore.type=BDB
diff --git a/qpid/java/test-profiles/java-bdb.0-10.testprofile b/qpid/java/test-profiles/java-bdb.0-10.testprofile
index cf5f608957..36f4123ad0 100644
--- a/qpid/java/test-profiles/java-bdb.0-10.testprofile
+++ b/qpid/java/test-profiles/java-bdb.0-10.testprofile
@@ -31,4 +31,5 @@ profile.excludes=JavaExcludes JavaPersistentExcludes Java010Excludes JavaBDBExcl
broker.clean.between.tests=true
broker.persistent=true
broker.version=v0_10
+messagestore.type=BDB
diff --git a/qpid/java/test-profiles/java-bdb.0-8.testprofile b/qpid/java/test-profiles/java-bdb.0-8.testprofile
index 09270f89b0..27284b3f13 100644
--- a/qpid/java/test-profiles/java-bdb.0-8.testprofile
+++ b/qpid/java/test-profiles/java-bdb.0-8.testprofile
@@ -35,4 +35,4 @@ broker.version=v0_8
# Do not enable. Allow client to attempt 0-10 and negotiate downwards
#
#qpid.amqp.version=0-8
-
+messagestore.type=BDB
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 4248a55f1c..4944773e18 100644
--- a/qpid/java/test-profiles/java-bdb.0-9-1.testprofile
+++ b/qpid/java/test-profiles/java-bdb.0-9-1.testprofile
@@ -25,7 +25,6 @@ broker.command.windows=build${file.separator}bin${file.separator}qpid-server.bat
broker.ready=BRK-1004
broker.stopped=Exception
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
@@ -35,4 +34,4 @@ broker.version=v0_9_1
# Do not enable. Allow client to attempt 0-10 and negotiate downwards
#
#qpid.amqp.version=0-91
-
+messagestore.type=BDB
diff --git a/qpid/java/test-profiles/java-bdb.0-9.testprofile b/qpid/java/test-profiles/java-bdb.0-9.testprofile
index cff55d7bde..fdd6ce65ac 100644
--- a/qpid/java/test-profiles/java-bdb.0-9.testprofile
+++ b/qpid/java/test-profiles/java-bdb.0-9.testprofile
@@ -25,7 +25,6 @@ broker.command.windows=build${file.separator}bin${file.separator}qpid-server.bat
broker.ready=BRK-1004
broker.stopped=Exception
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
@@ -35,4 +34,4 @@ broker.version=v0_9
# Do not enable. Allow client to attempt 0-10 and negotiate downwards
#
#qpid.amqp.version=0-9
-
+messagestore.type=BDB
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 f968d58ec9..d7c7cdef5e 100644
--- a/qpid/java/test-profiles/java-dby-mem.0-10.testprofile
+++ b/qpid/java/test-profiles/java-dby-mem.0-10.testprofile
@@ -30,3 +30,4 @@ messagestore.class.name=org.apache.qpid.server.store.derby.DerbyMessageStore
profile.excludes=JavaPersistentExcludes JavaDerbyExcludes Java010Excludes
broker.clean.between.tests=true
broker.persistent=true
+messagestore.type=DERBY \ No newline at end of file
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 b50e17b955..c459eb99b1 100644
--- a/qpid/java/test-profiles/java-dby-mem.0-8.testprofile
+++ b/qpid/java/test-profiles/java-dby-mem.0-8.testprofile
@@ -34,4 +34,4 @@ broker.persistent=true
# Do not enable. Allow client to attempt 0-10 and negotiate downwards
#
#qpid.amqp.version=0-8
-
+messagestore.type=DERBY
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 d16d17d220..1e4b30a846 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
@@ -34,4 +34,4 @@ broker.persistent=true
# Do not enable. Allow client to attempt 0-10 and negotiate downwards
#
#qpid.amqp.version=0-91
-
+messagestore.type=DERBY
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 35f2d0aa8c..e2caf50793 100644
--- a/qpid/java/test-profiles/java-dby-mem.0-9.testprofile
+++ b/qpid/java/test-profiles/java-dby-mem.0-9.testprofile
@@ -34,4 +34,4 @@ broker.persistent=true
# Do not enable. Allow client to attempt 0-10 and negotiate downwards
#
#qpid.amqp.version=0-9
-
+messagestore.type=DERBY
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 a3ea69a1ee..1ae7ac633a 100644
--- a/qpid/java/test-profiles/java-dby-spawn.0-10.testprofile
+++ b/qpid/java/test-profiles/java-dby-spawn.0-10.testprofile
@@ -29,3 +29,4 @@ messagestore.class.name=org.apache.qpid.server.store.derby.DerbyMessageStore
profile.excludes=JavaPersistentExcludes JavaDerbyExcludes Java010Excludes
broker.clean.between.tests=true
broker.persistent=true
+messagestore.type=DERBY \ No newline at end of file
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 8e737cec7c..d2a7654006 100644
--- a/qpid/java/test-profiles/java-dby-spawn.0-8.testprofile
+++ b/qpid/java/test-profiles/java-dby-spawn.0-8.testprofile
@@ -33,4 +33,4 @@ broker.persistent=true
# Do not enable. Allow client to attempt 0-10 and negotiate downwards
#
#qpid.amqp.version=0-8
-
+messagestore.type=DERBY
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 9de7a4a490..3cb8054c07 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
@@ -33,4 +33,4 @@ broker.persistent=true
# Do not enable. Allow client to attempt 0-10 and negotiate downwards
#
#qpid.amqp.version=0-91
-
+messagestore.type=DERBY
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 97fff81068..e26a545b6b 100644
--- a/qpid/java/test-profiles/java-dby-spawn.0-9.testprofile
+++ b/qpid/java/test-profiles/java-dby-spawn.0-9.testprofile
@@ -33,4 +33,4 @@ broker.persistent=true
# Do not enable. Allow client to attempt 0-10 and negotiate downwards
#
#qpid.amqp.version=0-9
-
+messagestore.type=DERBY
diff --git a/qpid/java/test-profiles/java-dby.0-10.testprofile b/qpid/java/test-profiles/java-dby.0-10.testprofile
index 07d75577d3..68b8873abc 100644
--- a/qpid/java/test-profiles/java-dby.0-10.testprofile
+++ b/qpid/java/test-profiles/java-dby.0-10.testprofile
@@ -30,3 +30,4 @@ messagestore.class.name=org.apache.qpid.server.store.derby.DerbyMessageStore
profile.excludes=JavaPersistentExcludes JavaDerbyExcludes Java010Excludes
broker.clean.between.tests=true
broker.persistent=true
+messagestore.type=DERBY \ No newline at end of file
diff --git a/qpid/java/test-profiles/java-dby.0-8.testprofile b/qpid/java/test-profiles/java-dby.0-8.testprofile
index b24dc8381d..f08c46ae8f 100644
--- a/qpid/java/test-profiles/java-dby.0-8.testprofile
+++ b/qpid/java/test-profiles/java-dby.0-8.testprofile
@@ -34,4 +34,4 @@ broker.persistent=true
# Do not enable. Allow client to attempt 0-10 and negotiate downwards
#
#qpid.amqp.version=0-8
-
+messagestore.type=DERBY
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 ec08913626..ab7f1785e8 100644
--- a/qpid/java/test-profiles/java-dby.0-9-1.testprofile
+++ b/qpid/java/test-profiles/java-dby.0-9-1.testprofile
@@ -34,4 +34,4 @@ broker.persistent=true
# Do not enable. Allow client to attempt 0-10 and negotiate downwards
#
#qpid.amqp.version=0-91
-
+messagestore.type=DERBY
diff --git a/qpid/java/test-profiles/java-dby.0-9.testprofile b/qpid/java/test-profiles/java-dby.0-9.testprofile
index 73b1161f6b..8b588a0a07 100644
--- a/qpid/java/test-profiles/java-dby.0-9.testprofile
+++ b/qpid/java/test-profiles/java-dby.0-9.testprofile
@@ -34,4 +34,4 @@ broker.persistent=true
# Do not enable. Allow client to attempt 0-10 and negotiate downwards
#
#qpid.amqp.version=0-9
-
+messagestore.type=DERBY
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 c2f2976d5f..15a1d365af 100644
--- a/qpid/java/test-profiles/java-mms-spawn.0-10.testprofile
+++ b/qpid/java/test-profiles/java-mms-spawn.0-10.testprofile
@@ -30,3 +30,4 @@ broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests.xml
#
#qpid.amqp.version=0-10
profile.excludes=JavaTransientExcludes Java010Excludes
+messagestore.type=Memory \ No newline at end of file
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 74da76edc4..2f6a5d8c1c 100644
--- a/qpid/java/test-profiles/java-mms-spawn.0-8.testprofile
+++ b/qpid/java/test-profiles/java-mms-spawn.0-8.testprofile
@@ -30,3 +30,4 @@ broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests.xml
#
#qpid.amqp.version=0-8
profile.excludes=JavaTransientExcludes XAExcludes JavaPre010Excludes
+messagestore.type=Memory \ No newline at end of file
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 4438a4293f..f9b12d5eb5 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
@@ -30,3 +30,4 @@ broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests.xml
#
#qpid.amqp.version=0-91
profile.excludes=JavaTransientExcludes XAExcludes JavaPre010Excludes
+messagestore.type=Memory \ No newline at end of file
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 828ad3fedf..8fd760bca7 100644
--- a/qpid/java/test-profiles/java-mms-spawn.0-9.testprofile
+++ b/qpid/java/test-profiles/java-mms-spawn.0-9.testprofile
@@ -30,3 +30,4 @@ broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests.xml
#
#qpid.amqp.version=0-9
profile.excludes=JavaTransientExcludes XAExcludes JavaPre010Excludes
+messagestore.type=Memory \ No newline at end of file
diff --git a/qpid/java/test-profiles/java-mms.0-10.testprofile b/qpid/java/test-profiles/java-mms.0-10.testprofile
index 33e90b940a..480d6307b1 100644
--- a/qpid/java/test-profiles/java-mms.0-10.testprofile
+++ b/qpid/java/test-profiles/java-mms.0-10.testprofile
@@ -28,3 +28,4 @@ qpid.broker_default_amqp_protocol_excludes=AMQP_1_0
broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests.xml
profile.excludes=JavaTransientExcludes Java010Excludes
+messagestore.type=Memory \ No newline at end of file
diff --git a/qpid/java/test-profiles/java-mms.0-8.testprofile b/qpid/java/test-profiles/java-mms.0-8.testprofile
index 93365e2e5c..b263cb6c9c 100644
--- a/qpid/java/test-profiles/java-mms.0-8.testprofile
+++ b/qpid/java/test-profiles/java-mms.0-8.testprofile
@@ -31,3 +31,4 @@ broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests.xml
#
#qpid.amqp.version=0-8
profile.excludes=JavaTransientExcludes XAExcludes JavaPre010Excludes
+messagestore.type=Memory \ No newline at end of file
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 78a4629c9b..37f65d3332 100644
--- a/qpid/java/test-profiles/java-mms.0-9-1.testprofile
+++ b/qpid/java/test-profiles/java-mms.0-9-1.testprofile
@@ -31,3 +31,4 @@ broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests.xml
#
#qpid.amqp.version=0-91
profile.excludes=JavaTransientExcludes XAExcludes JavaPre010Excludes
+messagestore.type=Memory \ No newline at end of file
diff --git a/qpid/java/test-profiles/java-mms.0-9.testprofile b/qpid/java/test-profiles/java-mms.0-9.testprofile
index c5edf32bee..a3d2abfb8a 100644
--- a/qpid/java/test-profiles/java-mms.0-9.testprofile
+++ b/qpid/java/test-profiles/java-mms.0-9.testprofile
@@ -31,3 +31,4 @@ broker.virtualhosts-config=${QPID_HOME}/etc/virtualhosts-systests.xml
#
#qpid.amqp.version=0-9
profile.excludes=JavaTransientExcludes XAExcludes JavaPre010Excludes
+messagestore.type=Memory \ No newline at end of file
diff --git a/qpid/java/test-profiles/testprofile.defaults b/qpid/java/test-profiles/testprofile.defaults
index ccd31a5d1e..4b6a8e5906 100644
--- a/qpid/java/test-profiles/testprofile.defaults
+++ b/qpid/java/test-profiles/testprofile.defaults
@@ -63,6 +63,6 @@ exclude.modules=none
profile.clustered=false
broker.config-store-type=json
-broker.virtualhosts-config="${QPID_HOME}${file.separator}etc${file.separator}virtualhosts-systests.xml"
+