summaryrefslogtreecommitdiff
path: root/qpid/java/broker-core/src
diff options
context:
space:
mode:
authorAndrew MacBean <macbean@apache.org>2014-06-26 11:19:54 +0000
committerAndrew MacBean <macbean@apache.org>2014-06-26 11:19:54 +0000
commit8a1190a3bc398233b3cb9a295add11eef0f3cec4 (patch)
tree15ecfb671967401f81b9dce15e46aa9f1a33489c /qpid/java/broker-core/src
parent4ad072fd1cca374bcf36292bcf83aba74f18f08c (diff)
downloadqpid-python-8a1190a3bc398233b3cb9a295add11eef0f3cec4.tar.gz
QPID-5821: [Java Broker] Refactor MessageStore and DurableConfigurationStore interfaces to remove message store settings map.
VirtualHost model objects now have attributes. Work done by Keith Wall <kwall@apache.org> and me. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1605737 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-core/src')
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStore.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/ManagementModeStoreHandler.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/MemoryConfigurationEntryStore.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java7
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/JDBCConnectionProviderFactory.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractMemoryStore.java3
-rwxr-xr-xqpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java8
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/FileBasedSettings.java24
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java15
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MemoryMessageStore.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStore.java11
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/NullMessageStore.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/Settings.java (renamed from qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/MessageStoreProvidingVirtualHostNode.java)14
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/SizeMonitorSettings.java26
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/SizeMonitoringSettings.java26
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java19
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ProvidedStoreVirtualHost.java54
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ProvidedStoreVirtualHostImpl.java91
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNode.java13
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java43
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/JsonVirtualHostNode.java (renamed from qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/FileBasedVirtualHostNode.java)12
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/JsonVirtualHostNodeImpl.java9
-rw-r--r--qpid/java/broker-core/src/main/resources/initial-config.json2
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ManagementModeStoreHandlerTest.java32
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java17
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/BrokerStoreUpgraderAndRecovererTest.java3
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreConfigurationTest.java19
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreTest.java61
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/MemoryMessageStoreTest.java11
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/MessageStoreQuotaEventsTestBase.java14
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/MessageStoreTestCase.java15
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java7
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/TestVirtualHostNode.java4
35 files changed, 328 insertions, 260 deletions
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java
index 78adb46622..1bbeaaca9d 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java
@@ -25,7 +25,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
-import java.util.Collections;
import java.util.List;
import java.util.Properties;
import java.util.Set;
@@ -150,7 +149,7 @@ public class Broker
store = new ManagementModeStoreHandler(store, options);
}
- store.openConfigurationStore(systemContext, Collections.<String, Object>emptyMap());
+ store.openConfigurationStore(systemContext);
_applicationRegistry = new ApplicationRegistry(store,systemContext);
try
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStore.java
index 2ee4d3500b..db8af346a6 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStore.java
@@ -23,7 +23,6 @@ package org.apache.qpid.server.configuration.store;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.Map;
import java.util.UUID;
@@ -144,7 +143,7 @@ public class JsonConfigurationEntryStore extends MemoryConfigurationEntryStore
}
};
- initialStore.openConfigurationStore(_parentObject, Collections.<String,Object>emptyMap());
+ initialStore.openConfigurationStore(_parentObject);
initialStore.visitConfiguredObjectRecords(replayHandler);
update(true, records.toArray(new ConfiguredObjectRecord[records.size()]));
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/ManagementModeStoreHandler.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/ManagementModeStoreHandler.java
index d5bbd51fe1..04ca68efae 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/ManagementModeStoreHandler.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/ManagementModeStoreHandler.java
@@ -73,11 +73,11 @@ public class ManagementModeStoreHandler implements DurableConfigurationStore
}
@Override
- public void openConfigurationStore(final ConfiguredObject<?> parent, final Map<String, Object> storeSettings)
+ public void openConfigurationStore(final ConfiguredObject<?> parent)
throws StoreException
{
_parent = parent;
- _store.openConfigurationStore(parent,storeSettings);
+ _store.openConfigurationStore(parent);
_records = new HashMap<UUID, ConfiguredObjectRecord>();
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 d95d58a9cf..d13fb29c2b 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
@@ -141,7 +141,7 @@ public class MemoryConfigurationEntryStore implements ConfigurationEntryStore
}
};
- initialStore.openConfigurationStore(parentObject, Collections.<String,Object>emptyMap());
+ initialStore.openConfigurationStore(parentObject);
initialStore.visitConfiguredObjectRecords(replayHandler);
update(true, records.toArray(new ConfiguredObjectRecord[records.size()]));
@@ -344,7 +344,7 @@ public class MemoryConfigurationEntryStore implements ConfigurationEntryStore
}
@Override
- public void openConfigurationStore(final ConfiguredObject<?> parent, final Map<String, Object> storeSettings)
+ public void openConfigurationStore(final ConfiguredObject<?> parent)
throws StoreException
{
_parent = parent;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java
index f568422d99..e084ea0f1d 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java
@@ -30,6 +30,7 @@ import java.lang.reflect.Proxy;
import java.security.AccessControlException;
import java.security.PrivilegedAction;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -308,7 +309,11 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im
case 1:
return candidates.iterator().next();
default:
- throw new ServerScopedRuntimeException("The configured object class " + getClass().getSimpleName() + " implements no single common interface which extends ConfiguredObject");
+ ArrayList<Class<? extends ConfiguredObject>> list = new ArrayList<>(candidates);
+
+ throw new ServerScopedRuntimeException("The configured object class " + getClass().getSimpleName()
+ + " implements no single common interface which extends ConfiguredObject"
+ + " Identified candidates were : " + Arrays.toString(list.toArray()));
}
}
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 6608b57024..518141a21d 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
@@ -43,7 +43,6 @@ public interface VirtualHost<X extends VirtualHost<X, Q, E>, Q extends Queue<?>,
String SUPPORTED_EXCHANGE_TYPES = "supportedExchangeTypes";
String SUPPORTED_QUEUE_TYPES = "supportedQueueTypes";
String HOUSE_KEEPING_THREAD_COUNT = "houseKeepingThreadCount";
- String MESSAGE_STORE_SETTINGS = "messageStoreSettings";
String MODEL_VERSION = "modelVersion";
// TODO - this isn't really an attribute
@@ -104,9 +103,6 @@ public interface VirtualHost<X extends VirtualHost<X, Q, E>, Q extends Queue<?>,
@ManagedAttribute( defaultValue = "${virtualhost.housekeepingThreadCount}")
int getHousekeepingThreadCount();
- @ManagedAttribute
- Map<String, Object> getMessageStoreSettings();
-
@DerivedAttribute( persist = true )
String getModelVersion();
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 c6b350d65b..f2ab47bfbb 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
@@ -27,13 +27,14 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
+import org.apache.qpid.server.model.ConfiguredObject;
import org.apache.qpid.server.store.jdbc.ConnectionProvider;
public interface JDBCConnectionProviderFactory extends Pluggable
{
String getType();
- ConnectionProvider getConnectionProvider(String connectionUrl, Map<String, Object> storeSettings)
+ ConnectionProvider getConnectionProvider(ConfiguredObject<?> parent, String connectionUrl)
throws SQLException;
static final class TYPES
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractMemoryStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractMemoryStore.java
index 48608dde4f..92184e9b81 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractMemoryStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractMemoryStore.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.store;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
@@ -73,7 +72,7 @@ abstract class AbstractMemoryStore implements DurableConfigurationStore, Message
}
@Override
- public void openConfigurationStore(ConfiguredObject<?> parent, Map<String, Object> storeSettings)
+ public void openConfigurationStore(ConfiguredObject<?> parent)
{
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java
index e353b55e68..1efd415e6a 100755
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java
@@ -28,16 +28,12 @@ import org.apache.qpid.server.store.handler.ConfiguredObjectRecordHandler;
public interface DurableConfigurationStore
{
- String STORE_TYPE = "storeType";
- String STORE_PATH = "storePath";
-
/**
* Initializes and opens the configuration store.
+ * @param parent
*
- * @param parent
- * @param storeSettings store settings
*/
- void openConfigurationStore(ConfiguredObject<?> parent, Map<String, Object> storeSettings) throws StoreException;
+ void openConfigurationStore(ConfiguredObject<?> parent) throws StoreException;
/**
* Requests that the store performs any upgrade work on the store's structure. If there is no
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/FileBasedSettings.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/FileBasedSettings.java
new file mode 100644
index 0000000000..a061f9c45d
--- /dev/null
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/FileBasedSettings.java
@@ -0,0 +1,24 @@
+/*
+ * 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;
+
+public interface FileBasedSettings extends Settings
+{
+ public String getStorePath();
+}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
index f787bd63ad..d733c351c4 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
@@ -55,9 +55,6 @@ import org.apache.qpid.server.store.handler.ConfiguredObjectRecordHandler;
public class JsonFileConfigStore implements DurableConfigurationStore
{
-
- public static final String TYPE = "JSON";
-
private final Map<UUID, ConfiguredObjectRecord> _objectsById = new HashMap<UUID, ConfiguredObjectRecord>();
private final Map<String, List<UUID>> _idsByType = new HashMap<String, List<UUID>>();
private final ObjectMapper _objectMapper = new ObjectMapper();
@@ -112,12 +109,13 @@ public class JsonFileConfigStore implements DurableConfigurationStore
}
@Override
- public void openConfigurationStore(ConfiguredObject<?> parent, Map<String, Object> storeSettings)
+ public void openConfigurationStore(ConfiguredObject<?> parent)
{
_parent = parent;
_name = parent.getName();
_classNameMapping = generateClassNameMap(_parent.getModel(), _rootClass);
- setup(storeSettings);
+ FileBasedSettings fileBasedSettings = (FileBasedSettings)_parent;
+ setup(fileBasedSettings);
load();
}
@@ -138,14 +136,13 @@ public class JsonFileConfigStore implements DurableConfigurationStore
}
- private void setup(final Map<String, Object> configurationStoreSettings)
+ private void setup(final FileBasedSettings configurationStoreSettings)
{
- Object storePathAttr = configurationStoreSettings.get(DurableConfigurationStore.STORE_PATH);
- if(!(storePathAttr instanceof String))
+ if(configurationStoreSettings.getStorePath() == null)
{
throw new StoreException("Cannot determine path for configuration storage");
}
- _directoryName = (String) storePathAttr;
+ _directoryName = configurationStoreSettings.getStorePath();
_configFileName = _name + ".json";
_backupFileName = _name + ".bak";
checkDirectoryIsWritable(_directoryName);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MemoryMessageStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MemoryMessageStore.java
index 21a94113cf..3df1ffb6bc 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MemoryMessageStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MemoryMessageStore.java
@@ -181,7 +181,7 @@ public class MemoryMessageStore implements MessageStore
@Override
- public void openMessageStore(final ConfiguredObject<?> parent, final Map<String, Object> messageStoreSettings)
+ public void openMessageStore(final ConfiguredObject<?> parent)
{
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStore.java
index e82f9dbbb0..642fcbdc54 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStore.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.store;
-import java.util.Map;
import org.apache.qpid.server.model.ConfiguredObject;
import org.apache.qpid.server.store.handler.DistributedTransactionHandler;
@@ -33,22 +32,16 @@ import org.apache.qpid.server.store.handler.MessageInstanceHandler;
*/
public interface MessageStore
{
- String STORE_TYPE = "storeType";
- String STORE_PATH = "storePath";
- String UNDERFULL_SIZE = "storeUnderfullSize";
- String OVERFULL_SIZE = "storeOverfullSize";
-
String getStoreLocation();
void addEventListener(EventListener eventListener, Event... events);
/**
* Initializes and opens the message store.
+ * @param parent parent object
*
- * @param parent parent object
- * @param messageStoreSettings store settings
*/
- void openMessageStore(ConfiguredObject<?> parent, Map<String, Object> messageStoreSettings);
+ void openMessageStore(ConfiguredObject<?> parent);
/**
* Requests that the store performs any upgrade work on the store's structure. If there is no
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/NullMessageStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/NullMessageStore.java
index a6657f48a8..8848dcdd94 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/NullMessageStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/NullMessageStore.java
@@ -19,7 +19,6 @@
*/
package org.apache.qpid.server.store;
-import java.util.Map;
import java.util.UUID;
import org.apache.qpid.server.model.ConfiguredObject;
@@ -37,7 +36,7 @@ public abstract class NullMessageStore implements MessageStore, DurableConfigura
}
@Override
- public void openConfigurationStore(ConfiguredObject<?> parent, Map<String, Object> storeSettings)
+ public void openConfigurationStore(ConfiguredObject<?> parent)
{
}
@@ -63,7 +62,7 @@ public abstract class NullMessageStore implements MessageStore, DurableConfigura
}
@Override
- public void openMessageStore(ConfiguredObject<?> parent, Map<String, Object> messageStoreSettings)
+ public void openMessageStore(ConfiguredObject<?> parent)
{
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/MessageStoreProvidingVirtualHostNode.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/Settings.java
index 4cb85dafd4..6d0ffe0b82 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/MessageStoreProvidingVirtualHostNode.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/Settings.java
@@ -1,5 +1,4 @@
/*
- *
* 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
@@ -16,17 +15,10 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
-package org.apache.qpid.server.virtualhostnode;
+package org.apache.qpid.server.store;
-import org.apache.qpid.server.model.ManagedObject;
-import org.apache.qpid.server.model.VirtualHostNode;
-import org.apache.qpid.server.store.MessageStore;
-
-@ManagedObject( category = false )
-public interface MessageStoreProvidingVirtualHostNode<X extends MessageStoreProvidingVirtualHostNode<X>>
- extends VirtualHostNode<X>
+public interface Settings
{
- MessageStore getProvidedMessageStore();
+
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/SizeMonitorSettings.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/SizeMonitorSettings.java
new file mode 100644
index 0000000000..189e06a6d7
--- /dev/null
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/SizeMonitorSettings.java
@@ -0,0 +1,26 @@
+/*
+ * 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;
+
+public interface SizeMonitorSettings extends Settings
+{
+ public Long getStoreUnderfullSize();
+ public Long getStoreOverfullSize();
+}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/SizeMonitoringSettings.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/SizeMonitoringSettings.java
new file mode 100644
index 0000000000..dc05889e5e
--- /dev/null
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/SizeMonitoringSettings.java
@@ -0,0 +1,26 @@
+/*
+ * 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;
+
+public interface SizeMonitoringSettings extends Settings
+{
+ public Long getStoreUnderfullSize();
+ public Long getStoreOverfullSize();
+}
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 6e3f9bd643..3c63c5b869 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
@@ -86,8 +86,7 @@ import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.server.util.MapValueConverter;
public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> extends AbstractConfiguredObject<X>
- implements VirtualHostImpl<X, AMQQueue<?>, ExchangeImpl<?>>, IConnectionRegistry.RegistryChangeListener, EventListener,
- VirtualHost<X,AMQQueue<?>, ExchangeImpl<?>>
+ implements VirtualHostImpl<X, AMQQueue<?>, ExchangeImpl<?>>, IConnectionRegistry.RegistryChangeListener, EventListener
{
public static final String DEFAULT_DLQ_NAME_SUFFIX = "_DLQ";
public static final String DLQ_ROUTING_KEY = "dlq";
@@ -130,9 +129,6 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte
private MessageStoreLogSubject _messageStoreLogSubject;
@ManagedAttributeField
- private Map<String, Object> _messageStoreSettings;
-
- @ManagedAttributeField
private boolean _queue_deadLetterQueueEnabled;
@ManagedAttributeField
@@ -1082,12 +1078,6 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte
}
@Override
- public Map<String, Object> getMessageStoreSettings()
- {
- return _messageStoreSettings;
- }
-
- @Override
public long getQueueCount()
{
return getQueues().size();
@@ -1328,12 +1318,7 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte
_houseKeepingTasks = new ScheduledThreadPoolExecutor(getHousekeepingThreadCount());
MessageStore messageStore = getMessageStore();
- Map<String, Object> messageStoreSettings = getMessageStoreSettings();
- if (messageStoreSettings == null)
- {
- messageStoreSettings = Collections.emptyMap();
- }
- messageStore.openMessageStore(this, messageStoreSettings);
+ messageStore.openMessageStore(this);
if (!(_virtualHostNode.getConfigurationStore() instanceof MessageStoreProvider))
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ProvidedStoreVirtualHost.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ProvidedStoreVirtualHost.java
index 347ef820d3..8f6fbea80f 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ProvidedStoreVirtualHost.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ProvidedStoreVirtualHost.java
@@ -1,5 +1,4 @@
/*
- *
* 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
@@ -16,55 +15,20 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
-package org.apache.qpid.server.virtualhost;
-import java.util.Map;
+package org.apache.qpid.server.virtualhost;
-import org.apache.qpid.server.configuration.IllegalConfigurationException;
-import org.apache.qpid.server.model.ManagedObject;
-import org.apache.qpid.server.model.ManagedObjectFactoryConstructor;
-import org.apache.qpid.server.model.VirtualHostNode;
-import org.apache.qpid.server.store.DurableConfigurationStore;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.store.MessageStoreProvider;
+import org.apache.qpid.server.exchange.ExchangeImpl;
+import org.apache.qpid.server.model.ManagedAttribute;
+import org.apache.qpid.server.queue.AMQQueue;
-@ManagedObject(category = false, type = ProvidedStoreVirtualHost.VIRTUAL_HOST_TYPE)
-public class ProvidedStoreVirtualHost extends AbstractVirtualHost<ProvidedStoreVirtualHost>
+public interface ProvidedStoreVirtualHost<X extends ProvidedStoreVirtualHost<X>> extends VirtualHostImpl<X,AMQQueue<?>,ExchangeImpl<?>>, org.apache.qpid.server.store.SizeMonitorSettings
{
- public static final String VIRTUAL_HOST_TYPE = "ProvidedStore";
+ @ManagedAttribute(mandatory = true, defaultValue = "0")
+ Long getStoreUnderfullSize();
- @ManagedObjectFactoryConstructor
- public ProvidedStoreVirtualHost(final Map<String, Object> attributes,
- final VirtualHostNode<?> virtualHostNode)
- {
- super(attributes, virtualHostNode);
- }
+ @ManagedAttribute(mandatory = true, defaultValue = "0")
+ Long getStoreOverfullSize();
- @Override
- public void onValidate()
- {
- super.onValidate();
-
- VirtualHostNode<?> virtualHostNode = getParent(VirtualHostNode.class);
- DurableConfigurationStore configurationStore = virtualHostNode.getConfigurationStore();
- if (!(configurationStore instanceof MessageStoreProvider))
- {
- throw new IllegalConfigurationException(VIRTUAL_HOST_TYPE +
- " virtual host can only be used where the node's store ("
- + configurationStore.getClass().getName()
- + ") is a message store provider. ");
- }
- }
-
- @Override
- protected MessageStore createMessageStore()
- {
- VirtualHostNode<?> virtualHostNode = getParent(VirtualHostNode.class);
- MessageStoreProvider messageStoreProvider = (MessageStoreProvider) virtualHostNode.getConfigurationStore();
- return messageStoreProvider.getMessageStore();
- }
}
-
-
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ProvidedStoreVirtualHostImpl.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ProvidedStoreVirtualHostImpl.java
new file mode 100644
index 0000000000..8586f32828
--- /dev/null
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ProvidedStoreVirtualHostImpl.java
@@ -0,0 +1,91 @@
+/*
+ *
+ * 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.virtualhost;
+
+import java.util.Map;
+
+import org.apache.qpid.server.configuration.IllegalConfigurationException;
+import org.apache.qpid.server.model.ManagedAttributeField;
+import org.apache.qpid.server.model.ManagedObject;
+import org.apache.qpid.server.model.ManagedObjectFactoryConstructor;
+import org.apache.qpid.server.model.VirtualHostNode;
+import org.apache.qpid.server.store.DurableConfigurationStore;
+import org.apache.qpid.server.store.MessageStore;
+import org.apache.qpid.server.store.MessageStoreProvider;
+
+@ManagedObject(category = false, type = ProvidedStoreVirtualHostImpl.VIRTUAL_HOST_TYPE)
+public class ProvidedStoreVirtualHostImpl extends AbstractVirtualHost<ProvidedStoreVirtualHostImpl> implements ProvidedStoreVirtualHost<ProvidedStoreVirtualHostImpl>
+{
+ public static final String VIRTUAL_HOST_TYPE = "ProvidedStore";
+ public static final String STORE_PATH = "storePath";
+
+ @ManagedAttributeField
+ private Long _storeUnderfullSize;
+
+ @ManagedAttributeField
+ private Long _storeOverfullSize;
+
+ @ManagedObjectFactoryConstructor
+ public ProvidedStoreVirtualHostImpl(final Map<String, Object> attributes,
+ final VirtualHostNode<?> virtualHostNode)
+ {
+ super(attributes, virtualHostNode);
+ }
+
+ @Override
+ public void onValidate()
+ {
+ super.onValidate();
+
+ VirtualHostNode<?> virtualHostNode = getParent(VirtualHostNode.class);
+ DurableConfigurationStore configurationStore = virtualHostNode.getConfigurationStore();
+ if (!(configurationStore instanceof MessageStoreProvider))
+ {
+ throw new IllegalConfigurationException(VIRTUAL_HOST_TYPE +
+ " virtual host can only be used where the node's store ("
+ + configurationStore.getClass().getName()
+ + ") is a message store provider. ");
+ }
+ }
+
+ @Override
+ protected MessageStore createMessageStore()
+ {
+ VirtualHostNode<?> virtualHostNode = getParent(VirtualHostNode.class);
+ MessageStoreProvider messageStoreProvider = (MessageStoreProvider) virtualHostNode.getConfigurationStore();
+ return messageStoreProvider.getMessageStore();
+ }
+
+ @Override
+ public Long getStoreUnderfullSize()
+ {
+ return _storeUnderfullSize;
+ }
+
+ @Override
+ public Long getStoreOverfullSize()
+ {
+ return _storeOverfullSize;
+ }
+
+}
+
+
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNode.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNode.java
index 6705185637..2a286379f4 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNode.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNode.java
@@ -73,19 +73,12 @@ public abstract class AbstractStandardVirtualHostNode<X extends AbstractStandard
LOGGER.debug("Activating virtualhost node " + this);
}
- Map<String, Object> attributes = buildAttributesForStore();
-
- getConfigurationStore().openConfigurationStore(this, attributes);
+ getConfigurationStore().openConfigurationStore(this);
getConfigurationStore().upgradeStoreStructure();
getEventLogger().message(getConfigurationStoreLogSubject(), ConfigStoreMessages.CREATED());
- if (this instanceof FileBasedVirtualHostNode)
- {
- @SuppressWarnings("rawtypes")
- FileBasedVirtualHostNode fileBasedVirtualHostNode = (FileBasedVirtualHostNode) this;
- getEventLogger().message(getConfigurationStoreLogSubject(), ConfigStoreMessages.STORE_LOCATION(fileBasedVirtualHostNode.getStorePath()));
- }
+ writeLocationEventLog();
getEventLogger().message(getConfigurationStoreLogSubject(), ConfigStoreMessages.RECOVERY_START());
@@ -151,6 +144,8 @@ public abstract class AbstractStandardVirtualHostNode<X extends AbstractStandard
}
}
+ protected abstract void writeLocationEventLog();
+
@Override
public String toString()
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java
index d0a065438e..44bc923f0e 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java
@@ -20,19 +20,7 @@
*/
package org.apache.qpid.server.virtualhostnode;
-import java.security.AccessControlException;
-import java.security.PrivilegedAction;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.security.auth.Subject;
-
import org.apache.log4j.Logger;
-
import org.apache.qpid.server.logging.EventLogger;
import org.apache.qpid.server.logging.messages.ConfigStoreMessages;
import org.apache.qpid.server.logging.subjects.MessageStoreLogSubject;
@@ -40,17 +28,20 @@ import org.apache.qpid.server.model.AbstractConfiguredObject;
import org.apache.qpid.server.model.Broker;
import org.apache.qpid.server.model.ConfiguredObject;
import org.apache.qpid.server.model.LifetimePolicy;
-import org.apache.qpid.server.model.ManagedAttributeField;
import org.apache.qpid.server.model.State;
import org.apache.qpid.server.model.StateTransition;
import org.apache.qpid.server.model.SystemContext;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.model.VirtualHostNode;
-import org.apache.qpid.server.security.SecurityManager;
import org.apache.qpid.server.security.access.Operation;
import org.apache.qpid.server.store.DurableConfigurationStore;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.store.MessageStoreProvider;
+
+import java.security.AccessControlException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
public abstract class AbstractVirtualHostNode<X extends AbstractVirtualHostNode<X>> extends AbstractConfiguredObject<X> implements VirtualHostNode<X>
{
@@ -163,26 +154,6 @@ public abstract class AbstractVirtualHostNode<X extends AbstractVirtualHostNode<
return _configurationStoreLogSubject;
}
- protected Map<String, Object> buildAttributesForStore()
- {
- final Map<String, Object> attributes = new HashMap<String, Object>();
- Subject.doAs(SecurityManager.getSubjectWithAddedSystemRights(), new PrivilegedAction<Object>()
- {
- @Override
- public Object run()
- {
- for (String attributeName : getAttributeNames())
- {
- Object value = getAttribute(attributeName);
- attributes.put(attributeName, value);
- }
- return null;
- }
- });
-
- return attributes;
- }
-
@StateTransition( currentState = { State.ACTIVE, State.STOPPED, State.ERRORED}, desiredState = State.DELETED )
protected void doDelete()
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/FileBasedVirtualHostNode.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/JsonVirtualHostNode.java
index 6274ee6c21..34a18c884f 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/FileBasedVirtualHostNode.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/JsonVirtualHostNode.java
@@ -1,5 +1,4 @@
/*
- *
* 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
@@ -16,18 +15,17 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
+
package org.apache.qpid.server.virtualhostnode;
import org.apache.qpid.server.model.ManagedAttribute;
-import org.apache.qpid.server.model.VirtualHostNode;
-public interface FileBasedVirtualHostNode<X extends FileBasedVirtualHostNode<X>> extends VirtualHostNode<X>
+public interface JsonVirtualHostNode<X extends JsonVirtualHostNode<X>> extends org.apache.qpid.server.model.VirtualHostNode<X>, org.apache.qpid.server.store.FileBasedSettings
{
- public static final String STORE_PATH = "storePath";
- @ManagedAttribute(mandatory = true)
- public String getStorePath();
+ String STORE_PATH = "storePath";
+ @ManagedAttribute(mandatory = true)
+ String getStorePath();
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/JsonVirtualHostNodeImpl.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/JsonVirtualHostNodeImpl.java
index 6d26decd72..004ad652f4 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/JsonVirtualHostNodeImpl.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/JsonVirtualHostNodeImpl.java
@@ -22,6 +22,7 @@ package org.apache.qpid.server.virtualhostnode;
import java.util.Map;
+import org.apache.qpid.server.logging.messages.ConfigStoreMessages;
import org.apache.qpid.server.model.Broker;
import org.apache.qpid.server.model.ManagedAttributeField;
import org.apache.qpid.server.model.ManagedObject;
@@ -30,7 +31,7 @@ import org.apache.qpid.server.store.DurableConfigurationStore;
import org.apache.qpid.server.store.JsonFileConfigStore;
@ManagedObject(type=JsonVirtualHostNodeImpl.VIRTUAL_HOST_NODE_TYPE, category=false)
-public class JsonVirtualHostNodeImpl extends AbstractStandardVirtualHostNode<JsonVirtualHostNodeImpl> implements FileBasedVirtualHostNode<JsonVirtualHostNodeImpl>
+public class JsonVirtualHostNodeImpl extends AbstractStandardVirtualHostNode<JsonVirtualHostNodeImpl> implements JsonVirtualHostNode<JsonVirtualHostNodeImpl>
{
public static final String VIRTUAL_HOST_NODE_TYPE = "JSON";
@@ -44,6 +45,12 @@ public class JsonVirtualHostNodeImpl extends AbstractStandardVirtualHostNode<Jso
}
@Override
+ protected void writeLocationEventLog()
+ {
+ getEventLogger().message(getConfigurationStoreLogSubject(), ConfigStoreMessages.STORE_LOCATION(getStorePath()));
+ }
+
+ @Override
protected DurableConfigurationStore createConfigurationStore()
{
return new JsonFileConfigStore();
diff --git a/qpid/java/broker-core/src/main/resources/initial-config.json b/qpid/java/broker-core/src/main/resources/initial-config.json
index d220fefa50..a7c00da02e 100644
--- a/qpid/java/broker-core/src/main/resources/initial-config.json
+++ b/qpid/java/broker-core/src/main/resources/initial-config.json
@@ -57,7 +57,7 @@
"type" : "JSON",
"storePath" : "${qpid.work_dir}/default/config",
"context" : {
- "virtualhostBlueprint" : "{ \"type\" : \"DERBY\", \"messageStoreSettings\" : { \"storePath\" : \"${qpid.work_dir}/default/messages\" }}"
+ "virtualhostBlueprint" : "{ \"type\" : \"DERBY\", \"storePath\" : \"${qpid.work_dir}/default/messages\" }"
}
} ],
"plugins" : [ {
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 45290d506d..c648011116 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
@@ -111,7 +111,7 @@ public class ManagementModeStoreHandlerTest extends QpidTestCase
_options = new BrokerOptions();
_handler = new ManagementModeStoreHandler(_store, _options);
- _handler.openConfigurationStore(_systemContext,Collections.<String,Object>emptyMap());
+ _handler.openConfigurationStore(_systemContext);
}
@Override
@@ -153,7 +153,7 @@ public class ManagementModeStoreHandlerTest extends QpidTestCase
{
_options.setManagementModeHttpPortOverride(9090);
_handler = new ManagementModeStoreHandler(_store, _options);
- _handler.openConfigurationStore(_systemContext,Collections.<String,Object>emptyMap());
+ _handler.openConfigurationStore(_systemContext);
ConfiguredObjectRecord root = getRootEntry();
assertEquals("Unexpected root id", _rootId, root.getId());
Collection<UUID> childrenIds = getChildrenIds(root);
@@ -165,7 +165,7 @@ public class ManagementModeStoreHandlerTest extends QpidTestCase
{
_options.setManagementModeRmiPortOverride(9090);
_handler = new ManagementModeStoreHandler(_store, _options);
- _handler.openConfigurationStore(_systemContext,Collections.<String,Object>emptyMap());
+ _handler.openConfigurationStore(_systemContext);
ConfiguredObjectRecord root = getRootEntry();
assertEquals("Unexpected root id", _rootId, root.getId());
@@ -178,7 +178,7 @@ public class ManagementModeStoreHandlerTest extends QpidTestCase
{
_options.setManagementModeJmxPortOverride(9090);
_handler = new ManagementModeStoreHandler(_store, _options);
- _handler.openConfigurationStore(_systemContext,Collections.<String,Object>emptyMap());
+ _handler.openConfigurationStore(_systemContext);
ConfiguredObjectRecord root = getRootEntry();
assertEquals("Unexpected root id", _rootId, root.getId());
@@ -193,7 +193,7 @@ public class ManagementModeStoreHandlerTest extends QpidTestCase
_options.setManagementModeRmiPortOverride(2000);
_options.setManagementModeJmxPortOverride(3000);
_handler = new ManagementModeStoreHandler(_store, _options);
- _handler.openConfigurationStore(_systemContext,Collections.<String,Object>emptyMap());
+ _handler.openConfigurationStore(_systemContext);
ConfiguredObjectRecord root = getRootEntry();
assertEquals("Unexpected root id", _rootId, root.getId());
@@ -221,7 +221,7 @@ public class ManagementModeStoreHandlerTest extends QpidTestCase
{
_options.setManagementModeJmxPortOverride(9090);
_handler = new ManagementModeStoreHandler(_store, _options);
- _handler.openConfigurationStore(_systemContext,Collections.<String,Object>emptyMap());
+ _handler.openConfigurationStore(_systemContext);
UUID optionsPort = getOptionsPortId();
@@ -233,7 +233,7 @@ public class ManagementModeStoreHandlerTest extends QpidTestCase
{
_options.setManagementModeHttpPortOverride(9090);
_handler = new ManagementModeStoreHandler(_store, _options);
- _handler.openConfigurationStore(_systemContext,Collections.<String,Object>emptyMap());
+ _handler.openConfigurationStore(_systemContext);
UUID optionsPort = getOptionsPortId();
@@ -248,7 +248,7 @@ public class ManagementModeStoreHandlerTest extends QpidTestCase
when(_portEntry.getAttributes()).thenReturn(attributes);
_options.setManagementModeHttpPortOverride(9090);
_handler = new ManagementModeStoreHandler(_store, _options);
- _handler.openConfigurationStore(_systemContext,Collections.<String,Object>emptyMap());
+ _handler.openConfigurationStore(_systemContext);
ConfiguredObjectRecord portEntry = getEntry(_portEntryId);
@@ -262,7 +262,7 @@ public class ManagementModeStoreHandlerTest extends QpidTestCase
when(_portEntry.getAttributes()).thenReturn(attributes);
_options.setManagementModeRmiPortOverride(9090);
_handler = new ManagementModeStoreHandler(_store, _options);
- _handler.openConfigurationStore(_systemContext,Collections.<String,Object>emptyMap());
+ _handler.openConfigurationStore(_systemContext);
ConfiguredObjectRecord portEntry = getEntry(_portEntryId);
@@ -276,7 +276,7 @@ public class ManagementModeStoreHandlerTest extends QpidTestCase
when(_portEntry.getAttributes()).thenReturn(attributes);
_options.setManagementModeRmiPortOverride(9090);
_handler = new ManagementModeStoreHandler(_store, _options);
- _handler.openConfigurationStore(_systemContext,Collections.<String,Object>emptyMap());
+ _handler.openConfigurationStore(_systemContext);
ConfiguredObjectRecord portEntry = getEntry(_portEntryId);
@@ -327,7 +327,7 @@ public class ManagementModeStoreHandlerTest extends QpidTestCase
}
_handler = new ManagementModeStoreHandler(_store, _options);
- _handler.openConfigurationStore(_systemContext,Collections.<String,Object>emptyMap());
+ _handler.openConfigurationStore(_systemContext);
ConfiguredObjectRecord hostEntry = getEntry(virtualHostId);
Map<String, Object> hostAttributes = new HashMap<String, Object>(hostEntry.getAttributes());
@@ -353,7 +353,7 @@ public class ManagementModeStoreHandlerTest extends QpidTestCase
_options.setManagementModeRmiPortOverride(2000);
_options.setManagementModeJmxPortOverride(3000);
_handler = new ManagementModeStoreHandler(_store, _options);
- _handler.openConfigurationStore(_systemContext,Collections.<String,Object>emptyMap());
+ _handler.openConfigurationStore(_systemContext);
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put(Port.NAME, "TEST");
@@ -370,7 +370,7 @@ public class ManagementModeStoreHandlerTest extends QpidTestCase
_options.setManagementModeRmiPortOverride(2000);
_options.setManagementModeJmxPortOverride(3000);
_handler = new ManagementModeStoreHandler(_store, _options);
- _handler.openConfigurationStore(_systemContext,Collections.<String,Object>emptyMap());
+ _handler.openConfigurationStore(_systemContext);
ConfiguredObjectRecord root = getRootEntry();
Map<String, Object> attributes = new HashMap<String, Object>();
@@ -385,7 +385,7 @@ public class ManagementModeStoreHandlerTest extends QpidTestCase
{
_options.setManagementModeHttpPortOverride(1000);
_handler = new ManagementModeStoreHandler(_store, _options);
- _handler.openConfigurationStore(_systemContext,Collections.<String,Object>emptyMap());
+ _handler.openConfigurationStore(_systemContext);
UUID portId = getOptionsPortId();
Map<String, Object> attributes = new HashMap<String, Object>();
@@ -409,7 +409,7 @@ public class ManagementModeStoreHandlerTest extends QpidTestCase
{
_options.setManagementModeHttpPortOverride(1000);
_handler = new ManagementModeStoreHandler(_store, _options);
- _handler.openConfigurationStore(_systemContext,Collections.<String,Object>emptyMap());
+ _handler.openConfigurationStore(_systemContext);
ConfiguredObjectRecord record = new ConfiguredObjectRecord()
{
@@ -445,7 +445,7 @@ public class ManagementModeStoreHandlerTest extends QpidTestCase
{
_options.setManagementModeHttpPortOverride(1000);
_handler = new ManagementModeStoreHandler(_store, _options);
- _handler.openConfigurationStore(_systemContext,Collections.<String,Object>emptyMap());
+ _handler.openConfigurationStore(_systemContext);
UUID portId = getOptionsPortId();
ConfiguredObjectRecord record = mock(ConfiguredObjectRecord.class);
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 96ee8195a2..6b6de5b66a 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
@@ -34,6 +34,8 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
+import org.apache.qpid.server.model.ConfiguredObjectFactory;
+import org.apache.qpid.server.model.VirtualHostNode;
import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatcher;
import org.mockito.invocation.InvocationOnMock;
@@ -83,7 +85,6 @@ public abstract class AbstractDurableConfigurationStoreTestCase extends QpidTest
private UUID _queueId;
private UUID _exchangeId;
private DurableConfigurationStore _configStore;
- protected Map<String, Object> _configurationStoreSettings;
private ConfiguredObjectFactoryImpl _factory;
private ConfiguredObject<?> _parent;
@@ -94,13 +95,11 @@ public abstract class AbstractDurableConfigurationStoreTestCase extends QpidTest
{
super.setUp();
- _configurationStoreSettings = new HashMap<String, Object>();
_queueId = UUIDGenerator.generateRandomUUID();
_exchangeId = UUIDGenerator.generateRandomUUID();
_factory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance());
_storeName = getName();
_storePath = TMP_FOLDER + File.separator + _storeName;
- _configurationStoreSettings.put(MessageStore.STORE_PATH, _storePath);
FileUtils.delete(new File(_storePath), true);
setTestSystemProperty("QPID_WORK", TMP_FOLDER);
@@ -112,18 +111,16 @@ public abstract class AbstractDurableConfigurationStoreTestCase extends QpidTest
String argValue = "some selector expression";
_bindingArgs.put(argKey, argValue);
-
- _parent = mock(ConfiguredObject.class);
- when(_parent.getName()).thenReturn("testName");
- when(_parent.getObjectFactory()).thenReturn(_factory);
- when(_parent.getModel()).thenReturn(_factory.getModel());
+ _parent = createVirtualHostNode(_storePath, _factory);
_configStore = createConfigStore();
- _configStore.openConfigurationStore(_parent, _configurationStoreSettings);
+ _configStore.openConfigurationStore(_parent);
_rootRecord = new ConfiguredObjectRecordImpl(UUID.randomUUID(), VirtualHost.class.getSimpleName(), Collections.<String, Object>emptyMap());
_configStore.create(_rootRecord);
}
+ protected abstract VirtualHostNode createVirtualHostNode(String storeLocation, ConfiguredObjectFactory factory);
+
public void tearDown() throws Exception
{
try
@@ -529,7 +526,7 @@ public abstract class AbstractDurableConfigurationStoreTestCase extends QpidTest
{
closeConfigStore();
_configStore = createConfigStore();
- _configStore.openConfigurationStore(_parent, _configurationStoreSettings);
+ _configStore.openConfigurationStore(_parent);
}
protected abstract DurableConfigurationStore createConfigStore() throws Exception;
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/BrokerStoreUpgraderAndRecovererTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/BrokerStoreUpgraderAndRecovererTest.java
index 2c9583490a..7eb5e3b63c 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/BrokerStoreUpgraderAndRecovererTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/BrokerStoreUpgraderAndRecovererTest.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.store;
-import static org.mockito.Matchers.contains;
import static org.mockito.Mockito.mock;
import java.util.Collections;
@@ -273,7 +272,7 @@ public class BrokerStoreUpgraderAndRecovererTest extends QpidTestCase
}
@Override
- public void openConfigurationStore(ConfiguredObject<?> parent, Map<String, Object> storeSettings) throws StoreException
+ public void openConfigurationStore(ConfiguredObject<?> parent) throws StoreException
{
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreConfigurationTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreConfigurationTest.java
index 2400a68c93..62cbe409a9 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreConfigurationTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreConfigurationTest.java
@@ -20,9 +20,28 @@
*/
package org.apache.qpid.server.store;
+import org.apache.qpid.server.model.ConfiguredObjectFactory;
+import org.apache.qpid.server.model.VirtualHostNode;
+import org.apache.qpid.server.virtualhostnode.JsonVirtualHostNode;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
public class JsonFileConfigStoreConfigurationTest extends AbstractDurableConfigurationStoreTestCase
{
@Override
+ protected VirtualHostNode createVirtualHostNode(String storeLocation, ConfiguredObjectFactory factory)
+ {
+ final JsonVirtualHostNode parent = mock(JsonVirtualHostNode.class);
+ when(parent.getStorePath()).thenReturn(storeLocation);
+ when(parent.getName()).thenReturn("testName");
+ when(parent.getObjectFactory()).thenReturn(factory);
+ when(parent.getModel()).thenReturn(factory.getModel());
+
+ return parent;
+ }
+
+ @Override
protected DurableConfigurationStore createConfigStore() throws Exception
{
return new JsonFileConfigStore();
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreTest.java
index 6012b1802d..e9f3ba3d21 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreTest.java
@@ -35,12 +35,12 @@ import java.util.Map;
import java.util.UUID;
import org.apache.qpid.server.model.BrokerModel;
-import org.apache.qpid.server.model.ConfiguredObject;
import org.apache.qpid.server.model.ConfiguredObjectFactory;
import org.apache.qpid.server.model.ConfiguredObjectFactoryImpl;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.store.handler.ConfiguredObjectRecordHandler;
import org.apache.qpid.server.util.ServerScopedRuntimeException;
+import org.apache.qpid.server.virtualhostnode.JsonVirtualHostNode;
import org.apache.qpid.test.utils.QpidTestCase;
import org.apache.qpid.test.utils.TestFileUtils;
import org.apache.qpid.util.FileUtils;
@@ -50,8 +50,7 @@ import org.mockito.InOrder;
public class JsonFileConfigStoreTest extends QpidTestCase
{
private JsonFileConfigStore _store;
- private HashMap<String, Object> _configurationStoreSettings;
- private ConfiguredObject<?> _parent;
+ private JsonVirtualHostNode<?> _parent;
private File _storeLocation;
private ConfiguredObjectRecordHandler _handler;
@@ -68,14 +67,13 @@ public class JsonFileConfigStoreTest extends QpidTestCase
ConfiguredObjectFactory factory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance());
- _parent = mock(ConfiguredObject.class);
+ _parent = mock(JsonVirtualHostNode.class);
when(_parent.getName()).thenReturn(getName());
when(_parent.getObjectFactory()).thenReturn(factory);
when(_parent.getModel()).thenReturn(factory.getModel());
_storeLocation = TestFileUtils.createTestDirectory("json", true);
- _configurationStoreSettings = new HashMap<String, Object>();
- _configurationStoreSettings.put(JsonFileConfigStore.STORE_TYPE, JsonFileConfigStore.TYPE);
- _configurationStoreSettings.put(JsonFileConfigStore.STORE_PATH, _storeLocation.getAbsolutePath());
+ when(_parent.getStorePath()).thenReturn(_storeLocation.getAbsolutePath());
+
_store = new JsonFileConfigStore();
_handler = mock(ConfiguredObjectRecordHandler.class);
@@ -97,10 +95,11 @@ public class JsonFileConfigStoreTest extends QpidTestCase
public void testNoStorePath() throws Exception
{
- _configurationStoreSettings.put(JsonFileConfigStore.STORE_PATH, null);
+ when(_parent.getStorePath()).thenReturn(null);
+
try
{
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
fail("Store should not successfully configure if there is no path set");
}
catch (ServerScopedRuntimeException e)
@@ -112,10 +111,10 @@ public class JsonFileConfigStoreTest extends QpidTestCase
public void testInvalidStorePath() throws Exception
{
- _configurationStoreSettings.put(JsonFileConfigStore.STORE_PATH, System.getProperty("file.separator"));
+ when(_parent.getStorePath()).thenReturn(System.getProperty("file.separator"));
try
{
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
fail("Store should not successfully configure if there is an invalid path set");
}
catch (ServerScopedRuntimeException e)
@@ -126,7 +125,7 @@ public class JsonFileConfigStoreTest extends QpidTestCase
public void testVisitEmptyStore()
{
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
_store.visitConfiguredObjectRecords(_handler);
InOrder inorder = inOrder(_handler);
@@ -139,17 +138,17 @@ public class JsonFileConfigStoreTest extends QpidTestCase
public void testInsertAndUpdateTopLevelObject() throws Exception
{
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
createRootRecord();
_store.closeConfigurationStore();
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
Map<String, Object> newAttributes = new HashMap<String, Object>(_rootRecord.getAttributes());
newAttributes.put("attributeName", "attributeValue");
_store.update(false, new ConfiguredObjectRecordImpl(_rootRecord.getId(), _rootRecord.getType(), newAttributes));
_store.closeConfigurationStore();
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
_store.visitConfiguredObjectRecords(_handler);
@@ -160,7 +159,7 @@ public class JsonFileConfigStoreTest extends QpidTestCase
public void testCreateObject() throws Exception
{
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
createRootRecord();
final UUID queueId = new UUID(0, 1);
@@ -170,7 +169,7 @@ public class JsonFileConfigStoreTest extends QpidTestCase
_store.create(new ConfiguredObjectRecordImpl(queueId, queueType, queueAttr, getRootAsParentMap()));
_store.closeConfigurationStore();
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
_store.visitConfiguredObjectRecords(_handler);
verify(_handler).handle(matchesRecord(queueId, queueType, queueAttr));
@@ -180,7 +179,7 @@ public class JsonFileConfigStoreTest extends QpidTestCase
public void testCreateAndUpdateObject() throws Exception
{
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
createRootRecord();
final UUID queueId = new UUID(0, 1);
@@ -195,7 +194,7 @@ public class JsonFileConfigStoreTest extends QpidTestCase
_store.closeConfigurationStore();
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
_store.visitConfiguredObjectRecords(_handler);
verify(_handler, times(1)).handle(matchesRecord(queueId, queueType, queueAttr));
_store.closeConfigurationStore();
@@ -204,7 +203,7 @@ public class JsonFileConfigStoreTest extends QpidTestCase
public void testCreateAndRemoveObject() throws Exception
{
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
createRootRecord();
final UUID queueId = new UUID(0, 1);
@@ -219,7 +218,7 @@ public class JsonFileConfigStoreTest extends QpidTestCase
_store.closeConfigurationStore();
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
_store.visitConfiguredObjectRecords(_handler);
verify(_handler, times(1)).handle(matchesRecord(ANY_UUID, VIRTUAL_HOST_TYPE, ANY_MAP));
_store.closeConfigurationStore();
@@ -227,7 +226,7 @@ public class JsonFileConfigStoreTest extends QpidTestCase
public void testCreateUnknownObjectType() throws Exception
{
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
createRootRecord();
try
@@ -243,7 +242,7 @@ public class JsonFileConfigStoreTest extends QpidTestCase
public void testTwoObjectsWithSameId() throws Exception
{
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
createRootRecord();
final UUID id = UUID.randomUUID();
@@ -262,13 +261,13 @@ public class JsonFileConfigStoreTest extends QpidTestCase
public void testChangeTypeOfObject() throws Exception
{
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
createRootRecord();
final UUID id = UUID.randomUUID();
_store.create(new ConfiguredObjectRecordImpl(id, "Queue", Collections.<String, Object>emptyMap(), getRootAsParentMap()));
_store.closeConfigurationStore();
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
try
{
@@ -283,13 +282,13 @@ public class JsonFileConfigStoreTest extends QpidTestCase
public void testLockFileGuaranteesExclusiveAccess() throws Exception
{
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
JsonFileConfigStore secondStore = new JsonFileConfigStore();
try
{
- secondStore.openConfigurationStore(_parent, _configurationStoreSettings);
+ secondStore.openConfigurationStore(_parent);
fail("Should not be able to open a second store with the same path");
}
catch(ServerScopedRuntimeException e)
@@ -297,7 +296,7 @@ public class JsonFileConfigStoreTest extends QpidTestCase
// pass
}
_store.closeConfigurationStore();
- secondStore.openConfigurationStore(_parent, _configurationStoreSettings);
+ secondStore.openConfigurationStore(_parent);
}
public void testStoreFileLifecycle()
@@ -308,7 +307,7 @@ public class JsonFileConfigStoreTest extends QpidTestCase
assertFalse("JSON store should not exist", expectedJsonFile.exists());
assertFalse("JSON backup should not exist", expectedJsonFileBak.exists());
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
assertTrue("JSON store should exist after open", expectedJsonFile.exists());
assertFalse("JSON backup should not exist after open", expectedJsonFileBak.exists());
@@ -322,7 +321,7 @@ public class JsonFileConfigStoreTest extends QpidTestCase
public void testCreatedNestedObjects() throws Exception
{
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
createRootRecord();
final UUID queueId = new UUID(0, 1);
@@ -355,7 +354,7 @@ public class JsonFileConfigStoreTest extends QpidTestCase
new ConfiguredObjectRecordImpl(binding2Id, "Binding", EMPTY_ATTR, binding2Parents);
_store.update(true, bindingRecord, binding2Record);
_store.closeConfigurationStore();
- _store.openConfigurationStore(_parent, _configurationStoreSettings);
+ _store.openConfigurationStore(_parent);
_store.visitConfiguredObjectRecords(_handler);
verify(_handler).handle(matchesRecord(queueId, "Queue", EMPTY_ATTR));
verify(_handler).handle(matchesRecord(queue2Id, "Queue", EMPTY_ATTR));
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/MemoryMessageStoreTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/MemoryMessageStoreTest.java
index 8fd3cbb1fe..f05da247ea 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/MemoryMessageStoreTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/MemoryMessageStoreTest.java
@@ -20,16 +20,19 @@
*/
package org.apache.qpid.server.store;
-import java.util.Collections;
-import java.util.Map;
+import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.virtualhost.TestMemoryVirtualHost;
+
+import static org.mockito.Mockito.mock;
public class MemoryMessageStoreTest extends MessageStoreTestCase
{
@Override
- protected Map<String, Object> getStoreSettings() throws Exception
+ protected VirtualHost createVirtualHost()
{
- return Collections.<String, Object>emptyMap();
+ final TestMemoryVirtualHost parent = mock(TestMemoryVirtualHost.class);
+ return parent;
}
@Override
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/MessageStoreQuotaEventsTestBase.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/MessageStoreQuotaEventsTestBase.java
index baab5dd6d3..51b33276ec 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/MessageStoreQuotaEventsTestBase.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/MessageStoreQuotaEventsTestBase.java
@@ -21,7 +21,6 @@
package org.apache.qpid.server.store;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
import java.io.File;
import java.nio.ByteBuffer;
@@ -33,6 +32,7 @@ import java.util.UUID;
import org.apache.log4j.Logger;
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.model.ConfiguredObject;
+import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.test.utils.QpidTestCase;
import org.apache.qpid.util.FileUtils;
@@ -49,8 +49,6 @@ public abstract class MessageStoreQuotaEventsTestBase extends QpidTestCase imple
private UUID _transactionResource;
protected abstract MessageStore createStore() throws Exception;
- protected abstract Map<String, Object> createStoreSettings(String storeLocation);
- protected abstract Map<String, String> createContextSettings();
protected abstract int getNumberOfMessagesToFillStore();
@Override
@@ -61,22 +59,18 @@ public abstract class MessageStoreQuotaEventsTestBase extends QpidTestCase imple
_storeLocation = new File(new File(TMP_FOLDER), getTestName());
FileUtils.delete(_storeLocation, true);
-
- Map<String, Object> storeSettings = createStoreSettings(_storeLocation.getAbsolutePath());
-
_store = createStore();
- ConfiguredObject<?> parent = mock(ConfiguredObject.class);
- when(parent.getName()).thenReturn("test");
- when(parent.getContext()).thenReturn(createContextSettings());
+ ConfiguredObject<?> parent = createVirtualHost(_storeLocation.getAbsolutePath());
- _store.openMessageStore(parent, storeSettings);
+ _store.openMessageStore(parent);
_transactionResource = UUID.randomUUID();
_events = new ArrayList<Event>();
_store.addEventListener(this, Event.PERSISTENT_MESSAGE_SIZE_OVERFULL, Event.PERSISTENT_MESSAGE_SIZE_UNDERFULL);
}
+ protected abstract VirtualHost createVirtualHost(String storeLocation);
@Override
public void tearDown() throws Exception
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/MessageStoreTestCase.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/MessageStoreTestCase.java
index c0968794f5..d4b990da07 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/MessageStoreTestCase.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/MessageStoreTestCase.java
@@ -28,6 +28,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -37,6 +38,7 @@ import java.util.concurrent.atomic.AtomicReference;
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.model.ConfiguredObject;
import org.apache.qpid.server.model.UUIDGenerator;
+import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.store.Transaction.Record;
import org.apache.qpid.server.store.handler.DistributedTransactionHandler;
import org.apache.qpid.server.store.handler.MessageHandler;
@@ -49,25 +51,20 @@ import org.mockito.ArgumentMatcher;
public abstract class MessageStoreTestCase extends QpidTestCase
{
private MessageStore _store;
- private Map<String, Object> _storeSettings;
private ConfiguredObject<?> _parent;
public void setUp() throws Exception
{
super.setUp();
- _parent = mock(ConfiguredObject.class);
- when(_parent.getName()).thenReturn("test");
-
- _storeSettings = getStoreSettings();
+ _parent = createVirtualHost();
_store = createMessageStore();
- _store.openMessageStore(_parent, _storeSettings);
-
+ _store.openMessageStore(_parent);
}
- protected abstract Map<String, Object> getStoreSettings() throws Exception;
+ protected abstract VirtualHost createVirtualHost();
protected abstract MessageStore createMessageStore();
@@ -81,7 +78,7 @@ public abstract class MessageStoreTestCase extends QpidTestCase
_store.closeMessageStore();
_store = createMessageStore();
- _store.openMessageStore(_parent, _storeSettings);
+ _store.openMessageStore(_parent);
}
public void testAddAndRemoveRecordXid() throws Exception
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 321a050747..e151391142 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
@@ -52,8 +52,6 @@ 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.store.DurableConfigurationStore;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.store.TestMemoryMessageStore;
import org.apache.qpid.server.virtualhost.AbstractVirtualHost;
import org.apache.qpid.server.virtualhost.QueueExistsException;
import org.apache.qpid.server.virtualhost.TestMemoryVirtualHost;
@@ -134,11 +132,6 @@ public class BrokerTestHelper
{
Map<String,Object> attributes = new HashMap<String, Object>();
attributes.put(org.apache.qpid.server.model.VirtualHost.TYPE, TestMemoryVirtualHost.VIRTUAL_HOST_TYPE);
-
- Map<String, Object> messageStoreSettings = new HashMap<String, Object>();
- messageStoreSettings.put(MessageStore.STORE_TYPE, TestMemoryMessageStore.TYPE);
-
- attributes.put(org.apache.qpid.server.model.VirtualHost.MESSAGE_STORE_SETTINGS, messageStoreSettings);
attributes.put(org.apache.qpid.server.model.VirtualHost.NAME, name);
return createVirtualHost(attributes);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/TestVirtualHostNode.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/TestVirtualHostNode.java
index 18d394d4f7..277ef8b400 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/TestVirtualHostNode.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/TestVirtualHostNode.java
@@ -52,4 +52,8 @@ public class TestVirtualHostNode extends AbstractStandardVirtualHostNode<TestVir
return _store;
}
+ @Override
+ protected void writeLocationEventLog()
+ {
+ }
}