You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by do...@apache.org on 2020/12/30 02:48:22 UTC

[shardingsphere] branch master updated: Rename actualDataSources and targetDataSource (#8817)

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

dongzonglei 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 4b7d611  Rename actualDataSources and targetDataSource (#8817)
4b7d611 is described below

commit 4b7d611d19cbcf22c2ab648507addd7b0e9b6543
Author: Liang Zhang <te...@163.com>
AuthorDate: Wed Dec 30 10:48:02 2020 +0800

    Rename actualDataSources and targetDataSource (#8817)
---
 .../shardingsphere/test/integration/engine/BaseIT.java | 18 +++++++++---------
 .../test/integration/engine/BatchIT.java               |  4 ++--
 .../test/integration/engine/dcl/BaseDCLIT.java         | 12 ++++++------
 .../test/integration/engine/dcl/GeneralDCLIT.java      |  4 ++--
 .../test/integration/engine/ddl/BaseDDLIT.java         |  2 +-
 .../test/integration/engine/ddl/GeneralDDLIT.java      |  2 +-
 .../test/integration/engine/dml/AdditionalDMLIT.java   | 14 +++++++-------
 .../test/integration/engine/dml/BaseDMLIT.java         |  6 +++---
 .../test/integration/engine/dml/BatchDMLIT.java        |  4 ++--
 .../test/integration/engine/dml/GeneralDMLIT.java      |  4 ++--
 .../test/integration/engine/dql/AdditionalDQLIT.java   |  8 ++++----
 .../test/integration/engine/dql/GeneralDQLIT.java      |  4 ++--
 12 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/BaseIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/BaseIT.java
index 14b767f..ed8d7ff 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/BaseIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/BaseIT.java
@@ -55,9 +55,9 @@ public abstract class BaseIT {
     
     private final DatabaseType databaseType;
     
-    private final Map<String, DataSource> dataSourceMap;
+    private final Map<String, DataSource> actualDataSources;
     
-    private final DataSource dataSource;
+    private final DataSource targetDataSource;
     
     static {
         TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
@@ -69,11 +69,11 @@ public abstract class BaseIT {
     BaseIT(final String ruleType, final DatabaseType databaseType) throws IOException, JAXBException, SQLException {
         this.ruleType = ruleType;
         this.databaseType = databaseType;
-        dataSourceMap = createDataSourceMap();
-        dataSource = createDataSource();
+        actualDataSources = createActualDataSources();
+        targetDataSource = createTargetDataSource();
     }
     
-    private Map<String, DataSource> createDataSourceMap() throws IOException, JAXBException {
+    private Map<String, DataSource> createActualDataSources() throws IOException, JAXBException {
         Collection<String> dataSourceNames = SchemaEnvironmentManager.getDataSourceNames(ruleType);
         Map<String, DataSource> result = new HashMap<>(dataSourceNames.size(), 1);
         for (String each : dataSourceNames) {
@@ -82,9 +82,9 @@ public abstract class BaseIT {
         return result;
     }
     
-    private DataSource createDataSource() throws SQLException, IOException {
+    private DataSource createTargetDataSource() throws SQLException, IOException {
         return IntegrateTestEnvironment.getInstance().isProxyEnvironment() ? ProxyDataSourceBuilder.build(String.format("proxy_%s", ruleType), databaseType) 
-                : YamlShardingSphereDataSourceFactory.createDataSource(dataSourceMap, new File(EnvironmentPath.getRulesConfigurationFile(ruleType)));
+                : YamlShardingSphereDataSourceFactory.createDataSource(actualDataSources, new File(EnvironmentPath.getRulesConfigurationFile(ruleType)));
     }
     
     protected static void setUpDatabasesAndTables() {
@@ -126,8 +126,8 @@ public abstract class BaseIT {
     
     @After
     public void tearDown() {
-        if (dataSource instanceof ShardingSphereDataSource) {
-            ((ShardingSphereDataSource) dataSource).getMetaDataContexts().getExecutorEngine().close();
+        if (targetDataSource instanceof ShardingSphereDataSource) {
+            ((ShardingSphereDataSource) targetDataSource).getMetaDataContexts().getExecutorEngine().close();
         }
     }
     
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/BatchIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/BatchIT.java
index 9f012c4..a062ab8 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/BatchIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/BatchIT.java
@@ -78,7 +78,7 @@ public abstract class BatchIT extends BaseIT {
         for (IntegrateTestCaseAssertion each : testCaseContext.getTestCase().getIntegrateTestCaseAssertions()) {
             dataSets.add(DataSetLoader.load(testCaseContext.getParentPath(), ruleType, databaseType, each.getExpectedDataFile()));
         }
-        dataSetEnvironmentManager = new DataSetEnvironmentManager(EnvironmentPath.getDataSetFile(ruleType), getDataSourceMap());
+        dataSetEnvironmentManager = new DataSetEnvironmentManager(EnvironmentPath.getDataSetFile(ruleType), getActualDataSources());
     }
     
     @BeforeClass
@@ -120,7 +120,7 @@ public abstract class BatchIT extends BaseIT {
         DataSetMetadata expectedDataSetMetadata = expected.getMetadataList().get(0);
         for (String each : new InlineExpressionParser(expectedDataSetMetadata.getDataNodes()).splitAndEvaluate()) {
             DataNode dataNode = new DataNode(each);
-            try (Connection connection = getDataSourceMap().get(dataNode.getDataSourceName()).getConnection();
+            try (Connection connection = getActualDataSources().get(dataNode.getDataSourceName()).getConnection();
                  PreparedStatement preparedStatement = connection.prepareStatement(String.format("SELECT * FROM %s ORDER BY 1", dataNode.getTableName()))) {
                 assertDataSet(preparedStatement, expected.findRows(dataNode), expectedDataSetMetadata);
             }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dcl/BaseDCLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dcl/BaseDCLIT.java
index d83e02c..09fb31a 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dcl/BaseDCLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dcl/BaseDCLIT.java
@@ -51,17 +51,17 @@ public abstract class BaseDCLIT extends SingleIT {
                         final DatabaseType databaseType, final SQLCaseType caseType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
         super(parentPath, assertion, ruleType, databaseType, caseType, sql);
         authorityEnvironmentManager = new AuthorityEnvironmentManager(
-                EnvironmentPath.getAuthorityFile(ruleType), null == getDataSourceMap() ? null : createInstanceDataSourceMap(), getDatabaseType());
+                EnvironmentPath.getAuthorityFile(ruleType), null == getActualDataSources() ? null : createInstanceDataSourceMap(), databaseType);
     }
     
     private Map<String, DataSource> createInstanceDataSourceMap() throws SQLException {
-        return "shadow".equals(getRuleType()) ? getDataSourceMap() : getShardingInstanceDataSourceMap();
+        return "shadow".equals(getRuleType()) ? getActualDataSources() : getShardingInstanceDataSourceMap();
     }
     
     private Map<String, DataSource> getShardingInstanceDataSourceMap() throws SQLException {
-        Map<String, DataSource> result = new LinkedHashMap<>();
+        Map<String, DataSource> result = new LinkedHashMap<>(getActualDataSources().size(), 1);
         Map<String, DataSourceMetaData> dataSourceMetaDataMap = getDataSourceMetaDataMap();
-        for (Entry<String, DataSource> entry : getDataSourceMap().entrySet()) {
+        for (Entry<String, DataSource> entry : getActualDataSources().entrySet()) {
             if (!isExisted(entry.getKey(), result.keySet(), dataSourceMetaDataMap)) {
                 result.put(entry.getKey(), entry.getValue());
             }
@@ -70,8 +70,8 @@ public abstract class BaseDCLIT extends SingleIT {
     }
     
     private Map<String, DataSourceMetaData> getDataSourceMetaDataMap() throws SQLException {
-        Map<String, DataSourceMetaData> result = new LinkedHashMap<>();
-        for (Entry<String, DataSource> entry : getDataSourceMap().entrySet()) {
+        Map<String, DataSourceMetaData> result = new LinkedHashMap<>(getActualDataSources().size(), 1);
+        for (Entry<String, DataSource> entry : getActualDataSources().entrySet()) {
             try (Connection connection = entry.getValue().getConnection()) {
                 DatabaseMetaData metaData = connection.getMetaData();
                 result.put(entry.getKey(), getDatabaseType().getDataSourceMetaData(metaData.getURL(), metaData.getUserName()));
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dcl/GeneralDCLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dcl/GeneralDCLIT.java
index 4c5fb54..567089b 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dcl/GeneralDCLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dcl/GeneralDCLIT.java
@@ -46,7 +46,7 @@ public final class GeneralDCLIT extends BaseDCLIT {
     
     @Test
     public void assertExecuteUpdate() throws SQLException {
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             if (SQLCaseType.Literal == getCaseType()) {
                 connection.createStatement().executeUpdate(getSql());
             } else {
@@ -60,7 +60,7 @@ public final class GeneralDCLIT extends BaseDCLIT {
     
     @Test
     public void assertExecute() throws SQLException {
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             if (SQLCaseType.Literal == getCaseType()) {
                 connection.createStatement().execute(getSql());
             } else {
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java
index aadb7d1..18c2fe4 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java
@@ -72,7 +72,7 @@ public abstract class BaseDDLIT extends SingleIT {
             dropTables();
         }
         createTables();
-        new DataSetEnvironmentManager(EnvironmentPath.getDataSetFile(getRuleType()), getDataSourceMap()).initialize();
+        new DataSetEnvironmentManager(EnvironmentPath.getDataSetFile(getRuleType()), getActualDataSources()).initialize();
     }
     
     @After
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/GeneralDDLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/GeneralDDLIT.java
index e6d74e7..18855e6 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/GeneralDDLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/GeneralDDLIT.java
@@ -57,7 +57,7 @@ public final class GeneralDDLIT extends BaseDDLIT {
     }
     
     private void assertExecute(final boolean isExecuteUpdate) throws SQLException {
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             dropTableIfExisted(connection);
             if (!Strings.isNullOrEmpty(((DDLIntegrateTestCaseAssertion) getAssertion()).getInitSQL())) {
                 for (String each : Splitter.on(";").trimResults().splitToList(((DDLIntegrateTestCaseAssertion) getAssertion()).getInitSQL())) {
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/AdditionalDMLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/AdditionalDMLIT.java
index 565ff7c..8ea3799 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/AdditionalDMLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/AdditionalDMLIT.java
@@ -61,7 +61,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
             return;
         }
         int actualUpdateCount;
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             actualUpdateCount = SQLCaseType.Literal == getCaseType() ? executeUpdateForStatementWithAutoGeneratedKeys(connection) : executeUpdateForPreparedStatementWithAutoGeneratedKeys(connection);
         }
         assertDataSet(actualUpdateCount);
@@ -89,7 +89,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
             return;
         }
         int actualUpdateCount;
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             actualUpdateCount = SQLCaseType.Literal == getCaseType() ? executeUpdateForStatementWithColumnIndexes(connection) : executeUpdateForPreparedStatementWithColumnIndexes(connection);
         }
         assertDataSet(actualUpdateCount);
@@ -117,7 +117,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
             return;
         }
         int actualUpdateCount;
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             actualUpdateCount = SQLCaseType.Literal == getCaseType() ? executeUpdateForStatementWithColumnNames(connection) : executeUpdateForPreparedStatementWithColumnNames(connection);
         }
         assertDataSet(actualUpdateCount);
@@ -145,7 +145,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
             return;
         }
         int actualUpdateCount;
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             actualUpdateCount = SQLCaseType.Literal == getCaseType() ? executeForStatementWithoutAutoGeneratedKeys(connection) : executeForPreparedStatementWithoutAutoGeneratedKeys(connection);
         }
         assertDataSet(actualUpdateCount);
@@ -175,7 +175,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
             return;
         }
         int actualUpdateCount;
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             actualUpdateCount = SQLCaseType.Literal == getCaseType() ? executeForStatementWithAutoGeneratedKeys(connection) : executeForPreparedStatementWithAutoGeneratedKeys(connection);
         }
         assertDataSet(actualUpdateCount);
@@ -207,7 +207,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
             return;
         }
         int actualUpdateCount;
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             actualUpdateCount = SQLCaseType.Literal == getCaseType() ? executeForStatementWithColumnIndexes(connection) : executeForPreparedStatementWithColumnIndexes(connection);
         }
         assertDataSet(actualUpdateCount);
@@ -237,7 +237,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
             return;
         }
         int actualUpdateCount;
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             actualUpdateCount = SQLCaseType.Literal == getCaseType() ? executeForStatementWithColumnNames(connection) : executeForPreparedStatementWithColumnNames(connection);
         }
         assertDataSet(actualUpdateCount);
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/BaseDMLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/BaseDMLIT.java
index 29a0fc5..b6ec56e 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/BaseDMLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/BaseDMLIT.java
@@ -59,7 +59,7 @@ public abstract class BaseDMLIT extends SingleIT {
     protected BaseDMLIT(final String parentPath, final DMLIntegrateTestCaseAssertion assertion, final String ruleType,
                         final DatabaseType databaseType, final SQLCaseType caseType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
         super(parentPath, assertion, ruleType, databaseType, caseType, sql);
-        dataSetEnvironmentManager = new DataSetEnvironmentManager(EnvironmentPath.getDataSetFile(getRuleType()), getDataSourceMap());
+        dataSetEnvironmentManager = new DataSetEnvironmentManager(EnvironmentPath.getDataSetFile(getRuleType()), getActualDataSources());
     }
     
     @BeforeClass
@@ -91,14 +91,14 @@ public abstract class BaseDMLIT extends SingleIT {
                 DataNode dataNode = new DataNode(each);
                 String sql;
                 if (getDatabaseType() instanceof PostgreSQLDatabaseType) {
-                    try (Connection connection = getDataSourceMap().get(dataNode.getDataSourceName()).getConnection()) {
+                    try (Connection connection = getActualDataSources().get(dataNode.getDataSourceName()).getConnection()) {
                         String primaryKeyColumnName = getPostgreSQLTablePrimaryKeyColumnName(connection, dataNode.getTableName());
                         sql = String.format("SELECT * FROM %s ORDER BY %s ASC", dataNode.getTableName(), primaryKeyColumnName);
                     }
                 } else {
                     sql = String.format("SELECT * FROM %s", dataNode.getTableName());
                 }
-                try (Connection connection = getDataSourceMap().get(dataNode.getDataSourceName()).getConnection();
+                try (Connection connection = getActualDataSources().get(dataNode.getDataSourceName()).getConnection();
                      PreparedStatement preparedStatement = connection.prepareStatement(sql)) {
                     assertDataSet(preparedStatement, getDataSet().findRows(dataNode), expectedDataSetMetadata);
                 }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/BatchDMLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/BatchDMLIT.java
index 0121165..994977b 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/BatchDMLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/BatchDMLIT.java
@@ -64,7 +64,7 @@ public final class BatchDMLIT extends BatchIT {
             return;
         }
         int[] actualUpdateCounts;
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             actualUpdateCounts = executeBatchForPreparedStatement(connection);
         }
         assertDataSet(actualUpdateCounts);
@@ -96,7 +96,7 @@ public final class BatchDMLIT extends BatchIT {
         if ("shadow".equals(getRuleType())) {
             return;
         }
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             try (PreparedStatement preparedStatement = connection.prepareStatement(getSql())) {
                 for (IntegrateTestCaseAssertion each : testCaseContext.getTestCase().getIntegrateTestCaseAssertions()) {
                     addBatch(preparedStatement, each);
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/GeneralDMLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/GeneralDMLIT.java
index 43958c8..e804ac3 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/GeneralDMLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/GeneralDMLIT.java
@@ -70,7 +70,7 @@ public final class GeneralDMLIT extends BaseDMLIT {
             return;
         }
         int actualUpdateCount;
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             actualUpdateCount = SQLCaseType.Literal == getCaseType() ? executeUpdateForStatement(connection) : executeUpdateForPreparedStatement(connection);
         } catch (final SQLException ex) {
             logException(ex);
@@ -105,7 +105,7 @@ public final class GeneralDMLIT extends BaseDMLIT {
             return;
         }
         int actualUpdateCount;
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             actualUpdateCount = SQLCaseType.Literal == getCaseType() ? executeForStatement(connection) : executeForPreparedStatement(connection);
         } catch (final SQLException ex) {
             logException(ex);
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/AdditionalDQLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/AdditionalDQLIT.java
index f5b3185..9b6fe56 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/AdditionalDQLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/AdditionalDQLIT.java
@@ -57,7 +57,7 @@ public final class AdditionalDQLIT extends BaseDQLIT {
     
     @Test
     public void assertExecuteQueryWithResultSetTypeAndResultSetConcurrency() throws SQLException, ParseException {
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             if (SQLCaseType.Literal == getCaseType()) {
                 assertExecuteQueryForStatementWithResultSetTypeAndResultSetConcurrency(connection);
             } else {
@@ -87,7 +87,7 @@ public final class AdditionalDQLIT extends BaseDQLIT {
     
     @Test
     public void assertExecuteQueryWithResultSetTypeAndResultSetConcurrencyAndResultSetHoldability() throws SQLException, ParseException {
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             if (SQLCaseType.Literal == getCaseType()) {
                 assertExecuteQueryForStatementWithResultSetTypeAndResultSetConcurrencyAndResultSetHoldability(connection);
             } else {
@@ -119,7 +119,7 @@ public final class AdditionalDQLIT extends BaseDQLIT {
     
     @Test
     public void assertExecuteWithResultSetTypeAndResultSetConcurrency() throws SQLException, ParseException {
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             if (SQLCaseType.Literal == getCaseType()) {
                 assertExecuteForStatementWithResultSetTypeAndResultSetConcurrency(connection);
             } else {
@@ -151,7 +151,7 @@ public final class AdditionalDQLIT extends BaseDQLIT {
     
     @Test
     public void assertExecuteWithResultSetTypeAndResultSetConcurrencyAndResultSetHoldability() throws SQLException, ParseException {
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             if (SQLCaseType.Literal == getCaseType()) {
                 assertExecuteForStatementWithResultSetTypeAndResultSetConcurrencyAndResultSetHoldability(connection);
             } else {
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/GeneralDQLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/GeneralDQLIT.java
index 2dfa1e0..8b4af03 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/GeneralDQLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/GeneralDQLIT.java
@@ -55,7 +55,7 @@ public final class GeneralDQLIT extends BaseDQLIT {
     
     @Test
     public void assertExecuteQuery() throws SQLException, ParseException {
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             if (SQLCaseType.Literal == getCaseType()) {
                 assertExecuteQueryForStatement(connection);
             } else {
@@ -88,7 +88,7 @@ public final class GeneralDQLIT extends BaseDQLIT {
     
     @Test
     public void assertExecute() throws SQLException, ParseException {
-        try (Connection connection = getDataSource().getConnection()) {
+        try (Connection connection = getTargetDataSource().getConnection()) {
             if (SQLCaseType.Literal == getCaseType()) {
                 assertExecuteForStatement(connection);
             } else {