This is an automated email from the ASF dual-hosted git repository.

zhaojinchao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new a3db165dd85 Merge DataSourcesMetaData into ShardingSphereResource 
(#17885)
a3db165dd85 is described below

commit a3db165dd85453854555f4295990d6a0147f9395
Author: Liang Zhang <[email protected]>
AuthorDate: Mon May 23 23:25:25 2022 +0800

    Merge DataSourcesMetaData into ShardingSphereResource (#17885)
---
 .../engine/type/ShardingRouteEngineFactory.java    |  6 +-
 .../ShardingInstanceBroadcastRoutingEngine.java    |  6 +-
 ...ShardingInstanceBroadcastRoutingEngineTest.java |  8 +--
 .../pom.xml                                        |  7 ++
 .../checker/ShardingRuleStatementCheckerTest.java  |  8 ++-
 ...AlterShardingTableRuleStatementUpdaterTest.java |  8 ++-
 ...reateShardingTableRuleStatementUpdaterTest.java |  8 ++-
 .../infra/metadata/ShardingSphereDatabase.java     |  4 +-
 .../metadata/resource/DataSourcesMetaData.java     | 75 -------------------
 .../metadata/resource/ShardingSphereResource.java  | 53 ++++++++++++--
 .../infra/metadata/ShardingSphereDatabaseTest.java |  9 ++-
 .../metadata/resource/DataSourcesMetaDataTest.java | 83 ----------------------
 .../resource/ShardingSphereResourceTest.java       |  2 +-
 .../sql/context/ExecutionContextBuilder.java       |  2 +-
 .../sql/context/ExecutionContextBuilderTest.java   | 10 ++-
 .../metadata/ShardingSphereDatabaseMetaData.java   | 11 ++-
 .../mode/manager/ContextManagerTest.java           |  3 +-
 .../ClusterContextManagerCoordinatorTest.java      |  3 +-
 .../SelectInformationSchemataExecutor.java         |  2 +-
 .../executor/SelectDatabaseExecutor.java           |  2 +-
 .../rql/resource/DataSourceQueryResultSet.java     |  2 +-
 .../resource/UnusedDataSourceQueryResultSet.java   |  2 +-
 .../query/impl/MySQLQueryHeaderBuilderTest.java    |  5 +-
 .../information/SelectInformationExecutorTest.java | 31 ++++----
 .../executor/SelectDatabaseExecutorTest.java       | 27 +++----
 .../executor/SelectTableExecutorTest.java          | 19 ++---
 .../updatable/SetVariableBackendHandlerTest.java   |  2 +-
 .../distsql/rql/DataSourceQueryResultSetTest.java  |  6 +-
 .../rql/RulesUsedResourceQueryResultSetTest.java   | 22 +++---
 .../rql/UnusedDataSourceQueryResultSetTest.java    |  4 +-
 .../OpenGaussAuthenticationHandlerTest.java        |  2 +-
 .../PostgreSQLAuthenticationHandlerTest.java       |  2 +-
 32 files changed, 147 insertions(+), 287 deletions(-)

diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/type/ShardingRouteEngineFactory.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/type/ShardingRouteEngineFactory.java
index b81f0a5d220..0c1a56ba809 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/type/ShardingRouteEngineFactory.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/type/ShardingRouteEngineFactory.java
@@ -109,7 +109,7 @@ public final class ShardingRouteEngineFactory {
             return new ShardingDatabaseBroadcastRoutingEngine();
         }
         if (sqlStatement instanceof CreateTablespaceStatement || sqlStatement 
instanceof AlterTablespaceStatement || sqlStatement instanceof 
DropTablespaceStatement) {
-            return new 
ShardingInstanceBroadcastRoutingEngine(database.getResource().getDataSourcesMetaData());
+            return new 
ShardingInstanceBroadcastRoutingEngine(database.getResource());
         }
         Collection<String> tableNames = sqlStatementContext instanceof 
TableAvailable
                 ? ((TableAvailable) 
sqlStatementContext).getAllTables().stream().map(each -> 
each.getTableName().getIdentifier().getValue()).collect(Collectors.toSet())
@@ -131,7 +131,7 @@ public final class ShardingRouteEngineFactory {
             return new ShardingDatabaseBroadcastRoutingEngine();
         }
         if (isResourceGroupStatement(sqlStatement)) {
-            return new 
ShardingInstanceBroadcastRoutingEngine(database.getResource().getDataSourcesMetaData());
+            return new 
ShardingInstanceBroadcastRoutingEngine(database.getResource());
         }
         Collection<String> tableNames = 
sqlStatementContext.getTablesContext().getTableNames();
         Collection<String> shardingRuleTableNames = 
shardingRule.getShardingRuleTableNames(tableNames);
@@ -163,7 +163,7 @@ public final class ShardingRouteEngineFactory {
                     ? new ShardingTableBroadcastRoutingEngine(database, 
sqlStatementContext, shardingRuleTableNames)
                     : new ShardingIgnoreRoutingEngine();
         } else {
-            return new 
ShardingInstanceBroadcastRoutingEngine(database.getResource().getDataSourcesMetaData());
+            return new 
ShardingInstanceBroadcastRoutingEngine(database.getResource());
         }
     }
     
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingInstanceBroadcastRoutingEngine.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingInstanceBroadcastRoutingEngine.java
index 89438a5af9b..0a3d5dfa390 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingInstanceBroadcastRoutingEngine.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-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.resource.DataSourcesMetaData;
+import 
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
 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,13 +33,13 @@ import java.util.Collections;
 @RequiredArgsConstructor
 public final class ShardingInstanceBroadcastRoutingEngine implements 
ShardingRouteEngine {
     
-    private final DataSourcesMetaData dataSourcesMetaData;
+    private final ShardingSphereResource resource;
     
     @Override
     public RouteContext route(final ShardingRule shardingRule) {
         RouteContext result = new RouteContext();
         for (String each : shardingRule.getDataSourceNames()) {
-            if 
(dataSourcesMetaData.getAllInstanceDataSourceNames().contains(each)) {
+            if (resource.getAllInstanceDataSourceNames().contains(each)) {
                 result.getRouteUnits().add(new RouteUnit(new RouteMapper(each, 
each), Collections.emptyList()));
             }
         }
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingInstanceBroadcastRoutingEngineTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingInstanceBroadcastRoutingEngineTest.java
index 8b50d984d9b..1bef57a3b5d 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingInstanceBroadcastRoutingEngineTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-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.resource.DataSourcesMetaData;
+import 
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
 import org.junit.Before;
@@ -41,15 +41,15 @@ public final class 
ShardingInstanceBroadcastRoutingEngineTest {
     private ShardingRule shardingRule;
     
     @Mock
-    private DataSourcesMetaData dataSourcesMetaData;
+    private ShardingSphereResource resource;
     
     private ShardingInstanceBroadcastRoutingEngine 
shardingInstanceBroadcastRoutingEngine;
     
     @Before
     public void setUp() {
         
when(shardingRule.getDataSourceNames()).thenReturn(Collections.singletonList(DATASOURCE_NAME));
-        
when(dataSourcesMetaData.getAllInstanceDataSourceNames()).thenReturn(Collections.singleton(DATASOURCE_NAME));
-        shardingInstanceBroadcastRoutingEngine = new 
ShardingInstanceBroadcastRoutingEngine(dataSourcesMetaData);
+        
when(resource.getAllInstanceDataSourceNames()).thenReturn(Collections.singleton(DATASOURCE_NAME));
+        shardingInstanceBroadcastRoutingEngine = new 
ShardingInstanceBroadcastRoutingEngine(resource);
     }
     
     @Test
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/pom.xml
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/pom.xml
index 33bc4feeb0b..a373e72ecd4 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/pom.xml
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/pom.xml
@@ -44,5 +44,12 @@
             <artifactId>shardingsphere-data-pipeline-core</artifactId>
             <version>${project.version}</version>
         </dependency>
+        
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-test-common</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java
index f2d9a6708dd..f295b682455 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.sharding.distsql.checker;
 
 import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
 import 
org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
 import 
org.apache.shardingsphere.infra.distsql.exception.resource.RequiredResourceMissedException;
 import 
org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
@@ -38,6 +39,7 @@ import 
org.apache.shardingsphere.sharding.distsql.parser.segment.AutoTableRuleSe
 import 
org.apache.shardingsphere.sharding.distsql.parser.segment.KeyGenerateStrategySegment;
 import 
org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingStrategySegment;
 import 
org.apache.shardingsphere.sharding.distsql.parser.segment.TableRuleSegment;
+import org.apache.shardingsphere.test.mock.MockedDataSource;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -69,7 +71,7 @@ public final class ShardingRuleStatementCheckerTest {
     
     private final ShardingRuleConfiguration shardingRuleConfig = 
createShardingRuleConfiguration();
     
-    private final ShardingSphereResource shardingSphereResource = new 
ShardingSphereResource(createDataSource(), null, null);
+    private final ShardingSphereResource shardingSphereResource = new 
ShardingSphereResource(mock(DatabaseType.class), createDataSource());
     
     @Before
     public void before() {
@@ -216,8 +218,8 @@ public final class ShardingRuleStatementCheckerTest {
     
     private static Map<String, DataSource> createDataSource() {
         Map<String, DataSource> result = new HashMap<>(2, 1);
-        result.put("ds_0", mock(DataSource.class));
-        result.put("ds_1", mock(DataSource.class));
+        result.put("ds_0", new MockedDataSource());
+        result.put("ds_1", new MockedDataSource());
         return result;
     }
     
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java
index 61c1f9dca37..7b1a5bc05fb 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.sharding.distsql.update;
 
 import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
 import 
org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereDatabase;
 import 
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
@@ -34,6 +35,7 @@ import 
org.apache.shardingsphere.sharding.distsql.parser.segment.KeyGenerateStra
 import 
org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingStrategySegment;
 import 
org.apache.shardingsphere.sharding.distsql.parser.segment.TableRuleSegment;
 import 
org.apache.shardingsphere.sharding.distsql.parser.statement.AlterShardingTableRuleStatement;
+import org.apache.shardingsphere.test.mock.MockedDataSource;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -65,7 +67,7 @@ public final class AlterShardingTableRuleStatementUpdaterTest 
{
     
     private final ShardingRuleConfiguration currentRuleConfig = 
createCurrentShardingRuleConfiguration();
     
-    private final ShardingSphereResource shardingSphereResource = new 
ShardingSphereResource(createDataSource(), null, null);
+    private final ShardingSphereResource shardingSphereResource = new 
ShardingSphereResource(mock(DatabaseType.class), createDataSource());
     
     private final AlterShardingTableRuleStatementUpdater updater = new 
AlterShardingTableRuleStatementUpdater();
     
@@ -199,8 +201,8 @@ public final class 
AlterShardingTableRuleStatementUpdaterTest {
     
     private static Map<String, DataSource> createDataSource() {
         Map<String, DataSource> result = new HashMap<>(2, 1);
-        result.put("ds_0", mock(DataSource.class));
-        result.put("ds_1", mock(DataSource.class));
+        result.put("ds_0", new MockedDataSource());
+        result.put("ds_1", new MockedDataSource());
         return result;
     }
 }
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java
index 8aa4f0140ba..b67bf201bf8 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.sharding.distsql.update;
 
 import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
 import 
org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereDatabase;
 import 
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
@@ -35,6 +36,7 @@ import 
org.apache.shardingsphere.sharding.distsql.parser.segment.KeyGenerateStra
 import 
org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingStrategySegment;
 import 
org.apache.shardingsphere.sharding.distsql.parser.segment.TableRuleSegment;
 import 
org.apache.shardingsphere.sharding.distsql.parser.statement.CreateShardingTableRuleStatement;
+import org.apache.shardingsphere.test.mock.MockedDataSource;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -68,7 +70,7 @@ public final class 
CreateShardingTableRuleStatementUpdaterTest {
     
     private final ShardingRuleConfiguration currentRuleConfig = 
createCurrentShardingRuleConfiguration();
     
-    private final ShardingSphereResource shardingSphereResource = new 
ShardingSphereResource(createDataSource(), null, null);
+    private final ShardingSphereResource shardingSphereResource = new 
ShardingSphereResource(mock(DatabaseType.class), createDataSource());
     
     private final CreateShardingTableRuleStatementUpdater updater = new 
CreateShardingTableRuleStatementUpdater();
     
@@ -167,8 +169,8 @@ public final class 
CreateShardingTableRuleStatementUpdaterTest {
     
     private Map<String, DataSource> createDataSource() {
         Map<String, DataSource> result = new HashMap<>(2, 1);
-        result.put("ds_0", mock(DataSource.class));
-        result.put("ds_1", mock(DataSource.class));
+        result.put("ds_0", new MockedDataSource());
+        result.put("ds_1", new MockedDataSource());
         return result;
     }
     
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereDatabase.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereDatabase.java
index 1753cae5d13..485393e03e1 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereDatabase.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereDatabase.java
@@ -24,7 +24,6 @@ import 
org.apache.shardingsphere.infra.config.database.impl.DataSourceProvidedDa
 import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.infra.database.type.DatabaseTypeEngine;
-import org.apache.shardingsphere.infra.metadata.resource.DataSourcesMetaData;
 import 
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
 import 
org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
 import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
@@ -100,8 +99,7 @@ public final class ShardingSphereDatabase {
     
     private static ShardingSphereResource createResource(final DatabaseType 
protocolType, final Map<String, DataSource> dataSourceMap) {
         DatabaseType databaseType = dataSourceMap.isEmpty() ? protocolType : 
DatabaseTypeEngine.getDatabaseType(dataSourceMap.values());
-        DataSourcesMetaData dataSourcesMetaData = new 
DataSourcesMetaData(databaseType, dataSourceMap);
-        return new ShardingSphereResource(dataSourceMap, dataSourcesMetaData, 
databaseType);
+        return new ShardingSphereResource(databaseType, dataSourceMap);
     }
     
     /**
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/resource/DataSourcesMetaData.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/resource/DataSourcesMetaData.java
deleted file mode 100644
index e179a52a563..00000000000
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/resource/DataSourcesMetaData.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.metadata.resource;
-
-import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import 
org.apache.shardingsphere.infra.datasource.props.DataSourcePropertiesCreator;
-
-import javax.sql.DataSource;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Map.Entry;
-
-/**
- * Data sources meta data.
- */
-public final class DataSourcesMetaData {
-    
-    private final Map<String, DataSourceMetaData> dataSourceMetaDataMap;
-    
-    public DataSourcesMetaData(final DatabaseType databaseType, final 
Map<String, DataSource> dataSourceMap) {
-        dataSourceMetaDataMap = new LinkedHashMap<>(dataSourceMap.size(), 1);
-        for (Entry<String, DataSource> entry : dataSourceMap.entrySet()) {
-            Map<String, Object> standardProps = 
DataSourcePropertiesCreator.create(entry.getValue()).getConnectionPropertySynonyms().getStandardProperties();
-            dataSourceMetaDataMap.put(entry.getKey(), 
databaseType.getDataSourceMetaData(standardProps.get("url").toString(), 
standardProps.get("username").toString()));
-        }
-    }
-    
-    /**
-     * Get all instance data source names.
-     *
-     * @return instance data source names
-     */
-    public Collection<String> getAllInstanceDataSourceNames() {
-        Collection<String> result = new LinkedList<>();
-        for (Entry<String, DataSourceMetaData> entry : 
dataSourceMetaDataMap.entrySet()) {
-            if (!isExisted(entry.getKey(), result)) {
-                result.add(entry.getKey());
-            }
-        }
-        return result;
-    }
-    
-    private boolean isExisted(final String dataSourceName, final 
Collection<String> existedDataSourceNames) {
-        DataSourceMetaData dataSourceMetaData = 
dataSourceMetaDataMap.get(dataSourceName);
-        return existedDataSourceNames.stream().anyMatch(each -> 
dataSourceMetaData.isInSameDatabaseInstance(dataSourceMetaDataMap.get(each)));
-    }
-    
-    /**
-     * Get data source meta data.
-     * 
-     * @param dataSourceName data source name
-     * @return data source meta data
-     */
-    public DataSourceMetaData getDataSourceMetaData(final String 
dataSourceName) {
-        return dataSourceMetaDataMap.get(dataSourceName);
-    }
-}
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/resource/ShardingSphereResource.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/resource/ShardingSphereResource.java
index 5f8e1934a62..d4735acd392 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/resource/ShardingSphereResource.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/resource/ShardingSphereResource.java
@@ -17,13 +17,17 @@
 
 package org.apache.shardingsphere.infra.metadata.resource;
 
+import lombok.AccessLevel;
 import lombok.Getter;
-import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import 
org.apache.shardingsphere.infra.datasource.pool.destroyer.DataSourcePoolDestroyer;
+import 
org.apache.shardingsphere.infra.datasource.props.DataSourcePropertiesCreator;
 
 import javax.sql.DataSource;
 import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.stream.Collectors;
@@ -31,15 +35,25 @@ import java.util.stream.Collectors;
 /**
  * ShardingSphere resource.
  */
-@RequiredArgsConstructor
 @Getter
 public final class ShardingSphereResource {
     
+    private final DatabaseType databaseType;
+    
     private final Map<String, DataSource> dataSources;
     
-    private final DataSourcesMetaData dataSourcesMetaData;
+    @Getter(AccessLevel.NONE)
+    private final Map<String, DataSourceMetaData> dataSourceMetaDataMap;
     
-    private final DatabaseType databaseType;
+    public ShardingSphereResource(final DatabaseType databaseType, final 
Map<String, DataSource> dataSources) {
+        this.databaseType = databaseType;
+        this.dataSources = dataSources;
+        dataSourceMetaDataMap = new LinkedHashMap<>(dataSources.size(), 1);
+        for (Entry<String, DataSource> entry : dataSources.entrySet()) {
+            Map<String, Object> standardProps = 
DataSourcePropertiesCreator.create(entry.getValue()).getConnectionPropertySynonyms().getStandardProperties();
+            dataSourceMetaDataMap.put(entry.getKey(), 
databaseType.getDataSourceMetaData(standardProps.get("url").toString(), 
standardProps.get("username").toString()));
+        }
+    }
     
     /**
      * Get all instance data sources.
@@ -47,7 +61,36 @@ public final class ShardingSphereResource {
      * @return all instance data sources
      */
     public Collection<DataSource> getAllInstanceDataSources() {
-        return dataSources.entrySet().stream().filter(entry -> 
dataSourcesMetaData.getAllInstanceDataSourceNames().contains(entry.getKey())).map(Entry::getValue).collect(Collectors.toSet());
+        return dataSources.entrySet().stream().filter(entry -> 
getAllInstanceDataSourceNames().contains(entry.getKey())).map(Entry::getValue).collect(Collectors.toSet());
+    }
+    
+    /**
+     * Get all instance data source names.
+     *
+     * @return instance data source names
+     */
+    public Collection<String> getAllInstanceDataSourceNames() {
+        Collection<String> result = new LinkedList<>();
+        for (Entry<String, DataSourceMetaData> entry : 
dataSourceMetaDataMap.entrySet()) {
+            if (!isExisted(entry.getKey(), result)) {
+                result.add(entry.getKey());
+            }
+        }
+        return result;
+    }
+    
+    private boolean isExisted(final String dataSourceName, final 
Collection<String> existedDataSourceNames) {
+        return existedDataSourceNames.stream().anyMatch(each -> 
dataSourceMetaDataMap.get(dataSourceName).isInSameDatabaseInstance(dataSourceMetaDataMap.get(each)));
+    }
+    
+    /**
+     * Get data source meta data.
+     *
+     * @param dataSourceName data source name
+     * @return data source meta data
+     */
+    public DataSourceMetaData getDataSourceMetaData(final String 
dataSourceName) {
+        return dataSourceMetaDataMap.get(dataSourceName);
     }
     
     /**
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/ShardingSphereDatabaseTest.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/ShardingSphereDatabaseTest.java
index dbc91aaabc2..6586726b0d5 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/ShardingSphereDatabaseTest.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/ShardingSphereDatabaseTest.java
@@ -19,13 +19,12 @@ package org.apache.shardingsphere.infra.metadata;
 
 import org.apache.shardingsphere.infra.config.RuleConfiguration;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.infra.metadata.resource.DataSourcesMetaData;
 import 
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
 import 
org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
 import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
+import org.apache.shardingsphere.test.mock.MockedDataSource;
 import org.junit.Test;
 
-import javax.sql.DataSource;
 import java.util.Collections;
 
 import static org.junit.Assert.assertFalse;
@@ -36,21 +35,21 @@ public final class ShardingSphereDatabaseTest {
     
     @Test
     public void assertIsComplete() {
-        ShardingSphereResource resource = new 
ShardingSphereResource(Collections.singletonMap("ds", mock(DataSource.class)), 
mock(DataSourcesMetaData.class), mock(DatabaseType.class));
+        ShardingSphereResource resource = new 
ShardingSphereResource(mock(DatabaseType.class), Collections.singletonMap("ds", 
new MockedDataSource()));
         ShardingSphereRuleMetaData ruleMetaData = new 
ShardingSphereRuleMetaData(Collections.singleton(mock(RuleConfiguration.class)),
 Collections.singleton(mock(ShardingSphereRule.class)));
         assertTrue(new ShardingSphereDatabase("foo_db", 
mock(DatabaseType.class), resource, ruleMetaData, 
Collections.emptyMap()).isComplete());
     }
     
     @Test
     public void assertIsNotCompleteWithoutRule() {
-        ShardingSphereResource resource = new 
ShardingSphereResource(Collections.singletonMap("ds", mock(DataSource.class)), 
mock(DataSourcesMetaData.class), mock(DatabaseType.class));
+        ShardingSphereResource resource = new 
ShardingSphereResource(mock(DatabaseType.class), Collections.singletonMap("ds", 
new MockedDataSource()));
         ShardingSphereRuleMetaData ruleMetaData = new 
ShardingSphereRuleMetaData(Collections.emptyList(), Collections.emptyList());
         assertFalse(new ShardingSphereDatabase("foo_db", 
mock(DatabaseType.class), resource, ruleMetaData, 
Collections.emptyMap()).isComplete());
     }
     
     @Test
     public void assertIsNotCompleteWithoutDataSource() {
-        ShardingSphereResource resource = new 
ShardingSphereResource(Collections.emptyMap(), mock(DataSourcesMetaData.class), 
mock(DatabaseType.class));
+        ShardingSphereResource resource = new 
ShardingSphereResource(mock(DatabaseType.class), Collections.emptyMap());
         ShardingSphereRuleMetaData ruleMetaData = new 
ShardingSphereRuleMetaData(Collections.singleton(mock(RuleConfiguration.class)),
 Collections.singleton(mock(ShardingSphereRule.class)));
         assertFalse(new ShardingSphereDatabase("foo_db", 
mock(DatabaseType.class), resource, ruleMetaData, 
Collections.emptyMap()).isComplete());
     }
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/resource/DataSourcesMetaDataTest.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/resource/DataSourcesMetaDataTest.java
deleted file mode 100644
index 31778cf8b21..00000000000
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/resource/DataSourcesMetaDataTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.metadata.resource;
-
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeFactory;
-import org.apache.shardingsphere.test.mock.MockedDataSource;
-import org.junit.Test;
-
-import javax.sql.DataSource;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
-public final class DataSourcesMetaDataTest {
-    
-    @Test
-    public void 
assertGetAllInstanceDataSourceNamesForShardingRuleByDifferentDataSource() {
-        Map<String, DataSource> dataSourceMap = new HashMap<>(2, 1);
-        dataSourceMap.put("ds_0", 
createDataSource("jdbc:mysql://127.0.0.1:3306/db_0"));
-        dataSourceMap.put("ds_1", 
createDataSource("jdbc:mysql://127.0.0.1:3307/db_1"));
-        DataSourcesMetaData dataSourcesMetaData = new 
DataSourcesMetaData(DatabaseTypeFactory.getInstance("MySQL"), dataSourceMap);
-        Collection<String> allInstanceDataSourceNames = 
dataSourcesMetaData.getAllInstanceDataSourceNames();
-        assertThat(allInstanceDataSourceNames.size(), is(2));
-        assertTrue(allInstanceDataSourceNames.contains("ds_0"));
-        assertTrue(allInstanceDataSourceNames.contains("ds_1"));
-    }
-    
-    @Test
-    public void 
assertGetAllInstanceDataSourceNamesForShardingRuleBySameDataSource() {
-        Map<String, DataSource> dataSourceMap = new HashMap<>(2, 1);
-        dataSourceMap.put("ds_0", 
createDataSource("jdbc:mysql://127.0.0.1:3306/db_0"));
-        dataSourceMap.put("ds_1", 
createDataSource("jdbc:mysql://127.0.0.1:3306/db_1"));
-        DataSourcesMetaData dataSourcesMetaData = new 
DataSourcesMetaData(DatabaseTypeFactory.getInstance("MySQL"), dataSourceMap);
-        Collection<String> allInstanceDataSourceNames = 
dataSourcesMetaData.getAllInstanceDataSourceNames();
-        assertThat(allInstanceDataSourceNames.size(), is(1));
-        assertTrue(allInstanceDataSourceNames.contains("ds_0") || 
allInstanceDataSourceNames.contains("ds_1"));
-    }
-    
-    @Test
-    public void assertGetActualCatalogForShardingRule() {
-        Map<String, DataSource> dataSourceMap = new HashMap<>(2, 1);
-        dataSourceMap.put("ds_0", 
createDataSource("jdbc:mysql://127.0.0.1:3306/db_0"));
-        dataSourceMap.put("ds_1", 
createDataSource("jdbc:mysql://127.0.0.1:3306/db_1"));
-        DataSourcesMetaData dataSourcesMetaData = new 
DataSourcesMetaData(DatabaseTypeFactory.getInstance("MySQL"), dataSourceMap);
-        
assertThat(dataSourcesMetaData.getDataSourceMetaData("ds_0").getCatalog(), 
is("db_0"));
-    }
-    
-    @Test
-    public void assertGetActualSchemaNameForShardingRuleForMysql() {
-        Map<String, DataSource> dataSourceMap = new HashMap<>(2, 1);
-        dataSourceMap.put("ds_0", 
createDataSource("jdbc:mysql://127.0.0.1:3306/db_0"));
-        dataSourceMap.put("ds_1", 
createDataSource("jdbc:mysql://127.0.0.1:3306/db_1"));
-        DataSourcesMetaData dataSourcesMetaData = new 
DataSourcesMetaData(DatabaseTypeFactory.getInstance("MySQL"), dataSourceMap);
-        
assertNull(dataSourcesMetaData.getDataSourceMetaData("ds_0").getSchema());
-    }
-    
-    private MockedDataSource createDataSource(final String url) {
-        MockedDataSource result = new MockedDataSource();
-        result.setUrl(url);
-        result.setUsername("test");
-        return result;
-    }
-}
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/resource/ShardingSphereResourceTest.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/resource/ShardingSphereResourceTest.java
index b296ab3b614..b9184ebc8b1 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/resource/ShardingSphereResourceTest.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/resource/ShardingSphereResourceTest.java
@@ -33,7 +33,7 @@ public final class ShardingSphereResourceTest {
     @Test
     public void assertClose() throws SQLException, IOException, 
InterruptedException {
         MockedDataSource dataSource = new MockedDataSource();
-        new ShardingSphereResource(Collections.singletonMap("foo_ds", 
dataSource), mock(DataSourcesMetaData.class), 
mock(DatabaseType.class)).close(dataSource);
+        new ShardingSphereResource(mock(DatabaseType.class), 
Collections.singletonMap("foo_ds", dataSource)).close(dataSource);
         while (null == dataSource.getClosed() || !dataSource.getClosed()) {
             Thread.sleep(10L);
         }
diff --git 
a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/context/ExecutionContextBuilder.java
 
b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/context/ExecutionContextBuilder.java
index dc5dd156ce0..f5b26bbb504 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/context/ExecutionContextBuilder.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/context/ExecutionContextBuilder.java
@@ -59,7 +59,7 @@ public final class ExecutionContextBuilder {
     
     private static Collection<ExecutionUnit> build(final 
ShardingSphereDatabase database,
                                                    final 
GenericSQLRewriteResult sqlRewriteResult, final SQLStatementContext<?> 
sqlStatementContext) {
-        Collection<String> instanceDataSourceNames = 
database.getResource().getDataSourcesMetaData().getAllInstanceDataSourceNames();
+        Collection<String> instanceDataSourceNames = 
database.getResource().getAllInstanceDataSourceNames();
         if (instanceDataSourceNames.isEmpty()) {
             return Collections.emptyList();
         }
diff --git 
a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/context/ExecutionContextBuilderTest.java
 
b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/context/ExecutionContextBuilderTest.java
index 525a89452eb..b7c36f42e52 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/context/ExecutionContextBuilderTest.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/context/ExecutionContextBuilderTest.java
@@ -21,7 +21,6 @@ import 
org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
 import org.apache.shardingsphere.infra.database.DefaultDatabase;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.metadata.resource.DataSourcesMetaData;
 import 
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
 import 
org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
 import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
@@ -55,10 +54,9 @@ public final class ExecutionContextBuilderTest {
         String sql = "sql";
         List<Object> parameters = Collections.singletonList("parameter");
         GenericSQLRewriteResult genericSQLRewriteResult = new 
GenericSQLRewriteResult(new SQLRewriteUnit(sql, parameters));
-        DataSourcesMetaData dataSourcesMetaData = 
mock(DataSourcesMetaData.class);
+        ShardingSphereResource resource = mock(ShardingSphereResource.class);
         String firstDataSourceName = "firstDataSourceName";
-        
when(dataSourcesMetaData.getAllInstanceDataSourceNames()).thenReturn(Arrays.asList(firstDataSourceName,
 "lastDataSourceName"));
-        ShardingSphereResource resource = new 
ShardingSphereResource(Collections.emptyMap(), dataSourcesMetaData, 
mock(DatabaseType.class));
+        
when(resource.getAllInstanceDataSourceNames()).thenReturn(Arrays.asList(firstDataSourceName,
 "lastDataSourceName"));
         ShardingSphereRuleMetaData ruleMetaData = new 
ShardingSphereRuleMetaData(Collections.emptyList(), Collections.emptyList());
         ShardingSphereDatabase database = new 
ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, mock(DatabaseType.class), 
resource, ruleMetaData, buildDatabase());
         Collection<ExecutionUnit> actual = 
ExecutionContextBuilder.build(database, genericSQLRewriteResult, 
mock(SQLStatementContext.class));
@@ -75,7 +73,7 @@ public final class ExecutionContextBuilderTest {
         Map<RouteUnit, SQLRewriteUnit> sqlRewriteUnits = new HashMap<>(2, 1);
         sqlRewriteUnits.put(routeUnit1, sqlRewriteUnit1);
         sqlRewriteUnits.put(routeUnit2, sqlRewriteUnit2);
-        ShardingSphereResource resource = new 
ShardingSphereResource(Collections.emptyMap(), mock(DataSourcesMetaData.class), 
mock(DatabaseType.class));
+        ShardingSphereResource resource = new 
ShardingSphereResource(mock(DatabaseType.class), Collections.emptyMap());
         ShardingSphereRuleMetaData ruleMetaData = new 
ShardingSphereRuleMetaData(Collections.emptyList(), Collections.emptyList());
         ShardingSphereDatabase database = new 
ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, mock(DatabaseType.class), 
resource, ruleMetaData, buildDatabase());
         Collection<ExecutionUnit> actual = 
ExecutionContextBuilder.build(database, new 
RouteSQLRewriteResult(sqlRewriteUnits), mock(SQLStatementContext.class));
@@ -93,7 +91,7 @@ public final class ExecutionContextBuilderTest {
         SQLRewriteUnit sqlRewriteUnit2 = new SQLRewriteUnit("sql2", 
Collections.singletonList("parameter2"));
         Map<RouteUnit, SQLRewriteUnit> sqlRewriteUnits = new HashMap<>(2, 1);
         sqlRewriteUnits.put(routeUnit2, sqlRewriteUnit2);
-        ShardingSphereResource resource = new 
ShardingSphereResource(Collections.emptyMap(), mock(DataSourcesMetaData.class), 
mock(DatabaseType.class));
+        ShardingSphereResource resource = new 
ShardingSphereResource(mock(DatabaseType.class), Collections.emptyMap());
         ShardingSphereRuleMetaData ruleMetaData = new 
ShardingSphereRuleMetaData(Collections.emptyList(), Collections.emptyList());
         ShardingSphereDatabase database = new 
ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, mock(DatabaseType.class), 
resource, ruleMetaData, buildDatabaseWithoutPrimaryKey());
         Collection<ExecutionUnit> actual = 
ExecutionContextBuilder.build(database, new 
RouteSQLRewriteResult(sqlRewriteUnits), mock(SQLStatementContext.class));
diff --git 
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/datasource/metadata/ShardingSphereDatabaseMetaData.java
 
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/datasource/metadata/ShardingSphereDatabaseMetaData.java
index e7539c53dde..ac8efefba05 100644
--- 
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/datasource/metadata/ShardingSphereDatabaseMetaData.java
+++ 
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/datasource/metadata/ShardingSphereDatabaseMetaData.java
@@ -22,7 +22,7 @@ import 
org.apache.shardingsphere.driver.jdbc.adapter.AdaptedDatabaseMetaData;
 import 
org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection;
 import 
org.apache.shardingsphere.driver.jdbc.core.resultset.DatabaseMetaDataResultSet;
 import org.apache.shardingsphere.infra.database.DefaultDatabase;
-import org.apache.shardingsphere.infra.metadata.resource.DataSourcesMetaData;
+import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
 import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import 
org.apache.shardingsphere.infra.rule.identifier.type.DataNodeContainedRule;
 
@@ -42,8 +42,6 @@ public final class ShardingSphereDatabaseMetaData extends 
AdaptedDatabaseMetaDat
     
     private final Collection<ShardingSphereRule> rules;
     
-    private final DataSourcesMetaData dataSourcesMetaData;
-    
     private String currentPhysicalDataSourceName;
     
     private Connection currentPhysicalConnection;
@@ -54,7 +52,6 @@ public final class ShardingSphereDatabaseMetaData extends 
AdaptedDatabaseMetaDat
         super(connection.getJdbcContext().getCachedDatabaseMetaData());
         this.connection = connection;
         rules = 
connection.getContextManager().getMetaDataContexts().getDatabaseMetaData(connection.getDatabaseName()).getRuleMetaData().getRules();
-        dataSourcesMetaData = 
connection.getContextManager().getMetaDataContexts().getDatabaseMetaData(connection.getDatabaseName()).getResource().getDataSourcesMetaData();
     }
     
     @Override
@@ -229,11 +226,13 @@ public final class ShardingSphereDatabaseMetaData extends 
AdaptedDatabaseMetaDat
     }
     
     private String getActualCatalog(final String catalog) {
-        return null != catalog && catalog.contains(DefaultDatabase.LOGIC_NAME) 
? dataSourcesMetaData.getDataSourceMetaData(getDataSourceName()).getCatalog() : 
catalog;
+        DataSourceMetaData metaData = 
connection.getContextManager().getMetaDataContexts().getDatabaseMetaData(connection.getDatabaseName()).getResource().getDataSourceMetaData(getDataSourceName());
+        return null != catalog && catalog.contains(DefaultDatabase.LOGIC_NAME) 
? metaData.getCatalog() : catalog;
     }
     
     private String getActualSchema(final String schema) {
-        return null != schema && schema.contains(DefaultDatabase.LOGIC_NAME) ? 
dataSourcesMetaData.getDataSourceMetaData(getDataSourceName()).getSchema() : 
schema;
+        DataSourceMetaData metaData = 
connection.getContextManager().getMetaDataContexts().getDatabaseMetaData(connection.getDatabaseName()).getResource().getDataSourceMetaData(getDataSourceName());
+        return null != schema && schema.contains(DefaultDatabase.LOGIC_NAME) ? 
metaData.getSchema() : schema;
     }
     
     private String getDataSourceName() {
diff --git 
a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerTest.java
 
b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerTest.java
index 970263053b2..897b41fcccd 100644
--- 
a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerTest.java
+++ 
b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerTest.java
@@ -30,7 +30,6 @@ import 
org.apache.shardingsphere.infra.federation.optimizer.metadata.FederationD
 import 
org.apache.shardingsphere.infra.federation.optimizer.metadata.FederationSchemaMetaData;
 import org.apache.shardingsphere.infra.instance.InstanceContext;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.metadata.resource.DataSourcesMetaData;
 import 
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
 import 
org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
 import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
@@ -86,7 +85,7 @@ public final class ContextManagerTest {
     
     @Test
     public void assertGetDataSourceMap() {
-        ShardingSphereResource resource = new 
ShardingSphereResource(Collections.singletonMap("foo_ds", new 
MockedDataSource()), mock(DataSourcesMetaData.class), mock(DatabaseType.class));
+        ShardingSphereResource resource = new 
ShardingSphereResource(mock(DatabaseType.class), 
Collections.singletonMap("foo_ds", new MockedDataSource()));
         
when(metaDataContexts.getDatabaseMetaData(DefaultDatabase.LOGIC_NAME)).thenReturn(
                 new ShardingSphereDatabase("foo_db", mock(DatabaseType.class), 
resource, mock(ShardingSphereRuleMetaData.class), Collections.emptyMap()));
         
assertThat(contextManager.getDataSourceMap(DefaultDatabase.LOGIC_NAME).size(), 
is(1));
diff --git 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterContextManagerCoordinatorTest.java
 
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterContextManagerCoordinatorTest.java
index 747573f4ffc..696c7c71e53 100644
--- 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterContextManagerCoordinatorTest.java
+++ 
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterContextManagerCoordinatorTest.java
@@ -36,7 +36,6 @@ import 
org.apache.shardingsphere.infra.instance.ComputeNodeInstance;
 import org.apache.shardingsphere.infra.instance.definition.InstanceDefinition;
 import org.apache.shardingsphere.infra.instance.definition.InstanceType;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.metadata.resource.DataSourcesMetaData;
 import 
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
 import 
org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
 import org.apache.shardingsphere.infra.metadata.schema.QualifiedDatabase;
@@ -387,7 +386,7 @@ public final class ClusterContextManagerCoordinatorTest {
     
     private Map<String, DataSource> initContextManager() {
         Map<String, DataSource> result = getDataSourceMap();
-        ShardingSphereResource resource = new ShardingSphereResource(result, 
mock(DataSourcesMetaData.class), new MySQLDatabaseType());
+        ShardingSphereResource resource = new ShardingSphereResource(new 
MySQLDatabaseType(), result);
         ShardingSphereDatabase database = new ShardingSphereDatabase("db", new 
MySQLDatabaseType(), resource, mock(ShardingSphereRuleMetaData.class), 
Collections.emptyMap());
         contextManager.getMetaDataContexts().getDatabaseMap().put("db", 
database);
         return result;
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/information/SelectInformationSchemataExecutor.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/information/SelectInformationSchemataExecutor.java
index 5670ee7436e..4d3b068d499 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/information/SelectInformationSchemataExecutor.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/information/SelectInformationSchemataExecutor.java
@@ -95,7 +95,7 @@ public final class SelectInformationSchemataExecutor extends 
DefaultDatabaseMeta
     @Override
     protected void rowPostProcessing(final String databaseName, final 
Map<String, Object> rowMap, final Map<String, String> aliasMap) {
         ShardingSphereResource resource = 
ProxyContext.getInstance().getContextManager().getMetaDataContexts().getDatabaseMetaData(databaseName).getResource();
-        Set<String> catalogs = 
resource.getDataSources().keySet().stream().map(each -> 
resource.getDataSourcesMetaData().getDataSourceMetaData(each).getCatalog()).collect(Collectors.toSet());
+        Set<String> catalogs = 
resource.getDataSources().keySet().stream().map(each -> 
resource.getDataSourceMetaData(each).getCatalog()).collect(Collectors.toSet());
         schemaNameAlias = aliasMap.getOrDefault(SCHEMA_NAME, "");
         String rowValue = rowMap.getOrDefault(schemaNameAlias, "").toString();
         queryDatabase = !rowValue.isEmpty();
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/postgresql/executor/SelectDatabaseExecutor.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/postgresql/executor/SelectDatabaseExecutor.java
index e10828e0960..e4942ed45b7 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/postgresql/executor/SelectDatabaseExecutor.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/postgresql/executor/SelectDatabaseExecutor.java
@@ -88,7 +88,7 @@ public final class SelectDatabaseExecutor extends 
DefaultDatabaseMetadataExecuto
     protected void rowPostProcessing(final String databaseName, final 
Map<String, Object> rowMap, final Map<String, String> aliasMap) {
         buildColumnNames(aliasMap);
         ShardingSphereResource resource = 
ProxyContext.getInstance().getContextManager().getMetaDataContexts().getDatabaseMetaData(databaseName).getResource();
-        Set<String> catalogs = 
resource.getDataSources().keySet().stream().map(each -> 
resource.getDataSourcesMetaData().getDataSourceMetaData(each).getCatalog()).collect(Collectors.toSet());
+        Set<String> catalogs = 
resource.getDataSources().keySet().stream().map(each -> 
resource.getDataSourceMetaData(each).getCatalog()).collect(Collectors.toSet());
         databaseNameAlias = aliasMap.getOrDefault(DATABASE_NAME, 
aliasMap.getOrDefault(DATNAME, aliasMap.getOrDefault(NAME, "")));
         String rowValue = rowMap.getOrDefault(databaseNameAlias, 
"").toString();
         isQueryDatabase = !rowValue.isEmpty();
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/resource/DataSourceQueryResultSet.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/resource/DataSourceQueryResultSet.java
index 1696c755ed1..bcb447d724e 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/resource/DataSourceQueryResultSet.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/resource/DataSourceQueryResultSet.java
@@ -83,7 +83,7 @@ public final class DataSourceQueryResultSet implements 
DistSQLResultSet {
     @Override
     public Collection<Object> getRowData() {
         String dataSourceName = dataSourceNames.next();
-        DataSourceMetaData metaData = 
resource.getDataSourcesMetaData().getDataSourceMetaData(dataSourceName);
+        DataSourceMetaData metaData = 
resource.getDataSourceMetaData(dataSourceName);
         Collection<Object> result = new LinkedList<>();
         result.add(dataSourceName);
         result.add(resource.getDatabaseType().getType());
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/resource/UnusedDataSourceQueryResultSet.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/resource/UnusedDataSourceQueryResultSet.java
index 6da75408a54..ba5684c85d1 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/resource/UnusedDataSourceQueryResultSet.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/resource/UnusedDataSourceQueryResultSet.java
@@ -128,7 +128,7 @@ public final class UnusedDataSourceQueryResultSet 
implements DistSQLResultSet {
     @Override
     public Collection<Object> getRowData() {
         String dataSourceName = dataSourceNames.next();
-        DataSourceMetaData metaData = 
resource.getDataSourcesMetaData().getDataSourceMetaData(dataSourceName);
+        DataSourceMetaData metaData = 
resource.getDataSourceMetaData(dataSourceName);
         Collection<Object> result = new LinkedList<>();
         result.add(dataSourceName);
         result.add(resource.getDatabaseType().getType());
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/response/header/query/impl/MySQLQueryHeaderBuilderTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/response/header/query/impl/MySQLQueryHeaderBuilderTest.java
index 18401af3bec..14bb1fab8ff 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/response/header/query/impl/MySQLQueryHeaderBuilderTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/response/header/query/impl/MySQLQueryHeaderBuilderTest.java
@@ -23,7 +23,6 @@ import 
org.apache.shardingsphere.infra.database.DefaultDatabase;
 import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResultMetaData;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.metadata.resource.DataSourcesMetaData;
 import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
 import org.apache.shardingsphere.infra.metadata.schema.model.ColumnMetaData;
 import org.apache.shardingsphere.infra.metadata.schema.model.IndexMetaData;
@@ -101,9 +100,7 @@ public final class MySQLQueryHeaderBuilderTest {
         ShardingSphereSchema schema = mock(ShardingSphereSchema.class);
         when(schema.get("t_logic_order")).thenReturn(new 
TableMetaData("t_logic_order",
                 Collections.singletonList(columnMetaData), 
Collections.singletonList(new IndexMetaData("order_id")), 
Collections.emptyList()));
-        DataSourcesMetaData dataSourcesMetaData = 
mock(DataSourcesMetaData.class);
-        
when(dataSourcesMetaData.getDataSourceMetaData("ds_0")).thenReturn(mock(DataSourceMetaData.class));
-        
when(result.getResource().getDataSourcesMetaData()).thenReturn(dataSourcesMetaData);
+        
when(result.getResource().getDataSourceMetaData("ds_0")).thenReturn(mock(DataSourceMetaData.class));
         
when(result.getSchemas().get(DefaultDatabase.LOGIC_NAME)).thenReturn(schema);
         ShardingRule shardingRule = mock(ShardingRule.class);
         
when(shardingRule.findLogicTableByActualTable("t_order")).thenReturn(Optional.of("t_logic_order"));
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/information/SelectInformationExecutorTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/information/SelectInformationExecutorTest.java
index f8d431441ff..122690b8d99 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/information/SelectInformationExecutorTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/information/SelectInformationExecutorTest.java
@@ -23,7 +23,6 @@ import 
org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
 import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
 import 
org.apache.shardingsphere.infra.federation.optimizer.context.OptimizerContext;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.metadata.resource.DataSourcesMetaData;
 import 
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
 import 
org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
 import org.apache.shardingsphere.infra.metadata.user.Grantee;
@@ -40,6 +39,7 @@ import 
org.apache.shardingsphere.proxy.backend.text.admin.executor.AbstractDatab
 import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 import 
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement;
+import org.apache.shardingsphere.test.mock.MockedDataSource;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -48,6 +48,7 @@ import org.mockito.junit.MockitoJUnitRunner;
 
 import javax.sql.DataSource;
 import java.lang.reflect.Field;
+import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
@@ -104,27 +105,19 @@ public final class SelectInformationExecutorTest extends 
ProxyContextRestorer {
     private ShardingSphereDatabase getDatabase() throws SQLException {
         ShardingSphereRuleMetaData ruleMetaData = 
mock(ShardingSphereRuleMetaData.class);
         
when(ruleMetaData.getRules()).thenReturn(Collections.singletonList(mock(AuthorityRule.class,
 RETURNS_DEEP_STUBS)));
-        return new ShardingSphereDatabase("sharding_db",
-                new MySQLDatabaseType(), new 
ShardingSphereResource(mockDatasourceMap(), mockDataSourcesMetaData(), new 
MySQLDatabaseType()), ruleMetaData, Collections.emptyMap());
+        return new ShardingSphereDatabase("sharding_db", new 
MySQLDatabaseType(), new ShardingSphereResource(new MySQLDatabaseType(), 
mockDatasourceMap()), ruleMetaData, Collections.emptyMap());
     }
     
     private ShardingSphereDatabase getEmptyDatabase(final String schemaName) {
         ShardingSphereRuleMetaData ruleMetaData = 
mock(ShardingSphereRuleMetaData.class);
         
when(ruleMetaData.getRules()).thenReturn(Collections.singletonList(mock(AuthorityRule.class,
 RETURNS_DEEP_STUBS)));
-        return new ShardingSphereDatabase(schemaName,
-                new MySQLDatabaseType(), new 
ShardingSphereResource(Collections.emptyMap(), mockDataSourcesMetaData(), new 
MySQLDatabaseType()), ruleMetaData, Collections.emptyMap());
+        return new ShardingSphereDatabase(schemaName, new MySQLDatabaseType(), 
new ShardingSphereResource(new MySQLDatabaseType(), Collections.emptyMap()), 
ruleMetaData, Collections.emptyMap());
     }
     
     private Map<String, DataSource> mockDatasourceMap() throws SQLException {
-        DataSource dataSource = mock(DataSource.class, RETURNS_DEEP_STUBS);
-        
when(dataSource.getConnection().prepareStatement(any(String.class)).executeQuery()).thenReturn(RESULT_SET);
-        return Collections.singletonMap("ds_0", dataSource);
-    }
-    
-    private DataSourcesMetaData mockDataSourcesMetaData() {
-        DataSourcesMetaData result = mock(DataSourcesMetaData.class, 
RETURNS_DEEP_STUBS);
-        
when(result.getDataSourceMetaData("ds_0").getCatalog()).thenReturn("demo_ds_0");
-        return result;
+        Connection connection = mock(Connection.class, RETURNS_DEEP_STUBS);
+        
when(connection.prepareStatement(any(String.class)).executeQuery()).thenReturn(RESULT_SET);
+        return Collections.singletonMap("ds_0", new 
MockedDataSource(connection));
     }
     
     @Test
@@ -132,7 +125,7 @@ public final class SelectInformationExecutorTest extends 
ProxyContextRestorer {
         final String sql = "SELECT SCHEMA_NAME, DEFAULT_CHARACTER_SET_NAME, 
DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA";
         final SQLStatement sqlStatement = new 
ShardingSphereSQLParserEngine("MySQL", parserConfig).parse(sql, false);
         Map<String, String> mockResultSetMap = new HashMap<>();
-        mockResultSetMap.put("SCHEMA_NAME", "demo_ds_0");
+        mockResultSetMap.put("SCHEMA_NAME", "foo_ds");
         mockResultSetMap.put("DEFAULT_CHARACTER_SET_NAME", 
"utf8mb4_0900_ai_ci");
         mockResultSetMap.put("DEFAULT_COLLATION_NAME", "utf8mb4");
         mockResultSet(mockResultSetMap);
@@ -163,7 +156,7 @@ public final class SelectInformationExecutorTest extends 
ProxyContextRestorer {
         final String sql = "SELECT SCHEMA_NAME, DEFAULT_CHARACTER_SET_NAME, 
DEFAULT_COLLATION_NAME, DEFAULT_ENCRYPTION FROM information_schema.SCHEMATA";
         final SQLStatement sqlStatement = new 
ShardingSphereSQLParserEngine("MySQL", parserConfig).parse(sql, false);
         Map<String, String> mockResultSetMap = new HashMap<>(4, 1);
-        mockResultSetMap.put("SCHEMA_NAME", "demo_ds_0");
+        mockResultSetMap.put("SCHEMA_NAME", "foo_ds");
         mockResultSetMap.put("DEFAULT_CHARACTER_SET_NAME", 
"utf8mb4_0900_ai_ci");
         mockResultSetMap.put("DEFAULT_COLLATION_NAME", "utf8mb4");
         mockResultSetMap.put("DEFAULT_ENCRYPTION", "NO");
@@ -194,15 +187,15 @@ public final class SelectInformationExecutorTest extends 
ProxyContextRestorer {
     public void assertSelectSchemaAliasExecute() throws SQLException {
         final String sql = "SELECT SCHEMA_NAME AS sn, 
DEFAULT_CHARACTER_SET_NAME FROM information_schema.SCHEMATA";
         Map<String, String> mockResultSetMap = new HashMap<>();
-        mockResultSetMap.put("sn", "demo_ds_0");
+        mockResultSetMap.put("sn", "foo_ds");
         mockResultSetMap.put("DEFAULT_CHARACTER_SET_NAME", "utf8mb4");
         mockResultSet(mockResultSetMap);
         Map<String, ShardingSphereDatabase> databaseMap = 
ProxyContext.getInstance().getContextManager().getMetaDataContexts().getDatabaseMap();
-        databaseMap.put("demo_ds_0", getDatabase());
+        databaseMap.put("foo_ds", getDatabase());
         databaseMap.put("test", getEmptyDatabase("test"));
         DefaultDatabaseMetadataExecutor selectExecutor = new 
DefaultDatabaseMetadataExecutor(sql);
         selectExecutor.execute(connectionSession);
-        assertThat(selectExecutor.getRows().get(0).get("sn"), is("demo_ds_0"));
+        assertThat(selectExecutor.getRows().get(0).get("sn"), is("foo_ds"));
         
assertThat(selectExecutor.getRows().get(0).get("DEFAULT_CHARACTER_SET_NAME"), 
is("utf8mb4"));
     }
     
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/postgresql/executor/SelectDatabaseExecutorTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/postgresql/executor/SelectDatabaseExecutorTest.java
index 6f2ade68a77..bdd22c8a312 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/postgresql/executor/SelectDatabaseExecutorTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/postgresql/executor/SelectDatabaseExecutorTest.java
@@ -22,7 +22,6 @@ import 
org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
 import 
org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
 import 
org.apache.shardingsphere.infra.federation.optimizer.context.OptimizerContext;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.metadata.resource.DataSourcesMetaData;
 import 
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
 import 
org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
 import org.apache.shardingsphere.infra.parser.ParserConfiguration;
@@ -37,6 +36,7 @@ import 
org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
 import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 import 
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement;
+import org.apache.shardingsphere.test.mock.MockedDataSource;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -44,6 +44,7 @@ import org.mockito.junit.MockitoJUnitRunner;
 
 import javax.sql.DataSource;
 import java.lang.reflect.Field;
+import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
@@ -95,26 +96,20 @@ public final class SelectDatabaseExecutorTest extends 
ProxyContextRestorer {
     
     private ShardingSphereDatabase getDatabase() throws SQLException {
         return new ShardingSphereDatabase("sharding_db", new 
PostgreSQLDatabaseType(),
-                new ShardingSphereResource(mockDatasourceMap(), 
mockDataSourcesMetaData(), new PostgreSQLDatabaseType()), 
mock(ShardingSphereRuleMetaData.class), Collections.emptyMap());
+                new ShardingSphereResource(new PostgreSQLDatabaseType(), 
mockDatasourceMap()), mock(ShardingSphereRuleMetaData.class), 
Collections.emptyMap());
     }
     
     private ShardingSphereDatabase getEmptyDatabaseMetaData(final String 
schemaName) {
         ShardingSphereRuleMetaData ruleMetaData = 
mock(ShardingSphereRuleMetaData.class);
         when(ruleMetaData.getRules()).thenReturn(Collections.emptyList());
-        return new ShardingSphereDatabase(schemaName, new 
PostgreSQLDatabaseType(),
-                new ShardingSphereResource(Collections.emptyMap(), 
mockDataSourcesMetaData(), new PostgreSQLDatabaseType()), ruleMetaData, 
Collections.emptyMap());
+        return new ShardingSphereDatabase(
+                schemaName, new PostgreSQLDatabaseType(), new 
ShardingSphereResource(new PostgreSQLDatabaseType(), Collections.emptyMap()), 
ruleMetaData, Collections.emptyMap());
     }
     
     private Map<String, DataSource> mockDatasourceMap() throws SQLException {
-        DataSource dataSource = mock(DataSource.class, RETURNS_DEEP_STUBS);
-        
when(dataSource.getConnection().prepareStatement(any(String.class)).executeQuery()).thenReturn(RESULT_SET);
-        return Collections.singletonMap("ds_0", dataSource);
-    }
-    
-    private DataSourcesMetaData mockDataSourcesMetaData() {
-        DataSourcesMetaData result = mock(DataSourcesMetaData.class, 
RETURNS_DEEP_STUBS);
-        
when(result.getDataSourceMetaData("ds_0").getCatalog()).thenReturn("demo_ds_0");
-        return result;
+        Connection connection = mock(Connection.class, RETURNS_DEEP_STUBS);
+        
when(connection.prepareStatement(any(String.class)).executeQuery()).thenReturn(RESULT_SET);
+        return Collections.singletonMap("ds_0", new 
MockedDataSource(connection));
     }
     
     @Test
@@ -124,7 +119,7 @@ public final class SelectDatabaseExecutorTest extends 
ProxyContextRestorer {
                 + "FROM pg_database d LEFT JOIN pg_tablespace t ON 
d.dattablespace = t.oid;";
         final SQLStatement sqlStatement = new 
ShardingSphereSQLParserEngine("PostgreSQL", parserConfig).parse(sql, false);
         Map<String, String> mockResultSetMap = new HashMap<>();
-        mockResultSetMap.put("databasename", "demo_ds_0");
+        mockResultSetMap.put("databasename", "foo_ds");
         mockResultSetMap.put("databaseowner", "postgres");
         mockResultSetMap.put("datconnlimit", "-1");
         mockResultSetMap.put("datctype", "en_US.utf8");
@@ -158,7 +153,7 @@ public final class SelectDatabaseExecutorTest extends 
ProxyContextRestorer {
                 + "FROM pg_database d LEFT JOIN pg_tablespace t ON 
d.dattablespace = t.oid;";
         final SQLStatement sqlStatement = new 
ShardingSphereSQLParserEngine("PostgreSQL", parserConfig).parse(sql, false);
         Map<String, String> mockResultSetMap = new HashMap<>(4, 1);
-        mockResultSetMap.put("databasename", "demo_ds_0");
+        mockResultSetMap.put("databasename", "foo_ds");
         mockResultSetMap.put("databaseowner", "postgres");
         mockResultSetMap.put("datconnlimit", "-1");
         mockResultSetMap.put("datctype", "en_US.utf8");
@@ -177,7 +172,7 @@ public final class SelectDatabaseExecutorTest extends 
ProxyContextRestorer {
         final String sql = "SELECT d.oid, d.datname AS databasename, d.datacl, 
d.datistemplate FROM pg_database d LEFT JOIN pg_tablespace t ON d.dattablespace 
= t.oid;";
         final SQLStatement sqlStatement = new 
ShardingSphereSQLParserEngine("PostgreSQL", parserConfig).parse(sql, false);
         Map<String, String> mockResultSetMap = new HashMap<>(4, 1);
-        mockResultSetMap.put("databasename", "demo_ds_0");
+        mockResultSetMap.put("databasename", "foo_ds");
         mockResultSetMap.put("databaseowner", "postgres");
         mockResultSetMap.put("datconnlimit", "-1");
         mockResultSetMap.put("datctype", "en_US.utf8");
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/postgresql/executor/SelectTableExecutorTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/postgresql/executor/SelectTableExecutorTest.java
index 10e8fd276a3..3ac3f897a18 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/postgresql/executor/SelectTableExecutorTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/postgresql/executor/SelectTableExecutorTest.java
@@ -22,7 +22,6 @@ import 
org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
 import 
org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
 import 
org.apache.shardingsphere.infra.federation.optimizer.context.OptimizerContext;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.metadata.resource.DataSourcesMetaData;
 import 
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
 import 
org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
 import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
@@ -33,6 +32,7 @@ import 
org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
 import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
+import org.apache.shardingsphere.test.mock.MockedDataSource;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -40,6 +40,7 @@ import org.mockito.junit.MockitoJUnitRunner;
 
 import javax.sql.DataSource;
 import java.lang.reflect.Field;
+import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
@@ -89,22 +90,14 @@ public final class SelectTableExecutorTest extends 
ProxyContextRestorer {
     }
     
     private ShardingSphereDatabase getDatabaseMetaData() throws SQLException {
-        return new ShardingSphereDatabase("sharding_db", new 
PostgreSQLDatabaseType(), new ShardingSphereResource(mockDatasourceMap(), 
mockDataSourcesMetaData(), new PostgreSQLDatabaseType()),
+        return new ShardingSphereDatabase("sharding_db", new 
PostgreSQLDatabaseType(), new ShardingSphereResource(new 
PostgreSQLDatabaseType(), mockDatasourceMap()),
                 mock(ShardingSphereRuleMetaData.class), 
Collections.singletonMap("public", new 
ShardingSphereSchema(Collections.singletonMap("t_order", 
mock(TableMetaData.class)))));
     }
     
     private Map<String, DataSource> mockDatasourceMap() throws SQLException {
-        DataSource dataSource = mock(DataSource.class, RETURNS_DEEP_STUBS);
-        
when(dataSource.getConnection().prepareStatement(any(String.class)).executeQuery()).thenReturn(RESULT_SET);
-        Map<String, DataSource> dataSourceMap = new HashMap<>();
-        dataSourceMap.put("ds_0", dataSource);
-        return dataSourceMap;
-    }
-    
-    private DataSourcesMetaData mockDataSourcesMetaData() {
-        DataSourcesMetaData result = mock(DataSourcesMetaData.class, 
RETURNS_DEEP_STUBS);
-        
when(result.getDataSourceMetaData("ds_0").getCatalog()).thenReturn("demo_ds_0");
-        return result;
+        Connection connection = mock(Connection.class, RETURNS_DEEP_STUBS);
+        
when(connection.prepareStatement(any(String.class)).executeQuery()).thenReturn(RESULT_SET);
+        return Collections.singletonMap("ds_0", new 
MockedDataSource(connection));
     }
     
     @Test
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetVariableBackendHandlerTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetVariableBackendHandlerTest.java
index 81539a6014f..6dc21ed6541 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetVariableBackendHandlerTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetVariableBackendHandlerTest.java
@@ -77,7 +77,7 @@ public final class SetVariableBackendHandlerTest extends 
ProxyContextRestorer {
         Map<String, ShardingSphereDatabase> result = new HashMap<>(10, 1);
         for (int i = 0; i < 10; i++) {
             ShardingSphereDatabase database = 
mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
-            when(database.getResource()).thenReturn(new 
ShardingSphereResource(Collections.emptyMap(), null, new MySQLDatabaseType()));
+            when(database.getResource()).thenReturn(new 
ShardingSphereResource(new MySQLDatabaseType(), Collections.emptyMap()));
             when(database.getRuleMetaData()).thenReturn(new 
ShardingSphereRuleMetaData(Collections.emptyList(), Collections.emptyList()));
             
when(database.getSchemas().get(DefaultDatabase.LOGIC_NAME)).thenReturn(mock(ShardingSphereSchema.class));
             result.put(String.format(DATABASE_PATTERN, i), database);
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/DataSourceQueryResultSetTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/DataSourceQueryResultSetTest.java
index a7b3de8908f..58ba4c8ad38 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/DataSourceQueryResultSetTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/DataSourceQueryResultSetTest.java
@@ -18,11 +18,9 @@
 package org.apache.shardingsphere.proxy.backend.text.distsql.rql;
 
 import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowResourcesStatement;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
 import org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.metadata.resource.DataSourcesMetaData;
 import 
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
 import 
org.apache.shardingsphere.proxy.backend.text.distsql.rql.resource.DataSourceQueryResultSet;
 import org.apache.shardingsphere.test.mock.MockedDataSource;
@@ -49,9 +47,7 @@ public final class DataSourceQueryResultSetTest {
     
     @Before
     public void before() {
-        DatabaseType databaseType = new MySQLDatabaseType();
-        DataSourcesMetaData dataSourcesMetaData = new 
DataSourcesMetaData(databaseType, Collections.singletonMap("foo_ds", 
createDataSource()));
-        ShardingSphereResource resource = new 
ShardingSphereResource(Collections.singletonMap("foo_ds", createDataSource()), 
dataSourcesMetaData, databaseType);
+        ShardingSphereResource resource = new ShardingSphereResource(new 
MySQLDatabaseType(), Collections.singletonMap("foo_ds", createDataSource()));
         when(database.getResource()).thenReturn(resource);
     }
     
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/RulesUsedResourceQueryResultSetTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/RulesUsedResourceQueryResultSetTest.java
index a000bb62d3a..2e854a8fe3c 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/RulesUsedResourceQueryResultSetTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/RulesUsedResourceQueryResultSetTest.java
@@ -17,13 +17,13 @@
 
 package org.apache.shardingsphere.proxy.backend.text.distsql.rql;
 
-import com.zaxxer.hikari.HikariDataSource;
 import 
org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
 import 
org.apache.shardingsphere.dbdiscovery.api.config.rule.DatabaseDiscoveryDataSourceRuleConfiguration;
 import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowRulesUsedResourceStatement;
 import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
 import 
org.apache.shardingsphere.encrypt.api.config.rule.EncryptTableRuleConfiguration;
 import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereDatabase;
 import 
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
@@ -36,6 +36,7 @@ import 
org.apache.shardingsphere.shadow.api.config.datasource.ShadowDataSourceCo
 import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
 import 
org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
 import 
org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.apache.shardingsphere.test.mock.MockedDataSource;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -137,25 +138,22 @@ public final class RulesUsedResourceQueryResultSetTest {
     
     private void init(final RuleConfiguration ruleConfig) {
         ShardingSphereRuleMetaData ruleMetaData = 
mock(ShardingSphereRuleMetaData.class);
-        
when(ruleMetaData.getConfigurations()).thenReturn(Collections.singletonList(ruleConfig));
+        
when(ruleMetaData.getConfigurations()).thenReturn(Collections.singleton(ruleConfig));
         when(database.getRuleMetaData()).thenReturn(ruleMetaData);
-        when(database.getResource()).thenReturn(createResource());
-    }
-    
-    private ShardingSphereResource createResource() {
-        return new ShardingSphereResource(Collections.singletonMap("ds_0", new 
HikariDataSource()), null, null);
+        ShardingSphereResource resource = new 
ShardingSphereResource(mock(DatabaseType.class), 
Collections.singletonMap("ds_0", new MockedDataSource()));
+        when(database.getResource()).thenReturn(resource);
     }
     
     private RuleConfiguration mockShardingTableRule() {
         ShardingRuleConfiguration result = 
mock(ShardingRuleConfiguration.class);
-        when(result.getTables()).thenReturn(Collections.singletonList(new 
ShardingTableRuleConfiguration("sharding_table")));
-        when(result.getAutoTables()).thenReturn(Collections.singletonList(new 
ShardingAutoTableRuleConfiguration("sharding_auto_table")));
+        when(result.getTables()).thenReturn(Collections.singleton(new 
ShardingTableRuleConfiguration("sharding_table")));
+        when(result.getAutoTables()).thenReturn(Collections.singleton(new 
ShardingAutoTableRuleConfiguration("sharding_auto_table")));
         return result;
     }
     
     private RuleConfiguration mockReadwriteSplittingRule() {
         ReadwriteSplittingRuleConfiguration result = 
mock(ReadwriteSplittingRuleConfiguration.class);
-        when(result.getDataSources()).thenReturn(Collections.singletonList(new 
ReadwriteSplittingDataSourceRuleConfiguration("readwrite_splitting_source", "", 
createProperties(), "")));
+        when(result.getDataSources()).thenReturn(Collections.singleton(new 
ReadwriteSplittingDataSourceRuleConfiguration("readwrite_splitting_source", "", 
createProperties(), "")));
         return result;
     }
     
@@ -168,13 +166,13 @@ public final class RulesUsedResourceQueryResultSetTest {
     
     private RuleConfiguration mockDBDiscoveryRule() {
         DatabaseDiscoveryRuleConfiguration result = 
mock(DatabaseDiscoveryRuleConfiguration.class);
-        when(result.getDataSources()).thenReturn(Collections.singletonList(new 
DatabaseDiscoveryDataSourceRuleConfiguration("db_discovery_group_name", 
Arrays.asList("ds_0", "ds_1"), "", "")));
+        when(result.getDataSources()).thenReturn(Collections.singleton(new 
DatabaseDiscoveryDataSourceRuleConfiguration("db_discovery_group_name", 
Arrays.asList("ds_0", "ds_1"), "", "")));
         return result;
     }
     
     private RuleConfiguration mockEncryptRule() {
         EncryptRuleConfiguration result = mock(EncryptRuleConfiguration.class);
-        when(result.getTables()).thenReturn(Collections.singletonList(new 
EncryptTableRuleConfiguration("encrypt_table", Collections.emptyList(), 
false)));
+        when(result.getTables()).thenReturn(Collections.singleton(new 
EncryptTableRuleConfiguration("encrypt_table", Collections.emptyList(), 
false)));
         return result;
     }
     
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/UnusedDataSourceQueryResultSetTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/UnusedDataSourceQueryResultSetTest.java
index 096643986c0..2dcd6484894 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/UnusedDataSourceQueryResultSetTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/UnusedDataSourceQueryResultSetTest.java
@@ -22,7 +22,6 @@ import 
org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
 import org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.metadata.resource.DataSourcesMetaData;
 import 
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
 import 
org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
 import 
org.apache.shardingsphere.proxy.backend.text.distsql.rql.resource.UnusedDataSourceQueryResultSet;
@@ -60,8 +59,7 @@ public final class UnusedDataSourceQueryResultSetTest {
     @Before
     public void before() {
         DatabaseType databaseType = new MySQLDatabaseType();
-        DataSourcesMetaData dataSourcesMetaData = new 
DataSourcesMetaData(databaseType, createDataSources());
-        ShardingSphereResource resource = new 
ShardingSphereResource(createDataSources(), dataSourcesMetaData, databaseType);
+        ShardingSphereResource resource = new 
ShardingSphereResource(databaseType, createDataSources());
         ShardingSphereRuleMetaData metaData = new 
ShardingSphereRuleMetaData(null, Collections.singleton(createShardingRule()));
         when(database.getResource()).thenReturn(resource);
         when(database.getRuleMetaData()).thenReturn(metaData);
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationHandlerTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationHandlerTest.java
index 5f0b4ac7afe..e1577ac1e69 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationHandlerTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationHandlerTest.java
@@ -140,7 +140,7 @@ public final class OpenGaussAuthenticationHandlerTest {
         for (int i = 0; i < 10; i++) {
             ShardingSphereDatabase database = 
mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
             ShardingSphereSchema schema = mock(ShardingSphereSchema.class);
-            when(database.getResource()).thenReturn(new 
ShardingSphereResource(Collections.emptyMap(), null, new MySQLDatabaseType()));
+            when(database.getResource()).thenReturn(new 
ShardingSphereResource(new MySQLDatabaseType(), Collections.emptyMap()));
             when(database.getRuleMetaData()).thenReturn(new 
ShardingSphereRuleMetaData(Collections.emptyList(), Collections.emptyList()));
             
when(database.getSchemas().get(DefaultDatabase.LOGIC_NAME)).thenReturn(schema);
             when(schema.getTables()).thenReturn(Collections.emptyMap());
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandlerTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandlerTest.java
index 7d99cbc053f..6620af8f6a9 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandlerTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandlerTest.java
@@ -156,7 +156,7 @@ public final class PostgreSQLAuthenticationHandlerTest {
         for (int i = 0; i < 10; i++) {
             ShardingSphereDatabase database = 
mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
             ShardingSphereSchema schema = mock(ShardingSphereSchema.class);
-            when(database.getResource()).thenReturn(new 
ShardingSphereResource(Collections.emptyMap(), null, new MySQLDatabaseType()));
+            when(database.getResource()).thenReturn(new 
ShardingSphereResource(new MySQLDatabaseType(), Collections.emptyMap()));
             when(database.getRuleMetaData()).thenReturn(new 
ShardingSphereRuleMetaData(Collections.emptyList(), Collections.emptyList()));
             
when(database.getSchemas().get(DefaultDatabase.LOGIC_NAME)).thenReturn(schema);
             when(schema.getTables()).thenReturn(Collections.emptyMap());

Reply via email to