From 5f844dee2ebd159f9e793d5130fce1963ff2a5d4 Mon Sep 17 00:00:00 2001 From: zhangliang Date: Tue, 3 Oct 2023 23:14:00 +0800 Subject: [PATCH] Rename StorageUnitMetaData --- .../impl/proxy/ProxyMetaDataInfoExporterTest.java | 4 ++-- .../data/ShardingStatisticsTableCollector.java | 4 ++-- .../database/resource/ResourceMetaData.java | 8 ++++---- ...eUnitMetaData.java => StorageUnitMetaData.java} | 4 ++-- .../builder/GenericSchemaBuilderMaterial.java | 4 ++-- .../ShardingSphereTableDataCollectorUtils.java | 4 ++-- .../infra/metadata/ShardingSphereMetaDataTest.java | 4 ++-- .../driver/DriverExecutionPrepareEngine.java | 6 +++--- .../infra/rewrite/SQLRewriteEntry.java | 4 ++-- .../rewrite/engine/GenericSQLRewriteEngine.java | 4 ++-- .../rewrite/engine/RouteSQLRewriteEngine.java | 4 ++-- .../infra/rewrite/SQLRewriteEntryTest.java | 8 ++++---- .../engine/GenericSQLRewriteEngineTest.java | 6 +++--- .../rewrite/engine/RouteSQLRewriteEngineTest.java | 6 +++--- .../route/engine/impl/PartialSQLRouteExecutor.java | 4 ++-- .../engine/impl/PartialSQLRouteExecutorTest.java | 4 ++-- .../DriverDatabaseConnectionManager.java | 4 ++-- .../core/datasource/ShardingSphereDataSource.java | 8 ++++---- .../DriverDatabaseConnectionManagerTest.java | 12 ++++++------ .../connection/ShardingSphereConnectionTest.java | 4 ++-- .../data/pipeline/cdc/api/impl/CDCJobAPI.java | 4 ++-- .../migration/api/impl/MigrationJobAPI.java | 4 ++-- .../single/route/SingleSQLRouterTest.java | 12 ++++++------ .../transaction/rule/TransactionRuleTest.java | 14 +++++++------- .../mode/manager/ContextManager.java | 4 ++-- .../context/ConfigurationContextManager.java | 6 +++--- .../manager/switcher/ResourceSwitchManager.java | 10 +++++----- .../mode/manager/ContextManagerTest.java | 12 ++++++------ .../executor/AbstractDatabaseMetaDataExecutor.java | 4 ++-- .../ral/queryable/ExportStorageNodesExecutor.java | 4 ++-- .../ral/updatable/RefreshTableMetaDataUpdater.java | 4 ++-- .../unit/AlterStorageUnitBackendHandler.java | 6 +++--- .../unit/UnregisterStorageUnitBackendHandler.java | 4 ++-- .../rql/storage/unit/ShowStorageUnitExecutor.java | 8 ++++---- .../proxy/backend/util/ExportUtils.java | 4 ++-- .../YamlDatabaseConfigurationImportExecutor.java | 6 +++--- .../ExportDatabaseConfigurationExecutorTest.java | 10 +++++----- .../ral/queryable/ExportMetaDataExecutorTest.java | 10 +++++----- .../queryable/ExportStorageNodesExecutorTest.java | 14 +++++++------- .../ral/updatable/ImportMetaDataUpdaterTest.java | 12 ++++++------ .../unit/AlterStorageUnitBackendHandlerTest.java | 6 +++--- .../UnregisterStorageUnitBackendHandlerTest.java | 12 ++++++------ .../version/ShardingSphereProxyVersionTest.java | 4 ++-- .../query/MySQLMultiStatementsHandlerTest.java | 4 ++-- .../bind/OpenGaussComBatchBindExecutorTest.java | 4 ++-- ...egatedBatchedStatementsCommandExecutorTest.java | 4 ++-- .../PostgreSQLBatchedStatementsExecutorTest.java | 4 ++-- .../PostgreSQLComDescribeExecutorTest.java | 4 ++-- .../test/it/rewrite/engine/SQLRewriterIT.java | 10 +++++----- 49 files changed, 155 insertions(+), 155 deletions(-) rename infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/unit/{NewStorageUnitMetaData.java => StorageUnitMetaData.java} (87%) diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyMetaDataInfoExporterTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyMetaDataInfoExporterTest.java index cb0050c8136bf..7259baae89f39 100644 --- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyMetaDataInfoExporterTest.java +++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyMetaDataInfoExporterTest.java @@ -25,7 +25,7 @@ import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.metadata.persist.MetaDataPersistService; import org.apache.shardingsphere.mode.manager.ContextManager; @@ -75,7 +75,7 @@ void assertExportWithContextManager() { private ContextManager mockContextManager() { ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS); - when(database.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("ds_0", mock(NewStorageUnitMetaData.class))); + when(database.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("ds_0", mock(StorageUnitMetaData.class))); when(database.getProtocolType()).thenReturn(TypedSPILoader.getService(DatabaseType.class, "FIXTURE")); ShardingSphereMetaData metaData = mock(ShardingSphereMetaData.class); when(metaData.getDatabases()).thenReturn(Collections.singletonMap("sharding_db", database)); diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/metadata/data/ShardingStatisticsTableCollector.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/metadata/data/ShardingStatisticsTableCollector.java index 9ec157c1d60d0..c2f721e6a4b2a 100644 --- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/metadata/data/ShardingStatisticsTableCollector.java +++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/metadata/data/ShardingStatisticsTableCollector.java @@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.database.core.type.DatabaseTypeRegistry; import org.apache.shardingsphere.infra.datanode.DataNode; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable; import org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereRowData; import org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereTableData; @@ -87,7 +87,7 @@ private void collectForShardingStatisticTable(final ShardingSphereDatabase datab } } - private void addTableRowsAndDataLength(final Map metaDataMap, final DataNode dataNode, final List row) throws SQLException { + private void addTableRowsAndDataLength(final Map metaDataMap, final DataNode dataNode, final List row) throws SQLException { DatabaseType databaseType = metaDataMap.get(dataNode.getDataSourceName()).getStorageUnit().getStorageType(); Optional dialectCollector = DatabaseTypedSPILoader.findService(DialectShardingStatisticsTableCollector.class, databaseType); boolean isAppended = false; diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ResourceMetaData.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ResourceMetaData.java index 21c3b189f5687..63aa082230ac0 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ResourceMetaData.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ResourceMetaData.java @@ -26,7 +26,7 @@ import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNode; import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNodeName; import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNodeUtils; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitNodeMapUtils; import javax.sql.DataSource; @@ -45,7 +45,7 @@ public final class ResourceMetaData { private final Map dataSources; - private final Map storageUnitMetaDataMap; + private final Map storageUnitMetaDataMap; public ResourceMetaData(final Map dataSources) { this.dataSources = StorageNodeUtils.getStorageNodeDataSources(dataSources); @@ -58,7 +58,7 @@ public ResourceMetaData(final Map dataSources) { if (!(dataSource instanceof CatalogSwitchableDataSource)) { dataSource = new CatalogSwitchableDataSource(dataSource, entry.getValue().getCatalog(), entry.getValue().getUrl()); } - storageUnitMetaDataMap.put(entry.getKey(), new NewStorageUnitMetaData(null, entry.getValue(), dataSourcePoolPropertiesMap.get(entry.getKey()), dataSource)); + storageUnitMetaDataMap.put(entry.getKey(), new StorageUnitMetaData(null, entry.getValue(), dataSourcePoolPropertiesMap.get(entry.getKey()), dataSource)); } } @@ -71,7 +71,7 @@ public ResourceMetaData(final String databaseName, final Map storageUnitMetaDataMap, + public GenericSchemaBuilderMaterial(final DatabaseType protocolType, final Map storageUnitMetaDataMap, final Collection rules, final ConfigurationProperties props, final String defaultSchemaName) { this(protocolType, storageUnitMetaDataMap.entrySet().stream() .collect(Collectors.toMap(Entry::getKey, entry -> entry.getValue().getStorageUnit().getStorageType(), (oldValue, currentValue) -> oldValue, LinkedHashMap::new)), diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/ShardingSphereTableDataCollectorUtils.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/ShardingSphereTableDataCollectorUtils.java index cd1d63871b006..3ce1aada78a27 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/ShardingSphereTableDataCollectorUtils.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/statistics/collector/ShardingSphereTableDataCollectorUtils.java @@ -20,7 +20,7 @@ import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable; import org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereRowData; @@ -57,7 +57,7 @@ public static Collection collectRowData(final ShardingSph return Collections.emptyList(); } Collection result = new LinkedList<>(); - for (NewStorageUnitMetaData each : database.getResourceMetaData().getStorageUnitMetaDataMap().values()) { + for (StorageUnitMetaData each : database.getResourceMetaData().getStorageUnitMetaDataMap().values()) { try ( Connection connection = each.getDataSource().getConnection(); Statement statement = connection.createStatement(); diff --git a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaDataTest.java b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaDataTest.java index bf5bb79a653b8..e604ce6411b6e 100644 --- a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaDataTest.java +++ b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaDataTest.java @@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNode; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.rule.identifier.type.ResourceHeldRule; import org.apache.shardingsphere.test.fixture.jdbc.MockedDataSource; @@ -90,7 +90,7 @@ private ShardingSphereDatabase mockDatabase(final ResourceMetaData resourceMetaD ShardingSphereDatabase result = mock(ShardingSphereDatabase.class); when(result.getName()).thenReturn("foo_db"); when(result.getResourceMetaData()).thenReturn(resourceMetaData); - NewStorageUnitMetaData storageUnitMetaData = new NewStorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), dataSource); + StorageUnitMetaData storageUnitMetaData = new StorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), dataSource); when(result.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("foo_db", storageUnitMetaData)); when(result.getRuleMetaData()).thenReturn(new RuleMetaData(Collections.singleton(databaseResourceHeldRule))); return result; diff --git a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/DriverExecutionPrepareEngine.java b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/DriverExecutionPrepareEngine.java index 66b2ebc204d70..ce4a9e3b9a038 100644 --- a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/DriverExecutionPrepareEngine.java +++ b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/DriverExecutionPrepareEngine.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.executor.sql.execute.engine.ConnectionMode; import org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.DriverExecutionUnit; import org.apache.shardingsphere.infra.executor.sql.prepare.AbstractExecutionPrepareEngine; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.rule.ShardingSphereRule; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; @@ -55,11 +55,11 @@ public final class DriverExecutionPrepareEngine @SuppressWarnings("rawtypes") private final SQLExecutionUnitBuilder sqlExecutionUnitBuilder; - private final Map storageUnitMetaDataMap; + private final Map storageUnitMetaDataMap; public DriverExecutionPrepareEngine(final String type, final int maxConnectionsSizePerQuery, final DatabaseConnectionManager databaseConnectionManager, final ExecutorStatementManager statementManager, final StorageResourceOption option, final Collection rules, - final Map storageUnitMetaDataMap) { + final Map storageUnitMetaDataMap) { super(maxConnectionsSizePerQuery, rules); this.databaseConnectionManager = databaseConnectionManager; this.statementManager = statementManager; diff --git a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/SQLRewriteEntry.java b/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/SQLRewriteEntry.java index a7d6e943abfd0..22c1f74610919 100644 --- a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/SQLRewriteEntry.java +++ b/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/SQLRewriteEntry.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.hint.HintValueContext; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.rewrite.context.SQLRewriteContext; import org.apache.shardingsphere.infra.rewrite.context.SQLRewriteContextDecorator; @@ -77,7 +77,7 @@ public SQLRewriteResult rewrite(final String sql, final List params, fin SQLRewriteContext sqlRewriteContext = createSQLRewriteContext(sql, params, sqlStatementContext, routeContext, connectionContext, hintValueContext); SQLTranslatorRule rule = globalRuleMetaData.getSingleRule(SQLTranslatorRule.class); DatabaseType protocolType = database.getProtocolType(); - Map storageUnitMetaDataMap = database.getResourceMetaData().getStorageUnitMetaDataMap(); + Map storageUnitMetaDataMap = database.getResourceMetaData().getStorageUnitMetaDataMap(); return routeContext.getRouteUnits().isEmpty() ? new GenericSQLRewriteEngine(rule, protocolType, storageUnitMetaDataMap).rewrite(sqlRewriteContext) : new RouteSQLRewriteEngine(rule, protocolType, storageUnitMetaDataMap).rewrite(sqlRewriteContext, routeContext); diff --git a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/engine/GenericSQLRewriteEngine.java b/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/engine/GenericSQLRewriteEngine.java index fed6844ab0908..992552ae630be 100644 --- a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/engine/GenericSQLRewriteEngine.java +++ b/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/engine/GenericSQLRewriteEngine.java @@ -19,7 +19,7 @@ import lombok.RequiredArgsConstructor; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.rewrite.context.SQLRewriteContext; import org.apache.shardingsphere.infra.rewrite.engine.result.GenericSQLRewriteResult; import org.apache.shardingsphere.infra.rewrite.engine.result.SQLRewriteUnit; @@ -38,7 +38,7 @@ public final class GenericSQLRewriteEngine { private final DatabaseType protocolType; - private final Map storageUnitMetaDataMap; + private final Map storageUnitMetaDataMap; /** * Rewrite SQL and parameters. diff --git a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/engine/RouteSQLRewriteEngine.java b/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/engine/RouteSQLRewriteEngine.java index 2f74bd8543787..7fbe66c41f686 100644 --- a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/engine/RouteSQLRewriteEngine.java +++ b/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/engine/RouteSQLRewriteEngine.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.infra.binder.context.statement.dml.SelectStatementContext; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.datanode.DataNode; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.rewrite.context.SQLRewriteContext; import org.apache.shardingsphere.infra.rewrite.engine.result.RouteSQLRewriteResult; import org.apache.shardingsphere.infra.rewrite.engine.result.SQLRewriteUnit; @@ -54,7 +54,7 @@ public final class RouteSQLRewriteEngine { private final DatabaseType protocolType; - private final Map storageUnitMetaDataMap; + private final Map storageUnitMetaDataMap; /** * Rewrite SQL and parameters. diff --git a/infra/rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/SQLRewriteEntryTest.java b/infra/rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/SQLRewriteEntryTest.java index 95494b98b0d91..eab21840bc6ee 100644 --- a/infra/rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/SQLRewriteEntryTest.java +++ b/infra/rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/SQLRewriteEntryTest.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.hint.HintValueContext; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; @@ -88,10 +88,10 @@ private ResourceMetaData mockResourceMetaData() { when(storageUnit1.getStorageType()).thenReturn(TypedSPILoader.getService(DatabaseType.class, "H2")); StorageUnit storageUnit2 = mock(StorageUnit.class); when(storageUnit2.getStorageType()).thenReturn(TypedSPILoader.getService(DatabaseType.class, "MySQL")); - Map metaDataMap = new LinkedHashMap<>(2, 1F); - NewStorageUnitMetaData storageUnitMetaData1 = mock(NewStorageUnitMetaData.class); + Map metaDataMap = new LinkedHashMap<>(2, 1F); + StorageUnitMetaData storageUnitMetaData1 = mock(StorageUnitMetaData.class); when(storageUnitMetaData1.getStorageUnit()).thenReturn(storageUnit1); - NewStorageUnitMetaData storageUnitMetaData2 = mock(NewStorageUnitMetaData.class); + StorageUnitMetaData storageUnitMetaData2 = mock(StorageUnitMetaData.class); when(storageUnitMetaData2.getStorageUnit()).thenReturn(storageUnit2); metaDataMap.put("ds_0", storageUnitMetaData1); metaDataMap.put("ds_1", storageUnitMetaData2); diff --git a/infra/rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/engine/GenericSQLRewriteEngineTest.java b/infra/rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/engine/GenericSQLRewriteEngineTest.java index 5eede96db7390..1aab869aca0f8 100644 --- a/infra/rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/engine/GenericSQLRewriteEngineTest.java +++ b/infra/rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/engine/GenericSQLRewriteEngineTest.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.hint.HintValueContext; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.rewrite.context.SQLRewriteContext; import org.apache.shardingsphere.infra.rewrite.engine.result.GenericSQLRewriteResult; @@ -63,8 +63,8 @@ void assertRewriteStorageTypeIsEmpty() { assertThat(actual.getSqlRewriteUnit().getParameters(), is(Collections.emptyList())); } - private Map mockStorageUnitMetaData(final DatabaseType databaseType) { - NewStorageUnitMetaData result = mock(NewStorageUnitMetaData.class, RETURNS_DEEP_STUBS); + private Map mockStorageUnitMetaData(final DatabaseType databaseType) { + StorageUnitMetaData result = mock(StorageUnitMetaData.class, RETURNS_DEEP_STUBS); when(result.getStorageUnit().getStorageType()).thenReturn(databaseType); return Collections.singletonMap("ds_0", result); } diff --git a/infra/rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/engine/RouteSQLRewriteEngineTest.java b/infra/rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/engine/RouteSQLRewriteEngineTest.java index d442e855a7136..765d82ac50ff2 100644 --- a/infra/rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/engine/RouteSQLRewriteEngineTest.java +++ b/infra/rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/engine/RouteSQLRewriteEngineTest.java @@ -26,7 +26,7 @@ import org.apache.shardingsphere.infra.datanode.DataNode; import org.apache.shardingsphere.infra.hint.HintValueContext; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.rewrite.context.SQLRewriteContext; import org.apache.shardingsphere.infra.rewrite.engine.result.RouteSQLRewriteResult; @@ -176,8 +176,8 @@ private ShardingSphereDatabase mockDatabase() { return result; } - private Map mockStorageUnitMetaData(final DatabaseType databaseType) { - NewStorageUnitMetaData result = mock(NewStorageUnitMetaData.class, RETURNS_DEEP_STUBS); + private Map mockStorageUnitMetaData(final DatabaseType databaseType) { + StorageUnitMetaData result = mock(StorageUnitMetaData.class, RETURNS_DEEP_STUBS); when(result.getStorageUnit().getStorageType()).thenReturn(databaseType); return Collections.singletonMap("ds_0", result); } diff --git a/infra/route/src/main/java/org/apache/shardingsphere/infra/route/engine/impl/PartialSQLRouteExecutor.java b/infra/route/src/main/java/org/apache/shardingsphere/infra/route/engine/impl/PartialSQLRouteExecutor.java index 9ec7bb57fa80d..b4c5a4a75c697 100644 --- a/infra/route/src/main/java/org/apache/shardingsphere/infra/route/engine/impl/PartialSQLRouteExecutor.java +++ b/infra/route/src/main/java/org/apache/shardingsphere/infra/route/engine/impl/PartialSQLRouteExecutor.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.infra.hint.HintValueContext; import org.apache.shardingsphere.infra.hint.SQLHintDataSourceNotExistsException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.route.SQLRouter; import org.apache.shardingsphere.infra.route.context.RouteContext; @@ -78,7 +78,7 @@ public RouteContext route(final ConnectionContext connectionContext, final Query return result; } - private Optional findDataSourceByHint(final HintValueContext hintValueContext, final Map metaDataMap) { + private Optional findDataSourceByHint(final HintValueContext hintValueContext, final Map metaDataMap) { Optional result = HintManager.isInstantiated() && HintManager.getDataSourceName().isPresent() ? HintManager.getDataSourceName() : hintValueContext.findHintDataSourceName(); if (result.isPresent() && !metaDataMap.containsKey(result.get())) { throw new SQLHintDataSourceNotExistsException(result.get()); diff --git a/infra/route/src/test/java/org/apache/shardingsphere/infra/route/engine/impl/PartialSQLRouteExecutorTest.java b/infra/route/src/test/java/org/apache/shardingsphere/infra/route/engine/impl/PartialSQLRouteExecutorTest.java index d3f871b8d5ad1..ba236063fd2a9 100644 --- a/infra/route/src/test/java/org/apache/shardingsphere/infra/route/engine/impl/PartialSQLRouteExecutorTest.java +++ b/infra/route/src/test/java/org/apache/shardingsphere/infra/route/engine/impl/PartialSQLRouteExecutorTest.java @@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.hint.HintValueContext; import org.apache.shardingsphere.infra.hint.SQLHintDataSourceNotExistsException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.route.context.RouteContext; import org.apache.shardingsphere.infra.session.connection.ConnectionContext; @@ -65,7 +65,7 @@ class PartialSQLRouteExecutorTest { @BeforeEach void setup() { - Map metaDataMap = new HashMap<>(); + Map metaDataMap = new HashMap<>(); metaDataMap.put("ds_0", null); metaDataMap.put("ds_1", null); when(database.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(metaDataMap); diff --git a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/DriverDatabaseConnectionManager.java b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/DriverDatabaseConnectionManager.java index ea8fa3130d6a7..307d0e61fb678 100644 --- a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/DriverDatabaseConnectionManager.java +++ b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/DriverDatabaseConnectionManager.java @@ -33,7 +33,7 @@ import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData; import org.apache.shardingsphere.infra.instance.metadata.InstanceType; import org.apache.shardingsphere.infra.instance.metadata.proxy.ProxyInstanceMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser; import org.apache.shardingsphere.infra.session.connection.ConnectionContext; import org.apache.shardingsphere.infra.session.connection.transaction.TransactionConnectionContext; @@ -89,7 +89,7 @@ public final class DriverDatabaseConnectionManager implements DatabaseConnection private final String databaseName; public DriverDatabaseConnectionManager(final String databaseName, final ContextManager contextManager) { - for (Entry entry : contextManager.getStorageUnitMetaDataMap(databaseName).entrySet()) { + for (Entry entry : contextManager.getStorageUnitMetaDataMap(databaseName).entrySet()) { DataSource dataSource = entry.getValue().getDataSource(); String cacheKey = getKey(databaseName, entry.getKey()); dataSourceMap.put(cacheKey, dataSource); diff --git a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/datasource/ShardingSphereDataSource.java b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/datasource/ShardingSphereDataSource.java index 390da85e974aa..8306082a3759d 100644 --- a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/datasource/ShardingSphereDataSource.java +++ b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/datasource/ShardingSphereDataSource.java @@ -26,7 +26,7 @@ import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData; import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaDataBuilder; import org.apache.shardingsphere.infra.instance.metadata.InstanceType; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.mode.manager.ContextManager; @@ -102,7 +102,7 @@ public Connection getConnection(final String username, final String password) { @Override public void close() throws SQLException { contextManagerDestroyedCallback(databaseName); - for (NewStorageUnitMetaData each : contextManager.getStorageUnitMetaDataMap(databaseName).values()) { + for (StorageUnitMetaData each : contextManager.getStorageUnitMetaDataMap(databaseName).values()) { close(each.getDataSource()); } contextManager.close(); @@ -133,13 +133,13 @@ private void contextManagerDestroyedCallback(final String databaseName) { @Override public int getLoginTimeout() throws SQLException { - Map metaDataMap = contextManager.getStorageUnitMetaDataMap(databaseName); + Map metaDataMap = contextManager.getStorageUnitMetaDataMap(databaseName); return metaDataMap.isEmpty() ? 0 : metaDataMap.values().iterator().next().getDataSource().getLoginTimeout(); } @Override public void setLoginTimeout(final int seconds) throws SQLException { - for (NewStorageUnitMetaData each : contextManager.getStorageUnitMetaDataMap(databaseName).values()) { + for (StorageUnitMetaData each : contextManager.getStorageUnitMetaDataMap(databaseName).values()) { each.getDataSource().setLoginTimeout(seconds); } } diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/connection/DriverDatabaseConnectionManagerTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/connection/DriverDatabaseConnectionManagerTest.java index 432cfa3e3078d..9123b85c61895 100644 --- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/connection/DriverDatabaseConnectionManagerTest.java +++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/connection/DriverDatabaseConnectionManagerTest.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.executor.sql.execute.engine.ConnectionMode; import org.apache.shardingsphere.infra.instance.metadata.InstanceType; import org.apache.shardingsphere.infra.instance.metadata.proxy.ProxyInstanceMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser; @@ -76,7 +76,7 @@ void setUp() throws SQLException { private ContextManager mockContextManager() throws SQLException { ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); - Map metaDataMap = mockStorageUnitMetaDataMap(); + Map metaDataMap = mockStorageUnitMetaDataMap(); when(result.getStorageUnitMetaDataMap(DefaultDatabase.LOGIC_NAME)).thenReturn(metaDataMap); MetaDataPersistService persistService = mockMetaDataPersistService(); when(result.getMetaDataContexts().getPersistService()).thenReturn(persistService); @@ -89,8 +89,8 @@ private ContextManager mockContextManager() throws SQLException { return result; } - private Map mockStorageUnitMetaDataMap() throws SQLException { - Map result = new HashMap<>(2, 1F); + private Map mockStorageUnitMetaDataMap() throws SQLException { + Map result = new HashMap<>(2, 1F); result.put("ds", mockStorageUnitMetaData(new MockedDataSource())); DataSource invalidDataSource = mock(DataSource.class); when(invalidDataSource.getConnection()).thenThrow(new SQLException()); @@ -98,8 +98,8 @@ private Map mockStorageUnitMetaDataMap() throws return result; } - private NewStorageUnitMetaData mockStorageUnitMetaData(final DataSource dataSource) { - NewStorageUnitMetaData result = mock(NewStorageUnitMetaData.class, RETURNS_DEEP_STUBS); + private StorageUnitMetaData mockStorageUnitMetaData(final DataSource dataSource) { + StorageUnitMetaData result = mock(StorageUnitMetaData.class, RETURNS_DEEP_STUBS); when(result.getDataSource()).thenReturn(dataSource); StorageUnit storageUnit = mock(StorageUnit.class); when(result.getStorageUnit()).thenReturn(storageUnit); diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/connection/ShardingSphereConnectionTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/connection/ShardingSphereConnectionTest.java index 25fbddc4ec64c..95fb177e82086 100644 --- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/connection/ShardingSphereConnectionTest.java +++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/connection/ShardingSphereConnectionTest.java @@ -20,7 +20,7 @@ import lombok.SneakyThrows; import org.apache.shardingsphere.infra.database.core.DefaultDatabase; import org.apache.shardingsphere.infra.executor.sql.execute.engine.ConnectionMode; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.session.connection.ConnectionContext; @@ -253,7 +253,7 @@ private ContextManager mockContextManager() { private ContextManager mockContextManager(final StorageUnit storageUnit) { ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); - NewStorageUnitMetaData storageUnitMetaData = mock(NewStorageUnitMetaData.class); + StorageUnitMetaData storageUnitMetaData = mock(StorageUnitMetaData.class); when(storageUnitMetaData.getStorageUnit()).thenReturn(storageUnit); DataSource dataSource = storageUnit.getDataSource(); when(storageUnitMetaData.getDataSource()).thenReturn(dataSource); diff --git a/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/api/impl/CDCJobAPI.java b/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/api/impl/CDCJobAPI.java index 0265ee76082b5..483804731052c 100644 --- a/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/api/impl/CDCJobAPI.java +++ b/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/api/impl/CDCJobAPI.java @@ -78,7 +78,7 @@ import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.util.yaml.YamlEngine; import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration; import org.apache.shardingsphere.infra.yaml.config.swapper.resource.YamlDataSourceConfigurationSwapper; @@ -160,7 +160,7 @@ private YamlCDCJobConfiguration getYamlCDCJobConfiguration(final StreamDataParam private ShardingSpherePipelineDataSourceConfiguration getDataSourceConfiguration(final ShardingSphereDatabase database) { Map> dataSourcePoolProps = new HashMap<>(); - for (Entry entry : database.getResourceMetaData().getStorageUnitMetaDataMap().entrySet()) { + for (Entry entry : database.getResourceMetaData().getStorageUnitMetaDataMap().entrySet()) { dataSourcePoolProps.put(entry.getKey(), dataSourceConfigSwapper.swapToMap(entry.getValue().getDataSourcePoolProperties())); } YamlRootConfiguration targetRootConfig = new YamlRootConfiguration(); diff --git a/kernel/data-pipeline/scenario/migration/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/impl/MigrationJobAPI.java b/kernel/data-pipeline/scenario/migration/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/impl/MigrationJobAPI.java index 10bef742cb049..a162586fdf17d 100644 --- a/kernel/data-pipeline/scenario/migration/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/impl/MigrationJobAPI.java +++ b/kernel/data-pipeline/scenario/migration/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/impl/MigrationJobAPI.java @@ -85,7 +85,7 @@ import org.apache.shardingsphere.infra.datasource.pool.props.domain.DataSourcePoolProperties; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.infra.util.json.JsonUtils; import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration; @@ -191,7 +191,7 @@ private YamlPipelineDataSourceConfiguration buildYamlPipelineDataSourceConfigura private PipelineDataSourceConfiguration buildTargetPipelineDataSourceConfiguration(final ShardingSphereDatabase targetDatabase) { Map> targetPoolProps = new HashMap<>(); YamlDataSourceConfigurationSwapper dataSourceConfigSwapper = new YamlDataSourceConfigurationSwapper(); - for (Entry entry : targetDatabase.getResourceMetaData().getStorageUnitMetaDataMap().entrySet()) { + for (Entry entry : targetDatabase.getResourceMetaData().getStorageUnitMetaDataMap().entrySet()) { targetPoolProps.put(entry.getKey(), dataSourceConfigSwapper.swapToMap(entry.getValue().getDataSourcePoolProperties())); } YamlRootConfiguration targetRootConfig = buildYamlRootConfiguration(targetDatabase.getName(), targetPoolProps, targetDatabase.getRuleMetaData().getConfigurations()); diff --git a/kernel/single/core/src/test/java/org/apache/shardingsphere/single/route/SingleSQLRouterTest.java b/kernel/single/core/src/test/java/org/apache/shardingsphere/single/route/SingleSQLRouterTest.java index 9482691e4ea54..cdbe185717246 100644 --- a/kernel/single/core/src/test/java/org/apache/shardingsphere/single/route/SingleSQLRouterTest.java +++ b/kernel/single/core/src/test/java/org/apache/shardingsphere/single/route/SingleSQLRouterTest.java @@ -26,7 +26,7 @@ import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNode; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.route.SQLRouter; @@ -85,7 +85,7 @@ void assertCreateRouteContextWithSingleDataSource() throws SQLException { private ShardingSphereDatabase mockSingleDatabase() { ShardingSphereDatabase result = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS); - when(result.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("foo_ds", mock(NewStorageUnitMetaData.class))); + when(result.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("foo_ds", mock(StorageUnitMetaData.class))); return result; } @@ -107,7 +107,7 @@ void assertCreateRouteContextWithReadwriteSplittingDataSource() throws SQLExcept private ShardingSphereDatabase mockReadwriteSplittingDatabase() { ShardingSphereDatabase result = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS); when(result.getName()).thenReturn(" db_schema"); - when(result.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("write_ds", mock(NewStorageUnitMetaData.class))); + when(result.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("write_ds", mock(StorageUnitMetaData.class))); return result; } @@ -148,9 +148,9 @@ private DataNode createDataNode(final String dataSourceName) { private ShardingSphereDatabase mockDatabaseWithMultipleResources() { ShardingSphereDatabase result = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS); - Map metaDataMap = new HashMap<>(2, 1F); - metaDataMap.put("ds_0", new NewStorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource())); - metaDataMap.put("ds_1", new NewStorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource())); + Map metaDataMap = new HashMap<>(2, 1F); + metaDataMap.put("ds_0", new StorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource())); + metaDataMap.put("ds_1", new StorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource())); when(result.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(metaDataMap); when(result.getName()).thenReturn(DefaultDatabase.LOGIC_NAME); ShardingSphereSchema schema = mock(ShardingSphereSchema.class); diff --git a/kernel/transaction/core/src/test/java/org/apache/shardingsphere/transaction/rule/TransactionRuleTest.java b/kernel/transaction/core/src/test/java/org/apache/shardingsphere/transaction/rule/TransactionRuleTest.java index 31b6b9682fcc6..1a53301b0c970 100644 --- a/kernel/transaction/core/src/test/java/org/apache/shardingsphere/transaction/rule/TransactionRuleTest.java +++ b/kernel/transaction/core/src/test/java/org/apache/shardingsphere/transaction/rule/TransactionRuleTest.java @@ -21,7 +21,7 @@ import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNode; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.test.fixture.jdbc.MockedDataSource; import org.apache.shardingsphere.transaction.api.TransactionType; import org.apache.shardingsphere.transaction.config.TransactionRuleConfiguration; @@ -99,9 +99,9 @@ private ShardingSphereDatabase createDatabase() { private ResourceMetaData createResourceMetaData() { ResourceMetaData result = mock(ResourceMetaData.class, RETURNS_DEEP_STUBS); - Map metaDataMap = new HashMap<>(2, 1F); - metaDataMap.put("ds_0", new NewStorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource())); - metaDataMap.put("ds_1", new NewStorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource())); + Map metaDataMap = new HashMap<>(2, 1F); + metaDataMap.put("ds_0", new StorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource())); + metaDataMap.put("ds_1", new StorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource())); when(result.getStorageUnitMetaDataMap()).thenReturn(metaDataMap); return result; } @@ -116,9 +116,9 @@ private ShardingSphereDatabase createAddDatabase() { private ResourceMetaData createAddResourceMetaData() { ResourceMetaData result = mock(ResourceMetaData.class, RETURNS_DEEP_STUBS); - Map metaDataMap = new HashMap<>(2, 1F); - metaDataMap.put("ds_0", new NewStorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource())); - metaDataMap.put("ds_1", new NewStorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource())); + Map metaDataMap = new HashMap<>(2, 1F); + metaDataMap.put("ds_0", new StorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource())); + metaDataMap.put("ds_1", new StorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource())); when(result.getStorageUnitMetaDataMap()).thenReturn(metaDataMap); return result; } diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java index ead8599eb4451..d1849567cb1b6 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java @@ -27,7 +27,7 @@ import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.SchemaManager; @@ -105,7 +105,7 @@ public synchronized void renewMetaDataContexts(final MetaDataContexts metaDataCo * @param databaseName database name * @return storage unit meta data map */ - public Map getStorageUnitMetaDataMap(final String databaseName) { + public Map getStorageUnitMetaDataMap(final String databaseName) { return metaDataContexts.get().getMetaData().getDatabase(databaseName).getResourceMetaData().getStorageUnitMetaDataMap(); } diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/context/ConfigurationContextManager.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/context/ConfigurationContextManager.java index 0db3fe1a5293c..dcafee869f5ec 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/context/ConfigurationContextManager.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/context/ConfigurationContextManager.java @@ -32,7 +32,7 @@ import org.apache.shardingsphere.infra.metadata.database.resource.StorageResource; import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNode; import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNodeName; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.SchemaManager; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; @@ -296,9 +296,9 @@ private Map getNewStorageNodes(final Map getNewStorageUnitNodeMap(final Map currentStorageUnitMetaDataMap, final SwitchingResource resource) { + private Map getNewStorageUnitNodeMap(final Map currentStorageUnitMetaDataMap, final SwitchingResource resource) { Map result = new LinkedHashMap<>(currentStorageUnitMetaDataMap.size(), 1F); - for (Entry entry : currentStorageUnitMetaDataMap.entrySet()) { + for (Entry entry : currentStorageUnitMetaDataMap.entrySet()) { if (!resource.getStaleStorageResource().getStorageUnitNodeMap().containsKey(entry.getKey())) { result.put(entry.getKey(), entry.getValue().getStorageNode()); } diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/switcher/ResourceSwitchManager.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/switcher/ResourceSwitchManager.java index f10156f58ef34..205385a0cbb56 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/switcher/ResourceSwitchManager.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/switcher/ResourceSwitchManager.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.metadata.database.resource.StorageResource; import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNode; import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNodeName; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitNodeMapUtils; import javax.sql.DataSource; @@ -197,9 +197,9 @@ private Map getToBeDeletedDataSources(final Map getToBeDeletedStorageUnitNodeMap(final Map storageUnitMetaDataMap, final Collection toBeChangedStorageUnitNames) { + private Map getToBeDeletedStorageUnitNodeMap(final Map storageUnitMetaDataMap, final Collection toBeChangedStorageUnitNames) { Map result = new LinkedHashMap<>(storageUnitMetaDataMap.size(), 1F); - for (Entry entry : storageUnitMetaDataMap.entrySet()) { + for (Entry entry : storageUnitMetaDataMap.entrySet()) { if (!toBeChangedStorageUnitNames.contains(entry.getKey())) { result.put(entry.getKey(), entry.getValue().getStorageNode()); } @@ -207,12 +207,12 @@ private Map getToBeDeletedStorageUnitNodeMap(final Map getChangedStorageUnitNodeMap(final Map storageUnitMetaDataMap, final Map toBeChangedStorageUnitNodeMap) { + private Map getChangedStorageUnitNodeMap(final Map storageUnitMetaDataMap, final Map toBeChangedStorageUnitNodeMap) { return toBeChangedStorageUnitNodeMap.entrySet().stream().filter(entry -> isModifiedStorageUnitNodeMap(storageUnitMetaDataMap, entry.getKey(), entry.getValue())) .collect(Collectors.toMap(Entry::getKey, Entry::getValue, (oldValue, currentValue) -> oldValue, LinkedHashMap::new)); } - private boolean isModifiedStorageUnitNodeMap(final Map originalstorageUnitMetaDataMap, + private boolean isModifiedStorageUnitNodeMap(final Map originalstorageUnitMetaDataMap, final String dataSourceName, final StorageNode storageNode) { return originalstorageUnitMetaDataMap.containsKey(dataSourceName) && !storageNode.equals(originalstorageUnitMetaDataMap.get(dataSourceName).getStorageNode()); } diff --git a/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerTest.java b/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerTest.java index e4831acab114b..b6a29531c9174 100644 --- a/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerTest.java +++ b/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerTest.java @@ -31,7 +31,7 @@ import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNode; import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNodeName; import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNodeUtils; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitNodeMapUtils; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn; @@ -104,11 +104,11 @@ private ShardingSphereDatabase mockDatabase() { when(mutableDataNodeRule.findTableDataNode("foo_schema", "foo_tbl")).thenReturn(Optional.of(mock(DataNode.class))); when(result.getRuleMetaData()).thenReturn(new RuleMetaData(Collections.singleton(mutableDataNodeRule))); when(result.getSchemas()).thenReturn(new HashMap<>(Collections.singletonMap("foo_schema", new ShardingSphereSchema()))); - NewStorageUnitMetaData storageUnitMetaData = mock(NewStorageUnitMetaData.class, RETURNS_DEEP_STUBS); + StorageUnitMetaData storageUnitMetaData = mock(StorageUnitMetaData.class, RETURNS_DEEP_STUBS); when(storageUnitMetaData.getStorageUnit().getStorageType()).thenReturn(TypedSPILoader.getService(DatabaseType.class, "FIXTURE")); when(result.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("foo_ds", storageUnitMetaData)); - Map metaDataMap = Collections.singletonMap("foo_ds", - new NewStorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource())); + Map metaDataMap = Collections.singletonMap("foo_ds", + new StorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource())); when(result.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(metaDataMap); return result; } @@ -254,9 +254,9 @@ private ResourceMetaData createOriginalResource() { originalDataSources.put("ds_2", new MockedDataSource()); Map storageNodeDataSourceMap = StorageNodeUtils.getStorageNodeDataSources(originalDataSources); Map storageUnitNodeMap = StorageUnitNodeMapUtils.fromDataSources(originalDataSources); - Map metaDataMap = new LinkedHashMap<>(2, 1F); + Map metaDataMap = new LinkedHashMap<>(2, 1F); for (Entry entry : storageUnitNodeMap.entrySet()) { - metaDataMap.put(entry.getKey(), new NewStorageUnitMetaData( + metaDataMap.put(entry.getKey(), new StorageUnitMetaData( "foo_db", storageUnitNodeMap.get(entry.getKey()), mock(DataSourcePoolProperties.class), storageNodeDataSourceMap.get(entry.getValue().getName()))); } ResourceMetaData result = mock(ResourceMetaData.class, RETURNS_DEEP_STUBS); diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/executor/AbstractDatabaseMetaDataExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/executor/AbstractDatabaseMetaDataExecutor.java index 1441417791b6c..b7f2e16228bde 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/executor/AbstractDatabaseMetaDataExecutor.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/executor/AbstractDatabaseMetaDataExecutor.java @@ -31,7 +31,7 @@ import org.apache.shardingsphere.infra.merge.result.MergedResult; import org.apache.shardingsphere.infra.merge.result.impl.transparent.TransparentMergedResult; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.user.Grantee; import org.apache.shardingsphere.proxy.backend.context.ProxyContext; import org.apache.shardingsphere.proxy.backend.session.ConnectionSession; @@ -160,7 +160,7 @@ protected Collection getDatabaseNames(final ConnectionSession connection @Override protected void processMetaData(final String databaseName, final Consumer callback) throws SQLException { ResourceMetaData resourceMetaData = ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getDatabase(databaseName).getResourceMetaData(); - Optional storageUnitMetaData = resourceMetaData.getStorageUnitMetaDataMap().values().stream().findFirst(); + Optional storageUnitMetaData = resourceMetaData.getStorageUnitMetaDataMap().values().stream().findFirst(); if (!storageUnitMetaData.isPresent()) { return; } diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutor.java index dd1c31b4a9bd3..0f9d8fc0a1ca6 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutor.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutor.java @@ -25,7 +25,7 @@ import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.util.json.JsonUtils; import org.apache.shardingsphere.proxy.backend.context.ProxyContext; import org.apache.shardingsphere.proxy.backend.distsql.export.ExportedStorageNode; @@ -87,7 +87,7 @@ private Map> getAllStorageNodes(final Sh private Map> generateDatabaseExportStorageNodesData(final ShardingSphereDatabase database) { Map storageNodes = new LinkedHashMap<>(); - for (Entry entry : database.getResourceMetaData().getStorageUnitMetaDataMap().entrySet()) { + for (Entry entry : database.getResourceMetaData().getStorageUnitMetaDataMap().entrySet()) { ConnectionProperties connectionProps = database.getResourceMetaData().getConnectionProperties(entry.getKey()); String databaseInstanceIp = getDatabaseInstanceIp(connectionProps); if (storageNodes.containsKey(databaseInstanceIp)) { diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/RefreshTableMetaDataUpdater.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/RefreshTableMetaDataUpdater.java index 7abd6c9f33916..08ea49a23840a 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/RefreshTableMetaDataUpdater.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/RefreshTableMetaDataUpdater.java @@ -25,7 +25,7 @@ import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.dialect.exception.syntax.database.NoDatabaseSelectedException; import org.apache.shardingsphere.infra.exception.dialect.exception.syntax.database.UnknownDatabaseException; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.mode.manager.ContextManager; import org.apache.shardingsphere.proxy.backend.context.ProxyContext; import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.updater.ConnectionSessionRequiredRALUpdater; @@ -60,7 +60,7 @@ public void executeUpdate(final ConnectionSession connectionSession, final Refre } } - private void checkStorageUnitMetaData(final String databaseName, final Map storageUnitMetaDataMap, final RefreshTableMetaDataStatement sqlStatement) { + private void checkStorageUnitMetaData(final String databaseName, final Map storageUnitMetaDataMap, final RefreshTableMetaDataStatement sqlStatement) { ShardingSpherePreconditions.checkState(!storageUnitMetaDataMap.isEmpty(), () -> new EmptyStorageUnitException(databaseName)); if (sqlStatement.getStorageUnitName().isPresent()) { String storageUnitName = sqlStatement.getStorageUnitName().get(); diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/storage/unit/AlterStorageUnitBackendHandler.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/storage/unit/AlterStorageUnitBackendHandler.java index f3a15925442dc..86074f2e642e3 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/storage/unit/AlterStorageUnitBackendHandler.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/storage/unit/AlterStorageUnitBackendHandler.java @@ -34,7 +34,7 @@ import org.apache.shardingsphere.infra.datasource.pool.props.domain.DataSourcePoolProperties; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.core.external.ShardingSphereExternalException; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.proxy.backend.context.ProxyContext; import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader; import org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader; @@ -101,13 +101,13 @@ private Collection getDuplicatedStorageUnitNames(final Collection storageUnitNames) { - Map metaDataMap = ProxyContext.getInstance().getDatabase(databaseName).getResourceMetaData().getStorageUnitMetaDataMap(); + Map metaDataMap = ProxyContext.getInstance().getDatabase(databaseName).getResourceMetaData().getStorageUnitMetaDataMap(); Collection notExistedStorageUnitNames = storageUnitNames.stream().filter(each -> !metaDataMap.containsKey(each)).collect(Collectors.toList()); ShardingSpherePreconditions.checkState(notExistedStorageUnitNames.isEmpty(), () -> new MissingRequiredStorageUnitsException(databaseName, notExistedStorageUnitNames)); } private void checkDatabase(final String databaseName, final AlterStorageUnitStatement sqlStatement) { - Map metaDataMap = ProxyContext.getInstance().getDatabase(databaseName).getResourceMetaData().getStorageUnitMetaDataMap(); + Map metaDataMap = ProxyContext.getInstance().getDatabase(databaseName).getResourceMetaData().getStorageUnitMetaDataMap(); Collection invalidStorageUnitNames = sqlStatement.getStorageUnits().stream().collect(Collectors.toMap(DataSourceSegment::getName, each -> each)).entrySet().stream() .filter(each -> !isIdenticalDatabase(each.getValue(), metaDataMap.get(each.getKey()).getDataSource())).map(Entry::getKey).collect(Collectors.toSet()); ShardingSpherePreconditions.checkState(invalidStorageUnitNames.isEmpty(), diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/storage/unit/UnregisterStorageUnitBackendHandler.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/storage/unit/UnregisterStorageUnitBackendHandler.java index 295e95aea4929..7003636bb0177 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/storage/unit/UnregisterStorageUnitBackendHandler.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/storage/unit/UnregisterStorageUnitBackendHandler.java @@ -25,7 +25,7 @@ import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.core.external.server.ShardingSphereServerException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.proxy.backend.context.ProxyContext; import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader; import org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader; @@ -71,7 +71,7 @@ public void checkSQLStatement(final String databaseName, final UnregisterStorage } private void checkExisted(final String databaseName, final Collection storageUnitNames) { - Map metaDataMap = ProxyContext.getInstance().getDatabase(databaseName).getResourceMetaData().getStorageUnitMetaDataMap(); + Map metaDataMap = ProxyContext.getInstance().getDatabase(databaseName).getResourceMetaData().getStorageUnitMetaDataMap(); Collection notExistedStorageUnits = storageUnitNames.stream().filter(each -> !metaDataMap.containsKey(each)).collect(Collectors.toList()); ShardingSpherePreconditions.checkState(notExistedStorageUnits.isEmpty(), () -> new MissingRequiredStorageUnitsException(databaseName, notExistedStorageUnits)); } diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/storage/unit/ShowStorageUnitExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/storage/unit/ShowStorageUnitExecutor.java index 731f2bbc87fed..4c7eb89236da5 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/storage/unit/ShowStorageUnitExecutor.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/storage/unit/ShowStorageUnitExecutor.java @@ -29,7 +29,7 @@ import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.util.json.JsonUtils; import org.apache.shardingsphere.proxy.backend.util.StorageUnitUtils; @@ -93,12 +93,12 @@ private Map getDataSourcePoolPropertiesMap(fin Map result = new LinkedHashMap<>(database.getResourceMetaData().getStorageUnitMetaDataMap().size(), 1F); Map propsMap = database.getResourceMetaData().getStorageUnitMetaDataMap().entrySet().stream() .collect(Collectors.toMap(Entry::getKey, entry -> entry.getValue().getDataSourcePoolProperties(), (oldValue, currentValue) -> currentValue, LinkedHashMap::new)); - Map metaDataMap = database.getResourceMetaData().getStorageUnitMetaDataMap(); + Map metaDataMap = database.getResourceMetaData().getStorageUnitMetaDataMap(); Optional usageCount = sqlStatement.getUsageCount(); if (usageCount.isPresent()) { Map> inUsedStorageUnits = StorageUnitUtils.getInUsedStorageUnits( database.getRuleMetaData(), database.getResourceMetaData().getStorageUnitMetaDataMap().size()); - for (Entry entry : database.getResourceMetaData().getStorageUnitMetaDataMap().entrySet()) { + for (Entry entry : database.getResourceMetaData().getStorageUnitMetaDataMap().entrySet()) { Integer currentUsageCount = inUsedStorageUnits.containsKey(entry.getKey()) ? inUsedStorageUnits.get(entry.getKey()).size() : 0; if (usageCount.get().equals(currentUsageCount)) { result.put(entry.getKey(), @@ -106,7 +106,7 @@ private Map getDataSourcePoolPropertiesMap(fin } } } else { - for (Entry entry : metaDataMap.entrySet()) { + for (Entry entry : metaDataMap.entrySet()) { result.put(entry.getKey(), getDataSourcePoolProperties(propsMap, entry.getKey(), metaDataMap.get(entry.getKey()).getStorageUnit().getStorageType(), entry.getValue().getDataSource())); } } diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/ExportUtils.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/ExportUtils.java index a6b345b6a4e32..c224c907b45b1 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/ExportUtils.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/ExportUtils.java @@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfiguration; import org.apache.shardingsphere.infra.datasource.pool.props.domain.DataSourcePoolProperties; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader; import org.apache.shardingsphere.infra.util.yaml.YamlEngine; import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper; @@ -88,7 +88,7 @@ private static void appendDataSourceConfigurations(final ShardingSphereDatabase return; } stringBuilder.append("dataSources:").append(System.lineSeparator()); - for (Entry entry : database.getResourceMetaData().getStorageUnitMetaDataMap().entrySet()) { + for (Entry entry : database.getResourceMetaData().getStorageUnitMetaDataMap().entrySet()) { appendDataSourceConfiguration(entry.getKey(), entry.getValue().getDataSourcePoolProperties(), stringBuilder); } } diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java index 3371392943ff8..bab3e6f3a6e44 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java @@ -44,7 +44,7 @@ import org.apache.shardingsphere.infra.instance.InstanceContext; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNode; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitNodeMapUtils; import org.apache.shardingsphere.infra.rule.ShardingSphereRule; import org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration; @@ -160,11 +160,11 @@ private void addResources(final String databaseName, final Map metaDataMap = ProxyContext.getInstance().getContextManager() + Map metaDataMap = ProxyContext.getInstance().getContextManager() .getMetaDataContexts().getMetaData().getDatabase(databaseName).getResourceMetaData().getStorageUnitMetaDataMap(); Map toBeAddedStorageNode = StorageUnitNodeMapUtils.fromDataSourcePoolProperties(propsMap); for (Entry entry : propsMap.entrySet()) { - metaDataMap.put(entry.getKey(), new NewStorageUnitMetaData(databaseName, toBeAddedStorageNode.get(entry.getKey()), entry.getValue(), DataSourcePoolCreator.create(entry.getValue()))); + metaDataMap.put(entry.getKey(), new StorageUnitMetaData(databaseName, toBeAddedStorageNode.get(entry.getKey()), entry.getValue(), DataSourcePoolCreator.create(entry.getValue()))); } } diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationExecutorTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationExecutorTest.java index 5ee23bf4c99c3..96eddf0ed5633 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationExecutorTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationExecutorTest.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.datasource.pool.props.creator.DataSourcePoolPropertiesCreator; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration; import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration; @@ -71,7 +71,7 @@ void assertGetColumns() { @Test void assertExecute() { when(database.getName()).thenReturn("normal_db"); - Map metaDataMap = createStorageUnitMetaDataMap(); + Map metaDataMap = createStorageUnitMetaDataMap(); when(database.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(metaDataMap); when(database.getRuleMetaData().getConfigurations()).thenReturn(Collections.singleton(createShardingRuleConfiguration())); Collection actual = new ExportDatabaseConfigurationExecutor().getRows(database, new ExportDatabaseConfigurationStatement(mock(DatabaseSegment.class), null)); @@ -80,14 +80,14 @@ void assertExecute() { assertThat(row.getCell(1), is(loadExpectedRow())); } - private Map createStorageUnitMetaDataMap() { + private Map createStorageUnitMetaDataMap() { Map propsMap = createDataSourceMap().entrySet().stream() .collect(Collectors.toMap(Entry::getKey, entry -> DataSourcePoolPropertiesCreator.create(entry.getValue()), (oldValue, currentValue) -> oldValue, LinkedHashMap::new)); - Map result = new LinkedHashMap<>(); + Map result = new LinkedHashMap<>(); for (Entry entry : propsMap.entrySet()) { StorageUnit storageUnit = mock(StorageUnit.class); when(storageUnit.getDataSourcePoolProperties()).thenReturn(entry.getValue()); - NewStorageUnitMetaData storageUnitMetaData = mock(NewStorageUnitMetaData.class, RETURNS_DEEP_STUBS); + StorageUnitMetaData storageUnitMetaData = mock(StorageUnitMetaData.class, RETURNS_DEEP_STUBS); when(storageUnitMetaData.getStorageUnit()).thenReturn(storageUnit); when(storageUnitMetaData.getDataSourcePoolProperties()).thenReturn(entry.getValue()); result.put(entry.getKey(), storageUnitMetaData); diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutorTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutorTest.java index 48caab8cfe38c..09d1e77894211 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutorTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutorTest.java @@ -38,7 +38,7 @@ import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.infra.util.eventbus.EventBusContext; @@ -134,7 +134,7 @@ private ContextManager mockEmptyContextManager() { void assertExecute() { when(database.getName()).thenReturn("normal_db"); when(database.getResourceMetaData().getAllInstanceDataSourceNames()).thenReturn(Collections.singleton("empty_metadata")); - Map metaDataMap = createStorageUnitMetaDataMap(); + Map metaDataMap = createStorageUnitMetaDataMap(); when(database.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(metaDataMap); when(database.getRuleMetaData().getConfigurations()).thenReturn(Collections.emptyList()); ContextManager contextManager = mockContextManager(); @@ -147,12 +147,12 @@ void assertExecute() { assertThat(row.getCell(3).toString(), is(loadExpectedRow())); } - private Map createStorageUnitMetaDataMap() { + private Map createStorageUnitMetaDataMap() { Map propsMap = createDataSourceMap().entrySet().stream() .collect(Collectors.toMap(Entry::getKey, entry -> DataSourcePoolPropertiesCreator.create(entry.getValue()), (oldValue, currentValue) -> oldValue, LinkedHashMap::new)); - Map result = new LinkedHashMap<>(); + Map result = new LinkedHashMap<>(); for (Entry entry : propsMap.entrySet()) { - NewStorageUnitMetaData storageUnitMetaData = mock(NewStorageUnitMetaData.class); + StorageUnitMetaData storageUnitMetaData = mock(StorageUnitMetaData.class); when(storageUnitMetaData.getDataSourcePoolProperties()).thenReturn(entry.getValue()); result.put(entry.getKey(), storageUnitMetaData); } diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutorTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutorTest.java index 68e4c1b5e76fa..9904ae0aaca5b 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutorTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutorTest.java @@ -29,7 +29,7 @@ import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; @@ -130,7 +130,7 @@ private ContextManager mockEmptyContextManager() { @Test void assertExecute() { when(database.getName()).thenReturn("normal_db"); - Map metaDataMap = createStorageUnitMetaDataMap(); + Map metaDataMap = createStorageUnitMetaDataMap(); when(database.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(metaDataMap); when(database.getRuleMetaData().getConfigurations()).thenReturn(Collections.singleton(createShardingRuleConfiguration())); ContextManager contextManager = mockContextManager(); @@ -144,7 +144,7 @@ void assertExecute() { @Test void assertExecuteWithDatabaseName() { when(database.getName()).thenReturn("normal_db"); - Map metaDataMap = createStorageUnitMetaDataMap(); + Map metaDataMap = createStorageUnitMetaDataMap(); when(database.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(metaDataMap); when(database.getRuleMetaData().getConfigurations()).thenReturn(Collections.singleton(createShardingRuleConfiguration())); ContextManager contextManager = mockContextManager(); @@ -165,18 +165,18 @@ private ContextManager mockContextManager() { return result; } - private Map createStorageUnitMetaDataMap() { - NewStorageUnitMetaData storageUnitMetaData1 = mock(NewStorageUnitMetaData.class); + private Map createStorageUnitMetaDataMap() { + StorageUnitMetaData storageUnitMetaData1 = mock(StorageUnitMetaData.class); StorageUnit storageUnit1 = createStorageUnit("demo_ds_0"); when(storageUnitMetaData1.getStorageUnit()).thenReturn(storageUnit1); DataSource dataSource1 = storageUnit1.getDataSource(); when(storageUnitMetaData1.getDataSource()).thenReturn(dataSource1); - NewStorageUnitMetaData storageUnitMetaData2 = mock(NewStorageUnitMetaData.class); + StorageUnitMetaData storageUnitMetaData2 = mock(StorageUnitMetaData.class); StorageUnit storageUnit2 = createStorageUnit("demo_ds_1"); when(storageUnitMetaData2.getStorageUnit()).thenReturn(storageUnit2); DataSource dataSource2 = storageUnit2.getDataSource(); when(storageUnitMetaData2.getDataSource()).thenReturn(dataSource2); - Map result = new LinkedHashMap<>(2, 1F); + Map result = new LinkedHashMap<>(2, 1F); result.put("ds_0", storageUnitMetaData1); result.put("ds_1", storageUnitMetaData2); return result; diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportMetaDataUpdaterTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportMetaDataUpdaterTest.java index 124fa95b56c19..988adfaa10858 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportMetaDataUpdaterTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportMetaDataUpdaterTest.java @@ -26,7 +26,7 @@ import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNode; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereIndex; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; @@ -110,7 +110,7 @@ private ContextManager mockContextManager(final String feature) { if (null != feature) { ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS); when(database.getSchema(DefaultDatabase.LOGIC_NAME)).thenReturn(new ShardingSphereSchema(createTableMap(), Collections.emptyMap())); - Map metaDataMap = createStorageUnitMetaDataMap(); + Map metaDataMap = createStorageUnitMetaDataMap(); when(database.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(metaDataMap); when(result.getMetaDataContexts().getMetaData().getDatabases()).thenReturn(Collections.singletonMap(feature, database)); when(result.getMetaDataContexts().getMetaData().getDatabase(feature)).thenReturn(database); @@ -118,10 +118,10 @@ private ContextManager mockContextManager(final String feature) { return result; } - private Map createStorageUnitMetaDataMap() { - Map result = new LinkedHashMap<>(2, 1F); - result.put("ds_0", new NewStorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource())); - result.put("ds_1", new NewStorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource())); + private Map createStorageUnitMetaDataMap() { + Map result = new LinkedHashMap<>(2, 1F); + result.put("ds_0", new StorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource())); + result.put("ds_1", new StorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource())); return result; } diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/storage/unit/AlterStorageUnitBackendHandlerTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/storage/unit/AlterStorageUnitBackendHandlerTest.java index 5475784a9f1f0..72b8cfc236d22 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/storage/unit/AlterStorageUnitBackendHandlerTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/storage/unit/AlterStorageUnitBackendHandlerTest.java @@ -29,7 +29,7 @@ import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.mode.manager.ContextManager; import org.apache.shardingsphere.mode.metadata.MetaDataContexts; @@ -80,7 +80,7 @@ void assertExecute() { when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager); when(ProxyContext.getInstance().getDatabase("foo_db")).thenReturn(database); ResourceMetaData resourceMetaData = mock(ResourceMetaData.class, RETURNS_DEEP_STUBS); - NewStorageUnitMetaData storageUnitMetaData = mock(NewStorageUnitMetaData.class); + StorageUnitMetaData storageUnitMetaData = mock(StorageUnitMetaData.class); when(storageUnitMetaData.getDataSource()).thenReturn(mockHikariDataSource("ds_0")); when(resourceMetaData.getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("ds_0", storageUnitMetaData)); when(database.getResourceMetaData()).thenReturn(resourceMetaData); @@ -107,7 +107,7 @@ void assertExecuteWithAlterDatabase() { when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager); when(ProxyContext.getInstance().getDatabase("foo_db")).thenReturn(database); ResourceMetaData resourceMetaData = mock(ResourceMetaData.class, RETURNS_DEEP_STUBS); - NewStorageUnitMetaData storageUnitMetaData = mock(NewStorageUnitMetaData.class); + StorageUnitMetaData storageUnitMetaData = mock(StorageUnitMetaData.class); when(storageUnitMetaData.getDataSource()).thenReturn(mockHikariDataSource("ds_1")); when(resourceMetaData.getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("ds_0", storageUnitMetaData)); when(database.getResourceMetaData()).thenReturn(resourceMetaData); diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/storage/unit/UnregisterStorageUnitBackendHandlerTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/storage/unit/UnregisterStorageUnitBackendHandlerTest.java index ce4fb9c2592cf..ce92452369544 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/storage/unit/UnregisterStorageUnitBackendHandlerTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/storage/unit/UnregisterStorageUnitBackendHandlerTest.java @@ -27,7 +27,7 @@ import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNode; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.mode.manager.ContextManager; import org.apache.shardingsphere.mode.metadata.MetaDataContexts; @@ -85,7 +85,7 @@ class UnregisterStorageUnitBackendHandlerTest { @BeforeEach void setUp() { resourceMetaData = mock(ResourceMetaData.class, RETURNS_DEEP_STUBS); - NewStorageUnitMetaData storageUnitMetaData = new NewStorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource()); + StorageUnitMetaData storageUnitMetaData = new StorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), new MockedDataSource()); when(resourceMetaData.getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("foo_ds", storageUnitMetaData)); when(database.getResourceMetaData()).thenReturn(resourceMetaData); contextManager = mockContextManager(); @@ -105,7 +105,7 @@ private ContextManager mockContextManager() { @Test void assertExecute() throws SQLException { - NewStorageUnitMetaData storageUnitMetaData = mock(NewStorageUnitMetaData.class); + StorageUnitMetaData storageUnitMetaData = mock(StorageUnitMetaData.class); when(storageUnitMetaData.getDataSource()).thenReturn(new MockedDataSource()); when(resourceMetaData.getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("foo_ds", storageUnitMetaData)); when(database.getResourceMetaData()).thenReturn(resourceMetaData); @@ -125,7 +125,7 @@ void assertStorageUnitNameNotExistedExecute() { void assertStorageUnitNameInUseExecute() { when(database.getRuleMetaData()).thenReturn(new RuleMetaData(Collections.singleton(shadowRule))); when(shadowRule.getDataSourceMapper()).thenReturn(Collections.singletonMap("", Collections.singleton("foo_ds"))); - NewStorageUnitMetaData storageUnitMetaData = mock(NewStorageUnitMetaData.class); + StorageUnitMetaData storageUnitMetaData = mock(StorageUnitMetaData.class); when(storageUnitMetaData.getDataSource()).thenReturn(new MockedDataSource()); when(resourceMetaData.getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("foo_ds", storageUnitMetaData)); when(database.getResourceMetaData()).thenReturn(resourceMetaData); @@ -140,7 +140,7 @@ void assertStorageUnitNameInUseWithoutIgnoreSingleTables() { DataNode dataNode = mock(DataNode.class); when(dataNode.getDataSourceName()).thenReturn("foo_ds"); when(singleRule.getAllDataNodes()).thenReturn(Collections.singletonMap("", Collections.singleton(dataNode))); - NewStorageUnitMetaData storageUnitMetaData = mock(NewStorageUnitMetaData.class); + StorageUnitMetaData storageUnitMetaData = mock(StorageUnitMetaData.class); when(storageUnitMetaData.getDataSource()).thenReturn(new MockedDataSource()); when(resourceMetaData.getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("foo_ds", storageUnitMetaData)); when(database.getResourceMetaData()).thenReturn(resourceMetaData); @@ -154,7 +154,7 @@ void assertStorageUnitNameInUseIgnoreSingleTables() throws SQLException { DataNode dataNode = mock(DataNode.class); when(dataNode.getDataSourceName()).thenReturn("foo_ds"); when(singleRule.getAllDataNodes()).thenReturn(Collections.singletonMap("", Collections.singleton(dataNode))); - NewStorageUnitMetaData storageUnitMetaData = mock(NewStorageUnitMetaData.class); + StorageUnitMetaData storageUnitMetaData = mock(StorageUnitMetaData.class); when(storageUnitMetaData.getDataSource()).thenReturn(new MockedDataSource()); when(resourceMetaData.getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("foo_ds", storageUnitMetaData)); when(database.getResourceMetaData()).thenReturn(resourceMetaData); diff --git a/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/version/ShardingSphereProxyVersionTest.java b/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/version/ShardingSphereProxyVersionTest.java index b9900760a79d9..cd4178533cb4a 100644 --- a/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/version/ShardingSphereProxyVersionTest.java +++ b/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/version/ShardingSphereProxyVersionTest.java @@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNode; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.mode.manager.ContextManager; import org.apache.shardingsphere.proxy.backend.context.ProxyContext; @@ -83,7 +83,7 @@ private ShardingSphereDatabase mockDatabase(final String databaseProductName, fi private ResourceMetaData mockResourceMetaData(final String databaseProductName, final String databaseProductVersion) throws SQLException { ResourceMetaData result = mock(ResourceMetaData.class, RETURNS_DEEP_STUBS); DataSource dataSource = createDataSource(databaseProductName, databaseProductVersion); - NewStorageUnitMetaData storageUnitMetaData = new NewStorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), dataSource); + StorageUnitMetaData storageUnitMetaData = new StorageUnitMetaData("foo_db", mock(StorageNode.class, RETURNS_DEEP_STUBS), mock(DataSourcePoolProperties.class), dataSource); when(result.getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("foo_ds", storageUnitMetaData)); return result; } diff --git a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLMultiStatementsHandlerTest.java b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLMultiStatementsHandlerTest.java index 223e284c88fa7..9d8ec06a38cdb 100644 --- a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLMultiStatementsHandlerTest.java +++ b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLMultiStatementsHandlerTest.java @@ -21,7 +21,7 @@ import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.executor.sql.execute.engine.ConnectionMode; import org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.StatementOption; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable; @@ -105,7 +105,7 @@ private ConnectionSession mockConnectionSession() throws SQLException { private ContextManager mockContextManager() { ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); when(result.getMetaDataContexts().getMetaData().getDatabase("foo_db").getResourceMetaData().getAllInstanceDataSourceNames()).thenReturn(Collections.singletonList("foo_ds")); - NewStorageUnitMetaData storageUnitMetaData = mock(NewStorageUnitMetaData.class, RETURNS_DEEP_STUBS); + StorageUnitMetaData storageUnitMetaData = mock(StorageUnitMetaData.class, RETURNS_DEEP_STUBS); when(storageUnitMetaData.getStorageUnit().getStorageType()).thenReturn(TypedSPILoader.getService(DatabaseType.class, "FIXTURE")); when(result.getMetaDataContexts().getMetaData().getDatabase("foo_db").getResourceMetaData().getStorageUnitMetaDataMap()) .thenReturn(Collections.singletonMap("foo_ds", storageUnitMetaData)); diff --git a/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/command/query/extended/bind/OpenGaussComBatchBindExecutorTest.java b/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/command/query/extended/bind/OpenGaussComBatchBindExecutorTest.java index 9b22f95acbed2..5a08f2d524d9e 100644 --- a/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/command/query/extended/bind/OpenGaussComBatchBindExecutorTest.java +++ b/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/command/query/extended/bind/OpenGaussComBatchBindExecutorTest.java @@ -30,7 +30,7 @@ import org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.StatementOption; import org.apache.shardingsphere.infra.hint.HintValueContext; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn; import org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine; @@ -140,7 +140,7 @@ private ContextManager mockContextManager() { private ShardingSphereDatabase mockDatabase() { ShardingSphereDatabase result = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS); when(result.getResourceMetaData().getAllInstanceDataSourceNames()).thenReturn(Collections.singleton("foo_ds")); - NewStorageUnitMetaData storageUnitMetaData = mock(NewStorageUnitMetaData.class, RETURNS_DEEP_STUBS); + StorageUnitMetaData storageUnitMetaData = mock(StorageUnitMetaData.class, RETURNS_DEEP_STUBS); when(storageUnitMetaData.getStorageUnit().getStorageType()).thenReturn(TypedSPILoader.getService(DatabaseType.class, "openGauss")); when(result.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("foo_ds", storageUnitMetaData)); when(result.getRuleMetaData()).thenReturn(new RuleMetaData(Collections.emptyList())); diff --git a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLAggregatedBatchedStatementsCommandExecutorTest.java b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLAggregatedBatchedStatementsCommandExecutorTest.java index c0e7b3f798d44..56c9b39e35971 100644 --- a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLAggregatedBatchedStatementsCommandExecutorTest.java +++ b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLAggregatedBatchedStatementsCommandExecutorTest.java @@ -35,7 +35,7 @@ import org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.StatementOption; import org.apache.shardingsphere.infra.hint.HintValueContext; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn; import org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine; @@ -158,7 +158,7 @@ private ContextManager mockContextManager() { when(result.getMetaDataContexts().getMetaData().getGlobalRuleMetaData()).thenReturn(globalRuleMetaData); ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS); when(database.getResourceMetaData().getAllInstanceDataSourceNames()).thenReturn(Collections.singletonList("foo_ds")); - NewStorageUnitMetaData storageUnitMetaData = mock(NewStorageUnitMetaData.class, RETURNS_DEEP_STUBS); + StorageUnitMetaData storageUnitMetaData = mock(StorageUnitMetaData.class, RETURNS_DEEP_STUBS); when(storageUnitMetaData.getStorageUnit().getStorageType()).thenReturn(TypedSPILoader.getService(DatabaseType.class, "PostgreSQL")); when(database.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("foo_ds", storageUnitMetaData)); when(database.getRuleMetaData()).thenReturn(new RuleMetaData(Collections.emptyList())); diff --git a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutorTest.java b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutorTest.java index d897e6e836344..f31324877e9b9 100644 --- a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutorTest.java +++ b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutorTest.java @@ -28,7 +28,7 @@ import org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.StatementOption; import org.apache.shardingsphere.infra.hint.HintValueContext; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn; import org.apache.shardingsphere.infra.session.connection.ConnectionContext; @@ -133,7 +133,7 @@ private ContextManager mockContextManager() { when(result.getMetaDataContexts().getMetaData().getProps().getValue(ConfigurationPropertyKey.MAX_CONNECTIONS_SIZE_PER_QUERY)).thenReturn(1); when(result.getMetaDataContexts().getMetaData().getProps().getValue(ConfigurationPropertyKey.SQL_SHOW)).thenReturn(false); ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS); - NewStorageUnitMetaData storageUnitMetaData = mock(NewStorageUnitMetaData.class, RETURNS_DEEP_STUBS); + StorageUnitMetaData storageUnitMetaData = mock(StorageUnitMetaData.class, RETURNS_DEEP_STUBS); when(storageUnitMetaData.getStorageUnit().getStorageType()).thenReturn(TypedSPILoader.getService(DatabaseType.class, "PostgreSQL")); when(database.getResourceMetaData().getStorageUnitMetaDataMap()).thenReturn(Collections.singletonMap("ds_0", storageUnitMetaData)); when(database.getResourceMetaData().getAllInstanceDataSourceNames()).thenReturn(Collections.singletonList("ds_0")); diff --git a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java index 7542b7076b1fa..9f7a4dbaffb8e 100644 --- a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java +++ b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java @@ -36,7 +36,7 @@ import org.apache.shardingsphere.infra.executor.sql.execute.engine.ConnectionMode; import org.apache.shardingsphere.infra.hint.HintValueContext; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; @@ -400,7 +400,7 @@ private ContextManager mockContextManager() { when(schema.getTable(TABLE_NAME)).thenReturn(table); when(schema.getAllColumnNames(TABLE_NAME)).thenReturn(Arrays.asList("id", "k", "c", "pad")); when(result.getMetaDataContexts().getMetaData().getDatabase(DATABASE_NAME).getProtocolType()).thenReturn(TypedSPILoader.getService(DatabaseType.class, "PostgreSQL")); - NewStorageUnitMetaData storageUnitMetaData = mock(NewStorageUnitMetaData.class, RETURNS_DEEP_STUBS); + StorageUnitMetaData storageUnitMetaData = mock(StorageUnitMetaData.class, RETURNS_DEEP_STUBS); when(storageUnitMetaData.getStorageUnit().getStorageType()).thenReturn(TypedSPILoader.getService(DatabaseType.class, "PostgreSQL")); when(result.getMetaDataContexts().getMetaData().getDatabase(DATABASE_NAME).getResourceMetaData().getStorageUnitMetaDataMap()) .thenReturn(Collections.singletonMap("ds_0", storageUnitMetaData)); diff --git a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/engine/SQLRewriterIT.java b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/engine/SQLRewriterIT.java index d3069cd64bc14..d6c4193f6e01c 100644 --- a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/engine/SQLRewriterIT.java +++ b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/engine/SQLRewriterIT.java @@ -33,7 +33,7 @@ import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.unit.NewStorageUnitMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; @@ -121,7 +121,7 @@ private Collection createSQLRewriteUnits(final SQLRewriteEngineT new YamlDataSourceConfigurationSwapper().swapToDataSources(rootConfig.getDataSources()), new YamlRuleConfigurationSwapperEngine().swapToRuleConfigurations(rootConfig.getRules())); mockDataSource(databaseConfig.getDataSources()); DatabaseType databaseType = TypedSPILoader.getService(DatabaseType.class, testParams.getDatabaseType()); - Map metaDataMap = createStorageUnitMetaDataMap(databaseConfig, databaseType); + Map metaDataMap = createStorageUnitMetaDataMap(databaseConfig, databaseType); ResourceMetaData resourceMetaData = mock(ResourceMetaData.class, RETURNS_DEEP_STUBS); when(resourceMetaData.getStorageUnitMetaDataMap()).thenReturn(metaDataMap); String schemaName = new DatabaseTypeRegistry(databaseType).getDefaultSchemaName(DefaultDatabase.LOGIC_NAME); @@ -171,12 +171,12 @@ private Collection createGlobalRules() { return result; } - private Map createStorageUnitMetaDataMap(final DatabaseConfiguration databaseConfig, final DatabaseType databaseType) { - Map result = new LinkedHashMap<>(databaseConfig.getDataSources().size(), 1F); + private Map createStorageUnitMetaDataMap(final DatabaseConfiguration databaseConfig, final DatabaseType databaseType) { + Map result = new LinkedHashMap<>(databaseConfig.getDataSources().size(), 1F); for (Entry entry : databaseConfig.getDataSources().entrySet()) { StorageUnit storageUnit = mock(StorageUnit.class); when(storageUnit.getStorageType()).thenReturn(databaseType); - NewStorageUnitMetaData storageUnitMetaData = mock(NewStorageUnitMetaData.class); + StorageUnitMetaData storageUnitMetaData = mock(StorageUnitMetaData.class); when(storageUnitMetaData.getStorageUnit()).thenReturn(storageUnit); result.put(entry.getKey(), storageUnitMetaData); }