diff options
| author | Alex Rudyy <orudyy@apache.org> | 2015-04-15 09:47:28 +0000 |
|---|---|---|
| committer | Alex Rudyy <orudyy@apache.org> | 2015-04-15 09:47:28 +0000 |
| commit | 0a0baee45ebcff44635907d457c4ff6810b09c87 (patch) | |
| tree | 8bfb0f9eddbc23cff88af69be80ab3ce7d47011c /qpid/java/broker-plugins/derby-store | |
| parent | 54aa3d7070da16ce55c28ccad3f7d0871479e461 (diff) | |
| download | qpid-python-0a0baee45ebcff44635907d457c4ff6810b09c87.tar.gz | |
QPID-6481: Move java source tree to top level
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1673693 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins/derby-store')
23 files changed, 0 insertions, 2069 deletions
diff --git a/qpid/java/broker-plugins/derby-store/pom.xml b/qpid/java/broker-plugins/derby-store/pom.xml deleted file mode 100644 index 1f247c7dcb..0000000000 --- a/qpid/java/broker-plugins/derby-store/pom.xml +++ /dev/null @@ -1,89 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.qpid</groupId> - <artifactId>qpid-java-build</artifactId> - <version>0.32-SNAPSHOT</version> - <relativePath>../../pom.xml</relativePath> - </parent> - - <artifactId>qpid-broker-plugins-derby-store</artifactId> - <name>Qpid Derby Message Store</name> - <description>Apache Derby DB message store broker plug-in</description> - - <dependencies> - <dependency> - <groupId>org.apache.qpid</groupId> - <artifactId>qpid-broker-core</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.qpid</groupId> - <artifactId>qpid-broker-codegen</artifactId> - <version>${project.version}</version> - <optional>true</optional> - </dependency> - - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derby</artifactId> - <version>${derby-version}</version> - </dependency> - - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>${log4j-version}</version> - </dependency> - - <!-- test dependencies --> - <dependency> - <groupId>org.apache.qpid</groupId> - <artifactId>qpid-test-utils</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.qpid</groupId> - <artifactId>qpid-broker-core</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <resources> - <resource> - <directory>src/main/resources</directory> - </resource> - <resource> - <directory>src/main/java</directory> - <includes> - <include>resources/</include> - </includes> - </resource> - </resources> - </build> - -</project> diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/AbstractDerbyMessageStore.java b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/AbstractDerbyMessageStore.java deleted file mode 100644 index df5eec025b..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/AbstractDerbyMessageStore.java +++ /dev/null @@ -1,331 +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.sql.CallableStatement; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.store.*; - -public abstract class AbstractDerbyMessageStore extends AbstractJDBCMessageStore -{ - private final AtomicBoolean _messageStoreOpen = new AtomicBoolean(false); - - private long _persistentSizeLowThreshold; - private long _persistentSizeHighThreshold; - private long _totalStoreSize; - private boolean _limitBusted; - - private ConfiguredObject<?> _parent; - - @Override - public final void openMessageStore(final ConfiguredObject<?> parent) - { - if (_messageStoreOpen.compareAndSet(false, true)) - { - _parent = parent; - initMessageStore(parent); - - DerbyUtils.loadDerbyDriver(); - - doOpen(parent); - - final SizeMonitoringSettings sizeMonitorSettings = (SizeMonitoringSettings) parent; - _persistentSizeHighThreshold = sizeMonitorSettings.getStoreOverfullSize(); - _persistentSizeLowThreshold = sizeMonitorSettings.getStoreUnderfullSize(); - - if (_persistentSizeLowThreshold > _persistentSizeHighThreshold || _persistentSizeLowThreshold < 0l) - { - _persistentSizeLowThreshold = _persistentSizeHighThreshold; - } - - createOrOpenMessageStoreDatabase(); - setInitialSize(); - setMaximumMessageId(); - } - } - - protected abstract void doOpen(final ConfiguredObject<?> parent); - - @Override - public final void upgradeStoreStructure() throws StoreException - { - checkMessageStoreOpen(); - - upgrade(_parent); - } - - @Override - public final void closeMessageStore() - { - if (_messageStoreOpen.compareAndSet(true, false)) - { - try - { - doClose(); - } - finally - { - super.closeMessageStore(); - } - } - } - - protected abstract void doClose(); - - @Override - protected boolean isMessageStoreOpen() - { - return _messageStoreOpen.get(); - } - - @Override - protected void checkMessageStoreOpen() - { - if (!_messageStoreOpen.get()) - { - throw new IllegalStateException("Message store is not open"); - } - } - - @Override - protected String getSqlBlobType() - { - return "blob"; - } - - @Override - protected String getSqlVarBinaryType(int size) - { - return "varchar("+size+") for bit data"; - } - - @Override - protected String getSqlBigIntType() - { - return "bigint"; - } - - @Override - protected byte[] getBlobAsBytes(ResultSet rs, int col) throws SQLException - { - return DerbyUtils.getBlobAsBytes(rs, col); - } - - @Override - protected boolean tableExists(final String tableName, final Connection conn) throws SQLException - { - return DerbyUtils.tableExists(tableName, conn); - } - - @Override - protected void storedSizeChange(final int delta) - { - if(getPersistentSizeHighThreshold() > 0) - { - synchronized(this) - { - // the delta supplied is an approximation of a store size change. we don;t want to check the statistic every - // time, so we do so only when there's been enough change that it is worth looking again. We do this by - // assuming the total size will change by less than twice the amount of the message data change. - long newSize = _totalStoreSize += 3*delta; - - Connection conn = null; - try - { - - if(!_limitBusted && newSize > getPersistentSizeHighThreshold()) - { - conn = newAutoCommitConnection(); - _totalStoreSize = getSizeOnDisk(conn); - if(_totalStoreSize > getPersistentSizeHighThreshold()) - { - _limitBusted = true; - _eventManager.notifyEvent(Event.PERSISTENT_MESSAGE_SIZE_OVERFULL); - } - } - else if(_limitBusted && newSize < getPersistentSizeLowThreshold()) - { - long oldSize = _totalStoreSize; - conn = newAutoCommitConnection(); - _totalStoreSize = getSizeOnDisk(conn); - if(oldSize <= _totalStoreSize) - { - - reduceSizeOnDisk(conn); - - _totalStoreSize = getSizeOnDisk(conn); - } - - if(_totalStoreSize < getPersistentSizeLowThreshold()) - { - _limitBusted = false; - _eventManager.notifyEvent(Event.PERSISTENT_MESSAGE_SIZE_UNDERFULL); - } - - - } - } - catch (SQLException e) - { - JdbcUtils.closeConnection(conn, getLogger()); - throw new StoreException("Exception while processing store size change", e); - } - } - } - } - - private void setInitialSize() - { - Connection conn = null; - try - { - conn = newAutoCommitConnection(); - _totalStoreSize = getSizeOnDisk(conn); - } - catch (SQLException e) - { - getLogger().error("Unable to set initial store size", e); - } - finally - { - JdbcUtils.closeConnection(conn, getLogger()); - } - } - - private long getSizeOnDisk(Connection conn) - { - PreparedStatement stmt = null; - try - { - String sizeQuery = "SELECT SUM(T2.NUMALLOCATEDPAGES * T2.PAGESIZE) TOTALSIZE" + - " FROM " + - " SYS.SYSTABLES systabs," + - " TABLE (SYSCS_DIAG.SPACE_TABLE(systabs.tablename)) AS T2" + - " WHERE systabs.tabletype = 'T'"; - - stmt = conn.prepareStatement(sizeQuery); - - ResultSet rs = null; - long size = 0l; - - try - { - rs = stmt.executeQuery(); - while(rs.next()) - { - size = rs.getLong(1); - } - } - finally - { - if(rs != null) - { - rs.close(); - } - } - - return size; - - } - catch (SQLException e) - { - throw new StoreException("Error establishing on disk size", e); - } - finally - { - JdbcUtils.closePreparedStatement(stmt, getLogger()); - } - } - - private void reduceSizeOnDisk(Connection conn) - { - CallableStatement cs = null; - PreparedStatement stmt = null; - try - { - String tableQuery = - "SELECT S.SCHEMANAME, T.TABLENAME FROM SYS.SYSSCHEMAS S, SYS.SYSTABLES T WHERE S.SCHEMAID = T.SCHEMAID AND T.TABLETYPE='T'"; - stmt = conn.prepareStatement(tableQuery); - ResultSet rs = null; - - List<String> schemas = new ArrayList<String>(); - List<String> tables = new ArrayList<String>(); - - try - { - rs = stmt.executeQuery(); - while(rs.next()) - { - schemas.add(rs.getString(1)); - tables.add(rs.getString(2)); - } - } - finally - { - if(rs != null) - { - rs.close(); - } - } - - - cs = conn.prepareCall - ("CALL SYSCS_UTIL.SYSCS_COMPRESS_TABLE(?, ?, ?)"); - - for(int i = 0; i < schemas.size(); i++) - { - cs.setString(1, schemas.get(i)); - cs.setString(2, tables.get(i)); - cs.setShort(3, (short) 0); - cs.execute(); - } - } - catch (SQLException e) - { - throw new StoreException("Error reducing on disk size", e); - } - finally - { - JdbcUtils.closePreparedStatement(stmt, getLogger()); - JdbcUtils.closePreparedStatement(cs, getLogger()); - } - } - - private long getPersistentSizeLowThreshold() - { - return _persistentSizeLowThreshold; - } - - private long getPersistentSizeHighThreshold() - { - return _persistentSizeHighThreshold; - } - -} diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java deleted file mode 100644 index d96dc8d224..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java +++ /dev/null @@ -1,242 +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.io.File; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.store.AbstractJDBCConfigurationStore; -import org.apache.qpid.server.store.ConfiguredObjectRecord; -import org.apache.qpid.server.store.DurableConfigurationStore; -import org.apache.qpid.server.store.FileBasedSettings; -import org.apache.qpid.server.store.MessageStore; -import org.apache.qpid.server.store.MessageStoreProvider; -import org.apache.qpid.server.store.StoreException; -import org.apache.qpid.util.FileUtils; - -/** - * Implementation of a DurableConfigurationStore backed by Apache Derby - * that also provides a MessageStore.A - */ -public class DerbyConfigurationStore extends AbstractJDBCConfigurationStore - implements MessageStoreProvider, DurableConfigurationStore -{ - private static final Logger LOGGER = LoggerFactory.getLogger(DerbyConfigurationStore.class); - - private final AtomicBoolean _configurationStoreOpen = new AtomicBoolean(); - private final ProvidedMessageStore _providedMessageStore = new ProvidedMessageStore(); - - private String _connectionURL; - - private ConfiguredObject<?> _parent; - private final Class<? extends ConfiguredObject> _rootClass; - - public DerbyConfigurationStore(final Class<? extends ConfiguredObject> rootClass) - { - _rootClass = rootClass; - } - - @Override - public void openConfigurationStore(ConfiguredObject<?> parent, - final boolean overwrite, - final ConfiguredObjectRecord... initialRecords) - throws StoreException - { - if (_configurationStoreOpen.compareAndSet(false, true)) - { - _parent = parent; - DerbyUtils.loadDerbyDriver(); - - _connectionURL = DerbyUtils.createConnectionUrl(parent.getName(), ((FileBasedSettings)_parent).getStorePath()); - - createOrOpenConfigurationStoreDatabase(overwrite); - - if(hasNoConfigurationEntries()) - { - update(true, initialRecords); - } - } - } - - @Override - public void upgradeStoreStructure() throws StoreException - { - checkConfigurationStoreOpen(); - upgradeIfNecessary(_parent); - } - - @Override - protected Connection getConnection() throws SQLException - { - checkConfigurationStoreOpen(); - return DriverManager.getConnection(_connectionURL); - } - - @Override - public void closeConfigurationStore() throws StoreException - { - if (_providedMessageStore.isMessageStoreOpen()) - { - throw new IllegalStateException("Cannot close the store as the provided message store is still open"); - } - - if (_configurationStoreOpen.compareAndSet(true, false)) - { - try - { - DerbyUtils.shutdownDatabase(_connectionURL); - } - catch (SQLException e) - { - throw new StoreException("Error closing configuration store", e); - } - } - } - - @Override - protected String getSqlBlobType() - { - return "blob"; - } - - @Override - protected String getSqlVarBinaryType(int size) - { - return "varchar("+size+") for bit data"; - } - - @Override - protected String getSqlBigIntType() - { - return "bigint"; - } - - @Override - protected String getBlobAsString(ResultSet rs, int col) throws SQLException - { - return DerbyUtils.getBlobAsString(rs, col); - } - - @Override - public void onDelete(ConfiguredObject<?> parent) - { - if (_providedMessageStore.isMessageStoreOpen()) - { - throw new IllegalStateException("Cannot delete the store as the provided message store is still open"); - } - - FileBasedSettings fileBasedSettings = (FileBasedSettings) parent; - String storePath = fileBasedSettings.getStorePath(); - - if (!DerbyUtils.MEMORY_STORE_LOCATION.equals(storePath)) - { - if (storePath != null) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Deleting store " + storePath); - } - - File configFile = new File(storePath); - if (!FileUtils.delete(configFile, true)) - { - LOGGER.info("Failed to delete the store at location " + storePath); - } - } - } - } - - @Override - public MessageStore getMessageStore() - { - return _providedMessageStore; - } - - @Override - protected boolean tableExists(final String tableName, final Connection conn) throws SQLException - { - return DerbyUtils.tableExists(tableName, conn); - } - - @Override - protected void checkConfigurationStoreOpen() - { - if (!_configurationStoreOpen.get()) - { - throw new IllegalStateException("Configuration store is not open"); - } - } - - @Override - protected Logger getLogger() - { - return LOGGER; - } - - private class ProvidedMessageStore extends AbstractDerbyMessageStore - { - @Override - protected void doOpen(final ConfiguredObject<?> parent) - { - // Nothing to do, store provided by DerbyConfigurationStore - } - - @Override - protected Connection getConnection() throws SQLException - { - checkMessageStoreOpen(); - return DerbyConfigurationStore.this.getConnection(); - } - - @Override - protected void doClose() - { - // Nothing to do, store provided by DerbyConfigurationStore - } - - @Override - public String getStoreLocation() - { - return ((FileBasedSettings)(DerbyConfigurationStore.this._parent)).getStorePath(); - } - - @Override - public File getStoreLocationAsFile() - { - return DerbyUtils.isInMemoryDatabase(getStoreLocation()) ? null : new File(getStoreLocation()); - } - - @Override - protected Logger getLogger() - { - return DerbyConfigurationStore.this.getLogger(); - } - } -} diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java deleted file mode 100644 index 10fed76b60..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java +++ /dev/null @@ -1,118 +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.io.File; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.store.FileBasedSettings; -import org.apache.qpid.server.store.StoreException; -import org.apache.qpid.util.FileUtils; - -/** - * Implementation of a MessageStore backed by Apache Derby. - */ -public class DerbyMessageStore extends AbstractDerbyMessageStore -{ - private static final Logger LOGGER = LoggerFactory.getLogger(DerbyMessageStore.class); - - private String _connectionURL; - private ConfiguredObject<?> _parent; - - @Override - protected void doOpen(final ConfiguredObject<?> parent) - { - _parent = parent; - _connectionURL = DerbyUtils.createConnectionUrl(parent.getName(), ((FileBasedSettings)_parent).getStorePath()); - } - - @Override - protected Connection getConnection() throws SQLException - { - checkMessageStoreOpen(); - return DriverManager.getConnection(_connectionURL); - } - - @Override - protected void doClose() - { - try - { - DerbyUtils.shutdownDatabase(_connectionURL); - } - catch (SQLException e) - { - throw new StoreException("Error closing configuration store", e); - } - } - - @Override - public void onDelete(ConfiguredObject parent) - { - if (isMessageStoreOpen()) - { - throw new IllegalStateException("Cannot delete the store as the provided message store is still open"); - } - - FileBasedSettings fileBasedSettings = (FileBasedSettings)parent; - String storePath = fileBasedSettings.getStorePath(); - - if (storePath != null) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Deleting store " + storePath); - } - - File configFile = new File(storePath); - if (!FileUtils.delete(configFile, true)) - { - LOGGER.info("Failed to delete the store at location " + storePath); - } - } - } - - @Override - protected Logger getLogger() - { - return LOGGER; - } - - - @Override - public String getStoreLocation() - { - return ((FileBasedSettings)_parent).getStorePath(); - } - - @Override - public File getStoreLocationAsFile() - { - return DerbyUtils.isInMemoryDatabase(getStoreLocation()) ? null : new File(getStoreLocation()); - } -} diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbySystemConfig.java b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbySystemConfig.java deleted file mode 100644 index d3a1fa2bbc..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbySystemConfig.java +++ /dev/null @@ -1,39 +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 org.apache.qpid.server.model.ManagedAttribute; -import org.apache.qpid.server.model.SystemConfig; -import org.apache.qpid.server.store.FileBasedSettings; -import org.apache.qpid.server.store.SizeMonitoringSettings; - -public interface DerbySystemConfig<X extends DerbySystemConfig<X>> extends SystemConfig<X>, FileBasedSettings, - SizeMonitoringSettings -{ - @ManagedAttribute(mandatory = true) - String getStorePath(); - - @ManagedAttribute(mandatory = true, defaultValue = "0") - Long getStoreUnderfullSize(); - - @ManagedAttribute(mandatory = true, defaultValue = "0") - Long getStoreOverfullSize(); -} diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbySystemConfigImpl.java b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbySystemConfigImpl.java deleted file mode 100644 index 0cc4f2b18c..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbySystemConfigImpl.java +++ /dev/null @@ -1,81 +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.configuration.updater.TaskExecutor; -import org.apache.qpid.server.logging.EventLogger; -import org.apache.qpid.server.logging.LogRecorder; -import org.apache.qpid.server.model.AbstractSystemConfig; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.model.BrokerShutdownProvider; -import org.apache.qpid.server.model.ManagedAttributeField; -import org.apache.qpid.server.model.ManagedObject; -import org.apache.qpid.server.model.SystemConfigFactoryConstructor; -import org.apache.qpid.server.store.DurableConfigurationStore; - -@ManagedObject(category = false, type = DerbySystemConfigImpl.SYSTEM_CONFIG_TYPE) -public class DerbySystemConfigImpl extends AbstractSystemConfig<DerbySystemConfigImpl> implements DerbySystemConfig<DerbySystemConfigImpl> -{ - public static final String SYSTEM_CONFIG_TYPE = "DERBY"; - - @ManagedAttributeField - private String _storePath; - @ManagedAttributeField - private Long _storeUnderfullSize; - @ManagedAttributeField - private Long _storeOverfullSize; - - @SystemConfigFactoryConstructor - public DerbySystemConfigImpl(final TaskExecutor taskExecutor, - final EventLogger eventLogger, - final LogRecorder logRecorder, - final Map<String,Object> attributes, - final BrokerShutdownProvider brokerShutdownProvider) - { - super(taskExecutor, eventLogger, logRecorder, attributes, brokerShutdownProvider); - } - - @Override - protected DurableConfigurationStore createStoreObject() - { - return new DerbyConfigurationStore(Broker.class); - } - - @Override - public String getStorePath() - { - return _storePath; - } - - @Override - public Long getStoreUnderfullSize() - { - return _storeUnderfullSize; - } - - @Override - public Long getStoreOverfullSize() - { - return _storeOverfullSize; - } -} diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyUtils.java b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyUtils.java deleted file mode 100644 index 8116274261..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyUtils.java +++ /dev/null @@ -1,234 +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.io.File; -import java.io.IOException; -import java.io.Writer; -import java.nio.charset.Charset; -import java.sql.Blob; -import java.sql.Connection; -import java.sql.Driver; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.store.StoreException; - -public class DerbyUtils -{ - public static final String MEMORY_STORE_LOCATION = ":memory:"; - public static final String DERBY_SINGLE_DB_SHUTDOWN_CODE = "08006"; - private static final String SQL_DRIVER_NAME = "org.apache.derby.jdbc.EmbeddedDriver"; - private static final String TABLE_EXISTENCE_QUERY = "SELECT 1 FROM SYS.SYSTABLES WHERE TABLENAME = ?"; - private static final Charset UTF8_CHARSET = Charset.forName("UTF-8"); - - private static final Logger DERBY_LOG = LoggerFactory.getLogger("DERBY"); - public static final DerbyLogWriter DERBY_LOG_WRITER = new DerbyLogWriter(); - public static final String DERBY_STREAM_ERROR_METHOD = "derby.stream.error.method"; - - public static void loadDerbyDriver() - { - try - { - // set the error log output - System.setProperty(DERBY_STREAM_ERROR_METHOD, - "org.apache.qpid.server.store.derby.DerbyUtils.getDerbyLogWriter"); - - Class<Driver> driverClass = (Class<Driver>) Class.forName(SQL_DRIVER_NAME); - } - catch (ClassNotFoundException e) - { - throw new StoreException("Failed to load driver " + SQL_DRIVER_NAME, e); - } - } - - public static Writer getDerbyLogWriter() - { - return DERBY_LOG_WRITER; - } - - public static String createConnectionUrl(final String name, final String databasePath) - { - // Derby wont use an existing directory, so we append parent name - if (isInMemoryDatabase(databasePath)) - { - return "jdbc:derby:" + MEMORY_STORE_LOCATION + "/" + name + ";create=true"; - } - else - { - File environmentPath = new File(databasePath); - if (!environmentPath.exists()) - { - if (!environmentPath.mkdirs()) - { - throw new IllegalArgumentException("Environment path " - + environmentPath - + " could not be read or created. " - + "Ensure the path is correct and that the permissions are correct."); - } - } - return "jdbc:derby:" + databasePath + "/" + name + ";create=true"; - } - - } - - public static boolean isInMemoryDatabase(final String databasePath) - { - return MEMORY_STORE_LOCATION.equals(databasePath); - } - - public static void shutdownDatabase(String connectionURL) throws SQLException - { - try - { - Connection conn = DriverManager.getConnection(connectionURL + ";shutdown=true"); - // Shouldn't reach this point - shutdown=true should throw SQLException - conn.close(); - } - catch (SQLException e) - { - if (e.getSQLState().equalsIgnoreCase(DerbyUtils.DERBY_SINGLE_DB_SHUTDOWN_CODE)) - { - //expected and represents a clean shutdown of this database only, do nothing. - } - else - { - throw e; - } - } - } - - public static String getBlobAsString(ResultSet rs, int col) throws SQLException - { - Blob blob = rs.getBlob(col); - if(blob == null) - { - return null; - } - byte[] bytes = blob.getBytes(1, (int) blob.length()); - return new String(bytes, UTF8_CHARSET); - } - - protected static byte[] getBlobAsBytes(ResultSet rs, int col) throws SQLException - { - Blob dataAsBlob = rs.getBlob(col); - return dataAsBlob.getBytes(1,(int) dataAsBlob.length()); - } - - public static boolean tableExists(final String tableName, final Connection conn) throws SQLException - { - PreparedStatement stmt = conn.prepareStatement(TABLE_EXISTENCE_QUERY); - try - { - stmt.setString(1, tableName); - ResultSet rs = stmt.executeQuery(); - try - { - return rs.next(); - } - finally - { - rs.close(); - } - } - finally - { - stmt.close(); - } - } - - - private static class DerbyLogWriter extends Writer - { - - public static final String DERBY_STARTUP_MESSAGE = "Booting Derby version "; - public static final String DERBY_SHUTDOWN_MESSAGE = "Shutting down instance "; - public static final String DERBY_CLASS_LOADER_STARTED_MESSAGE = "Database Class Loader started"; - public static final String DERBY_SYSTEM_HOME = "derby.system.home"; - public static final String DASHED_LINE = "\\s*-*\\s*"; - - private final ThreadLocal<StringBuilder> _threadLocalBuffer = new ThreadLocal<StringBuilder>() - { - @Override - protected StringBuilder initialValue() - { - return new StringBuilder(); - } - }; - - @Override - public void write(final char[] cbuf, final int off, final int len) throws IOException - { - _threadLocalBuffer.get().append(cbuf, off, len); - } - - @Override - public void flush() throws IOException - { - String logMessage = _threadLocalBuffer.get().toString(); - if(!logMessage.matches(DASHED_LINE)) - { - if(logMessage.contains(DERBY_STARTUP_MESSAGE)) - { - // the first line of the message containing the startup message is the current date/time, which - // we can remove - logMessage = logMessage.substring(logMessage.indexOf('\n') + 1); - } - - // This is pretty hideous, but since the Derby logging doesn't have any way of informing us of priority - // we simply have to assume everything is a warning except known startup / shutdown messages - // which we match using known prefixes. - - if(logMessage.startsWith(DERBY_STARTUP_MESSAGE) - || logMessage.startsWith(DERBY_SHUTDOWN_MESSAGE)) - { - DERBY_LOG.info(logMessage); - } - else if(logMessage.startsWith(DERBY_SYSTEM_HOME) - || logMessage.startsWith(DERBY_STREAM_ERROR_METHOD) - || logMessage.startsWith("java.vendor") - || logMessage.startsWith(DERBY_CLASS_LOADER_STARTED_MESSAGE)) - { - DERBY_LOG.debug(logMessage); - } - else - { - DERBY_LOG.warn(logMessage); - } - - } - _threadLocalBuffer.set(new StringBuilder()); - } - - @Override - public void close() throws IOException - { - - } - } -} - diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/virtualhost/derby/DerbyVirtualHost.java b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/virtualhost/derby/DerbyVirtualHost.java deleted file mode 100644 index 4935d5e707..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/virtualhost/derby/DerbyVirtualHost.java +++ /dev/null @@ -1,40 +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.virtualhost.derby; - -import org.apache.qpid.server.exchange.ExchangeImpl; -import org.apache.qpid.server.model.ManagedAttribute; -import org.apache.qpid.server.queue.AMQQueue; -import org.apache.qpid.server.store.SizeMonitoringSettings; -import org.apache.qpid.server.virtualhost.VirtualHostImpl; - -public interface DerbyVirtualHost<X extends DerbyVirtualHost<X>> extends VirtualHostImpl<X,AMQQueue<?>,ExchangeImpl<?>>, org.apache.qpid.server.store.FileBasedSettings, SizeMonitoringSettings -{ - String STORE_PATH = "storePath"; - - @ManagedAttribute(mandatory = true, defaultValue = "${qpid.work_dir}${file.separator}${this:name}${file.separator}messages") - String getStorePath(); - - @ManagedAttribute(mandatory = true, defaultValue = "0") - Long getStoreUnderfullSize(); - - @ManagedAttribute(mandatory = true, defaultValue = "0") - Long getStoreOverfullSize(); -} diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/virtualhost/derby/DerbyVirtualHostImpl.java b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/virtualhost/derby/DerbyVirtualHostImpl.java deleted file mode 100644 index dbaf5e55b7..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/virtualhost/derby/DerbyVirtualHostImpl.java +++ /dev/null @@ -1,89 +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.virtualhost.derby; - -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.MessageStore; -import org.apache.qpid.server.store.derby.DerbyMessageStore; -import org.apache.qpid.server.util.FileHelper; -import org.apache.qpid.server.virtualhost.AbstractVirtualHost; - -import java.util.Map; - -@ManagedObject(category = false, type = DerbyVirtualHostImpl.VIRTUAL_HOST_TYPE) -public class DerbyVirtualHostImpl extends AbstractVirtualHost<DerbyVirtualHostImpl> implements DerbyVirtualHost<DerbyVirtualHostImpl> -{ - public static final String VIRTUAL_HOST_TYPE = "DERBY"; - - @ManagedAttributeField - private String _storePath; - - @ManagedAttributeField - private Long _storeUnderfullSize; - - @ManagedAttributeField - private Long _storeOverfullSize; - - @ManagedObjectFactoryConstructor - public DerbyVirtualHostImpl(final Map<String, Object> attributes, - final VirtualHostNode<?> virtualHostNode) - { - super(attributes, virtualHostNode); - } - - - @Override - protected MessageStore createMessageStore() - { - return new DerbyMessageStore(); - } - - @Override - public String getStorePath() - { - return _storePath; - } - - @Override - public Long getStoreUnderfullSize() - { - return _storeUnderfullSize; - } - - @Override - public Long getStoreOverfullSize() - { - return _storeOverfullSize; - } - - @Override - protected void validateMessageStoreCreation() - { - if (!new FileHelper().isWritableDirectory(getStorePath())) - { - throw new IllegalConfigurationException("The store path is not writable directory"); - } - } -} 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 deleted file mode 100644 index 81a9167924..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/virtualhostnode/derby/DerbyVirtualHostNode.java +++ /dev/null @@ -1,31 +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.virtualhostnode.derby; - - -import org.apache.qpid.server.model.ManagedAttribute; - -public interface DerbyVirtualHostNode<X extends DerbyVirtualHostNode<X>> extends org.apache.qpid.server.model.VirtualHostNode<X>, org.apache.qpid.server.store.FileBasedSettings -{ - String STORE_PATH = "storePath"; - - @ManagedAttribute(mandatory = true, defaultValue = "${qpid.work_dir}${file.separator}${this:name}${file.separator}config") - String getStorePath(); -} diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/virtualhostnode/derby/DerbyVirtualHostNodeImpl.java b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/virtualhostnode/derby/DerbyVirtualHostNodeImpl.java deleted file mode 100644 index 8224a22929..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/virtualhostnode/derby/DerbyVirtualHostNodeImpl.java +++ /dev/null @@ -1,94 +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.virtualhostnode.derby; - -import java.util.Collection; -import java.util.Collections; -import java.util.Map; - -import org.apache.qpid.server.configuration.IllegalConfigurationException; -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; -import org.apache.qpid.server.model.ManagedObjectFactoryConstructor; -import org.apache.qpid.server.model.VirtualHost; -import org.apache.qpid.server.store.DurableConfigurationStore; -import org.apache.qpid.server.store.derby.DerbyConfigurationStore; -import org.apache.qpid.server.util.FileHelper; -import org.apache.qpid.server.virtualhostnode.AbstractStandardVirtualHostNode; - -@ManagedObject( category = false, - type = DerbyVirtualHostNodeImpl.VIRTUAL_HOST_NODE_TYPE, - validChildTypes = "org.apache.qpid.server.virtualhostnode.derby.DerbyVirtualHostNodeImpl#getSupportedChildTypes()" ) -public class DerbyVirtualHostNodeImpl extends AbstractStandardVirtualHostNode<DerbyVirtualHostNodeImpl> implements DerbyVirtualHostNode<DerbyVirtualHostNodeImpl> -{ - public static final String VIRTUAL_HOST_NODE_TYPE = "DERBY"; - - @ManagedAttributeField - private String _storePath; - - @ManagedObjectFactoryConstructor - public DerbyVirtualHostNodeImpl(Map<String, Object> attributes, Broker<?> parent) - { - super(attributes, parent); - } - - @Override - protected void writeLocationEventLog() - { - getEventLogger().message(getConfigurationStoreLogSubject(), ConfigStoreMessages.STORE_LOCATION(getStorePath())); - } - - @Override - protected DurableConfigurationStore createConfigurationStore() - { - return new DerbyConfigurationStore(VirtualHost.class); - } - - @Override - public String getStorePath() - { - return _storePath; - } - - @Override - public String toString() - { - return getClass().getSimpleName() + " [id=" + getId() + ", name=" + getName() + ", storePath=" + getStorePath() + "]"; - } - - - public static Map<String, Collection<String>> getSupportedChildTypes() - { - return Collections.singletonMap(VirtualHost.class.getSimpleName(), getSupportedVirtualHostTypes(true)); - } - - @Override - public void validateOnCreate() - { - if (!new FileHelper().isWritableDirectory(getStorePath())) - { - throw new IllegalConfigurationException("The store path is not writable directory"); - } - } -} diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/add.js b/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/add.js deleted file mode 100644 index 323b8e9750..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/add.js +++ /dev/null @@ -1,45 +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. - */ - -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/dom", - "dojo/dom-construct", - "dojo/json", - "dijit/registry", - "dojo/text!virtualhost/sizemonitoring/add.html", - "qpid/common/util", - "dijit/form/ValidationTextBox", - "dijit/form/NumberTextBox", - "dojo/domReady!"], - function (xhr, parser, dom, domConstruct, json, registry, template, util) - { - return { - show: function (data) - { - this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode); - parser.parse(this.containerNode).then(function(instances) - { - registry.byId("addVirtualHost.storeUnderfullSize").set("regExpGen", util.numericOrContextVarRegexp); - registry.byId("addVirtualHost.storeOverfullSize").set("regExpGen", util.numericOrContextVarRegexp); - }); - } - }; - } -); diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/edit.js b/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/edit.js deleted file mode 100644 index c1018313b8..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/edit.js +++ /dev/null @@ -1,34 +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. - */ -define(["qpid/common/util", "dijit/registry", "dojo/domReady!"], - function (util, registry) - { - return { - show: function(data) - { - util.parseHtmlIntoDiv(data.containerNode, "virtualhost/sizemonitoring/edit.html", - function() - { - registry.byId("editVirtualHost.storeUnderfullSize").set("regExpGen", util.numericOrContextVarRegexp); - registry.byId("editVirtualHost.storeOverfullSize").set("regExpGen", util.numericOrContextVarRegexp); - }); - } - }; - } -); diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/show.js b/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/show.js deleted file mode 100644 index e53ad75fe4..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/show.js +++ /dev/null @@ -1,38 +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. - */ - -define(["qpid/common/util", - "dojo/domReady!"], - function (util) - { - var fields = ["storePath", "storeUnderfullSize", "storeOverfullSize"]; - - function Derby(data) - { - util.buildUI(data.containerNode, data.parent, "virtualhost/sizemonitoring/show.html", fields, this); - } - - Derby.prototype.update = function(data) - { - util.updateUI(data, fields, this); - } - - return Derby; - } -); diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/add.js b/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/add.js deleted file mode 100644 index d981f1e13f..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/add.js +++ /dev/null @@ -1,41 +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. - * - */ -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/dom", - "dojo/dom-construct", - "dojo/json", - "dijit/registry", - "dojo/text!virtualhostnode/derby/add.html", - "dijit/form/ValidationTextBox", - "dijit/form/CheckBox", - "dojo/domReady!"], - function (xhr, parser, dom, domConstruct, json, registry, template) - { - return { - show: function (data) - { - this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode); - parser.parse(this.containerNode); - } - }; - } -); diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/edit.js b/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/edit.js deleted file mode 100644 index a7f5d05719..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/edit.js +++ /dev/null @@ -1,33 +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. - */ -define(["qpid/common/util", "dijit/registry", "dojo/domReady!"], - function (util, registry) - { - return { - show: function(data) - { - util.parseHtmlIntoDiv(data.containerNode, "virtualhostnode/filebased/edit.html", - function() - { - registry.byId("editVirtualHostNode.storePath").set("disabled", data.data.state != "STOPPED"); - }); - } - }; - } -); diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/show.js b/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/show.js deleted file mode 100644 index ffbe4bfacd..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/show.js +++ /dev/null @@ -1,38 +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. - * - */ -define(["qpid/common/util", "dojo/domReady!"], - function (util) - { - var fields = ["storePath"]; - - function DerbyNode(data) - { - this.parent = data.parent; - util.buildUI(data.containerNode, data.parent, "virtualhostnode/derby/show.html", fields, this); - } - - DerbyNode.prototype.update=function(data) - { - util.updateUI(data, fields, this); - }; - - return DerbyNode; -}); diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/resources/virtualhostnode/derby/add.html b/qpid/java/broker-plugins/derby-store/src/main/java/resources/virtualhostnode/derby/add.html deleted file mode 100644 index 4e82ab09e9..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/main/java/resources/virtualhostnode/derby/add.html +++ /dev/null @@ -1,35 +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. - - - --> -<div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Store path:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addVirtualHostNode.storePath" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'storePath', - placeHolder: 'path/to/store', - title: 'Enter store path', - promptMessage: 'File system location for the configuration store'"/> - </div> - </div> - <div class="clear"></div> -</div> diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/resources/virtualhostnode/derby/show.html b/qpid/java/broker-plugins/derby-store/src/main/java/resources/virtualhostnode/derby/show.html deleted file mode 100644 index d86d9cfa03..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/main/java/resources/virtualhostnode/derby/show.html +++ /dev/null @@ -1,21 +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. - --> - -<div class="clear"> - <div class="formLabel-labelCell">Configuration store path:</div> - <div class="storePath"></div> -</div> diff --git a/qpid/java/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/store/derby/DerbyMessageStoreConfigurationTest.java b/qpid/java/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/store/derby/DerbyMessageStoreConfigurationTest.java deleted file mode 100644 index 4a71fe2faf..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/store/derby/DerbyMessageStoreConfigurationTest.java +++ /dev/null @@ -1,49 +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 static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import org.apache.qpid.server.model.ConfiguredObjectFactory; -import org.apache.qpid.server.model.VirtualHost; -import org.apache.qpid.server.model.VirtualHostNode; -import org.apache.qpid.server.store.AbstractDurableConfigurationStoreTestCase; -import org.apache.qpid.server.virtualhostnode.derby.DerbyVirtualHostNode; - -public class DerbyMessageStoreConfigurationTest extends AbstractDurableConfigurationStoreTestCase -{ - - @Override - protected VirtualHostNode createVirtualHostNode(String storeLocation, ConfiguredObjectFactory factory) - { - final DerbyVirtualHostNode parent = mock(DerbyVirtualHostNode.class); - when(parent.getStorePath()).thenReturn(storeLocation); - return parent; - } - - @Override - protected DerbyConfigurationStore createConfigStore() throws Exception - { - return new DerbyConfigurationStore(VirtualHost.class); - } - -} diff --git a/qpid/java/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/store/derby/DerbyMessageStoreQuotaEventsTest.java b/qpid/java/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/store/derby/DerbyMessageStoreQuotaEventsTest.java deleted file mode 100644 index 0aeb6bd0e8..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/store/derby/DerbyMessageStoreQuotaEventsTest.java +++ /dev/null @@ -1,76 +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 static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.Collections; -import java.util.Map; - -import org.apache.qpid.server.model.VirtualHost; -import org.apache.qpid.server.store.MessageStore; -import org.apache.qpid.server.store.MessageStoreQuotaEventsTestBase; -import org.apache.qpid.server.virtualhost.derby.DerbyVirtualHost; - -public class DerbyMessageStoreQuotaEventsTest extends MessageStoreQuotaEventsTestBase -{ - private static final int NUMBER_OF_MESSAGES_TO_OVERFILL_STORE = 10; - - /** - * Estimated using an assumption that a physical disk space occupied by a - * message is 3 times bigger then a message size - */ - private static final long OVERFULL_SIZE = (long) (MESSAGE_DATA.length * 3 * NUMBER_OF_MESSAGES_TO_OVERFILL_STORE * 0.8); - - private static final long UNDERFULL_SIZE = (long) (OVERFULL_SIZE * 0.8); - - @Override - protected int getNumberOfMessagesToFillStore() - { - return NUMBER_OF_MESSAGES_TO_OVERFILL_STORE; - } - - @Override - protected VirtualHost createVirtualHost(String storeLocation) - { - final DerbyVirtualHost parent = mock(DerbyVirtualHost.class); - when(parent.getContext()).thenReturn(createContextSettings()); - when(parent.getContextKeys(false)).thenReturn(Collections.emptySet()); - when(parent.getStorePath()).thenReturn(storeLocation); - when(parent.getStoreOverfullSize()).thenReturn(OVERFULL_SIZE); - when(parent.getStoreUnderfullSize()).thenReturn(UNDERFULL_SIZE); - return parent; - } - - @Override - protected MessageStore createStore() throws Exception - { - return new DerbyMessageStore(); - } - - private Map<String, String> createContextSettings() - { - return Collections.emptyMap(); - } - - -} diff --git a/qpid/java/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/store/derby/DerbyMessageStoreTest.java b/qpid/java/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/store/derby/DerbyMessageStoreTest.java deleted file mode 100644 index 0b1847bb59..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/store/derby/DerbyMessageStoreTest.java +++ /dev/null @@ -1,96 +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.io.File; - -import org.apache.qpid.server.model.VirtualHost; -import org.apache.qpid.server.store.MessageStore; -import org.apache.qpid.server.store.MessageStoreTestCase; -import org.apache.qpid.server.virtualhost.derby.DerbyVirtualHost; -import org.apache.qpid.util.FileUtils; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class DerbyMessageStoreTest extends MessageStoreTestCase -{ - private String _storeLocation; - - @Override - public void tearDown() throws Exception - { - try - { - deleteStoreIfExists(); - } - finally - { - super.tearDown(); - } - } - - public void testOnDelete() throws Exception - { - File location = new File(_storeLocation); - assertTrue("Store does not exist at " + _storeLocation, location.exists()); - - getStore().closeMessageStore(); - assertTrue("Store does not exist at " + _storeLocation, location.exists()); - - DerbyVirtualHost mockVH = mock(DerbyVirtualHost.class); - when(mockVH.getStorePath()).thenReturn(_storeLocation); - - getStore().onDelete(mockVH); - assertFalse("Store exists at " + _storeLocation, location.exists()); - } - - @Override - protected VirtualHost createVirtualHost() - { - _storeLocation = TMP_FOLDER + File.separator + getTestName(); - deleteStoreIfExists(); - - final DerbyVirtualHost parent = mock(DerbyVirtualHost.class); - when(parent.getStorePath()).thenReturn(_storeLocation); - return parent; - } - - private void deleteStoreIfExists() - { - if (_storeLocation != null) - { - File location = new File(_storeLocation); - if (location.exists()) - { - FileUtils.delete(location, true); - } - } - } - - @Override - protected MessageStore createMessageStore() - { - return new DerbyMessageStore(); - } - -} diff --git a/qpid/java/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/virtualhostnode/derby/DerbyVirtualHostNodeTest.java b/qpid/java/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/virtualhostnode/derby/DerbyVirtualHostNodeTest.java deleted file mode 100644 index 5afbc7aceb..0000000000 --- a/qpid/java/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/virtualhostnode/derby/DerbyVirtualHostNodeTest.java +++ /dev/null @@ -1,175 +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.virtualhostnode.derby; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.File; -import java.nio.file.Files; -import java.nio.file.attribute.PosixFileAttributeView; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.apache.qpid.server.configuration.IllegalConfigurationException; -import org.apache.qpid.server.configuration.updater.TaskExecutor; -import org.apache.qpid.server.configuration.updater.TaskExecutorImpl; -import org.apache.qpid.server.logging.EventLogger; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.model.BrokerModel; -import org.apache.qpid.server.model.ConfiguredObjectFactoryImpl; -import org.apache.qpid.server.model.SystemConfig; -import org.apache.qpid.server.model.VirtualHostNode; -import org.apache.qpid.server.model.adapter.BrokerAdapter; -import org.apache.qpid.test.utils.QpidTestCase; -import org.apache.qpid.test.utils.TestFileUtils; - -public class DerbyVirtualHostNodeTest extends QpidTestCase -{ - private TaskExecutor _taskExecutor; - private File _workDir; - private Broker<BrokerAdapter> _broker; - - @Override - public void setUp() throws Exception - { - super.setUp(); - _taskExecutor = new TaskExecutorImpl(); - _taskExecutor.start(); - _workDir = TestFileUtils.createTestDirectory("qpid.work_dir", true); - setTestSystemProperty("qpid.work_dir", _workDir.getAbsolutePath()); - _broker = createBroker(); - } - - public void tearDown() throws Exception - { - try - { - _broker.close(); - } - finally - { - _taskExecutor.stop(); - TestFileUtils.delete(_workDir, true); - super.tearDown(); - } - } - - public void testCreateAndCloseVirtualHostNode() throws Exception - { - String nodeName = getTestName(); - Map<String, Object> nodeData = new HashMap<>(); - nodeData.put(VirtualHostNode.NAME, nodeName); - nodeData.put(VirtualHostNode.TYPE, DerbyVirtualHostNodeImpl.VIRTUAL_HOST_NODE_TYPE); - - VirtualHostNode<?> virtualHostNode = (VirtualHostNode<?>)_broker.createChild(VirtualHostNode.class, nodeData); - virtualHostNode.start(); - virtualHostNode.close(); - } - - - public void testCreateDuplicateVirtualHostNodeAndClose() throws Exception - { - - String nodeName = getTestName(); - Map<String, Object> nodeData = new HashMap<>(); - nodeData.put(VirtualHostNode.NAME, nodeName); - nodeData.put(VirtualHostNode.TYPE, DerbyVirtualHostNodeImpl.VIRTUAL_HOST_NODE_TYPE); - - VirtualHostNode<?> virtualHostNode = (VirtualHostNode<?>)_broker.createChild(VirtualHostNode.class, nodeData); - virtualHostNode.start(); - - try - { - _broker.createChild(VirtualHostNode.class, nodeData); - } - catch(Exception e) - { - assertEquals("Unexpected message", "Child of type " + virtualHostNode.getClass().getSimpleName() + " already exists with name of " + getTestName(), e.getMessage()); - } - virtualHostNode.close(); - } - - public void testOnCreateValidationForFileStorePath() throws Exception - { - File file = new File(_workDir, getTestName()); - file.createNewFile(); - - String nodeName = getTestName(); - Map<String, Object> nodeData = new HashMap<>(); - nodeData.put(VirtualHostNode.NAME, nodeName); - nodeData.put(VirtualHostNode.TYPE, DerbyVirtualHostNodeImpl.VIRTUAL_HOST_NODE_TYPE); - nodeData.put(DerbyVirtualHostNodeImpl.STORE_PATH, file.getAbsolutePath()); - try - { - _broker.createChild(VirtualHostNode.class, nodeData); - fail("Cannot create store for the file store path"); - } - catch(IllegalConfigurationException e) - { - // pass - } - - } - - - public void testOnCreateValidationForNonWritableStorePath() throws Exception - { - if (Files.getFileStore(_workDir.toPath()).supportsFileAttributeView(PosixFileAttributeView.class)) - { - File file = new File(_workDir, getTestName()); - file.mkdirs(); - if (file.setWritable(false, false)) - { - String nodeName = getTestName(); - Map<String, Object> nodeData = new HashMap<>(); - nodeData.put(VirtualHostNode.NAME, nodeName); - nodeData.put(VirtualHostNode.TYPE, DerbyVirtualHostNodeImpl.VIRTUAL_HOST_NODE_TYPE); - nodeData.put(DerbyVirtualHostNodeImpl.STORE_PATH, file.getAbsolutePath()); - try - { - _broker.createChild(VirtualHostNode.class, nodeData); - fail("Cannot create store for the non writable store path"); - } - catch (IllegalConfigurationException e) - { - // pass - } - } - } - } - - private BrokerAdapter createBroker() - { - Map<String, Object> brokerAttributes = Collections.<String, Object>singletonMap(Broker.NAME, "Broker"); - SystemConfig parent = mock(SystemConfig.class); - when(parent.getEventLogger()).thenReturn(new EventLogger()); - when(parent.getCategoryClass()).thenReturn(SystemConfig.class); - when(parent.getTaskExecutor()).thenReturn(_taskExecutor); - when(parent.getChildExecutor()).thenReturn(_taskExecutor); - when(parent.getModel()).thenReturn(BrokerModel.getInstance()); - when(parent.getObjectFactory()).thenReturn(new ConfiguredObjectFactoryImpl(BrokerModel.getInstance())); - BrokerAdapter broker = new BrokerAdapter(brokerAttributes, parent); - broker.start(); - return broker; - } -} |
