From 21aceae395ef19dca56dc603ed3f2af744b620a7 Mon Sep 17 00:00:00 2001 From: Keith Wall Date: Sat, 7 Jun 2014 19:00:39 +0000 Subject: QPID-5800: [Java Broker] Remove the now redundant MessageStore/DurableConfigurationStore factories git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1601162 13f79535-47bb-0310-9956-ffa450edef68 --- .../store/berkeleydb/BDBMessageStoreFactory.java | 85 --------------------- .../berkeleydb/BDBVirtualHostNodeImpl.java | 9 +-- .../java/org/apache/qpid/server/model/Broker.java | 5 +- .../qpid/server/model/adapter/BrokerAdapter.java | 11 --- .../plugin/DurableConfigurationStoreFactory.java | 36 --------- .../qpid/server/plugin/MessageStoreFactory.java | 36 --------- .../server/store/JsonFileConfigStoreFactory.java | 55 -------------- .../AbstractStandardVirtualHostNode.java | 22 ------ .../virtualhostnode/JsonVirtualHostNodeImpl.java | 9 +-- .../store/TestMemoryMessageStoreFactory.java | 61 --------------- .../AbstractStandardVirtualHostNodeTest.java | 9 --- .../virtualhostnode/TestVirtualHostNode.java | 31 +------- ....server.plugin.DurableConfigurationStoreFactory | 19 ----- ...g.apache.qpid.server.plugin.MessageStoreFactory | 19 ----- .../store/derby/DerbyMessageStoreFactory.java | 88 ---------------------- .../derby/DerbyVirtualHostNode.java | 8 +- .../server/store/jdbc/JDBCMessageStoreFactory.java | 85 --------------------- .../jdbc/JDBCVirtualHostNodeImpl.java | 9 +-- .../plugin/servlet/rest/HelperServlet.java | 2 +- .../virtualhost/standard/addVirtualHost.js | 2 +- .../server/store/MemoryMessageStoreFactory.java | 60 --------------- .../memory/MemoryVirtualHostNode.java | 9 +-- .../apache/qpid/server/store/SplitStoreTest.java | 7 +- .../qpid/systest/rest/BrokerRestHttpsTest.java | 2 +- .../apache/qpid/systest/rest/BrokerRestTest.java | 8 +- .../java/org/apache/qpid/test/utils/TestUtils.java | 68 ----------------- 26 files changed, 36 insertions(+), 719 deletions(-) delete mode 100644 qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java delete mode 100644 qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/DurableConfigurationStoreFactory.java delete mode 100644 qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/MessageStoreFactory.java delete mode 100644 qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStoreFactory.java delete mode 100644 qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestMemoryMessageStoreFactory.java delete mode 100644 qpid/java/broker-core/src/test/resources/META-INF/services/org.apache.qpid.server.plugin.DurableConfigurationStoreFactory delete mode 100644 qpid/java/broker-core/src/test/resources/META-INF/services/org.apache.qpid.server.plugin.MessageStoreFactory delete mode 100644 qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStoreFactory.java delete mode 100644 qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStoreFactory.java delete mode 100644 qpid/java/broker-plugins/memory-store/src/main/java/org/apache/qpid/server/store/MemoryMessageStoreFactory.java 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 deleted file mode 100644 index 067372a228..0000000000 --- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java +++ /dev/null @@ -1,85 +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.store.berkeleydb; - -import java.util.Map; - -import org.apache.qpid.server.model.VirtualHost; -import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory; -import org.apache.qpid.server.plugin.MessageStoreFactory; -import org.apache.qpid.server.plugin.PluggableService; -import org.apache.qpid.server.store.DurableConfigurationStore; -import org.apache.qpid.server.store.MessageStore; - -@PluggableService -public class BDBMessageStoreFactory implements MessageStoreFactory, DurableConfigurationStoreFactory -{ - - @Override - public String getType() - { - return StandardEnvironmentFacade.TYPE; - } - - @Override - public DurableConfigurationStore createDurableConfigurationStore() - { - return new BDBConfigurationStore(); - } - - @Override - public MessageStore createMessageStore() - { - return (new BDBConfigurationStore()).getMessageStore(); - } - - @Override - public void validateAttributes(Map attributes) - { - @SuppressWarnings("unchecked") - Map messageStoreSettings = (Map) attributes.get(VirtualHost.MESSAGE_STORE_SETTINGS); - if(messageStoreSettings != null && getType().equals(messageStoreSettings.get(MessageStore.STORE_TYPE))) - { - Object storePath = messageStoreSettings.get(MessageStore.STORE_PATH); - if(!(storePath instanceof String)) - { - throw new IllegalArgumentException("Setting '"+ MessageStore.STORE_PATH - +"' is required and must be of type String."); - - } - } - } - - @Override - public void validateConfigurationStoreSettings(Map configurationStoreSettings) - { - if(configurationStoreSettings != null && getType().equals(configurationStoreSettings.get(DurableConfigurationStore.STORE_TYPE))) - { - Object storePath = configurationStoreSettings.get(DurableConfigurationStore.STORE_PATH); - if(!(storePath instanceof String)) - { - throw new IllegalArgumentException("Durable configuration store setting '" + DurableConfigurationStore.STORE_PATH - + "' is required and must be of type String."); - - } - } - } -} diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBVirtualHostNodeImpl.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBVirtualHostNodeImpl.java index 138c0717a2..591623510f 100644 --- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBVirtualHostNodeImpl.java +++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBVirtualHostNodeImpl.java @@ -26,8 +26,8 @@ import org.apache.qpid.server.model.Broker; 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.plugin.DurableConfigurationStoreFactory; -import org.apache.qpid.server.store.berkeleydb.BDBMessageStoreFactory; +import org.apache.qpid.server.store.DurableConfigurationStore; +import org.apache.qpid.server.store.berkeleydb.BDBConfigurationStore; import org.apache.qpid.server.virtualhostnode.AbstractStandardVirtualHostNode; @ManagedObject( category = false, type = "BDB" ) @@ -46,9 +46,9 @@ public class BDBVirtualHostNodeImpl extends AbstractStandardVirtualHostNode> extends ConfiguredObject, EventL String PROCESS_PID = "processPid"; String PRODUCT_VERSION = "productVersion"; String SUPPORTED_VIRTUALHOST_TYPES = "supportedVirtualHostTypes"; - String SUPPORTED_VIRTUALHOST_STORE_TYPES = "supportedVirtualHostStoreTypes"; + String SUPPORTED_VIRTUALHOSTNODE_TYPES = "supportedVirtualHostNodeTypes"; String SUPPORTED_AUTHENTICATION_PROVIDERS = "supportedAuthenticationProviders"; String SUPPORTED_PREFERENCES_PROVIDER_TYPES = "supportedPreferencesProviderTypes"; String DEFAULT_VIRTUAL_HOST = "defaultVirtualHost"; @@ -92,9 +92,6 @@ public interface Broker> extends ConfiguredObject, EventL @DerivedAttribute Collection getSupportedVirtualHostNodeTypes(); - @DerivedAttribute - Collection getSupportedVirtualHostStoreTypes(); - @DerivedAttribute Collection getSupportedAuthenticationProviders(); diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java index e6d7f44e0c..77eda0dc67 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java @@ -47,7 +47,6 @@ import org.apache.qpid.server.logging.messages.BrokerMessages; import org.apache.qpid.server.logging.messages.VirtualHostMessages; import org.apache.qpid.server.model.*; import org.apache.qpid.server.model.port.AbstractPortWithAuthProvider; -import org.apache.qpid.server.plugin.MessageStoreFactory; import org.apache.qpid.server.security.SecurityManager; import org.apache.qpid.server.security.SubjectCreator; import org.apache.qpid.server.security.access.Operation; @@ -71,13 +70,10 @@ public class BrokerAdapter extends AbstractConfiguredObject imple private EventLogger _eventLogger; - //private final VirtualHostRegistry _virtualHostRegistry; private final LogRecorder _logRecorder; private final SecurityManager _securityManager; - private final Collection _supportedVirtualHostStoreTypes; - private AuthenticationProvider _managementModeAuthenticationProvider; private BrokerOptions _brokerOptions; @@ -109,7 +105,6 @@ public class BrokerAdapter extends AbstractConfiguredObject imple _eventLogger = parent.getEventLogger(); _brokerOptions = parent.getBrokerOptions(); _securityManager = new SecurityManager(this, _brokerOptions.isManagementMode()); - _supportedVirtualHostStoreTypes = MessageStoreFactory.FACTORY_LOADER.getSupportedTypes(); if (_brokerOptions.isManagementMode()) { Map authManagerAttrs = new HashMap(); @@ -310,12 +305,6 @@ public class BrokerAdapter extends AbstractConfiguredObject imple return getObjectFactory().getSupportedTypes(VirtualHostNode.class); } - @Override - public Collection getSupportedVirtualHostStoreTypes() - { - return _supportedVirtualHostStoreTypes; - } - @Override public Collection getSupportedVirtualHostTypes() { 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 deleted file mode 100644 index ba398f129d..0000000000 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/DurableConfigurationStoreFactory.java +++ /dev/null @@ -1,36 +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.plugin; - -import java.util.Map; - -import org.apache.qpid.server.store.DurableConfigurationStore; - -public interface DurableConfigurationStoreFactory extends Pluggable -{ - PluggableFactoryLoader FACTORY_LOADER = new PluggableFactoryLoader(DurableConfigurationStoreFactory.class); - - String getType(); - - DurableConfigurationStore createDurableConfigurationStore(); - - void validateConfigurationStoreSettings(Map attributes); -} 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 deleted file mode 100644 index bae6738f23..0000000000 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/MessageStoreFactory.java +++ /dev/null @@ -1,36 +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.plugin; - -import java.util.Map; - -import org.apache.qpid.server.store.MessageStore; - -public interface MessageStoreFactory extends Pluggable -{ - PluggableFactoryLoader FACTORY_LOADER = new PluggableFactoryLoader(MessageStoreFactory.class); - - String getType(); - - MessageStore createMessageStore(); - - void validateAttributes(Map attributes); -} diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStoreFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStoreFactory.java deleted file mode 100644 index ea1f41d7ab..0000000000 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStoreFactory.java +++ /dev/null @@ -1,55 +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.store; - -import java.util.Map; - -import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory; -import org.apache.qpid.server.plugin.PluggableService; - -@PluggableService -public class JsonFileConfigStoreFactory implements DurableConfigurationStoreFactory -{ - @Override - public String getType() - { - return JsonFileConfigStore.TYPE; - } - - @Override - public DurableConfigurationStore createDurableConfigurationStore() - { - return new JsonFileConfigStore(); - } - - @Override - public void validateConfigurationStoreSettings(Map attributes) - { - Object storePath = attributes.get(DurableConfigurationStore.STORE_PATH); - if(!(storePath instanceof String)) - { - throw new IllegalArgumentException("Setting '"+ DurableConfigurationStore.STORE_PATH - +"' is required and must be of type String."); - - } - } - -} 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 7f460aae4f..e37eeb17bf 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 @@ -38,9 +38,7 @@ import org.apache.qpid.server.model.ConfiguredObject; import org.apache.qpid.server.model.RemoteReplicationNode; import org.apache.qpid.server.model.VirtualHost; import org.apache.qpid.server.model.VirtualHostNode; -import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory; import org.apache.qpid.server.security.SecurityManager; -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.store.VirtualHostStoreUpgraderAndRecoverer; @@ -57,16 +55,6 @@ public abstract class AbstractStandardVirtualHostNode storeSettings = new HashMap(getActualAttributes()); - storeSettings.put(DurableConfigurationStore.STORE_TYPE, durableConfigurationStoreFactory.getType()); - durableConfigurationStoreFactory.validateConfigurationStoreSettings(storeSettings); - } - @SuppressWarnings({ "rawtypes", "unchecked" }) @Override protected C addChild(Class childClass, Map attributes, @@ -79,16 +67,6 @@ public abstract class AbstractStandardVirtualHostNode implements FileBasedVirtualHostNode @@ -42,9 +42,9 @@ public class JsonVirtualHostNodeImpl extends AbstractStandardVirtualHostNode attributes) - { - } - - @Override - public DurableConfigurationStore createDurableConfigurationStore() - { - return new AbstractMemoryStore() - { - }; - } - - @Override - public void validateConfigurationStoreSettings(Map attributes) - { - } -} diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNodeTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNodeTest.java index 220e9e94de..e0a56bc39c 100644 --- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNodeTest.java +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNodeTest.java @@ -37,13 +37,10 @@ import org.apache.qpid.server.model.State; 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.plugin.DurableConfigurationStoreFactory; import org.apache.qpid.server.store.ConfiguredObjectRecord; import org.apache.qpid.server.store.DurableConfigurationStore; -import org.apache.qpid.server.store.MessageStore; import org.apache.qpid.server.store.NullMessageStore; import org.apache.qpid.server.store.StoreException; -import org.apache.qpid.server.store.TestMemoryMessageStore; import org.apache.qpid.server.store.handler.ConfiguredObjectRecordHandler; import org.apache.qpid.server.util.BrokerTestHelper; import org.apache.qpid.server.virtualhost.TestMemoryVirtualHost; @@ -54,7 +51,6 @@ public class AbstractStandardVirtualHostNodeTest extends QpidTestCase private static final String TEST_VIRTUAL_HOST_NODE_NAME = "testNode"; private static final String TEST_VIRTUAL_HOST_NAME = "testVirtualHost"; - private DurableConfigurationStoreFactory _configStoreFactory = mock(DurableConfigurationStoreFactory.class); private UUID _nodeId = UUID.randomUUID(); private Broker _broker; private DurableConfigurationStore _configStore; @@ -102,7 +98,6 @@ public class AbstractStandardVirtualHostNodeTest extends QpidTestCase handler.end(); } }; - when(_configStoreFactory.createDurableConfigurationStore()).thenReturn(_configStore); Map nodeAttributes = new HashMap(); nodeAttributes.put(VirtualHostNode.NAME, TEST_VIRTUAL_HOST_NODE_NAME); @@ -131,7 +126,6 @@ public class AbstractStandardVirtualHostNodeTest extends QpidTestCase handler.end(); } }; - when(_configStoreFactory.createDurableConfigurationStore()).thenReturn(_configStore); Map nodeAttributes = new HashMap(); nodeAttributes.put(VirtualHostNode.NAME, TEST_VIRTUAL_HOST_NODE_NAME); @@ -156,9 +150,6 @@ public class AbstractStandardVirtualHostNodeTest extends QpidTestCase virtualHostAttributes.put(VirtualHost.NAME, TEST_VIRTUAL_HOST_NAME); virtualHostAttributes.put(VirtualHost.TYPE, TestMemoryVirtualHost.VIRTUAL_HOST_TYPE); virtualHostAttributes.put(VirtualHost.MODEL_VERSION, BrokerModel.MODEL_VERSION); - Map messageStoreSettings = new HashMap(); - virtualHostAttributes.put(VirtualHost.MESSAGE_STORE_SETTINGS, messageStoreSettings); - messageStoreSettings.put(MessageStore.STORE_TYPE, TestMemoryMessageStore.TYPE); ConfiguredObjectRecord record = mock(ConfiguredObjectRecord.class); when(record.getId()).thenReturn(virtualHostId); 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 eda07bd846..16a9aa5550 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 @@ -25,11 +25,10 @@ import java.util.Map; import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.model.ManagedObject; -import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory; 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.store.TestMemoryMessageStoreFactory; + @ManagedObject(type="TestMemory", category=false) public class TestVirtualHostNode extends AbstractStandardVirtualHostNode { @@ -49,33 +48,9 @@ public class TestVirtualHostNode extends AbstractStandardVirtualHostNode attributes) - { - } - - @Override - public String getType() - { - return null; - } - - @Override - public DurableConfigurationStore createDurableConfigurationStore() - { - return _store; - } - }; - } - - return new TestMemoryMessageStoreFactory(); + return _store; } @Override diff --git a/qpid/java/broker-core/src/test/resources/META-INF/services/org.apache.qpid.server.plugin.DurableConfigurationStoreFactory b/qpid/java/broker-core/src/test/resources/META-INF/services/org.apache.qpid.server.plugin.DurableConfigurationStoreFactory deleted file mode 100644 index 9512fb8117..0000000000 --- a/qpid/java/broker-core/src/test/resources/META-INF/services/org.apache.qpid.server.plugin.DurableConfigurationStoreFactory +++ /dev/null @@ -1,19 +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. -# -org.apache.qpid.server.store.TestMemoryMessageStoreFactory 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 deleted file mode 100644 index 9512fb8117..0000000000 --- a/qpid/java/broker-core/src/test/resources/META-INF/services/org.apache.qpid.server.plugin.MessageStoreFactory +++ /dev/null @@ -1,19 +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. -# -org.apache.qpid.server.store.TestMemoryMessageStoreFactory 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 deleted file mode 100644 index 9bc3780a71..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStoreFactory.java +++ /dev/null @@ -1,88 +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.store.derby; - -import java.util.Map; - -import org.apache.qpid.server.model.VirtualHost; -import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory; -import org.apache.qpid.server.plugin.MessageStoreFactory; -import org.apache.qpid.server.plugin.PluggableService; -import org.apache.qpid.server.store.DurableConfigurationStore; -import org.apache.qpid.server.store.MessageStore; - -@PluggableService -public class DerbyMessageStoreFactory implements MessageStoreFactory, DurableConfigurationStoreFactory -{ - - @Override - public String getType() - { - return DerbyMessageStore.TYPE; - } - - @Override - public DurableConfigurationStore createDurableConfigurationStore() - { - return new DerbyMessageStore(); - } - - @Override - public MessageStore createMessageStore() - { - return (new DerbyMessageStore()).getMessageStore(); - } - - @Override - public void validateAttributes(Map attributes) - { - @SuppressWarnings("unchecked") - Map messageStoreSettings = (Map) attributes.get(VirtualHost.MESSAGE_STORE_SETTINGS); - - if(getType().equals(messageStoreSettings.get(MessageStore.STORE_TYPE))) - { - Object storePath = messageStoreSettings.get(MessageStore.STORE_PATH); - if(!(storePath instanceof String)) - { - throw new IllegalArgumentException("Setting '"+ MessageStore.STORE_PATH - +"' is required and must be of type String."); - - } - } - - } - - @Override - public void validateConfigurationStoreSettings(Map configurationStoreSettings) - { - if(configurationStoreSettings != null && getType().equals(configurationStoreSettings.get(DurableConfigurationStore.STORE_TYPE))) - { - Object storePath = configurationStoreSettings.get(DurableConfigurationStore.STORE_PATH); - if(!(storePath instanceof String)) - { - throw new IllegalArgumentException("Setting '"+ DurableConfigurationStore.STORE_PATH - +"' is required and must be of type String."); - - } - } - } - -} diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/virtualhostnode/derby/DerbyVirtualHostNode.java b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/virtualhostnode/derby/DerbyVirtualHostNode.java index f65cc78f6a..9dc68d0343 100644 --- a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/virtualhostnode/derby/DerbyVirtualHostNode.java +++ b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/virtualhostnode/derby/DerbyVirtualHostNode.java @@ -27,8 +27,8 @@ import org.apache.qpid.server.model.Broker; 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.plugin.DurableConfigurationStoreFactory; -import org.apache.qpid.server.store.derby.DerbyMessageStoreFactory; +import org.apache.qpid.server.store.DurableConfigurationStore; +import org.apache.qpid.server.store.derby.DerbyMessageStore; import org.apache.qpid.server.virtualhostnode.AbstractStandardVirtualHostNode; import org.apache.qpid.server.virtualhostnode.FileBasedVirtualHostNode; @@ -45,9 +45,9 @@ public class DerbyVirtualHostNode extends AbstractStandardVirtualHostNode attributes) - { - @SuppressWarnings("unchecked") - Map messageStoreSettings = (Map) attributes.get(VirtualHost.MESSAGE_STORE_SETTINGS); - if(getType().equals(messageStoreSettings.get(MessageStore.STORE_TYPE))) - { - Object connectionURL = messageStoreSettings.get(JDBCMessageStore.CONNECTION_URL); - if(!(connectionURL instanceof String)) - { - throw new IllegalArgumentException("Setting '"+ JDBCMessageStore.CONNECTION_URL - +"' is required and must be of type String."); - - } - } - } - - @Override - public void validateConfigurationStoreSettings(Map configurationStoreSettings) - { - if(configurationStoreSettings != null && getType().equals(configurationStoreSettings.get(DurableConfigurationStore.STORE_TYPE))) - { - Object connectionURL = configurationStoreSettings.get(JDBCMessageStore.CONNECTION_URL); - if(!(connectionURL instanceof String)) - { - throw new IllegalArgumentException("Setting '"+ JDBCMessageStore.CONNECTION_URL - +"' is required and must be of type String."); - } - } - } - -} diff --git a/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNodeImpl.java b/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNodeImpl.java index cb3077bc65..29986335d0 100644 --- a/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNodeImpl.java +++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNodeImpl.java @@ -26,8 +26,8 @@ import org.apache.qpid.server.model.Broker; 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.plugin.DurableConfigurationStoreFactory; -import org.apache.qpid.server.store.jdbc.JDBCMessageStoreFactory; +import org.apache.qpid.server.store.DurableConfigurationStore; +import org.apache.qpid.server.store.jdbc.JDBCMessageStore; import org.apache.qpid.server.virtualhostnode.AbstractStandardVirtualHostNode; @ManagedObject( category = false, type = "JDBC" ) @@ -58,9 +58,9 @@ public class JDBCVirtualHostNodeImpl extends AbstractStandardVirtualHostNode attributes) - { - } - - @Override - public DurableConfigurationStore createDurableConfigurationStore() - { - return new MemoryConfigurationStore(); - } - - @Override - public void validateConfigurationStoreSettings(Map attributes) - { - } -} diff --git a/qpid/java/broker-plugins/memory-store/src/main/java/org/apache/qpid/server/virtualhostnode/memory/MemoryVirtualHostNode.java b/qpid/java/broker-plugins/memory-store/src/main/java/org/apache/qpid/server/virtualhostnode/memory/MemoryVirtualHostNode.java index ce587388ce..1fd4717ae1 100644 --- a/qpid/java/broker-plugins/memory-store/src/main/java/org/apache/qpid/server/virtualhostnode/memory/MemoryVirtualHostNode.java +++ b/qpid/java/broker-plugins/memory-store/src/main/java/org/apache/qpid/server/virtualhostnode/memory/MemoryVirtualHostNode.java @@ -25,8 +25,8 @@ import java.util.Map; import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.model.ManagedObject; import org.apache.qpid.server.model.ManagedObjectFactoryConstructor; -import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory; -import org.apache.qpid.server.store.MemoryMessageStoreFactory; +import org.apache.qpid.server.store.DurableConfigurationStore; +import org.apache.qpid.server.store.MemoryConfigurationStore; import org.apache.qpid.server.virtualhostnode.AbstractStandardVirtualHostNode; @ManagedObject(type="Memory",category=false) @@ -40,9 +40,8 @@ public class MemoryVirtualHostNode extends AbstractStandardVirtualHostNode messageStoreSettings = new HashMap(); messageStoreSettings.put(MessageStore.STORE_TYPE, getTestProfileMessageStoreType()); messageStoreSettings.put(MessageStore.STORE_PATH, _messageStorePath); - TestUtils.createStoreWithVirtualHostEntry(messageStoreSettings, config, nodeType); + + // TODO initialise the virtualhost with the required attributes using the virtualhost blueprint + // mechanism. + + //TestUtils.createStoreWithVirtualHostEntry(messageStoreSettings, config, nodeType); + super.startBroker(); } 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 7ddf119ebc..f59d9f797f 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 @@ -64,7 +64,7 @@ public class BrokerRestHttpsTest extends QpidRestTestCase Map brokerDetails = getRestTestHelper().getJsonAsSingletonList("broker"); Asserts.assertAttributesPresent(brokerDetails, ConfiguredObjectTypeRegistry.getAttributeNames(Broker.class), - Broker.PROCESS_PID, Broker.SUPPORTED_VIRTUALHOST_STORE_TYPES, + Broker.PROCESS_PID, ConfiguredObject.TYPE, ConfiguredObject.CREATED_BY, ConfiguredObject.CREATED_TIME, diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java index e312293c33..6faca2e32d 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java @@ -40,7 +40,6 @@ import org.apache.qpid.server.model.LifetimePolicy; import org.apache.qpid.server.model.Port; import org.apache.qpid.server.model.State; import org.apache.qpid.server.model.VirtualHostNode; -import org.apache.qpid.server.plugin.MessageStoreFactory; import org.apache.qpid.test.client.UnroutableMessageTestExceptionListener; import org.apache.qpid.test.utils.TestBrokerConfiguration; import org.apache.qpid.util.SystemUtils; @@ -234,10 +233,9 @@ public class BrokerRestTest extends QpidRestTestCase assertNotNull("Unexpected value of attribute ports", brokerDetails.get(BROKER_PORTS_ATTRIBUTE)); assertNotNull("Unexpected value of attribute authenticationproviders", brokerDetails.get(BROKER_AUTHENTICATIONPROVIDERS_ATTRIBUTE)); - @SuppressWarnings("unchecked") - Collection supportedVirtualHostStoreTypes = (Collection)brokerDetails.get(Broker.SUPPORTED_VIRTUALHOST_STORE_TYPES); - Collection expectedSupportedVirtualHostStoreTypes = MessageStoreFactory.FACTORY_LOADER.getSupportedTypes(); - assertEquals("Unexpected supported virtual host store types", new HashSet(expectedSupportedVirtualHostStoreTypes), new HashSet(supportedVirtualHostStoreTypes)); + assertNotNull("Unexpected value of attribute supportedVirtualHostTypes", brokerDetails.get(Broker.SUPPORTED_VIRTUALHOST_TYPES)); + assertNotNull("Unexpected value of attribute supportedVirtualHostNodeTypes", brokerDetails.get(Broker.SUPPORTED_VIRTUALHOSTNODE_TYPES)); + } } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/TestUtils.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/TestUtils.java index 3f993b38ce..5069e20335 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/TestUtils.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/TestUtils.java @@ -20,29 +20,10 @@ */ package org.apache.qpid.test.utils; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import java.io.File; import java.lang.management.ManagementFactory; import java.lang.management.ThreadInfo; import java.lang.management.ThreadMXBean; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.apache.qpid.server.model.BrokerModel; -import org.apache.qpid.server.model.VirtualHost; -import org.apache.qpid.server.model.VirtualHostNode; -import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory; -import org.apache.qpid.server.store.ConfiguredObjectRecordImpl; -import org.apache.qpid.server.store.DurableConfigurationStore; -import org.apache.qpid.server.store.JsonFileConfigStore; -import org.apache.qpid.server.store.MemoryConfigurationStore; -import org.apache.qpid.server.store.MemoryMessageStore; -import org.apache.qpid.server.virtualhost.ProvidedStoreVirtualHost; -import org.apache.qpid.util.FileUtils; -import org.apache.qpid.util.Strings; public class TestUtils { @@ -71,53 +52,4 @@ public class TestUtils } return dump.toString(); } - - public static String createStoreWithVirtualHostEntry(Map messageStoreSettings, TestBrokerConfiguration config, String configStoreType) - { - UUID virtualHostId = UUID.randomUUID(); - Map virtualHostAttributes = new HashMap(); - virtualHostAttributes.put(VirtualHost.NAME, TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST); - virtualHostAttributes.put(VirtualHost.ID, virtualHostId); - virtualHostAttributes.put(VirtualHost.TYPE, MemoryMessageStore.TYPE.equals(configStoreType) ? configStoreType : ProvidedStoreVirtualHost.VIRTUAL_HOST_TYPE); - virtualHostAttributes.put(VirtualHost.MESSAGE_STORE_SETTINGS, messageStoreSettings); - virtualHostAttributes.put(VirtualHost.MODEL_VERSION, BrokerModel.MODEL_VERSION); - - // If using MMS, switch to split store with JSON config store. - if (MemoryConfigurationStore.TYPE.equals(configStoreType)) - { - configStoreType = JsonFileConfigStore.TYPE; - } - DurableConfigurationStoreFactory storeFactory = DurableConfigurationStoreFactory.FACTORY_LOADER.get(configStoreType); - DurableConfigurationStore store = storeFactory.createDurableConfigurationStore(); - - config.setObjectAttribute(VirtualHostNode.class, TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST, VirtualHostNode.TYPE, configStoreType); - - Map nodeAttributes = config.getObjectAttributes(VirtualHostNode.class, TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST); - String storePath = (String)nodeAttributes.get(DurableConfigurationStore.STORE_PATH); - String path = Strings.expand(storePath, false, Strings.JAVA_SYS_PROPS_RESOLVER, Strings.ENV_VARS_RESOLVER); - - File pathFile = new File(path); - if (pathFile.exists()) - { - FileUtils.delete(pathFile, true); - } - - Map attributes = new HashMap(nodeAttributes); - attributes.put(DurableConfigurationStore.STORE_PATH, path); - - VirtualHostNode virtualHostNode = mock(VirtualHostNode.class); - when(virtualHostNode.getModel()).thenReturn(BrokerModel.getInstance()); - when(virtualHostNode.getName()).thenReturn(TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST); - - try - { - store.openConfigurationStore(virtualHostNode, attributes); - store.create(new ConfiguredObjectRecordImpl(virtualHostId, VirtualHost.class.getSimpleName(), virtualHostAttributes)); - } - finally - { - store.closeConfigurationStore(); - } - return path; - } } -- cgit v1.2.1