diff --git a/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingJDBCExecutorCallbackAdvice.java b/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingJDBCExecutorCallbackAdvice.java index a0d2353f85170..002e2c45cfc5c 100644 --- a/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingJDBCExecutorCallbackAdvice.java +++ b/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingJDBCExecutorCallbackAdvice.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.database.core.connector.ConnectionProperties; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutionUnit; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import java.lang.reflect.Method; @@ -40,7 +40,7 @@ public abstract class TracingJDBCExecutorCallbackAdvice implements InstanceMe @Override public final void beforeMethod(final TargetAdviceObject target, final Method method, final Object[] args, final String pluginType) { JDBCExecutionUnit executionUnit = (JDBCExecutionUnit) args[0]; - ShardingSphereResourceMetaData resourceMetaData = AgentReflectionUtils.getFieldValue(target, "resourceMetaData"); + ResourceMetaData resourceMetaData = AgentReflectionUtils.getFieldValue(target, "resourceMetaData"); ConnectionProperties connectionProps = resourceMetaData.getConnectionProperties(executionUnit.getExecutionUnit().getDataSourceName()); DatabaseType storageType = resourceMetaData.getStorageType(executionUnit.getExecutionUnit().getDataSourceName()); recordExecuteInfo(RootSpanContext.get(), target, executionUnit, (boolean) args[1], connectionProps, storageType); diff --git a/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryJDBCExecutorCallbackAdviceTest.java b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryJDBCExecutorCallbackAdviceTest.java index 8403d8bbd2e1a..abfc4760df5d8 100644 --- a/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryJDBCExecutorCallbackAdviceTest.java +++ b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryJDBCExecutorCallbackAdviceTest.java @@ -39,7 +39,7 @@ import org.apache.shardingsphere.infra.executor.sql.context.SQLUnit; import org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutionUnit; import org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLSelectStatement; import org.junit.jupiter.api.AfterEach; @@ -95,7 +95,7 @@ private void prepare() { when(connection.getMetaData()).thenReturn(databaseMetaData); when(statement.getConnection()).thenReturn(connection); executionUnit = new JDBCExecutionUnit(new ExecutionUnit(DATA_SOURCE_NAME, new SQLUnit(SQL, Collections.emptyList())), null, statement); - ShardingSphereResourceMetaData resourceMetaData = mock(ShardingSphereResourceMetaData.class); + ResourceMetaData resourceMetaData = mock(ResourceMetaData.class); when(resourceMetaData.getStorageType(DATA_SOURCE_NAME)).thenReturn(TypedSPILoader.getService(DatabaseType.class, "MySQL")); when(resourceMetaData.getConnectionProperties(DATA_SOURCE_NAME)).thenReturn(mock(ConnectionProperties.class)); JDBCExecutorCallback jdbcExecutorCallback = new JDBCExecutorCallbackFixture(TypedSPILoader.getService(DatabaseType.class, "MySQL"), resourceMetaData, new MySQLSelectStatement(), true); diff --git a/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/fixture/JDBCExecutorCallbackFixture.java b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/fixture/JDBCExecutorCallbackFixture.java index fe58274486382..ff5e0703697f0 100644 --- a/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/fixture/JDBCExecutorCallbackFixture.java +++ b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/fixture/JDBCExecutorCallbackFixture.java @@ -23,7 +23,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.execute.engine.driver.jdbc.JDBCExecutorCallback; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement; import java.sql.SQLException; @@ -36,7 +36,7 @@ public final class JDBCExecutorCallbackFixture extends JDBCExecutorCallback routedDataSourceNames = actual.getActualDataSourceNames().iterator(); assertThat(routedDataSourceNames.next(), is(NONE_READWRITE_SPLITTING_DATASOURCE_NAME)); @@ -122,7 +122,7 @@ void assertCreateRouteContextToReplicaDataSource() { QueryContext queryContext = new QueryContext(sqlStatementContext, "", Collections.emptyList()); ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData(Collections.singleton(staticRule)); ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, - mock(DatabaseType.class), mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap()); + mock(DatabaseType.class), mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap()); RouteContext actual = sqlRouter.createRouteContext(queryContext, mock(ShardingSphereRuleMetaData.class), database, staticRule, new ConfigurationProperties(new Properties()), new ConnectionContext()); assertThat(actual.getRouteUnits().size(), is(1)); @@ -142,7 +142,7 @@ void assertDecorateRouteContextToReplicaDataSource() { QueryContext queryContext = new QueryContext(sqlStatementContext, "", Collections.emptyList()); ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData(Collections.singleton(staticRule)); ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, - mock(DatabaseType.class), mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap()); + mock(DatabaseType.class), mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap()); sqlRouter.decorateRouteContext(actual, queryContext, database, staticRule, new ConfigurationProperties(new Properties()), new ConnectionContext()); Iterator routedDataSourceNames = actual.getActualDataSourceNames().iterator(); assertThat(routedDataSourceNames.next(), is(NONE_READWRITE_SPLITTING_DATASOURCE_NAME)); @@ -157,7 +157,7 @@ void assertCreateRouteContextToPrimaryDataSourceWithLock() { QueryContext queryContext = new QueryContext(sqlStatementContext, "", Collections.emptyList()); ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData(Collections.singleton(staticRule)); ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, - mock(DatabaseType.class), mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap()); + mock(DatabaseType.class), mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap()); RouteContext actual = sqlRouter.createRouteContext(queryContext, mock(ShardingSphereRuleMetaData.class), database, staticRule, new ConfigurationProperties(new Properties()), new ConnectionContext()); Iterator routedDataSourceNames = actual.getActualDataSourceNames().iterator(); @@ -173,7 +173,7 @@ void assertDecorateRouteContextToPrimaryDataSourceWithLock() { QueryContext queryContext = new QueryContext(sqlStatementContext, "", Collections.emptyList()); ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData(Collections.singleton(staticRule)); ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, - mock(DatabaseType.class), mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap()); + mock(DatabaseType.class), mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap()); sqlRouter.decorateRouteContext(actual, queryContext, database, staticRule, new ConfigurationProperties(new Properties()), new ConnectionContext()); Iterator routedDataSourceNames = actual.getActualDataSourceNames().iterator(); assertThat(routedDataSourceNames.next(), is(NONE_READWRITE_SPLITTING_DATASOURCE_NAME)); @@ -186,7 +186,7 @@ void assertCreateRouteContextToPrimaryDataSource() { QueryContext queryContext = new QueryContext(sqlStatementContext, "", Collections.emptyList()); ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData(Collections.singleton(staticRule)); ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, - mock(DatabaseType.class), mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap()); + mock(DatabaseType.class), mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap()); RouteContext actual = sqlRouter.createRouteContext(queryContext, mock(ShardingSphereRuleMetaData.class), database, staticRule, new ConfigurationProperties(new Properties()), new ConnectionContext()); Iterator routedDataSourceNames = actual.getActualDataSourceNames().iterator(); @@ -200,7 +200,7 @@ void assertCreateRouteContextToReadDataSource() { QueryContext queryContext = new QueryContext(sqlStatementContext, "", Collections.emptyList()); ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData(Collections.singleton(staticRule)); ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, - mock(DatabaseType.class), mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap()); + mock(DatabaseType.class), mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap()); RouteContext actual = sqlRouter.createRouteContext(queryContext, mock(ShardingSphereRuleMetaData.class), database, staticRule, new ConfigurationProperties(new Properties()), new ConnectionContext()); Iterator routedDataSourceNames = actual.getActualDataSourceNames().iterator(); @@ -226,7 +226,7 @@ void assertSqlHintRouteWriteOnly() { QueryContext queryContext = new QueryContext(sqlStatementContext, "", Collections.emptyList(), hintValueContext); ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData(Collections.singleton(staticRule)); ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, - mock(DatabaseType.class), mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap()); + mock(DatabaseType.class), mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap()); RouteContext actual = sqlRouter.createRouteContext(queryContext, mock(ShardingSphereRuleMetaData.class), database, staticRule, new ConfigurationProperties(new Properties()), new ConnectionContext()); Iterator routedDataSourceNames = actual.getActualDataSourceNames().iterator(); diff --git a/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/checker/ReadwriteSplittingRuleStatementChecker.java b/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/checker/ReadwriteSplittingRuleStatementChecker.java index 7565cd7e87981..86998457671c6 100644 --- a/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/checker/ReadwriteSplittingRuleStatementChecker.java +++ b/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/checker/ReadwriteSplittingRuleStatementChecker.java @@ -25,7 +25,7 @@ import org.apache.shardingsphere.distsql.handler.exception.rule.MissingRequiredRuleException; import org.apache.shardingsphere.distsql.handler.exception.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedRule; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; @@ -125,7 +125,7 @@ private static Collection getDuplicated(final Collection require private static void checkDuplicateRuleNamesWithExistsDataSources(final ShardingSphereDatabase database, final Collection segments) { Collection currentRuleNames = new HashSet<>(); - ShardingSphereResourceMetaData resourceMetaData = database.getResourceMetaData(); + ResourceMetaData resourceMetaData = database.getResourceMetaData(); if (null != resourceMetaData && null != resourceMetaData.getDataSources()) { currentRuleNames.addAll(resourceMetaData.getDataSources().keySet()); } diff --git a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleStatementUpdaterTest.java b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleStatementUpdaterTest.java index 8dd1606f86b97..26d22aa37e3d8 100644 --- a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleStatementUpdaterTest.java +++ b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleStatementUpdaterTest.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.distsql.handler.exception.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.spi.exception.ServiceProviderNotFoundException; import org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration; import org.apache.shardingsphere.readwritesplitting.api.rule.ReadwriteSplittingDataSourceRuleConfiguration; @@ -54,7 +54,7 @@ class AlterReadwriteSplittingRuleStatementUpdaterTest { private ShardingSphereDatabase database; @Mock - private ShardingSphereResourceMetaData resourceMetaData; + private ResourceMetaData resourceMetaData; private final AlterReadwriteSplittingRuleStatementUpdater updater = new AlterReadwriteSplittingRuleStatementUpdater(); diff --git a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleStatementUpdaterTest.java b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleStatementUpdaterTest.java index 25c4c3b056e8f..3da19a8b5acd8 100644 --- a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleStatementUpdaterTest.java +++ b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleStatementUpdaterTest.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.distsql.handler.exception.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedRule; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration; @@ -60,7 +60,7 @@ class CreateReadwriteSplittingRuleStatementUpdaterTest { private ShardingSphereDatabase database; @Mock - private ShardingSphereResourceMetaData resourceMetaData; + private ResourceMetaData resourceMetaData; private final CreateReadwriteSplittingRuleStatementUpdater updater = new CreateReadwriteSplittingRuleStatementUpdater(); diff --git a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleStatementUpdaterTest.java b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleStatementUpdaterTest.java index 64973e4401dc4..925451e04d868 100644 --- a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleStatementUpdaterTest.java +++ b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleStatementUpdaterTest.java @@ -23,7 +23,7 @@ import org.apache.shardingsphere.distsql.handler.exception.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration; import org.apache.shardingsphere.shadow.api.config.datasource.ShadowDataSourceConfiguration; import org.apache.shardingsphere.shadow.distsql.handler.update.AlterShadowRuleStatementUpdater; @@ -60,7 +60,7 @@ class AlterShadowRuleStatementUpdaterTest { private ShardingSphereDatabase database; @Mock - private ShardingSphereResourceMetaData resourceMetaData; + private ResourceMetaData resourceMetaData; @Mock private ShadowRuleConfiguration currentConfig; diff --git a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowRuleStatementUpdaterTest.java b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowRuleStatementUpdaterTest.java index 3ec0c1410308c..c601ab1c17bd2 100644 --- a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowRuleStatementUpdaterTest.java +++ b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowRuleStatementUpdaterTest.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.distsql.handler.exception.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedRule; import org.apache.shardingsphere.infra.spi.exception.ServiceProviderNotFoundException; import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration; @@ -58,7 +58,7 @@ class CreateShadowRuleStatementUpdaterTest { private ShardingSphereDatabase database; @Mock - private ShardingSphereResourceMetaData resourceMetaData; + private ResourceMetaData resourceMetaData; @Mock private ShadowRuleConfiguration currentConfig; diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingInstanceBroadcastRoutingEngine.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingInstanceBroadcastRoutingEngine.java index 6631188ddc148..b6a45a7db37a9 100644 --- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingInstanceBroadcastRoutingEngine.java +++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingInstanceBroadcastRoutingEngine.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.sharding.route.engine.type.broadcast; import lombok.RequiredArgsConstructor; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.route.context.RouteContext; import org.apache.shardingsphere.infra.route.context.RouteMapper; import org.apache.shardingsphere.infra.route.context.RouteUnit; @@ -33,7 +33,7 @@ @RequiredArgsConstructor public final class ShardingInstanceBroadcastRoutingEngine implements ShardingRouteEngine { - private final ShardingSphereResourceMetaData resourceMetaData; + private final ResourceMetaData resourceMetaData; @Override public RouteContext route(final ShardingRule shardingRule) { diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableCheckerTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableCheckerTest.java index 03bdbf907b2db..672a100c955c2 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableCheckerTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableCheckerTest.java @@ -26,7 +26,7 @@ import org.apache.shardingsphere.infra.instance.InstanceContext; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; @@ -123,7 +123,7 @@ private ShardingSphereDatabase createDatabase(final ShardingRule shardingRule, f new ShardingSphereColumn("order_broadcast_table_id", Types.INTEGER, true, false, false, true, false, false)), Collections.emptyList(), Collections.emptyList())); return new ShardingSphereDatabase(DATABASE_NAME, TypedSPILoader.getService(DatabaseType.class, "PostgreSQL"), - new ShardingSphereResourceMetaData(DATABASE_NAME, Collections.emptyMap()), new ShardingSphereRuleMetaData(Arrays.asList(shardingRule, timestampServiceRule)), + new ResourceMetaData(DATABASE_NAME, Collections.emptyMap()), new ShardingSphereRuleMetaData(Arrays.asList(shardingRule, timestampServiceRule)), Collections.singletonMap(SCHEMA_NAME, schema)); } @@ -133,7 +133,7 @@ private QueryContext createQueryContext(final ShardingSphereDatabase database, f } private ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DATABASE_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DATABASE_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/ShardingResultMergerEngineTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/ShardingResultMergerEngineTest.java index a98915cb8fb8d..f096dc884ba46 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/ShardingResultMergerEngineTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/ShardingResultMergerEngineTest.java @@ -26,7 +26,7 @@ import org.apache.shardingsphere.infra.merge.engine.merger.impl.TransparentResultMerger; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; @@ -99,7 +99,7 @@ private void assertNewInstanceWithSelectStatement(final SelectStatement selectSt } private ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/common/IteratorStreamMergedResultTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/common/IteratorStreamMergedResultTest.java index 4e91e6a0b9406..edc02b0935ab7 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/common/IteratorStreamMergedResultTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/common/IteratorStreamMergedResultTest.java @@ -19,7 +19,7 @@ import org.apache.shardingsphere.infra.binder.context.statement.dml.SelectStatementContext; import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.rule.identifier.type.TableContainedRule; import org.apache.shardingsphere.infra.session.connection.ConnectionContext; import org.apache.shardingsphere.infra.database.core.DefaultDatabase; @@ -72,7 +72,7 @@ private ShardingSphereDatabase mockDatabase() { } private ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/ddl/ShardingDDLResultMergerTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/ddl/ShardingDDLResultMergerTest.java index b05de9a1bf51f..3c52efae2f186 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/ddl/ShardingDDLResultMergerTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/ddl/ShardingDDLResultMergerTest.java @@ -21,7 +21,7 @@ import org.apache.shardingsphere.infra.binder.context.statement.ddl.FetchStatementContext; import org.apache.shardingsphere.infra.binder.context.statement.dml.SelectStatementContext; import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.session.connection.ConnectionContext; import org.apache.shardingsphere.infra.session.connection.cursor.CursorConnectionContext; import org.apache.shardingsphere.infra.database.core.DefaultDatabase; @@ -101,7 +101,7 @@ private CursorStatementContext createCursorStatementContext(final ShardingSphere } private ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/ddl/fetch/FetchStreamMergedResultTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/ddl/fetch/FetchStreamMergedResultTest.java index 1692d0a91f9ce..8f332d5d0ece9 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/ddl/fetch/FetchStreamMergedResultTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/ddl/fetch/FetchStreamMergedResultTest.java @@ -25,7 +25,7 @@ import org.apache.shardingsphere.infra.merge.result.MergedResult; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.session.connection.ConnectionContext; import org.apache.shardingsphere.infra.session.connection.cursor.CursorConnectionContext; @@ -111,7 +111,7 @@ private static CursorStatementContext createCursorStatementContext() { } private static ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMergerTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMergerTest.java index c07789a0a4314..a6aac5e60ffc9 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMergerTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMergerTest.java @@ -26,7 +26,7 @@ import org.apache.shardingsphere.infra.merge.result.MergedResult; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; @@ -483,7 +483,7 @@ void assertBuildGroupByMemoryMergedResultWithAggregationOnlyWithSQLServerLimit() } private ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } @@ -511,7 +511,7 @@ private ShardingSphereDatabase createDatabase() { ShardingSphereColumn column3 = new ShardingSphereColumn("col3", 0, false, false, false, true, false, false); ShardingSphereTable table = new ShardingSphereTable("tbl", Arrays.asList(column1, column2, column3), Collections.emptyList(), Collections.emptyList()); ShardingSphereSchema schema = new ShardingSphereSchema(Collections.singletonMap("tbl", table), Collections.emptyMap()); - return new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, TypedSPILoader.getService(DatabaseType.class, "MySQL"), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, TypedSPILoader.getService(DatabaseType.class, "MySQL"), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), Collections.singletonMap(DefaultDatabase.LOGIC_NAME, schema)); } diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResultTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResultTest.java index cbbdf05575a4a..470492434e2d9 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResultTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResultTest.java @@ -25,7 +25,7 @@ import org.apache.shardingsphere.infra.merge.result.MergedResult; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable; @@ -148,7 +148,7 @@ private SelectStatementContext createSelectStatementContext(final ShardingSphere } private ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByRowComparatorTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByRowComparatorTest.java index 1aaea80022803..a212729495699 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByRowComparatorTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByRowComparatorTest.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.merge.result.impl.memory.MemoryQueryResultRow; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.database.core.metadata.database.enums.NullsOrderType; @@ -271,7 +271,7 @@ private void assertCompareToForDecsWithGroupByItems(final SelectStatement select } private ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByStreamMergedResultTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByStreamMergedResultTest.java index bcb465c73c236..89013d8d6f513 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByStreamMergedResultTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByStreamMergedResultTest.java @@ -26,7 +26,7 @@ import org.apache.shardingsphere.infra.merge.result.MergedResult; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; @@ -178,7 +178,7 @@ private SelectStatementContext createSelectStatementContext() { } private static ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } @@ -189,7 +189,7 @@ private ShardingSphereDatabase createDatabase() { ShardingSphereTable table = new ShardingSphereTable("tbl", Arrays.asList(column1, column2, column3), Collections.emptyList(), Collections.emptyList()); ShardingSphereSchema schema = new ShardingSphereSchema(Collections.singletonMap("tbl", table), Collections.emptyMap()); return new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, TypedSPILoader.getService(DatabaseType.class, "MySQL"), - mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), Collections.singletonMap(DefaultDatabase.LOGIC_NAME, schema)); + mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), Collections.singletonMap(DefaultDatabase.LOGIC_NAME, schema)); } private QueryResult mockQueryResult() throws SQLException { diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/orderby/OrderByStreamMergedResultTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/orderby/OrderByStreamMergedResultTest.java index 2c21ffce24539..0977b9aae4474 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/orderby/OrderByStreamMergedResultTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/orderby/OrderByStreamMergedResultTest.java @@ -27,7 +27,7 @@ import org.apache.shardingsphere.infra.merge.result.MergedResult; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; @@ -87,7 +87,7 @@ private ShardingSphereDatabase mockDatabase() { } private ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } @@ -217,7 +217,7 @@ private ShardingSphereDatabase createDatabase() { ShardingSphereTable table = new ShardingSphereTable("tbl", Arrays.asList(column1, column2), Collections.emptyList(), Collections.emptyList()); ShardingSphereSchema schema = new ShardingSphereSchema(Collections.singletonMap("tbl", table), Collections.emptyMap()); return new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, - TypedSPILoader.getService(DatabaseType.class, "MySQL"), mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), + TypedSPILoader.getService(DatabaseType.class, "MySQL"), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), Collections.singletonMap(DefaultDatabase.LOGIC_NAME, schema)); } } diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/orderby/OrderByValueTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/orderby/OrderByValueTest.java index f6b92a4c94b89..4d57a01b102b5 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/orderby/OrderByValueTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/orderby/OrderByValueTest.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResult; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable; @@ -122,7 +122,7 @@ private ShardingSphereDatabase mockDatabase() { } private static ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/LimitDecoratorMergedResultTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/LimitDecoratorMergedResultTest.java index 36f7fb109a3e4..b0d3ac6920029 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/LimitDecoratorMergedResultTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/LimitDecoratorMergedResultTest.java @@ -19,7 +19,7 @@ import org.apache.shardingsphere.infra.binder.context.statement.dml.SelectStatementContext; import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.session.connection.ConnectionContext; import org.apache.shardingsphere.infra.database.core.DefaultDatabase; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; @@ -96,7 +96,7 @@ void assertNextWithRowCount() throws SQLException { } private ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/RowNumberDecoratorMergedResultTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/RowNumberDecoratorMergedResultTest.java index 1fe3735e6d94e..107923c27e37e 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/RowNumberDecoratorMergedResultTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/RowNumberDecoratorMergedResultTest.java @@ -19,7 +19,7 @@ import org.apache.shardingsphere.infra.binder.context.statement.dml.SelectStatementContext; import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.session.connection.ConnectionContext; import org.apache.shardingsphere.infra.database.core.DefaultDatabase; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; @@ -174,7 +174,7 @@ void assertNextForRowCountBoundOpenedTrue() throws SQLException { } private ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/TopAndRowNumberDecoratorMergedResultTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/TopAndRowNumberDecoratorMergedResultTest.java index bb68aec0e0792..bdb7498b2e6bc 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/TopAndRowNumberDecoratorMergedResultTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/TopAndRowNumberDecoratorMergedResultTest.java @@ -19,7 +19,7 @@ import org.apache.shardingsphere.infra.binder.context.statement.dml.SelectStatementContext; import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.session.connection.ConnectionContext; import org.apache.shardingsphere.infra.database.core.DefaultDatabase; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; @@ -141,7 +141,7 @@ void assertNextWithOffsetBoundOpenedTrue() throws SQLException { } private ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/ShardingRemoveTokenGeneratorTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/ShardingRemoveTokenGeneratorTest.java index 75e6ccd878254..12e7d6d157ce7 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/ShardingRemoveTokenGeneratorTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/ShardingRemoveTokenGeneratorTest.java @@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.database.core.DefaultDatabase; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.SQLToken; import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.generic.RemoveToken; @@ -90,7 +90,7 @@ private SelectStatementContext createUpdatesStatementContext() { } private ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingInstanceBroadcastRoutingEngineTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingInstanceBroadcastRoutingEngineTest.java index 8cd951ba1d773..d7ddf60472a93 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingInstanceBroadcastRoutingEngineTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingInstanceBroadcastRoutingEngineTest.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.sharding.route.engine.type.broadcast; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.route.context.RouteContext; import org.apache.shardingsphere.sharding.rule.ShardingRule; import org.junit.jupiter.api.BeforeEach; @@ -41,7 +41,7 @@ class ShardingInstanceBroadcastRoutingEngineTest { private ShardingRule shardingRule; @Mock - private ShardingSphereResourceMetaData resourceMetaData; + private ResourceMetaData resourceMetaData; private ShardingInstanceBroadcastRoutingEngine shardingInstanceBroadcastRoutingEngine; diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingTableBroadcastRoutingEngineTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingTableBroadcastRoutingEngineTest.java index 95cc0f5ce35d1..0ee38ad4fdec3 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingTableBroadcastRoutingEngineTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingTableBroadcastRoutingEngineTest.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.instance.InstanceContext; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.route.context.RouteContext; @@ -94,7 +94,7 @@ void assertRouteForDropIndexStatement() { when(((IndexAvailable) sqlStatementContext).getIndexes()).thenReturn(Collections.singletonList(segment)); Map schemas = Collections.singletonMap(DefaultDatabase.LOGIC_NAME, schema); ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, - databaseType, mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), schemas); + databaseType, mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), schemas); ShardingTableBroadcastRoutingEngine shardingTableBroadcastRoutingEngine = new ShardingTableBroadcastRoutingEngine(database, sqlStatementContext, tableNames); RouteContext routeContext = shardingTableBroadcastRoutingEngine.route(createShardingRule()); assertThat(routeContext.getActualDataSourceNames().size(), is(2)); @@ -117,7 +117,7 @@ void assertRouteForDropIndexStatementDoNotFoundTables() { when(sqlStatementContext.getTablesContext().getTableNames()).thenReturn(tableNames); Map schemas = Collections.singletonMap(DefaultDatabase.LOGIC_NAME, schema); ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, - databaseType, mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), schemas); + databaseType, mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), schemas); ShardingTableBroadcastRoutingEngine shardingTableBroadcastRoutingEngine = new ShardingTableBroadcastRoutingEngine(database, sqlStatementContext, tableNames); RouteContext routeContext = shardingTableBroadcastRoutingEngine.route(createShardingRule()); assertRouteUnitWithoutTables(routeContext); diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/assertion/ShardingRouteAssert.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/assertion/ShardingRouteAssert.java index 103f9c1b42863..a8caa0b5cde4f 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/assertion/ShardingRouteAssert.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/assertion/ShardingRouteAssert.java @@ -26,7 +26,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; @@ -78,7 +78,7 @@ public static RouteContext assertRoute(final String sql, final List para SQLStatementParserEngine sqlStatementParserEngine = new SQLStatementParserEngine(databaseType, new CacheOption(2000, 65535L), new CacheOption(128, 1024L), false); ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData(Arrays.asList(shardingRule, singleRule, timestampServiceRule)); - ShardingSphereResourceMetaData resourceMetaData = mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS); + ResourceMetaData resourceMetaData = mock(ResourceMetaData.class, RETURNS_DEEP_STUBS); when(resourceMetaData.getStorageTypes()).thenReturn(Collections.singletonMap("ds_0", databaseType)); ShardingSphereDatabase database = new ShardingSphereDatabase( DefaultDatabase.LOGIC_NAME, databaseType, resourceMetaData, ruleMetaData, schemas); @@ -89,7 +89,7 @@ public static RouteContext assertRoute(final String sql, final List para } private static ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingInsertStatementValidatorTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingInsertStatementValidatorTest.java index 4914b484db26b..2395d90f33beb 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingInsertStatementValidatorTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingInsertStatementValidatorTest.java @@ -27,7 +27,7 @@ import org.apache.shardingsphere.infra.hint.HintValueContext; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.route.context.RouteContext; @@ -116,7 +116,7 @@ void assertPreValidateWhenInsertMultiTables() { private InsertStatementContext createInsertStatementContext(final List params, final InsertStatement insertStatement) { when(database.getSchema(DefaultDatabase.LOGIC_NAME)).thenReturn(mock(ShardingSphereSchema.class)); - ShardingSphereMetaData metaData = new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + ShardingSphereMetaData metaData = new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); return new InsertStatementContext(metaData, params, insertStatement, DefaultDatabase.LOGIC_NAME); } diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java index 3c294139b8546..7a46a14244ae9 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java @@ -25,7 +25,7 @@ import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment; import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; import org.apache.shardingsphere.infra.spi.exception.ServiceProviderNotFoundException; @@ -74,7 +74,7 @@ class ShardingRuleStatementCheckerTest { private final ShardingRuleConfiguration shardingRuleConfig = createShardingRuleConfiguration(); - private final ShardingSphereResourceMetaData resourceMetaData = new ShardingSphereResourceMetaData("sharding_db", createDataSource()); + private final ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", createDataSource()); @BeforeEach void before() { diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java index d040afc2bc6fb..c8b16413577a9 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java @@ -20,7 +20,7 @@ import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment; import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration; import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration; @@ -63,7 +63,7 @@ class AlterShardingTableRuleStatementUpdaterTest { private final ShardingRuleConfiguration currentRuleConfig = createCurrentShardingRuleConfiguration(); - private final ShardingSphereResourceMetaData resourceMetaData = new ShardingSphereResourceMetaData("sharding_db", createDataSource()); + private final ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", createDataSource()); private final AlterShardingTableRuleStatementUpdater updater = new AlterShardingTableRuleStatementUpdater(); diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java index a4929c8c47e34..489bed2279e02 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java @@ -25,7 +25,7 @@ import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration; import org.apache.shardingsphere.infra.config.rule.RuleConfiguration; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedRule; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; @@ -86,7 +86,7 @@ class CreateShardingTableRuleStatementUpdaterTest { @BeforeEach void before() { when(database.getName()).thenReturn("schema"); - ShardingSphereResourceMetaData resourceMetaData = new ShardingSphereResourceMetaData("sharding_db", createDataSource()); + ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", createDataSource()); when(database.getResourceMetaData()).thenReturn(resourceMetaData); when(database.getRuleMetaData()).thenReturn(new ShardingSphereRuleMetaData(Collections.singleton(new MockDataSourceContainedRule()))); } diff --git a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/segment/select/pagination/PaginationContextTest.java b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/segment/select/pagination/PaginationContextTest.java index 48dbf47a2f449..f4403112cd3eb 100644 --- a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/segment/select/pagination/PaginationContextTest.java +++ b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/segment/select/pagination/PaginationContextTest.java @@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.database.core.metadata.database.enums.NullsOrderType; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.rule.identifier.type.TableContainedRule; import org.apache.shardingsphere.sql.parser.sql.common.enums.OrderDirection; @@ -170,7 +170,7 @@ void assertGetRevisedRowCountForSQLServer() { private void getRevisedRowCount(final SelectStatement selectStatement) { selectStatement.setProjections(new ProjectionsSegment(0, 0)); Map databases = Collections.singletonMap(DefaultDatabase.LOGIC_NAME, mockDatabase()); - ShardingSphereMetaData metaData = new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), + ShardingSphereMetaData metaData = new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); SelectStatementContext selectStatementContext = new SelectStatementContext(metaData, Collections.emptyList(), selectStatement, DefaultDatabase.LOGIC_NAME); assertThat(new PaginationContext(getOffsetSegment(), getRowCountSegment(), getParameters()).getRevisedRowCount(selectStatementContext), is(50L)); @@ -213,7 +213,7 @@ private void getRevisedRowCountWithMax(final SelectStatement selectStatement) { selectStatement.setOrderBy(new OrderBySegment(0, 0, Collections.singletonList(new IndexOrderByItemSegment(0, 0, 1, OrderDirection.DESC, NullsOrderType.LAST)))); Map databases = Collections.singletonMap(DefaultDatabase.LOGIC_NAME, mockDatabase()); ShardingSphereMetaData metaData = - new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); + new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); SelectStatementContext selectStatementContext = new SelectStatementContext(metaData, Collections.emptyList(), selectStatement, DefaultDatabase.LOGIC_NAME); assertThat(new PaginationContext(getOffsetSegment(), getRowCountSegment(), getParameters()).getRevisedRowCount(selectStatementContext), is((long) Integer.MAX_VALUE)); } diff --git a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/segment/select/projection/engine/ProjectionsContextEngineTest.java b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/segment/select/projection/engine/ProjectionsContextEngineTest.java index 737e3edc71446..9fd1d104fcc6f 100644 --- a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/segment/select/projection/engine/ProjectionsContextEngineTest.java +++ b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/segment/select/projection/engine/ProjectionsContextEngineTest.java @@ -27,7 +27,7 @@ import org.apache.shardingsphere.infra.database.core.metadata.database.enums.NullsOrderType; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.rule.identifier.type.TableContainedRule; import org.apache.shardingsphere.sql.parser.sql.common.enums.OrderDirection; @@ -226,7 +226,7 @@ private void assertCreateProjectionsContextWithoutIndexOrderByItemSegment(final private SelectStatementContext createSelectStatementContext(final SelectStatement selectStatement) { ShardingSphereDatabase database = mockDatabase(); Map databases = Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database); - ShardingSphereMetaData metaData = new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), + ShardingSphereMetaData metaData = new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); return new SelectStatementContext(metaData, Collections.emptyList(), selectStatement, DefaultDatabase.LOGIC_NAME); } diff --git a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/SQLStatementContextFactoryTest.java b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/SQLStatementContextFactoryTest.java index 33b48c865b628..3fc9f11401ef3 100644 --- a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/SQLStatementContextFactoryTest.java +++ b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/SQLStatementContextFactoryTest.java @@ -28,7 +28,7 @@ import org.apache.shardingsphere.infra.database.core.DefaultDatabase; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.assignment.AssignmentSegment; import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.assignment.ColumnAssignmentSegment; @@ -151,6 +151,6 @@ void assertNewInstanceForFetchStatement() { private ShardingSphereMetaData mockMetaData() { Map databases = Collections.singletonMap(DefaultDatabase.LOGIC_NAME, mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS)); - return new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); + return new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } } diff --git a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/dml/InsertStatementContextTest.java b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/dml/InsertStatementContextTest.java index b8ad0c5abdccf..e9c75e35edb2b 100644 --- a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/dml/InsertStatementContextTest.java +++ b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/dml/InsertStatementContextTest.java @@ -21,7 +21,7 @@ import org.apache.shardingsphere.infra.database.core.DefaultDatabase; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.assignment.AssignmentSegment; @@ -118,7 +118,7 @@ private InsertStatementContext createInsertStatementContext(final List p } private ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } diff --git a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/dml/SelectStatementContextTest.java b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/dml/SelectStatementContextTest.java index 52c272ce3365a..9e078480da31f 100644 --- a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/dml/SelectStatementContextTest.java +++ b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/dml/SelectStatementContextTest.java @@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.database.core.metadata.database.enums.QuoteCharacter; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.rule.identifier.type.TableContainedRule; import org.apache.shardingsphere.sql.parser.sql.common.enums.AggregationType; @@ -264,7 +264,7 @@ private void assertIsSameGroupByAndOrderByItems(final SelectStatement selectStat } private SelectStatementContext createSelectStatementContext(final SelectStatement selectStatement) { - ShardingSphereMetaData metaData = new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, mockDatabase()), mock(ShardingSphereResourceMetaData.class), + ShardingSphereMetaData metaData = new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, mockDatabase()), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); return new SelectStatementContext(metaData, Collections.emptyList(), selectStatement, DefaultDatabase.LOGIC_NAME); } @@ -491,7 +491,7 @@ private void assertContainsSubqueryWhereEmpty(final SelectStatement selectStatem ProjectionsSegment projectionsSegment = new ProjectionsSegment(0, 0); projectionsSegment.getProjections().add(projectionSegment); selectStatement.setProjections(projectionsSegment); - ShardingSphereMetaData metaData = new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, mockDatabase()), mock(ShardingSphereResourceMetaData.class), + ShardingSphereMetaData metaData = new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, mockDatabase()), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); assertTrue(new SelectStatementContext(metaData, Collections.emptyList(), selectStatement, DefaultDatabase.LOGIC_NAME).isContainsSubquery()); } @@ -525,7 +525,7 @@ private void assertContainsDollarParameterMarker(final SelectStatement selectSta ProjectionsSegment projectionsSegment = new ProjectionsSegment(0, 0); projectionsSegment.getProjections().add(new ParameterMarkerExpressionSegment(0, 0, 0, ParameterMarkerType.DOLLAR)); selectStatement.setProjections(projectionsSegment); - ShardingSphereMetaData metaData = new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, mockDatabase()), mock(ShardingSphereResourceMetaData.class), + ShardingSphereMetaData metaData = new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, mockDatabase()), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); SelectStatementContext selectStatementContext = new SelectStatementContext(metaData, Collections.emptyList(), selectStatement, DefaultDatabase.LOGIC_NAME); assertTrue(selectStatementContext.isContainsDollarParameterMarker()); @@ -567,14 +567,14 @@ private void assertContainsPartialDistinctAggregation(final SelectStatement sele projectionsSegment.getProjections().add(new AggregationProjectionSegment(0, 0, AggregationType.COUNT, "COUNT(*)")); projectionsSegment.getProjections().add(new AggregationDistinctProjectionSegment(0, 10, AggregationType.COUNT, "COUNT(1)", "distinctExpression")); selectStatement.setProjections(projectionsSegment); - ShardingSphereMetaData metaData = new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, mockDatabase()), mock(ShardingSphereResourceMetaData.class), + ShardingSphereMetaData metaData = new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, mockDatabase()), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); SelectStatementContext selectStatementContext = new SelectStatementContext(metaData, Collections.emptyList(), selectStatement, DefaultDatabase.LOGIC_NAME); assertTrue(selectStatementContext.isContainsPartialDistinctAggregation()); } private ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } @@ -621,7 +621,7 @@ void assertIsContainsEnhancedTable() { SelectStatement selectStatement = new MySQLSelectStatement(); selectStatement.setProjections(projectionsSegment); selectStatement.setFrom(new SimpleTableSegment(new TableNameSegment(0, 0, new IdentifierValue("t_order")))); - ShardingSphereMetaData metaData = new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, mockDatabase()), mock(ShardingSphereResourceMetaData.class), + ShardingSphereMetaData metaData = new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, mockDatabase()), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); SelectStatementContext actual = new SelectStatementContext(metaData, Collections.emptyList(), selectStatement, DefaultDatabase.LOGIC_NAME); assertTrue(actual.isContainsEnhancedTable()); diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/database/DatabaseTypeEngine.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/database/DatabaseTypeEngine.java index 502f3134b42da..e4393472a9f4e 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/database/DatabaseTypeEngine.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/database/DatabaseTypeEngine.java @@ -77,7 +77,7 @@ private static Optional findConfiguredDatabaseType(final Configura private static Map getEnabledDataSources(final Map databaseConfigs) { Map result = new LinkedHashMap<>(); for (Entry entry : databaseConfigs.entrySet()) { - result.putAll(DataSourceStateManager.getInstance().getEnabledDataSourceMap(entry.getKey(), entry.getValue().getDataSources())); + result.putAll(DataSourceStateManager.getInstance().getEnabledDataSources(entry.getKey(), entry.getValue().getDataSources())); } return result; } @@ -91,7 +91,7 @@ private static Map getEnabledDataSources(final Map getStorageTypes(final String databaseName, final DatabaseConfiguration databaseConfig) { Map result = new LinkedHashMap<>(databaseConfig.getDataSources().size(), 1F); - Map enabledDataSources = DataSourceStateManager.getInstance().getEnabledDataSourceMap(databaseName, databaseConfig.getDataSources()); + Map enabledDataSources = DataSourceStateManager.getInstance().getEnabledDataSources(databaseName, databaseConfig.getDataSources()); for (Entry entry : enabledDataSources.entrySet()) { result.put(entry.getKey(), getStorageType(entry.getValue())); } diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java index 83ed3669ec21f..ff7bb173a897f 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.infra.config.props.temporary.TemporaryConfigurationProperties; 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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.rule.identifier.type.ResourceHeldRule; import org.apache.shardingsphere.infra.rule.identifier.type.StaticDataSourceContainedRule; @@ -42,7 +42,7 @@ public final class ShardingSphereMetaData { private final Map databases; - private final ShardingSphereResourceMetaData globalResourceMetaData; + private final ResourceMetaData globalResourceMetaData; private final ShardingSphereRuleMetaData globalRuleMetaData; @@ -51,11 +51,11 @@ public final class ShardingSphereMetaData { private final TemporaryConfigurationProperties temporaryProps; public ShardingSphereMetaData() { - this(new LinkedHashMap<>(), new ShardingSphereResourceMetaData(Collections.emptyMap()), new ShardingSphereRuleMetaData(Collections.emptyList()), + this(new LinkedHashMap<>(), new ResourceMetaData(Collections.emptyMap()), new ShardingSphereRuleMetaData(Collections.emptyList()), new ConfigurationProperties(new Properties())); } - public ShardingSphereMetaData(final Map databases, final ShardingSphereResourceMetaData globalResourceMetaData, + public ShardingSphereMetaData(final Map databases, final ResourceMetaData globalResourceMetaData, final ShardingSphereRuleMetaData globalRuleMetaData, final ConfigurationProperties props) { this.databases = new ConcurrentHashMap<>(databases.size(), 1F); databases.forEach((key, value) -> this.databases.put(key.toLowerCase(), value)); diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabase.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabase.java index 8f3a9329f24cf..aac1a85ad99be 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabase.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabase.java @@ -25,10 +25,9 @@ import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.database.core.type.DatabaseTypeRegistry; import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties; -import org.apache.shardingsphere.infra.state.datasource.DataSourceStateManager; import org.apache.shardingsphere.infra.datasource.storage.StorageResource; import org.apache.shardingsphere.infra.instance.InstanceContext; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.builder.GenericSchemaBuilder; import org.apache.shardingsphere.infra.metadata.database.schema.builder.GenericSchemaBuilderMaterial; @@ -37,6 +36,7 @@ import org.apache.shardingsphere.infra.rule.ShardingSphereRule; import org.apache.shardingsphere.infra.rule.builder.database.DatabaseRulesBuilder; import org.apache.shardingsphere.infra.rule.identifier.type.MutableDataNodeRule; +import org.apache.shardingsphere.infra.state.datasource.DataSourceStateManager; import java.sql.SQLException; import java.util.Collection; @@ -55,13 +55,13 @@ public final class ShardingSphereDatabase { private final DatabaseType protocolType; - private final ShardingSphereResourceMetaData resourceMetaData; + private final ResourceMetaData resourceMetaData; private final ShardingSphereRuleMetaData ruleMetaData; private final Map schemas; - public ShardingSphereDatabase(final String name, final DatabaseType protocolType, final ShardingSphereResourceMetaData resourceMetaData, + public ShardingSphereDatabase(final String name, final DatabaseType protocolType, final ResourceMetaData resourceMetaData, final ShardingSphereRuleMetaData ruleMetaData, final Map schemas) { this.name = name; this.protocolType = protocolType; @@ -87,7 +87,7 @@ public static ShardingSphereDatabase create(final String name, final DatabaseTyp final DatabaseConfiguration databaseConfig, final ConfigurationProperties props, final InstanceContext instanceContext) throws SQLException { Collection databaseRules = DatabaseRulesBuilder.build(name, databaseConfig, instanceContext); Map schemas = new ConcurrentHashMap<>(GenericSchemaBuilder - .build(new GenericSchemaBuilderMaterial(protocolType, storageTypes, DataSourceStateManager.getInstance().getEnabledDataSourceMap(name, databaseConfig.getDataSources()), databaseRules, + .build(new GenericSchemaBuilderMaterial(protocolType, storageTypes, DataSourceStateManager.getInstance().getEnabledDataSources(name, databaseConfig.getDataSources()), databaseRules, props, new DatabaseTypeRegistry(protocolType).getDefaultSchemaName(name)))); SystemSchemaBuilder.build(name, protocolType, props).forEach(schemas::putIfAbsent); return create(name, protocolType, databaseConfig, databaseRules, schemas); @@ -118,14 +118,14 @@ public static ShardingSphereDatabase create(final String name, final DatabaseTyp */ public static ShardingSphereDatabase create(final String name, final DatabaseType protocolType, final DatabaseConfiguration databaseConfig, final Collection rules, final Map schemas) { - ShardingSphereResourceMetaData resourceMetaData = createResourceMetaData(name, databaseConfig.getStorageResource(), databaseConfig.getDataSourcePropsMap()); + ResourceMetaData resourceMetaData = createResourceMetaData(name, databaseConfig.getStorageResource(), databaseConfig.getDataSourcePropsMap()); ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData(rules); return new ShardingSphereDatabase(name, protocolType, resourceMetaData, ruleMetaData, schemas); } - private static ShardingSphereResourceMetaData createResourceMetaData(final String databaseName, final StorageResource storageResource, - final Map dataSourcePropsMap) { - return new ShardingSphereResourceMetaData(databaseName, storageResource, dataSourcePropsMap); + private static ResourceMetaData createResourceMetaData(final String databaseName, final StorageResource storageResource, + final Map dataSourcePropsMap) { + return new ResourceMetaData(databaseName, storageResource, dataSourcePropsMap); } /** diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ShardingSphereResourceMetaData.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ResourceMetaData.java similarity index 80% rename from infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ShardingSphereResourceMetaData.java rename to infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ResourceMetaData.java index 85785680f9e6d..6ae10225510f5 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ShardingSphereResourceMetaData.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ResourceMetaData.java @@ -38,35 +38,35 @@ import java.util.stream.Collectors; /** - * ShardingSphere resource meta data. + * Resource meta data. */ @Getter -public final class ShardingSphereResourceMetaData { +public final class ResourceMetaData { - private final ShardingSphereStorageNodeMetaData storageNodeMetaData; + private final StorageNodeMetaData storageNodeMetaData; - private final ShardingSphereStorageUnitMetaData storageUnitMetaData; + private final StorageUnitMetaData storageUnitMetaData; private final Map dataSourcePropsMap; - public ShardingSphereResourceMetaData(final Map dataSources) { + public ResourceMetaData(final Map dataSources) { this(null, dataSources); } - public ShardingSphereResourceMetaData(final String databaseName, final Map dataSources) { - Map enabledDataSources = DataSourceStateManager.getInstance().getEnabledDataSourceMap(databaseName, dataSources); + public ResourceMetaData(final String databaseName, final Map dataSources) { + Map enabledDataSources = DataSourceStateManager.getInstance().getEnabledDataSources(databaseName, dataSources); Map storageTypes = createStorageTypes(dataSources, enabledDataSources); - this.dataSourcePropsMap = DataSourcePropertiesCreator.create(dataSources); - storageNodeMetaData = new ShardingSphereStorageNodeMetaData(dataSources); - storageUnitMetaData = new ShardingSphereStorageUnitMetaData(dataSources, storageTypes, StorageUtils.getStorageUnits(dataSources), enabledDataSources); + dataSourcePropsMap = DataSourcePropertiesCreator.create(dataSources); + storageNodeMetaData = new StorageNodeMetaData(dataSources); + storageUnitMetaData = new StorageUnitMetaData(dataSources, storageTypes, StorageUtils.getStorageUnits(dataSources), enabledDataSources); } - public ShardingSphereResourceMetaData(final String databaseName, final StorageResource storageResource, final Map dataSourcePropsMap) { - Map enabledDataSources = DataSourceStateManager.getInstance().getEnabledDataSourceMap(databaseName, storageResource.getStorageNodes()); + public ResourceMetaData(final String databaseName, final StorageResource storageResource, final Map dataSourcePropsMap) { + Map enabledDataSources = DataSourceStateManager.getInstance().getEnabledDataSources(databaseName, storageResource.getStorageNodes()); Map storageTypes = createStorageTypes(storageResource.getStorageNodes(), enabledDataSources); - storageNodeMetaData = new ShardingSphereStorageNodeMetaData(storageResource.getStorageNodes()); - storageUnitMetaData = new ShardingSphereStorageUnitMetaData(storageResource.getStorageNodes(), storageTypes, storageResource.getStorageUnits(), enabledDataSources); + storageNodeMetaData = new StorageNodeMetaData(storageResource.getStorageNodes()); + storageUnitMetaData = new StorageUnitMetaData(storageResource.getStorageNodes(), storageTypes, storageResource.getStorageUnits(), enabledDataSources); this.dataSourcePropsMap = dataSourcePropsMap; } diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ShardingSphereStorageNodeMetaData.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/StorageNodeMetaData.java similarity index 91% rename from infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ShardingSphereStorageNodeMetaData.java rename to infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/StorageNodeMetaData.java index b95709c7397ef..7fca766ca1b81 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ShardingSphereStorageNodeMetaData.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/StorageNodeMetaData.java @@ -24,11 +24,11 @@ import java.util.Map; /** - * ShardingSphere storage node meta data. + * Storage node meta data. */ -@Getter @RequiredArgsConstructor -public final class ShardingSphereStorageNodeMetaData { +@Getter +public final class StorageNodeMetaData { private final Map dataSources; } diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ShardingSphereStorageUnitMetaData.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/StorageUnitMetaData.java similarity index 92% rename from infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ShardingSphereStorageUnitMetaData.java rename to infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/StorageUnitMetaData.java index 7cb4ba0607fa9..05357738ffced 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/ShardingSphereStorageUnitMetaData.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/StorageUnitMetaData.java @@ -34,10 +34,10 @@ import java.util.Map.Entry; /** - * ShardingSphere storage unit meta data. + * Storage unit meta data. */ @Getter -public final class ShardingSphereStorageUnitMetaData { +public final class StorageUnitMetaData { private final Map dataSources; @@ -47,8 +47,8 @@ public final class ShardingSphereStorageUnitMetaData { private final Map connectionPropsMap; - public ShardingSphereStorageUnitMetaData(final Map dataSources, final Map storageTypes, final Map storageUnits, - final Map enabledDataSources) { + public StorageUnitMetaData(final Map dataSources, final Map storageTypes, final Map storageUnits, + final Map enabledDataSources) { this.storageUnits = storageUnits; this.dataSources = getStorageUnitDataSources(dataSources, storageUnits); this.storageTypes = getStorageUnitTypes(storageTypes); diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/state/datasource/DataSourceStateManager.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/state/datasource/DataSourceStateManager.java index e9bd41ff197bb..48d7a4c861e28 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/state/datasource/DataSourceStateManager.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/state/datasource/DataSourceStateManager.java @@ -99,17 +99,17 @@ private void checkState(final String databaseName, final String actualDataSource * @return enabled data sources */ public Collection getEnabledDataSources(final String databaseName, final DatabaseConfiguration databaseConfig) { - return databaseConfig.getDataSources().isEmpty() ? Collections.emptyList() : getEnabledDataSourceMap(databaseName, databaseConfig.getDataSources()).values(); + return databaseConfig.getDataSources().isEmpty() ? Collections.emptyList() : getEnabledDataSources(databaseName, databaseConfig.getDataSources()).values(); } /** - * Get enabled data source map. + * Get enabled data sources. * * @param databaseName database name * @param dataSources data sources - * @return enabled data source map + * @return enabled data sources */ - public Map getEnabledDataSourceMap(final String databaseName, final Map dataSources) { + public Map getEnabledDataSources(final String databaseName, final Map dataSources) { if (dataSources.isEmpty() || !initialized.get()) { return dataSources; } 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 ddb26c0b62dc1..8597ac0a043bd 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 @@ -22,7 +22,7 @@ import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.instance.InstanceContext; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.rule.identifier.type.ResourceHeldRule; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; @@ -57,12 +57,12 @@ class ShardingSphereMetaDataTest { @Test void assertAddDatabase() { ResourceHeldRule globalResourceHeldRule = mock(ResourceHeldRule.class); - ShardingSphereDatabase database = mockDatabase(mock(ShardingSphereResourceMetaData.class), new MockedDataSource(), mock(ResourceHeldRule.class)); + ShardingSphereDatabase database = mockDatabase(mock(ResourceMetaData.class), new MockedDataSource(), mock(ResourceHeldRule.class)); DatabaseType databaseType = mock(DatabaseType.class); ConfigurationProperties configProps = new ConfigurationProperties(new Properties()); when(ShardingSphereDatabase.create("foo_db", databaseType, configProps)).thenReturn(database); Map databases = new HashMap<>(Collections.singletonMap("foo_db", database)); - ShardingSphereMetaData metaData = new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), + ShardingSphereMetaData metaData = new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singleton(globalResourceHeldRule)), configProps); metaData.addDatabase("foo_db", databaseType, configProps); assertThat(metaData.getDatabases(), is(databases)); @@ -71,12 +71,12 @@ void assertAddDatabase() { @Test void assertDropDatabase() { - ShardingSphereResourceMetaData resourceMetaData = mock(ShardingSphereResourceMetaData.class); + ResourceMetaData resourceMetaData = mock(ResourceMetaData.class); DataSource dataSource = new MockedDataSource(); ResourceHeldRule databaseResourceHeldRule = mock(ResourceHeldRule.class); ResourceHeldRule globalResourceHeldRule = mock(ResourceHeldRule.class); ShardingSphereMetaData metaData = new ShardingSphereMetaData(new HashMap<>(Collections.singletonMap("foo_db", mockDatabase(resourceMetaData, dataSource, databaseResourceHeldRule))), - mock(ShardingSphereResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singleton(globalResourceHeldRule)), new ConfigurationProperties(new Properties())); + mock(ResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singleton(globalResourceHeldRule)), new ConfigurationProperties(new Properties())); metaData.dropDatabase("foo_db"); assertTrue(metaData.getDatabases().isEmpty()); verify(resourceMetaData).close(dataSource); @@ -84,7 +84,7 @@ void assertDropDatabase() { verify(globalResourceHeldRule).closeStaleResource("foo_db"); } - private ShardingSphereDatabase mockDatabase(final ShardingSphereResourceMetaData resourceMetaData, final DataSource dataSource, final ResourceHeldRule databaseResourceHeldRule) { + private ShardingSphereDatabase mockDatabase(final ResourceMetaData resourceMetaData, final DataSource dataSource, final ResourceHeldRule databaseResourceHeldRule) { ShardingSphereDatabase result = mock(ShardingSphereDatabase.class); when(result.getName()).thenReturn("foo_db"); when(result.getResourceMetaData()).thenReturn(resourceMetaData); diff --git a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabaseTest.java b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabaseTest.java index 9c2006bae74a4..e6ff52bba4901 100644 --- a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabaseTest.java +++ b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabaseTest.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.infra.metadata.database; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.rule.ShardingSphereRule; import org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedRule; @@ -42,28 +42,28 @@ class ShardingSphereDatabaseTest { @Test void assertIsComplete() { - ShardingSphereResourceMetaData resourceMetaData = new ShardingSphereResourceMetaData("sharding_db", Collections.singletonMap("ds", new MockedDataSource())); + ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", Collections.singletonMap("ds", new MockedDataSource())); ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData(Collections.singleton(mock(ShardingSphereRule.class))); assertTrue(new ShardingSphereDatabase("foo_db", mock(DatabaseType.class), resourceMetaData, ruleMetaData, Collections.emptyMap()).isComplete()); } @Test void assertIsNotCompleteWithoutRule() { - ShardingSphereResourceMetaData resourceMetaData = new ShardingSphereResourceMetaData("sharding_db", Collections.singletonMap("ds", new MockedDataSource())); + ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", Collections.singletonMap("ds", new MockedDataSource())); ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData(Collections.emptyList()); assertFalse(new ShardingSphereDatabase("foo_db", mock(DatabaseType.class), resourceMetaData, ruleMetaData, Collections.emptyMap()).isComplete()); } @Test void assertIsNotCompleteWithoutDataSource() { - ShardingSphereResourceMetaData resourceMetaData = new ShardingSphereResourceMetaData("sharding_db", Collections.emptyMap()); + ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", Collections.emptyMap()); ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData(Collections.singleton(mock(ShardingSphereRule.class))); assertFalse(new ShardingSphereDatabase("foo_db", mock(DatabaseType.class), resourceMetaData, ruleMetaData, Collections.emptyMap()).isComplete()); } @Test void assertReloadRules() { - ShardingSphereResourceMetaData resourceMetaData = new ShardingSphereResourceMetaData("sharding_db", Collections.singletonMap("ds", new MockedDataSource())); + ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", Collections.singletonMap("ds", new MockedDataSource())); Collection rules = new LinkedList<>(); rules.add(mock(MutableDataNodeRule.class, RETURNS_DEEP_STUBS)); rules.add(mock(DataSourceContainedRule.class, RETURNS_DEEP_STUBS)); diff --git a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/resource/ShardingSphereResourceTest.java b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/resource/ShardingSphereResourceTest.java index f6dea0b43fe61..bd313fe248d25 100644 --- a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/resource/ShardingSphereResourceTest.java +++ b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/resource/ShardingSphereResourceTest.java @@ -31,7 +31,7 @@ class ShardingSphereResourceTest { @Test void assertClose() { MockedDataSource dataSource = new MockedDataSource(); - new ShardingSphereResourceMetaData("sharding_db", Collections.singletonMap("foo_ds", dataSource)).close(dataSource); + new ResourceMetaData("sharding_db", Collections.singletonMap("foo_ds", dataSource)).close(dataSource); Awaitility.await().atMost(1L, TimeUnit.MINUTES).pollInterval(10L, TimeUnit.MILLISECONDS).until(dataSource::isClosed); assertTrue(dataSource.isClosed()); } diff --git a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/util/IndexMetaDataUtilsTest.java b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/util/IndexMetaDataUtilsTest.java index cba4051020256..7ccd4bdbd2c3f 100644 --- a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/util/IndexMetaDataUtilsTest.java +++ b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/util/IndexMetaDataUtilsTest.java @@ -20,7 +20,7 @@ import org.apache.shardingsphere.infra.database.core.DefaultDatabase; 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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.QualifiedTable; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereIndex; @@ -93,6 +93,6 @@ private ShardingSphereDatabase buildDatabase() { ShardingSphereTable table = new ShardingSphereTable(TABLE_NAME, Collections.emptyList(), Collections.singleton(new ShardingSphereIndex(INDEX_NAME)), Collections.emptyList()); Map tables = Collections.singletonMap(TABLE_NAME, table); Map schemas = Collections.singletonMap(DefaultDatabase.LOGIC_NAME, new ShardingSphereSchema(tables, Collections.emptyMap())); - return new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, mock(DatabaseType.class), mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), schemas); + return new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, mock(DatabaseType.class), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), schemas); } } diff --git a/infra/context/src/test/java/org/apache/shardingsphere/infra/connection/kernel/KernelProcessorTest.java b/infra/context/src/test/java/org/apache/shardingsphere/infra/connection/kernel/KernelProcessorTest.java index 14bec6d8e7932..32be083237d0b 100644 --- a/infra/context/src/test/java/org/apache/shardingsphere/infra/connection/kernel/KernelProcessorTest.java +++ b/infra/context/src/test/java/org/apache/shardingsphere/infra/connection/kernel/KernelProcessorTest.java @@ -25,7 +25,7 @@ import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.executor.sql.context.ExecutionContext; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.rule.ShardingSphereRule; import org.apache.shardingsphere.infra.session.connection.ConnectionContext; @@ -54,7 +54,7 @@ void assertGenerateExecutionContext() { when(sqlStatementContext.getSqlStatement()).thenReturn(mock(SelectStatement.class)); QueryContext queryContext = new QueryContext(sqlStatementContext, "SELECT * FROM tbl", Collections.emptyList()); ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, mock(DatabaseType.class), - mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), new ShardingSphereRuleMetaData(mockShardingSphereRule()), Collections.emptyMap()); + mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), new ShardingSphereRuleMetaData(mockShardingSphereRule()), Collections.emptyMap()); ConfigurationProperties props = new ConfigurationProperties(PropertiesBuilder.build(new Property(ConfigurationPropertyKey.SQL_SHOW.getKey(), Boolean.TRUE.toString()))); ExecutionContext actual = new KernelProcessor().generateExecutionContext(queryContext, database, new ShardingSphereRuleMetaData(mockShardingSphereRule()), props, mock(ConnectionContext.class)); diff --git a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/JDBCExecutorCallback.java b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/JDBCExecutorCallback.java index faf5a6fada93c..47fdf0aa220b3 100644 --- a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/JDBCExecutorCallback.java +++ b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/JDBCExecutorCallback.java @@ -27,7 +27,7 @@ import org.apache.shardingsphere.infra.executor.sql.hook.SPISQLExecutionHook; import org.apache.shardingsphere.infra.executor.sql.hook.SQLExecutionHook; import org.apache.shardingsphere.infra.executor.sql.process.ProcessEngine; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement; import java.sql.SQLException; @@ -46,7 +46,7 @@ public abstract class JDBCExecutorCallback implements ExecutorCallback sqlRewriteUnits = new HashMap<>(2, 1F); sqlRewriteUnits.put(routeUnit1, sqlRewriteUnit1); sqlRewriteUnits.put(routeUnit2, sqlRewriteUnit2); - ShardingSphereResourceMetaData resourceMetaData = new ShardingSphereResourceMetaData("sharding_db", Collections.emptyMap()); + ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", Collections.emptyMap()); ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData(Collections.emptyList()); ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, mock(DatabaseType.class), resourceMetaData, ruleMetaData, buildDatabase()); Collection actual = ExecutionContextBuilder.build(database, new RouteSQLRewriteResult(sqlRewriteUnits), mock(SQLStatementContext.class)); @@ -89,7 +89,7 @@ void assertBuildRouteSQLRewriteResultWithEmptyPrimaryKeyMeta() { SQLRewriteUnit sqlRewriteUnit2 = new SQLRewriteUnit("sql2", Collections.singletonList("parameter2")); Map sqlRewriteUnits = new HashMap<>(2, 1F); sqlRewriteUnits.put(routeUnit2, sqlRewriteUnit2); - ShardingSphereResourceMetaData resourceMetaData = new ShardingSphereResourceMetaData("sharding_db", Collections.emptyMap()); + ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", Collections.emptyMap()); ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData(Collections.emptyList()); ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, mock(DatabaseType.class), resourceMetaData, ruleMetaData, buildDatabaseWithoutPrimaryKey()); Collection actual = ExecutionContextBuilder.build(database, new RouteSQLRewriteResult(sqlRewriteUnits), mock(SQLStatementContext.class)); diff --git a/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/jdbc/JDBCExecutorCallbackTest.java b/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/jdbc/JDBCExecutorCallbackTest.java index 9f052cea11c54..2874a515c52bc 100644 --- a/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/jdbc/JDBCExecutorCallbackTest.java +++ b/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/jdbc/JDBCExecutorCallbackTest.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.executor.sql.execute.engine.SQLExecutorExceptionHandler; import org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutionUnit; import org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement; import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement; @@ -65,7 +65,7 @@ void setUp() { @Test void assertExecuteFailedAndProtocolTypeDifferentWithDatabaseType() throws SQLException { Object saneResult = new Object(); - ShardingSphereResourceMetaData resourceMetaData = mock(ShardingSphereResourceMetaData.class); + ResourceMetaData resourceMetaData = mock(ResourceMetaData.class); when(resourceMetaData.getStorageType("ds")).thenReturn(TypedSPILoader.getService(DatabaseType.class, "PostgreSQL")); JDBCExecutorCallback callback = new JDBCExecutorCallback(TypedSPILoader.getService(DatabaseType.class, "MySQL"), resourceMetaData, mock(SelectStatement.class), true) { @@ -86,7 +86,7 @@ protected Optional getSaneResult(final SQLStatement sqlStatement, final @Test void assertExecuteSQLExceptionOccurredAndProtocolTypeSameAsDatabaseType() { - ShardingSphereResourceMetaData resourceMetaData = mock(ShardingSphereResourceMetaData.class); + ResourceMetaData resourceMetaData = mock(ResourceMetaData.class); when(resourceMetaData.getStorageType("ds")).thenReturn(TypedSPILoader.getService(DatabaseType.class, "PostgreSQL")); JDBCExecutorCallback callback = new JDBCExecutorCallback(TypedSPILoader.getService(DatabaseType.class, "MySQL"), resourceMetaData, mock(SelectStatement.class), true) { 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 2a1deca038357..f0cd1e58752ac 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 @@ -23,7 +23,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.rewrite.engine.result.GenericSQLRewriteResult; @@ -80,8 +80,8 @@ void assertRewriteForRouteSQLRewriteResult() { assertThat(sqlRewriteResult.getSqlRewriteUnits().size(), is(2)); } - private ShardingSphereResourceMetaData mockResource() { - ShardingSphereResourceMetaData result = mock(ShardingSphereResourceMetaData.class); + private ResourceMetaData mockResource() { + ResourceMetaData result = mock(ResourceMetaData.class); Map databaseTypes = new LinkedHashMap<>(2, 1F); databaseTypes.put("ds_0", TypedSPILoader.getService(DatabaseType.class, "H2")); databaseTypes.put("ds_1", TypedSPILoader.getService(DatabaseType.class, "MySQL")); diff --git a/infra/route/src/test/java/org/apache/shardingsphere/infra/route/engine/SQLRouteEngineTest.java b/infra/route/src/test/java/org/apache/shardingsphere/infra/route/engine/SQLRouteEngineTest.java index b6b3cb5081f36..ad9dc87263429 100644 --- a/infra/route/src/test/java/org/apache/shardingsphere/infra/route/engine/SQLRouteEngineTest.java +++ b/infra/route/src/test/java/org/apache/shardingsphere/infra/route/engine/SQLRouteEngineTest.java @@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.session.connection.ConnectionContext; 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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.route.context.RouteContext; import org.apache.shardingsphere.infra.route.context.RouteUnit; @@ -48,7 +48,7 @@ void assertRouteSuccess() { QueryContext queryContext = new QueryContext(mock(CommonSQLStatementContext.class), "SELECT 1", Collections.emptyList()); ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData(Collections.singleton(new RouteRuleFixture())); ShardingSphereDatabase database = new ShardingSphereDatabase("logic_schema", - mock(DatabaseType.class), mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap()); + mock(DatabaseType.class), mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap()); SQLRouteEngine sqlRouteEngine = new SQLRouteEngine(Collections.singleton(new RouteRuleFixture()), new ConfigurationProperties(new Properties())); RouteContext actual = sqlRouteEngine.route(new ConnectionContext(), queryContext, mock(ShardingSphereRuleMetaData.class), database); assertThat(actual.getRouteUnits().size(), is(1)); @@ -63,7 +63,7 @@ void assertRouteFailure() { QueryContext queryContext = new QueryContext(mock(CommonSQLStatementContext.class), "SELECT 1", Collections.emptyList()); ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData(Collections.singleton(new RouteRuleFixture())); ShardingSphereDatabase database = new ShardingSphereDatabase("logic_schema", - mock(DatabaseType.class), mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap()); + mock(DatabaseType.class), mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap()); assertThrows(UnsupportedOperationException.class, () -> new SQLRouteEngine(Collections.singleton(new RouteFailureRuleFixture()), new ConfigurationProperties(new Properties())).route(new ConnectionContext(), queryContext, mock(ShardingSphereRuleMetaData.class), database)); } diff --git a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/executor/callback/ExecuteQueryCallback.java b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/executor/callback/ExecuteQueryCallback.java index e685149746c6b..e1caae0ef6f7d 100644 --- a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/executor/callback/ExecuteQueryCallback.java +++ b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/executor/callback/ExecuteQueryCallback.java @@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResult; import org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.driver.jdbc.type.memory.JDBCMemoryQueryResult; import org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.driver.jdbc.type.stream.JDBCStreamQueryResult; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement; import java.sql.ResultSet; @@ -36,7 +36,7 @@ */ public abstract class ExecuteQueryCallback extends JDBCExecutorCallback { - protected ExecuteQueryCallback(final DatabaseType protocolType, final ShardingSphereResourceMetaData resourceMetaData, final SQLStatement sqlStatement, final boolean isExceptionThrown) { + protected ExecuteQueryCallback(final DatabaseType protocolType, final ResourceMetaData resourceMetaData, final SQLStatement sqlStatement, final boolean isExceptionThrown) { super(protocolType, resourceMetaData, sqlStatement, isExceptionThrown); } diff --git a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/executor/callback/impl/PreparedStatementExecuteQueryCallback.java b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/executor/callback/impl/PreparedStatementExecuteQueryCallback.java index ddba6419f2a48..8d5b4c084f02a 100644 --- a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/executor/callback/impl/PreparedStatementExecuteQueryCallback.java +++ b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/executor/callback/impl/PreparedStatementExecuteQueryCallback.java @@ -19,7 +19,7 @@ import org.apache.shardingsphere.driver.executor.callback.ExecuteQueryCallback; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement; import java.sql.PreparedStatement; @@ -32,7 +32,7 @@ */ public final class PreparedStatementExecuteQueryCallback extends ExecuteQueryCallback { - public PreparedStatementExecuteQueryCallback(final DatabaseType protocolType, final ShardingSphereResourceMetaData resourceMetaData, final SQLStatement sqlStatement, + public PreparedStatementExecuteQueryCallback(final DatabaseType protocolType, final ResourceMetaData resourceMetaData, final SQLStatement sqlStatement, final boolean isExceptionThrown) { super(protocolType, resourceMetaData, sqlStatement, isExceptionThrown); } diff --git a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/executor/callback/impl/StatementExecuteQueryCallback.java b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/executor/callback/impl/StatementExecuteQueryCallback.java index 41c335d22a867..30fa6af5c3c4b 100644 --- a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/executor/callback/impl/StatementExecuteQueryCallback.java +++ b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/executor/callback/impl/StatementExecuteQueryCallback.java @@ -19,7 +19,7 @@ import org.apache.shardingsphere.driver.executor.callback.ExecuteQueryCallback; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement; import java.sql.ResultSet; @@ -31,7 +31,7 @@ */ public final class StatementExecuteQueryCallback extends ExecuteQueryCallback { - public StatementExecuteQueryCallback(final DatabaseType protocolType, final ShardingSphereResourceMetaData resourceMetaData, final SQLStatement sqlStatement, final boolean isExceptionThrown) { + public StatementExecuteQueryCallback(final DatabaseType protocolType, final ResourceMetaData resourceMetaData, final SQLStatement sqlStatement, final boolean isExceptionThrown) { super(protocolType, resourceMetaData, sqlStatement, isExceptionThrown); } diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/state/DriverStateContextTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/state/DriverStateContextTest.java index 06a291f5f249c..59dc1435d07ef 100644 --- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/state/DriverStateContextTest.java +++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/state/DriverStateContextTest.java @@ -23,7 +23,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.state.cluster.ClusterStateContext; import org.apache.shardingsphere.infra.state.instance.InstanceStateContext; @@ -63,7 +63,7 @@ void setUp() { Map databases = mockDatabases(); ShardingSphereRuleMetaData globalRuleMetaData = new ShardingSphereRuleMetaData(Arrays.asList(mock(TransactionRule.class, RETURNS_DEEP_STUBS), mock(TrafficRule.class))); MetaDataContexts metaDataContexts = new MetaDataContexts( - mock(MetaDataPersistService.class), new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), + mock(MetaDataPersistService.class), new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), globalRuleMetaData, new ConfigurationProperties(new Properties()))); when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts); when(contextManager.getInstanceContext().getInstance().getState()).thenReturn(new InstanceStateContext()); diff --git a/kernel/authority/distsql/handler/src/test/java/org/apache/shardingsphere/authority/distsql/handler/ShowAuthorityRuleExecutorTest.java b/kernel/authority/distsql/handler/src/test/java/org/apache/shardingsphere/authority/distsql/handler/ShowAuthorityRuleExecutorTest.java index 4c478e4059269..0d6edd3624213 100644 --- a/kernel/authority/distsql/handler/src/test/java/org/apache/shardingsphere/authority/distsql/handler/ShowAuthorityRuleExecutorTest.java +++ b/kernel/authority/distsql/handler/src/test/java/org/apache/shardingsphere/authority/distsql/handler/ShowAuthorityRuleExecutorTest.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser; import org.junit.jupiter.api.Test; @@ -69,7 +69,7 @@ void assertGetColumnNames() { private ShardingSphereMetaData mockMetaData() { AuthorityRule authorityRule = mock(AuthorityRule.class); when(authorityRule.getConfiguration()).thenReturn(createAuthorityRuleConfiguration()); - return new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singleton(authorityRule)), new ConfigurationProperties(new Properties())); } diff --git a/kernel/global-clock/distsql/handler/src/test/java/org/apache/shardingsphere/globalclock/distsql/handler/query/ShowGlobalClockRuleExecutorTest.java b/kernel/global-clock/distsql/handler/src/test/java/org/apache/shardingsphere/globalclock/distsql/handler/query/ShowGlobalClockRuleExecutorTest.java index 33fd274b7151c..39cbd9125d0e3 100644 --- a/kernel/global-clock/distsql/handler/src/test/java/org/apache/shardingsphere/globalclock/distsql/handler/query/ShowGlobalClockRuleExecutorTest.java +++ b/kernel/global-clock/distsql/handler/src/test/java/org/apache/shardingsphere/globalclock/distsql/handler/query/ShowGlobalClockRuleExecutorTest.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.globalclock.distsql.parser.statement.queryable.ShowGlobalClockRuleStatement; import org.junit.jupiter.api.Test; @@ -69,7 +69,7 @@ void assertGetColumnNames() { private ShardingSphereMetaData mockMetaData() { GlobalClockRule sqlParserRule = mock(GlobalClockRule.class); when(sqlParserRule.getConfiguration()).thenReturn(new DefaultGlobalClockRuleConfigurationBuilder().build()); - return new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singleton(sqlParserRule)), new ConfigurationProperties(new Properties())); } } diff --git a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/decorator/SingleRuleConfigurationDecorator.java b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/decorator/SingleRuleConfigurationDecorator.java index 472e2c1a56305..e0a596a443547 100644 --- a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/decorator/SingleRuleConfigurationDecorator.java +++ b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/decorator/SingleRuleConfigurationDecorator.java @@ -61,7 +61,7 @@ private Collection decorateTables(final String databaseName, final Map enabledDataSources = DataSourceStateManager.getInstance().getEnabledDataSourceMap(databaseName, dataSources); + Map enabledDataSources = DataSourceStateManager.getInstance().getEnabledDataSources(databaseName, dataSources); Map aggregatedDataSources = SingleTableLoadUtils.getAggregatedDataSourceMap(enabledDataSources, builtRules); DatabaseType databaseType = DatabaseTypeEngine.getStorageType(enabledDataSources.values()); Collection excludedTables = SingleTableLoadUtils.getExcludedTables(builtRules); diff --git a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/rule/SingleRule.java b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/rule/SingleRule.java index d708bdf8c3b04..c3b7908fdd125 100644 --- a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/rule/SingleRule.java +++ b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/rule/SingleRule.java @@ -76,7 +76,7 @@ public final class SingleRule implements DatabaseRule, DataNodeContainedRule, Ta public SingleRule(final SingleRuleConfiguration ruleConfig, final String databaseName, final Map dataSourceMap, final Collection builtRules) { configuration = ruleConfig; defaultDataSource = ruleConfig.getDefaultDataSource().orElse(null); - Map enabledDataSources = DataSourceStateManager.getInstance().getEnabledDataSourceMap(databaseName, dataSourceMap); + Map enabledDataSources = DataSourceStateManager.getInstance().getEnabledDataSources(databaseName, dataSourceMap); Map aggregateDataSourceMap = SingleTableLoadUtils.getAggregatedDataSourceMap(enabledDataSources, builtRules); dataSourceNames = aggregateDataSourceMap.keySet(); databaseType = DatabaseTypeEngine.getStorageType(enabledDataSources.values()); 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 8a0426125c06f..75fc6855a6da0 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 @@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.datanode.DataNode; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.route.SQLRouter; @@ -178,7 +178,7 @@ void assertDecorateRouteContextWithReadwriteSplittingDataSource() { routeContext.getRouteUnits().add(readWriteRouteUnit); routeContext.getRouteUnits().add(writeRouteUnit); SingleSQLRouter sqlRouter = (SingleSQLRouter) OrderedSPILoader.getServices(SQLRouter.class, Collections.singleton(rule)).get(rule); - ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, mock(DatabaseType.class), mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), + ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, mock(DatabaseType.class), mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), new ShardingSphereRuleMetaData(Collections.singleton(rule)), Collections.emptyMap()); sqlRouter.decorateRouteContext(routeContext, createQueryContext(), database, rule, new ConfigurationProperties(new Properties()), new ConnectionContext()); Iterator routedDataSourceNames = routeContext.getActualDataSourceNames().iterator(); diff --git a/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/ShowUnloadedSingleTableExecutor.java b/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/ShowUnloadedSingleTableExecutor.java index ca9efdb58c884..d3d23805cdc62 100644 --- a/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/ShowUnloadedSingleTableExecutor.java +++ b/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/ShowUnloadedSingleTableExecutor.java @@ -21,7 +21,7 @@ import org.apache.shardingsphere.infra.datanode.DataNode; 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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.single.datanode.SingleTableDataNodeLoader; import org.apache.shardingsphere.single.distsql.statement.rql.ShowUnloadedSingleTableStatement; import org.apache.shardingsphere.single.rule.SingleRule; @@ -59,7 +59,7 @@ public Collection getRows(final ShardingSphereDatabase } private Map> getActualDataNodes(final ShardingSphereDatabase database) { - ShardingSphereResourceMetaData resourceMetaData = database.getResourceMetaData(); + ResourceMetaData resourceMetaData = database.getResourceMetaData(); Map aggregateDataSourceMap = SingleTableLoadUtils.getAggregatedDataSourceMap(resourceMetaData.getDataSources(), database.getRuleMetaData().getRules()); Collection excludedTables = SingleTableLoadUtils.getExcludedTables(database.getRuleMetaData().getRules()); return SingleTableDataNodeLoader.load(database.getName(), database.getProtocolType(), aggregateDataSourceMap, excludedTables); diff --git a/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/update/LoadSingleTableStatementUpdater.java b/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/update/LoadSingleTableStatementUpdater.java index 520f8e270ce08..ece0779d4afb3 100644 --- a/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/update/LoadSingleTableStatementUpdater.java +++ b/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/update/LoadSingleTableStatementUpdater.java @@ -25,7 +25,7 @@ import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.dialect.exception.syntax.table.TableExistsException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedRule; import org.apache.shardingsphere.single.api.config.SingleRuleConfiguration; @@ -111,7 +111,7 @@ private void checkActualTableExist(final ShardingSphereDatabase database, final if (requiredDataSources.isEmpty()) { return; } - ShardingSphereResourceMetaData resourceMetaData = database.getResourceMetaData(); + ResourceMetaData resourceMetaData = database.getResourceMetaData(); Map aggregateDataSourceMap = SingleTableLoadUtils.getAggregatedDataSourceMap(resourceMetaData.getDataSources(), database.getRuleMetaData().getRules()); Map>> actualTableNodes = new LinkedHashMap<>(); for (String each : requiredDataSources) { diff --git a/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/engine/SQLFederationEngineTest.java b/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/engine/SQLFederationEngineTest.java index e4a312874aef3..0509b9c5d4830 100644 --- a/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/engine/SQLFederationEngineTest.java +++ b/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/engine/SQLFederationEngineTest.java @@ -25,7 +25,7 @@ import org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereStatistics; import org.apache.shardingsphere.infra.rule.ShardingSphereRule; @@ -69,7 +69,7 @@ void assertDecideWhenSelectStatementContainsSystemSchema() throws SQLException { when(sqlStatementContext.getDatabaseType()).thenReturn(databaseType); when(sqlStatementContext.getTablesContext().getSchemaNames()).thenReturn(Collections.singletonList("information_schema")); ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, - databaseType, mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), mock(ShardingSphereRuleMetaData.class), Collections.emptyMap()); + databaseType, mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), mock(ShardingSphereRuleMetaData.class), Collections.emptyMap()); assertTrue(engine.decide(sqlStatementContext, Collections.emptyList(), database, mock(ShardingSphereRuleMetaData.class))); engine.close(); } @@ -86,7 +86,7 @@ void assertDecideWhenNotConfigSqlFederationEnabled() throws SQLException { Collections.singletonList(new SQLFederationRule(new SQLFederationRuleConfiguration(false, mock(CacheOption.class)), Collections.emptyMap(), mock(ConfigurationProperties.class))); SQLFederationEngine engine = createSQLFederationEngine(globalRules, Collections.emptyList()); ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, - databaseType, mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), new ShardingSphereRuleMetaData(globalRules), Collections.emptyMap()); + databaseType, mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), new ShardingSphereRuleMetaData(globalRules), Collections.emptyMap()); ShardingSphereRuleMetaData globalRuleMetaData = new ShardingSphereRuleMetaData(globalRules); assertFalse(engine.decide(mock(CommonSQLStatementContext.class), Collections.emptyList(), database, globalRuleMetaData)); engine.close(); @@ -98,7 +98,7 @@ void assertDecideWhenExecuteNotSelectStatement() throws SQLException { Collections.singletonList(new SQLFederationRule(new SQLFederationRuleConfiguration(true, mock(CacheOption.class)), Collections.emptyMap(), mock(ConfigurationProperties.class))); SQLFederationEngine engine = createSQLFederationEngine(globalRules, Collections.emptyList()); ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, - databaseType, mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), new ShardingSphereRuleMetaData(globalRules), Collections.emptyMap()); + databaseType, mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), new ShardingSphereRuleMetaData(globalRules), Collections.emptyMap()); ShardingSphereRuleMetaData globalRuleMetaData = new ShardingSphereRuleMetaData(globalRules); assertFalse(engine.decide(mock(CommonSQLStatementContext.class), Collections.emptyList(), database, globalRuleMetaData)); engine.close(); @@ -111,7 +111,7 @@ void assertDecideWhenConfigSingleMatchedRule() throws SQLException { Collection databaseRules = Collections.singletonList(new SQLFederationDeciderRuleMatchFixture()); SQLFederationEngine engine = createSQLFederationEngine(globalRules, databaseRules); ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, - databaseType, mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), new ShardingSphereRuleMetaData(globalRules), Collections.emptyMap()); + databaseType, mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), new ShardingSphereRuleMetaData(globalRules), Collections.emptyMap()); ShardingSphereRuleMetaData globalRuleMetaData = new ShardingSphereRuleMetaData(globalRules); SelectStatementContext selectStatementContext = mock(SelectStatementContext.class, RETURNS_DEEP_STUBS); when(selectStatementContext.getDatabaseType()).thenReturn(databaseType); @@ -126,7 +126,7 @@ void assertDecideWhenConfigSingleNotMatchedRule() throws SQLException { Collection databaseRules = Collections.singletonList(new SQLFederationDeciderRuleNotMatchFixture()); SQLFederationEngine engine = createSQLFederationEngine(globalRules, databaseRules); ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, - databaseType, mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), new ShardingSphereRuleMetaData(databaseRules), Collections.emptyMap()); + databaseType, mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), new ShardingSphereRuleMetaData(databaseRules), Collections.emptyMap()); SelectStatementContext selectStatementContext = mock(SelectStatementContext.class, RETURNS_DEEP_STUBS); when(selectStatementContext.getDatabaseType()).thenReturn(databaseType); assertFalse(engine.decide(selectStatementContext, Collections.emptyList(), database, new ShardingSphereRuleMetaData(globalRules))); @@ -141,7 +141,7 @@ void assertDecideWhenConfigMultiRule() throws SQLException { new SQLFederationDeciderRuleMatchFixture()); SQLFederationEngine engine = createSQLFederationEngine(globalRules, databaseRules); ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, - databaseType, mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), new ShardingSphereRuleMetaData(databaseRules), Collections.emptyMap()); + databaseType, mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), new ShardingSphereRuleMetaData(databaseRules), Collections.emptyMap()); SelectStatementContext selectStatementContext = mock(SelectStatementContext.class, RETURNS_DEEP_STUBS); when(selectStatementContext.getDatabaseType()).thenReturn(databaseType); assertTrue(engine.decide(selectStatementContext, Collections.emptyList(), database, new ShardingSphereRuleMetaData(globalRules))); diff --git a/kernel/sql-federation/distsql/handler/src/test/java/org/apache/shardingsphere/sqlfederation/distsql/handler/query/ShowSQLFederationRuleExecutorTest.java b/kernel/sql-federation/distsql/handler/src/test/java/org/apache/shardingsphere/sqlfederation/distsql/handler/query/ShowSQLFederationRuleExecutorTest.java index 54ab9327bfde1..8e23d76c7ed46 100644 --- a/kernel/sql-federation/distsql/handler/src/test/java/org/apache/shardingsphere/sqlfederation/distsql/handler/query/ShowSQLFederationRuleExecutorTest.java +++ b/kernel/sql-federation/distsql/handler/src/test/java/org/apache/shardingsphere/sqlfederation/distsql/handler/query/ShowSQLFederationRuleExecutorTest.java @@ -20,7 +20,7 @@ import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.sql.parser.api.CacheOption; import org.apache.shardingsphere.sqlfederation.api.config.SQLFederationRuleConfiguration; @@ -66,7 +66,7 @@ void assertGetColumnNames() { private ShardingSphereMetaData mockMetaData() { SQLFederationRule sqlFederationRule = mock(SQLFederationRule.class); when(sqlFederationRule.getConfiguration()).thenReturn(new SQLFederationRuleConfiguration(true, new CacheOption(2000, 65535L))); - return new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singleton(sqlFederationRule)), new ConfigurationProperties(new Properties())); } } diff --git a/kernel/sql-parser/distsql/handler/src/test/java/org/apache/shardingsphere/parser/distsql/handler/query/ShowSQLParserRuleExecutorTest.java b/kernel/sql-parser/distsql/handler/src/test/java/org/apache/shardingsphere/parser/distsql/handler/query/ShowSQLParserRuleExecutorTest.java index 5d8bc52b9e5e6..ee793e1de947f 100644 --- a/kernel/sql-parser/distsql/handler/src/test/java/org/apache/shardingsphere/parser/distsql/handler/query/ShowSQLParserRuleExecutorTest.java +++ b/kernel/sql-parser/distsql/handler/src/test/java/org/apache/shardingsphere/parser/distsql/handler/query/ShowSQLParserRuleExecutorTest.java @@ -20,7 +20,7 @@ import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.parser.config.SQLParserRuleConfiguration; import org.apache.shardingsphere.parser.distsql.parser.statement.queryable.ShowSQLParserRuleStatement; @@ -68,7 +68,7 @@ void assertGetColumnNames() { private ShardingSphereMetaData mockMetaData() { SQLParserRule sqlParserRule = mock(SQLParserRule.class); when(sqlParserRule.getConfiguration()).thenReturn(new SQLParserRuleConfiguration(true, new CacheOption(128, 1024), new CacheOption(2000, 65535))); - return new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singleton(sqlParserRule)), new ConfigurationProperties(new Properties())); } } diff --git a/kernel/sql-translator/distsql/handler/src/test/java/org/apache/shardingsphere/sqltranslator/distsql/handler/ShowSQLTranslatorRuleExecutorTest.java b/kernel/sql-translator/distsql/handler/src/test/java/org/apache/shardingsphere/sqltranslator/distsql/handler/ShowSQLTranslatorRuleExecutorTest.java index 941a0e2ae241d..82c57017671b5 100644 --- a/kernel/sql-translator/distsql/handler/src/test/java/org/apache/shardingsphere/sqltranslator/distsql/handler/ShowSQLTranslatorRuleExecutorTest.java +++ b/kernel/sql-translator/distsql/handler/src/test/java/org/apache/shardingsphere/sqltranslator/distsql/handler/ShowSQLTranslatorRuleExecutorTest.java @@ -20,7 +20,7 @@ import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.sqltranslator.api.config.SQLTranslatorRuleConfiguration; import org.apache.shardingsphere.sqltranslator.distsql.parser.statement.ShowSQLTranslatorRuleStatement; @@ -65,7 +65,7 @@ void assertGetColumnNames() { private ShardingSphereMetaData mockMetaData() { SQLTranslatorRule sqlTranslatorRule = mock(SQLTranslatorRule.class); when(sqlTranslatorRule.getConfiguration()).thenReturn(createSQLTranslatorRuleConfiguration()); - return new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singleton(sqlTranslatorRule)), new ConfigurationProperties(new Properties())); } diff --git a/kernel/traffic/core/src/test/java/org/apache/shardingsphere/traffic/rule/TrafficRuleTest.java b/kernel/traffic/core/src/test/java/org/apache/shardingsphere/traffic/rule/TrafficRuleTest.java index 6226931a340db..ecaf67a57b591 100644 --- a/kernel/traffic/core/src/test/java/org/apache/shardingsphere/traffic/rule/TrafficRuleTest.java +++ b/kernel/traffic/core/src/test/java/org/apache/shardingsphere/traffic/rule/TrafficRuleTest.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.database.core.DefaultDatabase; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.rule.identifier.type.TableContainedRule; import org.apache.shardingsphere.infra.session.query.QueryContext; @@ -104,7 +104,7 @@ private ShardingSphereDatabase mockDatabase() { } private ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } diff --git a/kernel/traffic/distsql/handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/query/ShowTrafficRuleExecutorTest.java b/kernel/traffic/distsql/handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/query/ShowTrafficRuleExecutorTest.java index d8ab1eeeed35e..3d3b13940e2b3 100644 --- a/kernel/traffic/distsql/handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/query/ShowTrafficRuleExecutorTest.java +++ b/kernel/traffic/distsql/handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/query/ShowTrafficRuleExecutorTest.java @@ -21,7 +21,7 @@ import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.test.util.PropertiesBuilder; import org.apache.shardingsphere.test.util.PropertiesBuilder.Property; @@ -85,7 +85,7 @@ void assertGetColumnNames() { private ShardingSphereMetaData mockMetaData() { TrafficRule trafficRule = mock(TrafficRule.class); when(trafficRule.getConfiguration()).thenReturn(createTrafficRuleConfiguration()); - return new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singleton(trafficRule)), new ConfigurationProperties(new Properties())); } 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 6bf6172ae3fe9..a62016760ba1d 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 @@ -19,7 +19,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.test.fixture.jdbc.MockedDataSource; import org.apache.shardingsphere.transaction.api.TransactionType; @@ -60,13 +60,13 @@ void assertAddResource() { assertNotNull(actual.getResource()); assertThat(actual.getDatabases().size(), is(2)); assertTrue(actual.getDatabases().containsKey(SHARDING_DB_1)); - ShardingSphereResourceMetaData resourceMetaData1 = actual.getDatabases().get(SHARDING_DB_1).getResourceMetaData(); + ResourceMetaData resourceMetaData1 = actual.getDatabases().get(SHARDING_DB_1).getResourceMetaData(); assertThat(resourceMetaData1.getDataSources().size(), is(2)); assertTrue(resourceMetaData1.getDataSources().containsKey("ds_0")); assertTrue(resourceMetaData1.getDataSources().containsKey("ds_1")); assertThat(resourceMetaData1.getStorageTypes().size(), is(2)); assertTrue(actual.getDatabases().containsKey(SHARDING_DB_2)); - ShardingSphereResourceMetaData resourceMetaData2 = actual.getDatabases().get(SHARDING_DB_2).getResourceMetaData(); + ResourceMetaData resourceMetaData2 = actual.getDatabases().get(SHARDING_DB_2).getResourceMetaData(); assertThat(resourceMetaData2.getDataSources().size(), is(2)); assertTrue(resourceMetaData2.getDataSources().containsKey("ds_0")); assertTrue(resourceMetaData2.getDataSources().containsKey("ds_1")); @@ -92,14 +92,14 @@ void assertCloseAllStaleResources() { private ShardingSphereDatabase createDatabase() { ShardingSphereDatabase result = mock(ShardingSphereDatabase.class); - ShardingSphereResourceMetaData resourceMetaData = createResourceMetaData(); + ResourceMetaData resourceMetaData = createResourceMetaData(); when(result.getResourceMetaData()).thenReturn(resourceMetaData); when(result.getName()).thenReturn("sharding_db"); return result; } - private ShardingSphereResourceMetaData createResourceMetaData() { - ShardingSphereResourceMetaData result = mock(ShardingSphereResourceMetaData.class); + private ResourceMetaData createResourceMetaData() { + ResourceMetaData result = mock(ResourceMetaData.class); Map dataSourceMap = new LinkedHashMap<>(2, 1F); dataSourceMap.put("ds_0", new MockedDataSource()); dataSourceMap.put("ds_1", new MockedDataSource()); @@ -113,14 +113,14 @@ private ShardingSphereResourceMetaData createResourceMetaData() { private ShardingSphereDatabase createAddDatabase() { ShardingSphereDatabase result = mock(ShardingSphereDatabase.class); - ShardingSphereResourceMetaData resourceMetaData = createAddResourceMetaData(); + ResourceMetaData resourceMetaData = createAddResourceMetaData(); when(result.getResourceMetaData()).thenReturn(resourceMetaData); when(result.getName()).thenReturn(SHARDING_DB_2); return result; } - private ShardingSphereResourceMetaData createAddResourceMetaData() { - ShardingSphereResourceMetaData result = mock(ShardingSphereResourceMetaData.class); + private ResourceMetaData createAddResourceMetaData() { + ResourceMetaData result = mock(ResourceMetaData.class); Map dataSourceMap = new LinkedHashMap<>(2, 1F); dataSourceMap.put("ds_0", new MockedDataSource()); dataSourceMap.put("ds_1", new MockedDataSource()); diff --git a/kernel/transaction/core/src/test/java/org/apache/shardingsphere/transaction/rule/builder/TransactionRuleBuilderTest.java b/kernel/transaction/core/src/test/java/org/apache/shardingsphere/transaction/rule/builder/TransactionRuleBuilderTest.java index ee08a1a9d1dfe..e9ca7fc49d57e 100644 --- a/kernel/transaction/core/src/test/java/org/apache/shardingsphere/transaction/rule/builder/TransactionRuleBuilderTest.java +++ b/kernel/transaction/core/src/test/java/org/apache/shardingsphere/transaction/rule/builder/TransactionRuleBuilderTest.java @@ -20,7 +20,7 @@ import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; import org.apache.shardingsphere.infra.database.core.DefaultDatabase; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.rule.ShardingSphereRule; @@ -45,7 +45,7 @@ class TransactionRuleBuilderTest { @Test void assertBuild() { TransactionRuleConfiguration ruleConfig = new TransactionRuleConfiguration("LOCAL", "provider", new Properties()); - ShardingSphereDatabase database = new ShardingSphereDatabase("logic_db", null, new ShardingSphereResourceMetaData("db", createDataSourceMap()), + ShardingSphereDatabase database = new ShardingSphereDatabase("logic_db", null, new ResourceMetaData("db", createDataSourceMap()), new ShardingSphereRuleMetaData(Collections.singletonList(mock(ShardingSphereRule.class))), Collections.singletonMap("test", mock(ShardingSphereSchema.class))); TransactionRule rule = new TransactionRuleBuilder().build(ruleConfig, Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ConfigurationProperties.class)); assertNotNull(rule.getConfiguration()); diff --git a/kernel/transaction/distsql/handler/src/test/java/org/apache/shardingsphere/transaction/distsql/handler/query/ShowTransactionRuleExecutorTest.java b/kernel/transaction/distsql/handler/src/test/java/org/apache/shardingsphere/transaction/distsql/handler/query/ShowTransactionRuleExecutorTest.java index 1e2adb607300b..6d8cc1c8071d3 100644 --- a/kernel/transaction/distsql/handler/src/test/java/org/apache/shardingsphere/transaction/distsql/handler/query/ShowTransactionRuleExecutorTest.java +++ b/kernel/transaction/distsql/handler/src/test/java/org/apache/shardingsphere/transaction/distsql/handler/query/ShowTransactionRuleExecutorTest.java @@ -20,7 +20,7 @@ import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.test.util.PropertiesBuilder; import org.apache.shardingsphere.test.util.PropertiesBuilder.Property; @@ -48,7 +48,7 @@ void assertExecuteWithXA() { ShowTransactionRuleExecutor executor = new ShowTransactionRuleExecutor(); ShardingSphereRuleMetaData ruleMetaData = mockGlobalRuleMetaData(TransactionType.XA.name(), "Atomikos", PropertiesBuilder.build(new Property("host", "127.0.0.1"), new Property("databaseName", "jbossts"))); - ShardingSphereMetaData metaData = new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ShardingSphereResourceMetaData.class), ruleMetaData, new ConfigurationProperties(new Properties())); + ShardingSphereMetaData metaData = new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ResourceMetaData.class), ruleMetaData, new ConfigurationProperties(new Properties())); Collection actual = executor.getRows(metaData, mock(ShowTransactionRuleStatement.class)); assertThat(actual.size(), is(1)); Iterator iterator = actual.iterator(); @@ -64,7 +64,7 @@ void assertExecuteWithXA() { void assertExecuteWithLocal() { ShowTransactionRuleExecutor executor = new ShowTransactionRuleExecutor(); ShardingSphereRuleMetaData ruleMetaData = mockGlobalRuleMetaData(TransactionType.LOCAL.name(), null, new Properties()); - ShardingSphereMetaData metaData = new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ShardingSphereResourceMetaData.class), ruleMetaData, new ConfigurationProperties(new Properties())); + ShardingSphereMetaData metaData = new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ResourceMetaData.class), ruleMetaData, new ConfigurationProperties(new Properties())); Collection actual = executor.getRows(metaData, mock(ShowTransactionRuleStatement.class)); assertThat(actual.size(), is(1)); Iterator iterator = actual.iterator(); 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 c1650f4a5f122..1eaa18c8f833f 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 @@ -26,7 +26,7 @@ import org.apache.shardingsphere.infra.instance.InstanceContext; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.SchemaManager; import org.apache.shardingsphere.infra.metadata.database.schema.builder.GenericSchemaBuilder; @@ -116,7 +116,7 @@ public Map getDataSourceMap(final String databaseName) { public void reloadDatabaseMetaData(final String databaseName) { try { ShardingSphereDatabase database = metaDataContexts.get().getMetaData().getDatabase(databaseName); - ShardingSphereResourceMetaData currentResourceMetaData = database.getResourceMetaData(); + ResourceMetaData currentResourceMetaData = database.getResourceMetaData(); Map dataSourceProps = metaDataContexts.get().getPersistService().getDataSourceUnitService().load(databaseName); SwitchingResource switchingResource = new ResourceSwitchManager().createByAlterDataSourceProps(currentResourceMetaData, dataSourceProps); metaDataContexts.get().getMetaData().getDatabases().putAll(configurationContextManager.renewDatabase(database, switchingResource)); 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 af5066d6fd401..5678ba5a7b235 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 @@ -30,7 +30,7 @@ import org.apache.shardingsphere.infra.instance.InstanceContext; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.SchemaManager; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; @@ -274,7 +274,7 @@ public Map renewDatabase(final ShardingSphereDat StorageResource newStorageResource = new StorageResource(newStorageNodes, newStorageUnits); return Collections.singletonMap(database.getName().toLowerCase(), new ShardingSphereDatabase(database.getName(), database.getProtocolType(), - new ShardingSphereResourceMetaData(database.getName(), newStorageResource, database.getResourceMetaData().getDataSourcePropsMap()), + new ResourceMetaData(database.getName(), newStorageResource, database.getResourceMetaData().getDataSourcePropsMap()), database.getRuleMetaData(), database.getSchemas())); } @@ -337,7 +337,7 @@ public MetaDataContexts createMetaDataContexts(final String databaseName, final */ public synchronized Map createChangedDatabases(final String databaseName, final boolean internalLoadMetaData, final SwitchingResource switchingResource, final Collection ruleConfigs) throws SQLException { - ShardingSphereResourceMetaData resourceMetaData = metaDataContexts.get().getMetaData().getDatabase(databaseName).getResourceMetaData(); + ResourceMetaData resourceMetaData = metaDataContexts.get().getMetaData().getDatabase(databaseName).getResourceMetaData(); if (null != switchingResource && null != switchingResource.getNewStorageResource() && !switchingResource.getNewStorageResource().getStorageNodes().isEmpty()) { resourceMetaData.getStorageNodeMetaData().getDataSources().putAll(switchingResource.getNewStorageResource().getStorageNodes()); } diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/switcher/NewResourceSwitchManager.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/switcher/NewResourceSwitchManager.java index d1f9a31b4d538..16eef1c5844a9 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/switcher/NewResourceSwitchManager.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/switcher/NewResourceSwitchManager.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.infra.datasource.storage.StorageResource; import org.apache.shardingsphere.infra.datasource.storage.StorageResourceWithProperties; import org.apache.shardingsphere.infra.datasource.storage.StorageUnit; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import javax.sql.DataSource; import java.util.Collections; @@ -43,14 +43,14 @@ public final class NewResourceSwitchManager { * @param dataSourceProps data source properties * @return created switching resource */ - public SwitchingResource registerStorageUnit(final ShardingSphereResourceMetaData resourceMetaData, final Map dataSourceProps) { + public SwitchingResource registerStorageUnit(final ResourceMetaData resourceMetaData, final Map dataSourceProps) { resourceMetaData.getDataSourcePropsMap().putAll(dataSourceProps); StorageResourceWithProperties toBeCreatedStorageResource = DataSourcePoolCreator.createStorageResourceWithoutDataSource(dataSourceProps); return new SwitchingResource(resourceMetaData, getRegisterNewStorageResource(resourceMetaData, toBeCreatedStorageResource), new StorageResource(Collections.emptyMap(), Collections.emptyMap()), resourceMetaData.getDataSourcePropsMap()); } - private StorageResource getRegisterNewStorageResource(final ShardingSphereResourceMetaData resourceMetaData, final StorageResourceWithProperties toBeCreatedStorageResource) { + private StorageResource getRegisterNewStorageResource(final ResourceMetaData resourceMetaData, final StorageResourceWithProperties toBeCreatedStorageResource) { Map storageNodes = new LinkedHashMap<>(toBeCreatedStorageResource.getStorageNodes().size(), 1F); for (String each : toBeCreatedStorageResource.getStorageNodes().keySet()) { if (!resourceMetaData.getStorageNodeMetaData().getDataSources().containsKey(each)) { @@ -67,7 +67,7 @@ private StorageResource getRegisterNewStorageResource(final ShardingSphereResour * @param dataSourceProps data source properties * @return created switching resource */ - public SwitchingResource alterStorageUnit(final ShardingSphereResourceMetaData resourceMetaData, final Map dataSourceProps) { + public SwitchingResource alterStorageUnit(final ResourceMetaData resourceMetaData, final Map dataSourceProps) { resourceMetaData.getDataSourcePropsMap().putAll(dataSourceProps); StorageResourceWithProperties toBeAlteredStorageResource = DataSourcePoolCreator.createStorageResourceWithoutDataSource(dataSourceProps); return new SwitchingResource(resourceMetaData, getAlterNewStorageResource(toBeAlteredStorageResource), @@ -82,7 +82,7 @@ private StorageResource getAlterNewStorageResource(final StorageResourceWithProp return new StorageResource(storageNodes, toBeAlteredStorageResource.getStorageUnits()); } - private StorageResource getStaleStorageResource(final ShardingSphereResourceMetaData resourceMetaData, final StorageResourceWithProperties toBeAlteredStorageResource) { + private StorageResource getStaleStorageResource(final ResourceMetaData resourceMetaData, final StorageResourceWithProperties toBeAlteredStorageResource) { Map storageNodes = new LinkedHashMap<>(toBeAlteredStorageResource.getStorageNodes().size(), 1F); for (Entry entry : resourceMetaData.getStorageNodeMetaData().getDataSources().entrySet()) { if (toBeAlteredStorageResource.getStorageNodes().containsKey(entry.getKey())) { @@ -99,13 +99,13 @@ private StorageResource getStaleStorageResource(final ShardingSphereResourceMeta * @param storageUnitName storage unit name * @return created switching resource */ - public SwitchingResource unregisterStorageUnit(final ShardingSphereResourceMetaData resourceMetaData, final String storageUnitName) { + public SwitchingResource unregisterStorageUnit(final ResourceMetaData resourceMetaData, final String storageUnitName) { resourceMetaData.getDataSourcePropsMap().remove(storageUnitName); return new SwitchingResource(resourceMetaData, new StorageResource(Collections.emptyMap(), Collections.emptyMap()), getToBeRemovedStaleStorageResource(resourceMetaData, storageUnitName), resourceMetaData.getDataSourcePropsMap()); } - private StorageResource getToBeRemovedStaleStorageResource(final ShardingSphereResourceMetaData resourceMetaData, final String storageUnitName) { + private StorageResource getToBeRemovedStaleStorageResource(final ResourceMetaData resourceMetaData, final String storageUnitName) { StorageUnit storageUnit = resourceMetaData.getStorageUnitMetaData().getStorageUnits().remove(storageUnitName); Map reservedStorageUnits = resourceMetaData.getStorageUnitMetaData().getStorageUnits(); Map storageNodes = new LinkedHashMap<>(1, 1F); 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 1f14cc00c1f7b..47463d3699def 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 @@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.datasource.storage.StorageResource; import org.apache.shardingsphere.infra.datasource.storage.StorageResourceWithProperties; import org.apache.shardingsphere.infra.datasource.storage.StorageUnit; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import javax.sql.DataSource; import java.util.Collection; @@ -45,7 +45,7 @@ public final class ResourceSwitchManager { * @param toBeChangedDataSourceProps to be changed data source properties map * @return created switching resource */ - public SwitchingResource create(final ShardingSphereResourceMetaData resourceMetaData, final Map toBeChangedDataSourceProps) { + public SwitchingResource create(final ResourceMetaData resourceMetaData, final Map toBeChangedDataSourceProps) { resourceMetaData.getDataSourcePropsMap().putAll(toBeChangedDataSourceProps); StorageResourceWithProperties toBeChangedStorageResource = DataSourcePoolCreator.createStorageResourceWithoutDataSource(toBeChangedDataSourceProps); return new SwitchingResource(resourceMetaData, createNewStorageResource(resourceMetaData, toBeChangedStorageResource), @@ -59,7 +59,7 @@ public SwitchingResource create(final ShardingSphereResourceMetaData resourceMet * @param toBeDeletedDataSourceProps to be deleted data source properties map * @return created switching resource */ - public SwitchingResource createByDropResource(final ShardingSphereResourceMetaData resourceMetaData, final Map toBeDeletedDataSourceProps) { + public SwitchingResource createByDropResource(final ResourceMetaData resourceMetaData, final Map toBeDeletedDataSourceProps) { resourceMetaData.getDataSourcePropsMap().keySet().removeIf(toBeDeletedDataSourceProps::containsKey); StorageResourceWithProperties toToBeRemovedStorageResource = DataSourcePoolCreator.createStorageResourceWithoutDataSource(toBeDeletedDataSourceProps); return new SwitchingResource(resourceMetaData, new StorageResource(Collections.emptyMap(), Collections.emptyMap()), @@ -78,7 +78,7 @@ private Map getToBeReversedDataSourcePropsMap(fina * @param toBeChangedDataSourceProps to be changed data source properties map * @return created switching resource */ - public SwitchingResource createByAlterDataSourceProps(final ShardingSphereResourceMetaData resourceMetaData, final Map toBeChangedDataSourceProps) { + public SwitchingResource createByAlterDataSourceProps(final ResourceMetaData resourceMetaData, final Map toBeChangedDataSourceProps) { resourceMetaData.getDataSourcePropsMap().keySet().removeIf(each -> !toBeChangedDataSourceProps.containsKey(each)); resourceMetaData.getDataSourcePropsMap().putAll(toBeChangedDataSourceProps); StorageResourceWithProperties toBeChangedStorageResource = DataSourcePoolCreator.createStorageResourceWithoutDataSource(toBeChangedDataSourceProps); @@ -88,13 +88,13 @@ public SwitchingResource createByAlterDataSourceProps(final ShardingSphereResour return new SwitchingResource(resourceMetaData, createNewStorageResource(resourceMetaData, toBeChangedStorageResource), staleStorageResource, toBeChangedDataSourceProps); } - private StorageResource createNewStorageResource(final ShardingSphereResourceMetaData resourceMetaData, final StorageResourceWithProperties toBeChangedStorageResource) { + private StorageResource createNewStorageResource(final ResourceMetaData resourceMetaData, final StorageResourceWithProperties toBeChangedStorageResource) { Map storageNodes = getNewStorageNodes(resourceMetaData, toBeChangedStorageResource.getStorageNodes(), toBeChangedStorageResource.getDataSourcePropertiesMap()); Map storageUnits = getNewStorageUnits(resourceMetaData, toBeChangedStorageResource.getStorageUnits()); return new StorageResource(storageNodes, storageUnits); } - private Map getNewStorageNodes(final ShardingSphereResourceMetaData resourceMetaData, final Map toBeChangedStorageNodes, + private Map getNewStorageNodes(final ResourceMetaData resourceMetaData, final Map toBeChangedStorageNodes, final Map dataSourcePropertiesMap) { Map result = new LinkedHashMap<>(resourceMetaData.getStorageNodeMetaData().getDataSources()); result.keySet().removeAll(getToBeDeletedDataSources(resourceMetaData.getStorageNodeMetaData().getDataSources(), toBeChangedStorageNodes.keySet()).keySet()); @@ -103,7 +103,7 @@ private Map getNewStorageNodes(final ShardingSphereResourceM return result; } - private Map getNewStorageUnits(final ShardingSphereResourceMetaData resourceMetaData, final Map toBeChangedStorageUnits) { + private Map getNewStorageUnits(final ResourceMetaData resourceMetaData, final Map toBeChangedStorageUnits) { Map result = new LinkedHashMap<>(resourceMetaData.getStorageUnitMetaData().getStorageUnits()); result.keySet().removeAll(getToBeDeletedStorageUnits(resourceMetaData.getStorageUnitMetaData().getStorageUnits(), toBeChangedStorageUnits.keySet()).keySet()); result.putAll(getChangedStorageUnits(resourceMetaData.getStorageUnitMetaData().getStorageUnits(), toBeChangedStorageUnits)); @@ -136,7 +136,7 @@ private Map getToBeAddedDataSources(final Map reservedStorageUnits = resourceMetaData.getStorageUnitMetaData().getStorageUnits().entrySet().stream() .filter(entry -> !toBeRemovedStorageResource.getStorageUnits().containsKey(entry.getKey())).collect(Collectors.toMap(Entry::getKey, Entry::getValue)); Collection inUsedDataSourceNames = reservedStorageUnits.values().stream().map(StorageUnit::getNodeName).collect(Collectors.toSet()); @@ -148,7 +148,7 @@ private StorageResource getToBeRemovedStaleDataSources(final ShardingSphereResou return new StorageResource(staleStorageNodes, staleStorageUnits); } - private StorageResource getStaleDataSources(final ShardingSphereResourceMetaData resourceMetaData, final StorageResourceWithProperties toBeChangedStorageResource) { + private StorageResource getStaleDataSources(final ResourceMetaData resourceMetaData, final StorageResourceWithProperties toBeChangedStorageResource) { Map storageNodes = new LinkedHashMap<>(resourceMetaData.getStorageNodeMetaData().getDataSources().size(), 1F); Map storageUnits = new LinkedHashMap<>(resourceMetaData.getStorageUnitMetaData().getStorageUnits().size(), 1F); storageNodes.putAll(getToBeChangedDataSources(resourceMetaData.getStorageNodeMetaData().getDataSources(), toBeChangedStorageResource.getDataSourcePropertiesMap())); diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/switcher/SwitchingResource.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/switcher/SwitchingResource.java index 006285a39ed51..f5c49360ff165 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/switcher/SwitchingResource.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/switcher/SwitchingResource.java @@ -21,7 +21,7 @@ import lombok.RequiredArgsConstructor; import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties; import org.apache.shardingsphere.infra.datasource.storage.StorageResource; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import java.util.Map; import java.util.Objects; @@ -32,7 +32,7 @@ @RequiredArgsConstructor public final class SwitchingResource { - private final ShardingSphereResourceMetaData resourceMetaData; + private final ResourceMetaData resourceMetaData; @Getter private final StorageResource newStorageResource; diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContexts.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContexts.java index 7f103bd8bdda1..36c21b964a297 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContexts.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContexts.java @@ -61,11 +61,10 @@ private ShardingSphereStatistics initStatistics(final ShardingSphereMetaData met if (null == protocolType) { return new ShardingSphereStatistics(); } - // TODO can `protocolType instanceof SchemaSupportedDatabaseType ? "PostgreSQL" : protocolType.getType()` replace to trunk database type? DialectDatabaseMetaData dialectDatabaseMetaData = new DatabaseTypeRegistry(protocolType).getDialectDatabaseMetaData(); - Optional statisticsBuilder = DatabaseTypedSPILoader.findService(ShardingSphereStatisticsBuilder.class, dialectDatabaseMetaData.getDefaultSchema().isPresent() - ? TypedSPILoader.getService(DatabaseType.class, "PostgreSQL") - : protocolType); + // TODO can `protocolType instanceof SchemaSupportedDatabaseType ? "PostgreSQL" : protocolType.getType()` replace to trunk database type? + DatabaseType databaseType = dialectDatabaseMetaData.getDefaultSchema().isPresent() ? TypedSPILoader.getService(DatabaseType.class, "PostgreSQL") : protocolType; + Optional statisticsBuilder = DatabaseTypedSPILoader.findService(ShardingSphereStatisticsBuilder.class, databaseType); if (!statisticsBuilder.isPresent()) { return new ShardingSphereStatistics(); } diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java index 26d7b86b42078..93bfe8b751540 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java @@ -32,7 +32,7 @@ import org.apache.shardingsphere.infra.instance.metadata.jdbc.JDBCInstanceMetaData; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.rule.builder.global.GlobalRulesBuilder; import org.apache.shardingsphere.metadata.factory.ExternalMetaDataFactory; @@ -94,7 +94,7 @@ public static MetaDataContexts create(final MetaDataPersistService persistServic Map databases = isDatabaseMetaDataExisted ? InternalMetaDataFactory.create(persistService, effectiveDatabaseConfigs, props, instanceContext) : ExternalMetaDataFactory.create(effectiveDatabaseConfigs, props, instanceContext); - ShardingSphereResourceMetaData globalResourceMetaData = new ShardingSphereResourceMetaData(globalDataSources); + ResourceMetaData globalResourceMetaData = new ResourceMetaData(globalDataSources); ShardingSphereRuleMetaData globalRuleMetaData = new ShardingSphereRuleMetaData(GlobalRulesBuilder.buildRules(globalRuleConfigs, databases, props)); MetaDataContexts result = new MetaDataContexts(persistService, new ShardingSphereMetaData(databases, globalResourceMetaData, globalRuleMetaData, props)); if (!isDatabaseMetaDataExisted) { diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/NewMetaDataContextsFactory.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/NewMetaDataContextsFactory.java index 4266c1a8e678b..123b575b94668 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/NewMetaDataContextsFactory.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/NewMetaDataContextsFactory.java @@ -32,7 +32,7 @@ import org.apache.shardingsphere.infra.instance.metadata.jdbc.JDBCInstanceMetaData; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.rule.builder.global.GlobalRulesBuilder; import org.apache.shardingsphere.metadata.factory.ExternalMetaDataFactory; @@ -95,7 +95,7 @@ public static MetaDataContexts create(final NewMetaDataPersistService persistSer Map databases = isDatabaseMetaDataExisted ? NewInternalMetaDataFactory.create(persistService, effectiveDatabaseConfigs, props, instanceContext) : ExternalMetaDataFactory.create(effectiveDatabaseConfigs, props, instanceContext); - ShardingSphereResourceMetaData globalResourceMetaData = new ShardingSphereResourceMetaData(globalDataSources); + ResourceMetaData globalResourceMetaData = new ResourceMetaData(globalDataSources); ShardingSphereRuleMetaData globalRuleMetaData = new ShardingSphereRuleMetaData(GlobalRulesBuilder.buildRules(globalRuleConfigs, databases, props)); MetaDataContexts result = new MetaDataContexts(persistService, new ShardingSphereMetaData(databases, globalResourceMetaData, globalRuleMetaData, props)); if (!isDatabaseMetaDataExisted) { 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 f97258459e4f4..2a238b72da367 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 @@ -28,7 +28,7 @@ import org.apache.shardingsphere.infra.instance.InstanceContext; import org.apache.shardingsphere.infra.instance.mode.ModeContextManager; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; @@ -105,7 +105,7 @@ private ShardingSphereDatabase mockDatabase() { @Test void assertGetDataSourceMap() { - ShardingSphereResourceMetaData resourceMetaData = new ShardingSphereResourceMetaData("sharding_db", Collections.singletonMap("foo_ds", new MockedDataSource())); + ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", Collections.singletonMap("foo_ds", new MockedDataSource())); ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, mock(DatabaseType.class), resourceMetaData, mock(ShardingSphereRuleMetaData.class), Collections.emptyMap()); when(metaDataContexts.getMetaData().getDatabase(DefaultDatabase.LOGIC_NAME)).thenReturn(database); @@ -212,7 +212,7 @@ private void assertAlteredDataSource(final MockedDataSource actual) { @Test void assertAlterRuleConfiguration() { - ShardingSphereResourceMetaData resourceMetaData = mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS); + ResourceMetaData resourceMetaData = mock(ResourceMetaData.class, RETURNS_DEEP_STUBS); Map dataSources = Collections.singletonMap("ds_0", new MockedDataSource()); when(resourceMetaData.getStorageNodeMetaData().getDataSources()).thenReturn(dataSources); when(resourceMetaData.getStorageUnitMetaData().getStorageUnits()).thenReturn(StorageUtils.getStorageUnits(dataSources)); @@ -238,8 +238,8 @@ void assertAlterDataSourceConfiguration() { .getResourceMetaData().getStorageNodeMetaData().getDataSources().get("foo_ds")); } - private ShardingSphereResourceMetaData createOriginalResource() { - ShardingSphereResourceMetaData result = mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS); + private ResourceMetaData createOriginalResource() { + ResourceMetaData result = mock(ResourceMetaData.class, RETURNS_DEEP_STUBS); Map originalDataSources = new LinkedHashMap<>(2, 1F); originalDataSources.put("ds_1", new MockedDataSource()); originalDataSources.put("ds_2", new MockedDataSource()); diff --git a/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/switcher/ResourceSwitchManagerTest.java b/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/switcher/ResourceSwitchManagerTest.java index 18d2ac23ec440..c981dfd887bb6 100644 --- a/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/switcher/ResourceSwitchManagerTest.java +++ b/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/switcher/ResourceSwitchManagerTest.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.mode.manager.switcher; import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.test.fixture.jdbc.MockedDataSource; import org.awaitility.Awaitility; import org.junit.jupiter.api.Test; @@ -40,7 +40,7 @@ class ResourceSwitchManagerTest { @Test void assertCreate() { Map dataSourceMap = createDataSourceMap(); - SwitchingResource actual = new ResourceSwitchManager().create(new ShardingSphereResourceMetaData("sharding_db", dataSourceMap), createToBeChangedDataSourcePropsMap()); + SwitchingResource actual = new ResourceSwitchManager().create(new ResourceMetaData("sharding_db", dataSourceMap), createToBeChangedDataSourcePropsMap()); assertNewDataSources(actual); actual.closeStaleDataSources(); assertStaleDataSources(dataSourceMap); @@ -51,7 +51,7 @@ void assertCreateByAlterDataSourceProps() { Map dataSourceMap = new HashMap<>(3, 1F); dataSourceMap.put("ds_0", new MockedDataSource()); dataSourceMap.put("ds_1", new MockedDataSource()); - SwitchingResource actual = new ResourceSwitchManager().createByAlterDataSourceProps(new ShardingSphereResourceMetaData("sharding_db", dataSourceMap), Collections.emptyMap()); + SwitchingResource actual = new ResourceSwitchManager().createByAlterDataSourceProps(new ResourceMetaData("sharding_db", dataSourceMap), Collections.emptyMap()); assertTrue(actual.getNewStorageResource().getStorageNodes().isEmpty()); assertThat(actual.getStaleStorageResource().getStorageNodes().size(), is(2)); actual.closeStaleDataSources(); diff --git a/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/switcher/SwitchingResourceTest.java b/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/switcher/SwitchingResourceTest.java index ab018e4da6395..6cc4f6f1b506d 100644 --- a/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/switcher/SwitchingResourceTest.java +++ b/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/switcher/SwitchingResourceTest.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.mode.manager.switcher; import org.apache.shardingsphere.infra.datasource.storage.StorageResource; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.test.fixture.jdbc.MockedDataSource; import org.junit.jupiter.api.Test; @@ -32,7 +32,7 @@ class SwitchingResourceTest { @Test void assertCloseStaleDataSources() { MockedDataSource staleDataSource = new MockedDataSource(); - ShardingSphereResourceMetaData resourceMetaData = mock(ShardingSphereResourceMetaData.class); + ResourceMetaData resourceMetaData = mock(ResourceMetaData.class); StorageResource newStorageResource = new StorageResource(Collections.singletonMap("new_ds", new MockedDataSource()), Collections.emptyMap()); StorageResource staleStorageResource = new StorageResource(Collections.singletonMap("stale_ds", staleDataSource), Collections.emptyMap()); new SwitchingResource(resourceMetaData, newStorageResource, staleStorageResource, Collections.emptyMap()).closeStaleDataSources(); diff --git a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsTest.java b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsTest.java index 44e0be61a9f3c..a2d154c0e85bf 100644 --- a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsTest.java +++ b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsTest.java @@ -22,7 +22,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.metadata.persist.MetaDataPersistService; @@ -44,7 +44,7 @@ void assertGetDefaultMetaData() { ShardingSphereDatabase database = mock(ShardingSphereDatabase.class); when(database.getProtocolType()).thenReturn(TypedSPILoader.getService(DatabaseType.class, "FIXTURE")); Map databases = Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database); - ShardingSphereMetaData metaData = new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), + ShardingSphereMetaData metaData = new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties())); assertThat(new MetaDataContexts(mock(MetaDataPersistService.class), metaData).getMetaData().getDatabase(DefaultDatabase.LOGIC_NAME), is(database)); } diff --git a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/ClusterModeContextManagerTest.java b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/ClusterModeContextManagerTest.java index 0e4c67bbbae1d..5d477efa91706 100644 --- a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/ClusterModeContextManagerTest.java +++ b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/ClusterModeContextManagerTest.java @@ -28,7 +28,7 @@ import org.apache.shardingsphere.infra.instance.workerid.WorkerIdGenerator; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.pojo.AlterSchemaMetaDataPOJO; import org.apache.shardingsphere.infra.metadata.database.schema.pojo.AlterSchemaPOJO; @@ -268,7 +268,7 @@ void assertAlterStorageUnitsWithoutDataSourceProperties() { Map databases = new HashMap<>(); ShardingSphereRuleMetaData globalRuleMetaData = new ShardingSphereRuleMetaData(new LinkedList<>()); MetaDataContexts metaDataContexts = new MetaDataContexts(persistService, - new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), globalRuleMetaData, new ConfigurationProperties(new Properties()))); + new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), globalRuleMetaData, new ConfigurationProperties(new Properties()))); ComputeNodeInstance instance = new ComputeNodeInstance(new JDBCInstanceMetaData("42")); WorkerIdGenerator workerIdGenerator = mock(WorkerIdGenerator.class); ModeConfiguration modeConfig = new ModeConfiguration("Type", @@ -385,8 +385,8 @@ void assertAlterRuleConfiguration() { private ShardingSphereMetaData createShardingSphereMetaData() { return new ShardingSphereMetaData(Collections.singletonMap("db", new ShardingSphereDatabase("db", TypedSPILoader.getService(DatabaseType.class, "FIXTURE"), - new ShardingSphereResourceMetaData("db", Collections.emptyMap()), new ShardingSphereRuleMetaData(Collections.emptyList()), Collections.emptyMap())), - mock(ShardingSphereResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.emptyList()), new ConfigurationProperties(new Properties())); + new ResourceMetaData("db", Collections.emptyMap()), new ShardingSphereRuleMetaData(Collections.emptyList()), Collections.emptyMap())), + mock(ResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.emptyList()), new ConfigurationProperties(new Properties())); } @Test diff --git a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ConfigurationChangedSubscriberTest.java b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ConfigurationChangedSubscriberTest.java index d52c56a5d66e4..aef869275ed96 100644 --- a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ConfigurationChangedSubscriberTest.java +++ b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ConfigurationChangedSubscriberTest.java @@ -31,7 +31,7 @@ import org.apache.shardingsphere.infra.instance.metadata.proxy.ProxyInstanceMetaData; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser; @@ -112,7 +112,7 @@ private ContextManagerBuilderParameter createContextManagerBuilderParameter() { private Map createDatabases() { when(database.getName()).thenReturn("db"); - ShardingSphereResourceMetaData resourceMetaData = mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS); + ResourceMetaData resourceMetaData = mock(ResourceMetaData.class, RETURNS_DEEP_STUBS); when(database.getResourceMetaData()).thenReturn(resourceMetaData); when(resourceMetaData.getStorageNodeMetaData().getDataSources()).thenReturn(Collections.emptyMap()); when(resourceMetaData.getStorageUnitMetaData().getStorageUnits()).thenReturn(Collections.emptyMap()); diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/jdbc/executor/callback/ProxyJDBCExecutorCallback.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/jdbc/executor/callback/ProxyJDBCExecutorCallback.java index bbc41bbe9ef55..74375b56f2f1d 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/jdbc/executor/callback/ProxyJDBCExecutorCallback.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/jdbc/executor/callback/ProxyJDBCExecutorCallback.java @@ -26,7 +26,7 @@ import org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.driver.jdbc.type.memory.JDBCMemoryQueryResult; import org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.driver.jdbc.type.stream.JDBCStreamQueryResult; import org.apache.shardingsphere.infra.executor.sql.execute.result.update.UpdateResult; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.proxy.backend.connector.DatabaseConnector; import org.apache.shardingsphere.proxy.backend.connector.sane.SaneQueryResultEngine; @@ -53,7 +53,7 @@ public abstract class ProxyJDBCExecutorCallback extends JDBCExecutorCallback getDatabaseNames(final ConnectionSession connection @Override protected void processMetaData(final String databaseName, final Consumer callback) throws SQLException { - ShardingSphereResourceMetaData resourceMetaData = ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getDatabase(databaseName).getResourceMetaData(); + ResourceMetaData resourceMetaData = ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getDatabase(databaseName).getResourceMetaData(); Optional> dataSourceEntry = resourceMetaData.getDataSources().entrySet().stream().findFirst(); if (!dataSourceEntry.isPresent()) { return; 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 1e7ed7bd8fb25..f632d955cd296 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.datasource.props.DataSourcePropertiesCreator; 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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.proxy.backend.util.StorageUnitUtils; import javax.sql.DataSource; @@ -66,7 +66,7 @@ public Collection getColumnNames() { @Override public Collection getRows(final ShardingSphereDatabase database, final ShowStorageUnitsStatement sqlStatement) { - ShardingSphereResourceMetaData resourceMetaData = database.getResourceMetaData(); + ResourceMetaData resourceMetaData = database.getResourceMetaData(); Map dataSourcePropsMap = getDataSourcePropsMap(database, sqlStatement); Collection result = new LinkedList<>(); for (Entry entry : dataSourcePropsMap.entrySet()) { diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rul/sql/PreviewExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rul/sql/PreviewExecutor.java index 4b38cb60e2353..3bf2652baed8a 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rul/sql/PreviewExecutor.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rul/sql/PreviewExecutor.java @@ -49,7 +49,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.session.query.QueryContext; import org.apache.shardingsphere.mode.metadata.MetaDataContexts; @@ -146,7 +146,7 @@ private Collection getFederationExecutionUnits(final QueryContext return context.getExecutionUnits(); } - private JDBCExecutorCallback createPreviewFederationCallback(final DatabaseType protocolType, final ShardingSphereResourceMetaData resourceMetaData, + private JDBCExecutorCallback createPreviewFederationCallback(final DatabaseType protocolType, final ResourceMetaData resourceMetaData, final SQLStatement sqlStatement) { return new JDBCExecutorCallback(protocolType, resourceMetaData, sqlStatement, SQLExecutorExceptionHandler.isExceptionThrown()) { diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnectorFactoryTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnectorFactoryTest.java index 33c5b7ec08dcb..976ffd7affba4 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnectorFactoryTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnectorFactoryTest.java @@ -22,7 +22,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.session.query.QueryContext; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; @@ -83,7 +83,7 @@ void assertNewDatabaseConnectorWithParameters() { private ContextManager mockContextManager(final ShardingSphereDatabase database) { MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), - new ShardingSphereMetaData(Collections.singletonMap("foo_db", database), mock(ShardingSphereResourceMetaData.class), + new ShardingSphereMetaData(Collections.singletonMap("foo_db", database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); when(result.getMetaDataContexts()).thenReturn(metaDataContexts); diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnectorTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnectorTest.java index 4ff840ec48d75..2cb8fcb990954 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnectorTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnectorTest.java @@ -29,7 +29,7 @@ import org.apache.shardingsphere.infra.merge.result.impl.memory.MemoryQueryResultRow; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereIndex; @@ -116,7 +116,7 @@ private ContextManager mockContextManager() { ShardingSphereRuleMetaData globalRuleMetaData = new ShardingSphereRuleMetaData(Arrays.asList(new SQLParserRule(new SQLParserRuleConfiguration(false, mock(CacheOption.class), mock(CacheOption.class))), sqlFederationRule)); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), - new ShardingSphereMetaData(mockDatabases(), mock(ShardingSphereResourceMetaData.class), globalRuleMetaData, new ConfigurationProperties(new Properties()))); + new ShardingSphereMetaData(mockDatabases(), mock(ResourceMetaData.class), globalRuleMetaData, new ConfigurationProperties(new Properties()))); ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); when(result.getMetaDataContexts()).thenReturn(metaDataContexts); return result; diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/ProxySQLExecutorTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/ProxySQLExecutorTest.java index c31982d692c16..dd16f78d1aa24 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/ProxySQLExecutorTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/ProxySQLExecutorTest.java @@ -33,7 +33,7 @@ import org.apache.shardingsphere.infra.instance.InstanceContext; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.route.context.RouteContext; @@ -243,7 +243,7 @@ private CursorStatementContext createCursorStatementContext() { } private ShardingSphereMetaData createShardingSphereMetaData(final ShardingSphereDatabase database) { - return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), mock(ConfigurationProperties.class)); } diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/jdbc/datasource/JDBCBackendDataSourceTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/jdbc/datasource/JDBCBackendDataSourceTest.java index 22e19d4ce230a..59657bc223b0f 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/jdbc/datasource/JDBCBackendDataSourceTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/jdbc/datasource/JDBCBackendDataSourceTest.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.executor.sql.execute.engine.ConnectionMode; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.metadata.persist.MetaDataPersistService; @@ -86,7 +86,7 @@ void setUp() { private ContextManager mockContextManager() { ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), - new ShardingSphereMetaData(createDatabases(), mock(ShardingSphereResourceMetaData.class), mockGlobalRuleMetaData(), new ConfigurationProperties(new Properties()))); + new ShardingSphereMetaData(createDatabases(), mock(ResourceMetaData.class), mockGlobalRuleMetaData(), new ConfigurationProperties(new Properties()))); when(result.getMetaDataContexts()).thenReturn(metaDataContexts); return result; } diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/context/ProxyContextTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/context/ProxyContextTest.java index 8cd89fdc50b61..62307423e5b2b 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/context/ProxyContextTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/context/ProxyContextTest.java @@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.instance.InstanceContext; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.state.cluster.ClusterState; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; @@ -84,7 +84,7 @@ void assertDatabaseExists() { Map databases = mockDatabases(); ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), - new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); + new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts); ProxyContext.init(contextManager); assertTrue(ProxyContext.getInstance().databaseExists("db")); @@ -106,7 +106,7 @@ void assertGetDatabaseWhenNotExisted() { Map databases = mockDatabases(); ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), - new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); + new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts); ProxyContext.init(contextManager); assertThrows(NoDatabaseSelectedException.class, () -> ProxyContext.getInstance().getDatabase("db1")); @@ -117,7 +117,7 @@ void assertGetDatabase() { Map databases = mockDatabases(); ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), - new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); + new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts); ProxyContext.init(contextManager); assertThat(databases.get("db"), is(ProxyContext.getInstance().getDatabase("db"))); @@ -128,7 +128,7 @@ void assertGetAllDatabaseNames() { Map databases = createDatabases(); ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), - new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); + new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts); ProxyContext.init(contextManager); assertThat(new LinkedHashSet<>(ProxyContext.getInstance().getAllDatabaseNames()), is(databases.keySet())); diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/DatabaseAdminQueryBackendHandlerTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/DatabaseAdminQueryBackendHandlerTest.java index 583cdec68b991..7d76fd796aa5d 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/DatabaseAdminQueryBackendHandlerTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/DatabaseAdminQueryBackendHandlerTest.java @@ -24,7 +24,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.database.core.spi.DatabaseTypedSPILoader; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; @@ -113,7 +113,7 @@ private ContextManager mockContextManager() { when(database.getProtocolType()).thenReturn(databaseType); when(ProxyContext.getInstance().getDatabase("foo_db")).thenReturn(database); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), new ShardingSphereMetaData( - Collections.singletonMap("foo_db", database), mock(ShardingSphereResourceMetaData.class), + Collections.singletonMap("foo_db", database), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); return new ContextManager(metaDataContexts, mock(InstanceContext.class)); } diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/executor/DefaultDatabaseMetaDataExecutorTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/executor/DefaultDatabaseMetaDataExecutorTest.java index fcbd503da03f1..1f332c2ef247d 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/executor/DefaultDatabaseMetaDataExecutorTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/executor/DefaultDatabaseMetaDataExecutorTest.java @@ -23,7 +23,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.util.SystemSchemaUtils; import org.apache.shardingsphere.infra.metadata.user.Grantee; @@ -119,7 +119,7 @@ void assertExecuteWithPreparedStatement() throws SQLException { private ShardingSphereDatabase createDatabase(final Map expectedResultSetMap) throws SQLException { return new ShardingSphereDatabase("auth_db", TypedSPILoader.getService(DatabaseType.class, "FIXTURE"), - new ShardingSphereResourceMetaData("sharding_db", Collections.singletonMap("foo_ds", new MockedDataSource(mockConnection(expectedResultSetMap)))), + new ResourceMetaData("sharding_db", Collections.singletonMap("foo_ds", new MockedDataSource(mockConnection(expectedResultSetMap)))), mock(ShardingSphereRuleMetaData.class), Collections.emptyMap()); } @@ -149,7 +149,7 @@ private ContextManager mockContextManager(final ShardingSphereDatabase database) when(authorityRule.findPrivileges(grantee)).thenReturn(Optional.of(new DatabasePermittedPrivileges(Collections.singleton("auth_db")))); ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), new ShardingSphereMetaData(Collections.singletonMap("auth_db", database), - mock(ShardingSphereResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singleton(authorityRule)), new ConfigurationProperties(new Properties()))); + mock(ResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singleton(authorityRule)), new ConfigurationProperties(new Properties()))); when(result.getMetaDataContexts()).thenReturn(metaDataContexts); when(ProxyContext.getInstance().getDatabase("auth_db")).thenReturn(database); when(ProxyContext.getInstance().getAllDatabaseNames()).thenReturn(Collections.singleton("auth_db")); diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/data/impl/UnicastDatabaseBackendHandlerTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/data/impl/UnicastDatabaseBackendHandlerTest.java index fa24dd08c5c0a..2bbc558731067 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/data/impl/UnicastDatabaseBackendHandlerTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/data/impl/UnicastDatabaseBackendHandlerTest.java @@ -23,7 +23,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.session.query.QueryContext; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; @@ -129,7 +129,7 @@ void assertDatabaseUsingStream() throws SQLException { private ContextManager mockContextManager() { ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), - new ShardingSphereMetaData(createDatabases(), mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); + new ShardingSphereMetaData(createDatabases(), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); when(result.getMetaDataContexts()).thenReturn(metaDataContexts); return result; } diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/database/DatabaseOperateBackendHandlerFactoryTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/database/DatabaseOperateBackendHandlerFactoryTest.java index 86c948f498bc5..d7c43f9aff128 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/database/DatabaseOperateBackendHandlerFactoryTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/database/DatabaseOperateBackendHandlerFactoryTest.java @@ -22,7 +22,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; @@ -79,7 +79,7 @@ class DatabaseOperateBackendHandlerFactoryTest { @BeforeEach void setUp() { MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), - new ShardingSphereMetaData(getDatabases(), mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); + new ShardingSphereMetaData(getDatabases(), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts); when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager); when(ProxyContext.getInstance().databaseExists("foo_db")).thenReturn(true); diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactoryTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactoryTest.java index f8c454355082a..11da69c3c620e 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactoryTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactoryTest.java @@ -26,7 +26,7 @@ import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration; import org.apache.shardingsphere.infra.instance.mode.ModeContextManager; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.mode.manager.ContextManager; import org.apache.shardingsphere.mode.metadata.MetaDataContexts; @@ -211,7 +211,7 @@ void assertExecuteShowResourceContext() throws SQLException { private void mockShardingSphereRuleMetaData() { ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS); when(database.getName()).thenReturn("foo_db"); - when(database.getResourceMetaData()).thenReturn(mock(ShardingSphereResourceMetaData.class)); + when(database.getResourceMetaData()).thenReturn(mock(ResourceMetaData.class)); ShardingSphereRuleMetaData ruleMetaData = mock(ShardingSphereRuleMetaData.class); ShadowRuleConfiguration ruleConfig = mockShadowRuleConfiguration(); when(ruleMetaData.getConfigurations()).thenReturn(Collections.singleton(ruleConfig)); 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 823ea21fd810d..50c7c39743e9e 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 @@ -36,7 +36,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.util.eventbus.EventBusContext; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; @@ -119,7 +119,7 @@ void assertExecuteWithEmptyMetaData() { private ContextManager mockEmptyContextManager() { ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), new ShardingSphereMetaData(new HashMap<>(), - new ShardingSphereResourceMetaData(Collections.emptyMap()), new ShardingSphereRuleMetaData(Collections.singletonList( + new ResourceMetaData(Collections.emptyMap()), new ShardingSphereRuleMetaData(Collections.singletonList( new GlobalClockRule(new DefaultGlobalClockRuleConfigurationBuilder().build(), Collections.emptyMap()))), new ConfigurationProperties(new Properties()))); when(result.getMetaDataContexts()).thenReturn(metaDataContexts); @@ -145,7 +145,7 @@ void assertExecute() { private ContextManager mockContextManager() { MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), new ShardingSphereMetaData(Collections.singletonMap(database.getName(), database), - new ShardingSphereResourceMetaData(Collections.emptyMap()), + new ResourceMetaData(Collections.emptyMap()), new ShardingSphereRuleMetaData(Arrays.asList(new AuthorityRule(new DefaultAuthorityRuleConfigurationBuilder().build(), Collections.emptyMap()), new GlobalClockRule(new DefaultGlobalClockRuleConfigurationBuilder().build(), Collections.singletonMap(database.getName(), database)))), new ConfigurationProperties(PropertiesBuilder.build(new Property(ConfigurationPropertyKey.SQL_SHOW.getKey(), "true"))))); 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 8cb7591425020..002d378339f35 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 @@ -28,7 +28,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.metadata.persist.MetaDataPersistService; @@ -117,7 +117,7 @@ void assertExecuteWithEmptyMetaData() { private ContextManager mockEmptyContextManager() { ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), new ShardingSphereMetaData(new HashMap<>(), - new ShardingSphereResourceMetaData(Collections.emptyMap()), new ShardingSphereRuleMetaData(Collections.emptyList()), new ConfigurationProperties(new Properties()))); + new ResourceMetaData(Collections.emptyMap()), new ShardingSphereRuleMetaData(Collections.emptyList()), new ConfigurationProperties(new Properties()))); when(result.getMetaDataContexts()).thenReturn(metaDataContexts); return result; } @@ -151,7 +151,7 @@ void assertExecuteWithDatabaseName() { private ContextManager mockContextManager() { ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), new ShardingSphereMetaData(Collections.singletonMap(database.getName(), database), - new ShardingSphereResourceMetaData(Collections.emptyMap()), + new ResourceMetaData(Collections.emptyMap()), new ShardingSphereRuleMetaData(Collections.singleton(new AuthorityRule(new DefaultAuthorityRuleConfigurationBuilder().build(), Collections.emptyMap()))), new ConfigurationProperties(PropertiesBuilder.build(new Property(ConfigurationPropertyKey.SQL_SHOW.getKey(), "true"))))); when(result.getMetaDataContexts()).thenReturn(metaDataContexts); diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowStatusFromReadwriteSplittingRulesExecutorTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowStatusFromReadwriteSplittingRulesExecutorTest.java index 185ac8319de2c..addea54975c38 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowStatusFromReadwriteSplittingRulesExecutorTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowStatusFromReadwriteSplittingRulesExecutorTest.java @@ -23,7 +23,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.rule.ShardingSphereRule; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; @@ -91,11 +91,11 @@ private ContextManager mockContextManager() { private ShardingSphereMetaData mockMetaData() { ShardingSphereDatabase database = new ShardingSphereDatabase("readwrite_db", TypedSPILoader.getService(DatabaseType.class, "FIXTURE"), - mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), + mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), new ShardingSphereRuleMetaData(Collections.singletonList(mock(ShardingSphereRule.class))), Collections.emptyMap()); Map databaseMap = new LinkedHashMap<>(); databaseMap.put("readwrite_db", database); - return new ShardingSphereMetaData(databaseMap, mock(ShardingSphereResourceMetaData.class), + return new ShardingSphereMetaData(databaseMap, mock(ResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.emptyList()), new ConfigurationProperties(new Properties())); } } diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdaterTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdaterTest.java index 0cce0e0791662..97b42e17c20df 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdaterTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdaterTest.java @@ -26,7 +26,7 @@ import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey; import org.apache.shardingsphere.infra.database.core.DefaultDatabase; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedRule; import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; @@ -125,7 +125,7 @@ private void init(final String databaseName) { private ContextManager mockContextManager(final String databaseName) { ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS); - ShardingSphereResourceMetaData resourceMetaData = mock(ShardingSphereResourceMetaData.class); + ResourceMetaData resourceMetaData = mock(ResourceMetaData.class); when(database.getResourceMetaData()).thenReturn(resourceMetaData); ShardingSphereSchema schema = mock(ShardingSphereSchema.class); when(database.getSchema(DefaultDatabase.LOGIC_NAME)).thenReturn(schema); 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 3b78829963b54..15ea177183afd 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 @@ -28,7 +28,7 @@ import org.apache.shardingsphere.distsql.parser.statement.rdl.alter.AlterStorageUnitStatement; 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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.mode.manager.ContextManager; import org.apache.shardingsphere.mode.metadata.MetaDataContexts; @@ -78,7 +78,7 @@ void assertExecute() { ContextManager contextManager = mockContextManager(mock(MetaDataContexts.class, RETURNS_DEEP_STUBS)); when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager); when(ProxyContext.getInstance().getDatabase("foo_db")).thenReturn(database); - ShardingSphereResourceMetaData resourceMetaData = mock(ShardingSphereResourceMetaData.class); + ResourceMetaData resourceMetaData = mock(ResourceMetaData.class); when(resourceMetaData.getDataSources()).thenReturn(Collections.singletonMap("ds_0", mockHikariDataSource("ds_0"))); when(database.getResourceMetaData()).thenReturn(resourceMetaData); assertThat(handler.execute("foo_db", createAlterStorageUnitStatement("ds_0")), instanceOf(UpdateResponseHeader.class)); @@ -103,7 +103,7 @@ void assertExecuteWithAlterDatabase() { ContextManager contextManager = mockContextManager(mock(MetaDataContexts.class, RETURNS_DEEP_STUBS)); when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager); when(ProxyContext.getInstance().getDatabase("foo_db")).thenReturn(database); - ShardingSphereResourceMetaData resourceMetaData = mock(ShardingSphereResourceMetaData.class); + ResourceMetaData resourceMetaData = mock(ResourceMetaData.class); when(resourceMetaData.getDataSources()).thenReturn(Collections.singletonMap("ds_0", mockHikariDataSource("ds_1"))); when(database.getResourceMetaData()).thenReturn(resourceMetaData); assertThrows(InvalidStorageUnitsException.class, () -> handler.execute("foo_db", createAlterStorageUnitStatement("ds_0"))); 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 dc0fc3c45fe0d..ca23178d82ff0 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 @@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.datanode.DataNode; import org.apache.shardingsphere.infra.instance.mode.ModeContextManager; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.rule.identifier.type.DataNodeContainedRule; import org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedRule; @@ -65,7 +65,7 @@ class UnregisterStorageUnitBackendHandlerTest { private ShardingSphereDatabase database; @Mock - private ShardingSphereResourceMetaData resourceMetaData; + private ResourceMetaData resourceMetaData; @Mock private DataSource dataSource; @@ -88,7 +88,7 @@ class UnregisterStorageUnitBackendHandlerTest { @BeforeEach void setUp() { - resourceMetaData = mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS); + resourceMetaData = mock(ResourceMetaData.class, RETURNS_DEEP_STUBS); when(resourceMetaData.getDataSources()).thenReturn(Collections.singletonMap("foo_ds", dataSource)); when(database.getRuleMetaData()).thenReturn(ruleMetaData); when(database.getResourceMetaData()).thenReturn(resourceMetaData); diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/ShowRulesUsedStorageUnitExecutorTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/ShowRulesUsedStorageUnitExecutorTest.java index d4eb0abca5284..97e33c45430d0 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/ShowRulesUsedStorageUnitExecutorTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/ShowRulesUsedStorageUnitExecutorTest.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.encrypt.rule.EncryptRule; 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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.mask.api.config.MaskRuleConfiguration; import org.apache.shardingsphere.mask.api.config.rule.MaskTableRuleConfiguration; @@ -94,7 +94,7 @@ private ShardingSphereDatabase mockDatabase() { ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData( Arrays.asList(mockShardingRule(), mockReadwriteSplittingRule(), mockEncryptRule(), mockShadowRule(), mockMaskRule())); when(result.getRuleMetaData()).thenReturn(ruleMetaData); - ShardingSphereResourceMetaData resourceMetaData = new ShardingSphereResourceMetaData("sharding_db", Collections.singletonMap("foo_ds", new MockedDataSource())); + ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", Collections.singletonMap("foo_ds", new MockedDataSource())); when(result.getResourceMetaData()).thenReturn(resourceMetaData); return result; } @@ -154,7 +154,7 @@ void assertGetEmptyRowData() { private ShardingSphereDatabase mockEmptyDatabase() { ShardingSphereDatabase result = mock(ShardingSphereDatabase.class); when(result.getRuleMetaData()).thenReturn(new ShardingSphereRuleMetaData(Collections.emptyList())); - ShardingSphereResourceMetaData resourceMetaData = new ShardingSphereResourceMetaData("sharding_db", Collections.singletonMap("empty_ds", new MockedDataSource())); + ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", Collections.singletonMap("empty_ds", new MockedDataSource())); when(result.getResourceMetaData()).thenReturn(resourceMetaData); return result; } diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/storage/unit/ShowStorageUnitExecutorTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/storage/unit/ShowStorageUnitExecutorTest.java index 726dbc596ab97..3c88645c914ae 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/storage/unit/ShowStorageUnitExecutorTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/storage/unit/ShowStorageUnitExecutorTest.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.infra.instance.InstanceContext; 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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration; import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration; @@ -61,7 +61,7 @@ class ShowStorageUnitExecutorTest { @BeforeEach void before() { - ShardingSphereResourceMetaData resourceMetaData = new ShardingSphereResourceMetaData("sharding_db", createDataSources()); + ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", createDataSources()); ShardingSphereRuleMetaData metaData = new ShardingSphereRuleMetaData(Collections.singleton(createShardingRule())); when(database.getResourceMetaData()).thenReturn(resourceMetaData); when(database.getRuleMetaData()).thenReturn(metaData); diff --git a/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/information/SelectInformationSchemataExecutor.java b/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/information/SelectInformationSchemataExecutor.java index 388dbe73e5a10..effd4e5e0ddd6 100644 --- a/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/information/SelectInformationSchemataExecutor.java +++ b/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/information/SelectInformationSchemataExecutor.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.proxy.backend.mysql.handler.admin.executor.information; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.proxy.backend.context.ProxyContext; import org.apache.shardingsphere.proxy.backend.handler.admin.executor.AbstractDatabaseMetaDataExecutor; import org.apache.shardingsphere.proxy.backend.handler.admin.executor.AbstractDatabaseMetaDataExecutor.DefaultDatabaseMetaDataExecutor; @@ -94,7 +94,7 @@ protected Collection getDatabaseNames(final ConnectionSession connection @Override protected void preProcess(final String databaseName, final Map rows, final Map alias) { - ShardingSphereResourceMetaData resourceMetaData = ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getDatabase(databaseName).getResourceMetaData(); + ResourceMetaData resourceMetaData = ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getDatabase(databaseName).getResourceMetaData(); Collection catalogs = resourceMetaData.getDataSources().keySet().stream().map(each -> resourceMetaData.getConnectionProperties(each).getCatalog()).collect(Collectors.toSet()); schemaNameAlias = alias.getOrDefault(SCHEMA_NAME, ""); String rowValue = rows.getOrDefault(schemaNameAlias, "").toString(); diff --git a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/MySQLAdminExecutorCreatorTest.java b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/MySQLAdminExecutorCreatorTest.java index f4261569038ea..7fbdc6cd2db74 100644 --- a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/MySQLAdminExecutorCreatorTest.java +++ b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/MySQLAdminExecutorCreatorTest.java @@ -22,7 +22,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.metadata.persist.MetaDataPersistService; @@ -264,7 +264,7 @@ void assertCreateWithOtherSelectStatementForNoResource() { @Test void assertCreateWithOtherSelectStatementForDatabaseName() { - ShardingSphereResourceMetaData resourceMetaData = new ShardingSphereResourceMetaData("sharding_db", Collections.singletonMap("ds", new MockedDataSource())); + ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", Collections.singletonMap("ds", new MockedDataSource())); ShardingSphereDatabase database = new ShardingSphereDatabase("db_0", databaseType, resourceMetaData, mock(ShardingSphereRuleMetaData.class), Collections.emptyMap()); Map result = Collections.singletonMap("db_0", database); initProxyContext(result); @@ -282,7 +282,7 @@ void assertCreateWithOtherSelectStatementForDatabaseName() { @Test void assertCreateWithOtherSelectStatementForNullDatabaseName() { - ShardingSphereResourceMetaData resourceMetaData = new ShardingSphereResourceMetaData("sharding_db", Collections.singletonMap("ds_0", new MockedDataSource())); + ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", Collections.singletonMap("ds_0", new MockedDataSource())); ShardingSphereDatabase database = new ShardingSphereDatabase("db_0", databaseType, resourceMetaData, mock(ShardingSphereRuleMetaData.class), Collections.emptyMap()); Map result = Collections.singletonMap("db_0", database); initProxyContext(result); @@ -355,7 +355,7 @@ void assertCreateWithSelectStatementFromPerformanceSchema() { private void initProxyContext(final Map databases) { ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), - new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); + new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts); when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager); } diff --git a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowCreateDatabaseExecutorTest.java b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowCreateDatabaseExecutorTest.java index 901898c3c9c8f..594e573977721 100644 --- a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowCreateDatabaseExecutorTest.java +++ b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowCreateDatabaseExecutorTest.java @@ -21,7 +21,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.metadata.persist.MetaDataPersistService; @@ -72,7 +72,7 @@ void assertExecute() throws SQLException { private ContextManager mockContextManager() { Map databases = getDatabases(); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), - new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); + new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); when(result.getMetaDataContexts()).thenReturn(metaDataContexts); return result; diff --git a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowCurrentUserExecutorTest.java b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowCurrentUserExecutorTest.java index 3cccb6d9130cc..f45a05d98bd0c 100644 --- a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowCurrentUserExecutorTest.java +++ b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowCurrentUserExecutorTest.java @@ -20,7 +20,7 @@ import org.apache.shardingsphere.authority.rule.AuthorityRule; import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.user.Grantee; import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser; @@ -67,7 +67,7 @@ void assertExecute() throws SQLException { private ContextManager mockContextManager() { ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), - new ShardingSphereMetaData(new HashMap<>(), mock(ShardingSphereResourceMetaData.class), mockShardingSphereRuleMetaData(), new ConfigurationProperties(new Properties()))); + new ShardingSphereMetaData(new HashMap<>(), mock(ResourceMetaData.class), mockShardingSphereRuleMetaData(), new ConfigurationProperties(new Properties()))); when(result.getMetaDataContexts()).thenReturn(metaDataContexts); return result; } diff --git a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowDatabasesExecutorTest.java b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowDatabasesExecutorTest.java index 844205ee41419..2ef441f20023e 100644 --- a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowDatabasesExecutorTest.java +++ b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowDatabasesExecutorTest.java @@ -23,7 +23,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.user.Grantee; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; @@ -177,7 +177,7 @@ private ContextManager mockContextManager() { ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); ShardingSphereRuleMetaData globalRuleMetaData = new ShardingSphereRuleMetaData(Collections.singleton(mockAuthorityRule())); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), new ShardingSphereMetaData(getDatabases(), - mock(ShardingSphereResourceMetaData.class), globalRuleMetaData, new ConfigurationProperties(new Properties()))); + mock(ResourceMetaData.class), globalRuleMetaData, new ConfigurationProperties(new Properties()))); when(result.getMetaDataContexts()).thenReturn(metaDataContexts); return result; } diff --git a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowFunctionStatusExecutorTest.java b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowFunctionStatusExecutorTest.java index f18912ac32df9..bb2f4d5d1202a 100644 --- a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowFunctionStatusExecutorTest.java +++ b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowFunctionStatusExecutorTest.java @@ -21,7 +21,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.metadata.persist.MetaDataPersistService; @@ -64,7 +64,7 @@ void assertExecute() throws SQLException { private ContextManager mockContextManager() { Map databases = getDatabases(); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), - new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); + new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); when(result.getMetaDataContexts()).thenReturn(metaDataContexts); return result; diff --git a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowProcedureStatusExecutorTest.java b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowProcedureStatusExecutorTest.java index 8b05a3de84216..6e2c0c75759a3 100644 --- a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowProcedureStatusExecutorTest.java +++ b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowProcedureStatusExecutorTest.java @@ -21,7 +21,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.metadata.persist.MetaDataPersistService; @@ -64,7 +64,7 @@ void assertExecute() throws SQLException { private ContextManager mockContextManager() { Map databases = getDatabases(); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), - new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); + new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); when(result.getMetaDataContexts()).thenReturn(metaDataContexts); return result; diff --git a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowTablesExecutorTest.java b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowTablesExecutorTest.java index 457ec4b45129f..b499572a70c4b 100644 --- a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowTablesExecutorTest.java +++ b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowTablesExecutorTest.java @@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.merge.result.MergedResult; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable; @@ -193,7 +193,7 @@ void assertShowTableFromUncompletedDatabase() throws SQLException { private ContextManager mockContextManager(final Map databases) { MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), - new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); + new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); when(result.getMetaDataContexts()).thenReturn(metaDataContexts); return result; diff --git a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/UseDatabaseExecutorTest.java b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/UseDatabaseExecutorTest.java index dbe60385227fd..e152d0bf465a9 100644 --- a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/UseDatabaseExecutorTest.java +++ b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/UseDatabaseExecutorTest.java @@ -22,7 +22,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.metadata.persist.MetaDataPersistService; @@ -83,7 +83,7 @@ void assertExecuteUseStatementBackendHandlerWhenSchemaNotExist() { private ContextManager mockContextManager() { ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), - new ShardingSphereMetaData(getDatabases(), mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); + new ShardingSphereMetaData(getDatabases(), mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(new Properties()))); when(result.getMetaDataContexts()).thenReturn(metaDataContexts); return result; } diff --git a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/information/SelectInformationSchemataExecutorTest.java b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/information/SelectInformationSchemataExecutorTest.java index 9b1d4e5e01928..f4c2839a9c56a 100644 --- a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/information/SelectInformationSchemataExecutorTest.java +++ b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/information/SelectInformationSchemataExecutorTest.java @@ -23,7 +23,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.user.Grantee; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; @@ -148,21 +148,21 @@ private ContextManager mockContextManager(final ShardingSphereDatabase... databa ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), new ShardingSphereMetaData( Arrays.stream(databases).collect(Collectors.toMap(ShardingSphereDatabase::getName, each -> each, (key, value) -> value)), - mock(ShardingSphereResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singleton(authorityRule)), new ConfigurationProperties(new Properties()))); + mock(ResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singleton(authorityRule)), new ConfigurationProperties(new Properties()))); when(result.getMetaDataContexts()).thenReturn(metaDataContexts); return result; } - private ShardingSphereDatabase createDatabase(final String databaseName, final ShardingSphereResourceMetaData resourceMetaData) { + private ShardingSphereDatabase createDatabase(final String databaseName, final ResourceMetaData resourceMetaData) { return new ShardingSphereDatabase(databaseName, TypedSPILoader.getService(DatabaseType.class, "MySQL"), resourceMetaData, mock(ShardingSphereRuleMetaData.class), Collections.emptyMap()); } private ShardingSphereDatabase createDatabase(final String databaseName) { - return createDatabase(databaseName, new ShardingSphereResourceMetaData(databaseName, Collections.emptyMap())); + return createDatabase(databaseName, new ResourceMetaData(databaseName, Collections.emptyMap())); } private ShardingSphereDatabase createDatabase(final Map expectedResultSetMap) throws SQLException { - return createDatabase("auth_db", new ShardingSphereResourceMetaData("auth_db", Collections.singletonMap("foo_ds", new MockedDataSource(mockConnection(expectedResultSetMap))))); + return createDatabase("auth_db", new ResourceMetaData("auth_db", Collections.singletonMap("foo_ds", new MockedDataSource(mockConnection(expectedResultSetMap))))); } private Connection mockConnection(final Map expectedResultSetMap) throws SQLException { diff --git a/proxy/backend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/OpenGaussSystemCatalogAdminQueryExecutor.java b/proxy/backend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/OpenGaussSystemCatalogAdminQueryExecutor.java index 5a1e6cc8d1a37..ed167da52033a 100644 --- a/proxy/backend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/OpenGaussSystemCatalogAdminQueryExecutor.java +++ b/proxy/backend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/OpenGaussSystemCatalogAdminQueryExecutor.java @@ -37,7 +37,7 @@ import org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.StatementOption; import org.apache.shardingsphere.infra.merge.result.MergedResult; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.session.query.QueryContext; import org.apache.shardingsphere.mode.metadata.MetaDataContexts; import org.apache.shardingsphere.proxy.backend.context.BackendExecutorContext; @@ -103,7 +103,7 @@ private DriverExecutionPrepareEngine createDriver metaDataContexts.getMetaData().getDatabase(databaseName).getResourceMetaData().getStorageTypes()); } - private JDBCExecutorCallback createOpenGaussSystemCatalogAdminQueryCallback(final DatabaseType protocolType, final ShardingSphereResourceMetaData resourceMetaData, + private JDBCExecutorCallback createOpenGaussSystemCatalogAdminQueryCallback(final DatabaseType protocolType, final ResourceMetaData resourceMetaData, final SQLStatement sqlStatement) { return new JDBCExecutorCallback(protocolType, resourceMetaData, sqlStatement, SQLExecutorExceptionHandler.isExceptionThrown()) { diff --git a/proxy/backend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/OpenGaussSystemCatalogAdminQueryExecutorTest.java b/proxy/backend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/OpenGaussSystemCatalogAdminQueryExecutorTest.java index 3aa6856c6016a..6571f7f5d3a2c 100644 --- a/proxy/backend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/OpenGaussSystemCatalogAdminQueryExecutorTest.java +++ b/proxy/backend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/OpenGaussSystemCatalogAdminQueryExecutorTest.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.merge.result.MergedResult; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; @@ -86,7 +86,7 @@ void assertExecuteSelectFromPgDatabase() throws SQLException { when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getGlobalRuleMetaData()).thenReturn(mock(ShardingSphereRuleMetaData.class)); OpenGaussSelectStatement sqlStatement = createSelectStatementForPgDatabase(); ShardingSphereMetaData metaData = - new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singletonList(sqlFederationRule)), properties); + new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singletonList(sqlFederationRule)), properties); when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData()).thenReturn(metaData); SelectStatementContext sqlStatementContext = new SelectStatementContext(metaData, Collections.emptyList(), sqlStatement, "sharding_db"); OpenGaussSystemCatalogAdminQueryExecutor executor = new OpenGaussSystemCatalogAdminQueryExecutor(sqlStatementContext, @@ -134,7 +134,7 @@ private Map createShardingSphereDatabaseMap() { ShardingSphereSchema schema = new ShardingSphereSchema( Collections.singletonMap("pg_database", new ShardingSphereTable("pg_database", columns, Collections.emptyList(), Collections.emptyList())), Collections.emptyMap()); result.put("sharding_db", new ShardingSphereDatabase("sharding_db", TypedSPILoader.getService(DatabaseType.class, "openGauss"), - mock(ShardingSphereResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), Collections.singletonMap("pg_catalog", schema))); + mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), Collections.singletonMap("pg_catalog", schema))); return result; } @@ -149,7 +149,7 @@ void assertExecuteSelectVersion() throws SQLException { SQLFederationRule sqlFederationRule = new SQLFederationRule(new SQLFederationRuleConfiguration(false, new CacheOption(1, 1)), databases, properties); OpenGaussSelectStatement sqlStatement = createSelectStatementForVersion(); ShardingSphereMetaData metaData = - new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singletonList(sqlFederationRule)), properties); + new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singletonList(sqlFederationRule)), properties); when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData()).thenReturn(metaData); SelectStatementContext sqlStatementContext = new SelectStatementContext(metaData, Collections.emptyList(), sqlStatement, "sharding_db"); OpenGaussSystemCatalogAdminQueryExecutor executor = @@ -183,7 +183,7 @@ void assertExecuteSelectGsPasswordDeadlineAndIntervalToNum() throws SQLException SQLFederationRule sqlFederationRule = new SQLFederationRule(new SQLFederationRuleConfiguration(false, new CacheOption(1, 1)), databases, properties); OpenGaussSelectStatement sqlStatement = createSelectStatementForGsPasswordDeadlineAndIntervalToNum(); ShardingSphereMetaData metaData = - new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singletonList(sqlFederationRule)), properties); + new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singletonList(sqlFederationRule)), properties); when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData()).thenReturn(metaData); SelectStatementContext sqlStatementContext = new SelectStatementContext(metaData, Collections.emptyList(), sqlStatement, "sharding_db"); OpenGaussSystemCatalogAdminQueryExecutor executor = @@ -219,7 +219,7 @@ void assertExecuteSelectGsPasswordNotifyTime() throws SQLException { SQLFederationRule sqlFederationRule = new SQLFederationRule(new SQLFederationRuleConfiguration(false, new CacheOption(1, 1)), databases, properties); OpenGaussSelectStatement sqlStatement = createSelectStatementForGsPasswordNotifyTime(); ShardingSphereMetaData metaData = - new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singletonList(sqlFederationRule)), properties); + new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singletonList(sqlFederationRule)), properties); when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData()).thenReturn(metaData); SelectStatementContext sqlStatementContext = new SelectStatementContext(metaData, Collections.emptyList(), sqlStatement, "sharding_db"); OpenGaussSystemCatalogAdminQueryExecutor executor = diff --git a/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/version/ShardingSphereProxyVersion.java b/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/version/ShardingSphereProxyVersion.java index 1bbf893c81213..4886ed672e551 100644 --- a/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/version/ShardingSphereProxyVersion.java +++ b/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/version/ShardingSphereProxyVersion.java @@ -27,7 +27,7 @@ import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.state.datasource.DataSourceStateManager; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.mode.manager.ContextManager; import org.apache.shardingsphere.proxy.database.DatabaseServerInfo; @@ -72,8 +72,8 @@ private static void setDatabaseVersion(final ShardingSphereDatabase database) { DatabaseProtocolServerInfo.setProtocolVersion(database.getName(), databaseServerInfo.getDatabaseVersion()); } - private static Optional findDataSourceByProtocolType(final String databaseName, final ShardingSphereResourceMetaData resourceMetaData, final DatabaseType protocolType) { + private static Optional findDataSourceByProtocolType(final String databaseName, final ResourceMetaData resourceMetaData, final DatabaseType protocolType) { Optional dataSourceName = resourceMetaData.getStorageTypes().entrySet().stream().filter(entry -> entry.getValue().equals(protocolType)).map(Entry::getKey).findFirst(); - return dataSourceName.flatMap(optional -> Optional.ofNullable(DataSourceStateManager.getInstance().getEnabledDataSourceMap(databaseName, resourceMetaData.getDataSources()).get(optional))); + return dataSourceName.flatMap(optional -> Optional.ofNullable(DataSourceStateManager.getInstance().getEnabledDataSources(databaseName, resourceMetaData.getDataSources()).get(optional))); } } 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 f3664d128dec5..2fa4cd21ae48f 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 @@ -20,7 +20,7 @@ import org.apache.shardingsphere.db.protocol.constant.DatabaseProtocolServerInfo; 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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.mode.manager.ContextManager; import org.apache.shardingsphere.proxy.backend.context.ProxyContext; @@ -71,13 +71,13 @@ private ShardingSphereDatabase mockDatabase(final String databaseProductName, fi ShardingSphereDatabase result = mock(ShardingSphereDatabase.class); when(result.getName()).thenReturn("foo_db"); when(result.getProtocolType()).thenReturn(TypedSPILoader.getService(DatabaseType.class, "MySQL")); - ShardingSphereResourceMetaData resourceMetaData = mockResourceMetaData(databaseProductName, databaseProductVersion); + ResourceMetaData resourceMetaData = mockResourceMetaData(databaseProductName, databaseProductVersion); when(result.getResourceMetaData()).thenReturn(resourceMetaData); return result; } - private ShardingSphereResourceMetaData mockResourceMetaData(final String databaseProductName, final String databaseProductVersion) throws SQLException { - ShardingSphereResourceMetaData result = mock(ShardingSphereResourceMetaData.class); + private ResourceMetaData mockResourceMetaData(final String databaseProductName, final String databaseProductVersion) throws SQLException { + ResourceMetaData result = mock(ResourceMetaData.class); when(result.getStorageTypes()).thenReturn(Collections.singletonMap("foo_ds", TypedSPILoader.getService(DatabaseType.class, databaseProductName))); DataSource dataSource = createDataSource(databaseProductName, databaseProductVersion); when(result.getDataSources()).thenReturn(Collections.singletonMap("foo_ds", dataSource)); diff --git a/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/protocol/FrontDatabaseProtocolTypeFactoryTest.java b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/protocol/FrontDatabaseProtocolTypeFactoryTest.java index bce509257d68f..93502e4eac5e8 100644 --- a/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/protocol/FrontDatabaseProtocolTypeFactoryTest.java +++ b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/protocol/FrontDatabaseProtocolTypeFactoryTest.java @@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.instance.InstanceContext; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.metadata.persist.MetaDataPersistService; @@ -85,7 +85,7 @@ private Map mockDatabases() { private ContextManager mockContextManager(final Map databases, final Properties props) { MetaDataContexts metaDataContexts = new MetaDataContexts( - mock(MetaDataPersistService.class), new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), + mock(MetaDataPersistService.class), new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), mock(ShardingSphereRuleMetaData.class), new ConfigurationProperties(props))); return new ContextManager(metaDataContexts, mock(InstanceContext.class)); } diff --git a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLMultiStatementsHandler.java b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLMultiStatementsHandler.java index f650cf2bcf449..78736ead87f86 100644 --- a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLMultiStatementsHandler.java +++ b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLMultiStatementsHandler.java @@ -38,7 +38,7 @@ import org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.JDBCDriverType; import org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.StatementOption; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.parser.SQLParserEngine; import org.apache.shardingsphere.infra.rule.ShardingSphereRule; @@ -168,7 +168,7 @@ private void prepareBatchedStatement(final JDBCExecutionUnit each) throws SQLExc private UpdateResponseHeader executeBatchedStatements(final ExecutionGroupContext executionGroupContext) throws SQLException { boolean isExceptionThrown = SQLExecutorExceptionHandler.isExceptionThrown(); - ShardingSphereResourceMetaData resourceMetaData = metaDataContexts.getMetaData().getDatabase(connectionSession.getDatabaseName()).getResourceMetaData(); + ResourceMetaData resourceMetaData = metaDataContexts.getMetaData().getDatabase(connectionSession.getDatabaseName()).getResourceMetaData(); JDBCExecutorCallback callback = new BatchedJDBCExecutorCallback(resourceMetaData, sqlStatementSample, isExceptionThrown); List executeResults = jdbcExecutor.execute(executionGroupContext, callback); int updated = 0; @@ -183,7 +183,7 @@ private UpdateResponseHeader executeBatchedStatements(final ExecutionGroupContex private static final class BatchedJDBCExecutorCallback extends JDBCExecutorCallback { - private BatchedJDBCExecutorCallback(final ShardingSphereResourceMetaData resourceMetaData, final SQLStatement sqlStatement, final boolean isExceptionThrown) { + private BatchedJDBCExecutorCallback(final ResourceMetaData resourceMetaData, final SQLStatement sqlStatement, final boolean isExceptionThrown) { super(TypedSPILoader.getService(DatabaseType.class, "MySQL"), resourceMetaData, sqlStatement, isExceptionThrown); } diff --git a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java index f25768695345f..40c4b118de246 100644 --- a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java +++ b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java @@ -41,7 +41,7 @@ import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.user.Grantee; import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser; @@ -277,7 +277,7 @@ private ContextManager mockContextManager(final AuthorityRule rule) { ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); Map databases = Collections.singletonMap("foo_db", mock(ShardingSphereDatabase.class)); MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), new ShardingSphereMetaData(databases, - mock(ShardingSphereResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singleton(rule)), new ConfigurationProperties(new Properties()))); + mock(ResourceMetaData.class), new ShardingSphereRuleMetaData(Collections.singleton(rule)), new ConfigurationProperties(new Properties()))); when(result.getMetaDataContexts()).thenReturn(metaDataContexts); return result; } diff --git a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutorTest.java b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutorTest.java index 3c3e270709ad8..39c299b25b5d8 100644 --- a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutorTest.java +++ b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutorTest.java @@ -34,7 +34,7 @@ import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.exception.mysql.exception.UnsupportedPreparedStatementException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; @@ -206,7 +206,7 @@ private ContextManager mockContextManager() { ShardingSphereSchema schema = new ShardingSphereSchema(); schema.getTables().put("user", table); ShardingSphereDatabase database = new ShardingSphereDatabase("foo_db", TypedSPILoader.getService(DatabaseType.class, "MySQL"), - new ShardingSphereResourceMetaData("foo_db", Collections.emptyMap()), new ShardingSphereRuleMetaData(Collections.emptyList()), Collections.singletonMap("foo_db", schema)); + new ResourceMetaData("foo_db", Collections.emptyMap()), new ShardingSphereRuleMetaData(Collections.emptyList()), Collections.singletonMap("foo_db", schema)); when(result.getMetaDataContexts().getMetaData().getDatabase("foo_db")).thenReturn(database); return result; } diff --git a/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationEngineTest.java b/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationEngineTest.java index 5cfc43d3105cd..fe0bb5abd4478 100644 --- a/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationEngineTest.java +++ b/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationEngineTest.java @@ -36,7 +36,7 @@ import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration; import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser; import org.apache.shardingsphere.metadata.persist.MetaDataPersistService; @@ -137,7 +137,7 @@ void assertAuthenticateWithNonPasswordMessage() { private ContextManager mockContextManager() { MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), - new ShardingSphereMetaData(Collections.emptyMap(), mock(ShardingSphereResourceMetaData.class), + new ShardingSphereMetaData(Collections.emptyMap(), mock(ResourceMetaData.class), buildGlobalRuleMetaData(new ShardingSphereUser("root", "sharding", "")), mock(ConfigurationProperties.class))); ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); when(result.getMetaDataContexts()).thenReturn(metaDataContexts); diff --git a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutor.java b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutor.java index 178cfa27565ef..f87a498a29c1e 100644 --- a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutor.java +++ b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutor.java @@ -40,7 +40,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.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.rule.ShardingSphereRule; import org.apache.shardingsphere.infra.session.query.QueryContext; @@ -195,7 +195,7 @@ private int executeBatchedPreparedStatements() throws SQLException { private static final class BatchedStatementsJDBCExecutorCallback extends JDBCExecutorCallback { - private BatchedStatementsJDBCExecutorCallback(final DatabaseType protocolType, final ShardingSphereResourceMetaData resourceMetaData, final SQLStatement sqlStatement, + private BatchedStatementsJDBCExecutorCallback(final DatabaseType protocolType, final ResourceMetaData resourceMetaData, final SQLStatement sqlStatement, final boolean isExceptionThrown) { super(protocolType, resourceMetaData, sqlStatement, isExceptionThrown); } diff --git a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngineTest.java b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngineTest.java index dd9252152bda9..566fa1d45f8dc 100644 --- a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngineTest.java +++ b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngineTest.java @@ -39,7 +39,7 @@ import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration; import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser; import org.apache.shardingsphere.mode.manager.ContextManager; @@ -200,7 +200,7 @@ private ContextManager mockContextManager() { private MetaDataContexts getMetaDataContexts(final ShardingSphereUser user) { return new MetaDataContexts(mock(MetaDataPersistService.class), - new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ShardingSphereResourceMetaData.class), buildGlobalRuleMetaData(user), new ConfigurationProperties(new Properties()))); + new ShardingSphereMetaData(new LinkedHashMap<>(), mock(ResourceMetaData.class), buildGlobalRuleMetaData(user), new ConfigurationProperties(new Properties()))); } private ShardingSphereRuleMetaData buildGlobalRuleMetaData(final ShardingSphereUser user) { 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 241de8c638b6e..752d6bdd7b337 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 @@ -32,7 +32,7 @@ import org.apache.shardingsphere.infra.instance.InstanceContext; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; -import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.parser.sql.SQLStatementParserEngine; @@ -119,7 +119,7 @@ private Collection createSQLRewriteUnits(final SQLRewriteEngineT mockDataSource(databaseConfig.getDataSources()); DatabaseType databaseType = TypedSPILoader.getService(DatabaseType.class, testParams.getDatabaseType()); Map storageTypes = createStorageTypes(databaseConfig, databaseType); - ShardingSphereResourceMetaData resourceMetaData = mock(ShardingSphereResourceMetaData.class); + ResourceMetaData resourceMetaData = mock(ResourceMetaData.class); when(resourceMetaData.getStorageTypes()).thenReturn(storageTypes); String schemaName = new DatabaseTypeRegistry(databaseType).getDefaultSchemaName(DefaultDatabase.LOGIC_NAME); SQLStatementParserEngine sqlStatementParserEngine = new SQLStatementParserEngine(TypedSPILoader.getService(DatabaseType.class, testParams.getDatabaseType()), @@ -131,7 +131,7 @@ private Collection createSQLRewriteUnits(final SQLRewriteEngineT Map databases = new HashMap<>(2, 1F); databases.put(schemaName, database); ShardingSphereRuleMetaData globalRuleMetaData = new ShardingSphereRuleMetaData(createGlobalRules()); - ShardingSphereMetaData metaData = new ShardingSphereMetaData(databases, mock(ShardingSphereResourceMetaData.class), globalRuleMetaData, mock(ConfigurationProperties.class)); + ShardingSphereMetaData metaData = new ShardingSphereMetaData(databases, mock(ResourceMetaData.class), globalRuleMetaData, mock(ConfigurationProperties.class)); SQLStatementContext sqlStatementContext = new SQLBindEngine(metaData, schemaName).bind(sqlStatement, Collections.emptyList()); if (sqlStatementContext instanceof ParameterAware) { ((ParameterAware) sqlStatementContext).setUpParameters(testParams.getInputParameters());