You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/05/10 04:30:46 UTC

[shardingsphere] branch master updated: Move getDatabaseType by URL from DatabaseTypeRegistry to DatabaseTypeRecognizer (#17508)

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 d7d507c2e10 Move getDatabaseType by URL from DatabaseTypeRegistry to DatabaseTypeRecognizer (#17508)
d7d507c2e10 is described below

commit d7d507c2e10090d9768cc5d571b663e08395818c
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Tue May 10 12:30:38 2022 +0800

    Move getDatabaseType by URL from DatabaseTypeRegistry to DatabaseTypeRecognizer (#17508)
---
 .../infra/database/metadata/url/JdbcUrlAppender.java   |  4 ++--
 .../infra/database/type/DatabaseTypeRecognizer.java    | 18 ++++++++++++++++--
 .../infra/database/type/DatabaseTypeRegistry.java      | 14 --------------
 .../datasource/pool/creator/DataSourceReflection.java  |  4 ++--
 .../database/type/DatabaseTypeRecognizerTest.java      | 15 +++++++++++++++
 .../infra/database/type/DatabaseTypeRegistryTest.java  | 15 ---------------
 .../ShardingSpherePipelineDataSourceConfiguration.java |  6 +++---
 .../impl/StandardPipelineDataSourceConfiguration.java  |  4 ++--
 .../scenario/rulealtered/RuleAlteredJobWorker.java     |  4 ++--
 .../config/NarayanaConfigurationFileGenerator.java     |  4 ++--
 .../scenario/dataset/DataSetEnvironmentManager.java    |  6 +++---
 11 files changed, 47 insertions(+), 47 deletions(-)

diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/metadata/url/JdbcUrlAppender.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/metadata/url/JdbcUrlAppender.java
index c9e799c198e..27d18bc89cd 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/metadata/url/JdbcUrlAppender.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/metadata/url/JdbcUrlAppender.java
@@ -17,7 +17,7 @@
 
 package org.apache.shardingsphere.infra.database.metadata.url;
 
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
+import org.apache.shardingsphere.infra.database.type.DatabaseTypeRecognizer;
 
 import java.util.Map.Entry;
 import java.util.Properties;
@@ -35,7 +35,7 @@ public final class JdbcUrlAppender {
      * @return appended JDBC URL
      */
     public String appendQueryProperties(final String jdbcUrl, final Properties queryProps) {
-        Properties currentQueryProps = DatabaseTypeRegistry.getDatabaseTypeByURL(jdbcUrl).getDataSourceMetaData(jdbcUrl, null).getQueryProperties();
+        Properties currentQueryProps = DatabaseTypeRecognizer.getDatabaseType(jdbcUrl).getDataSourceMetaData(jdbcUrl, null).getQueryProperties();
         return hasConflictedQueryProperties(currentQueryProps, queryProps)
                 ? concat(jdbcUrl.substring(0, jdbcUrl.indexOf('?') + 1), getMergedProperties(currentQueryProps, queryProps))
                 : concat(jdbcUrl + (currentQueryProps.isEmpty() ? "?" : "&"), queryProps);
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeRecognizer.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeRecognizer.java
index 328c0f9af86..920afc2a412 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeRecognizer.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeRecognizer.java
@@ -38,6 +38,16 @@ import java.util.Optional;
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
 public final class DatabaseTypeRecognizer {
     
+    /**
+     * Get database type.
+     *
+     * @param url database URL
+     * @return database type
+     */
+    public static DatabaseType getDatabaseType(final String url) {
+        return DatabaseTypeFactory.newInstances().stream().filter(each -> matchURLs(url, each)).findAny().orElseGet(() -> DatabaseTypeFactory.newInstance("SQL92"));
+    }
+    
     /**
      * Get database type.
      * 
@@ -56,7 +66,7 @@ public final class DatabaseTypeRecognizer {
     
     private static DatabaseType getDatabaseType(final DataSource dataSource) {
         try (Connection connection = dataSource.getConnection()) {
-            return DatabaseTypeRegistry.getDatabaseTypeByURL(connection.getMetaData().getURL());
+            return getDatabaseType(connection.getMetaData().getURL());
         } catch (final SQLException ex) {
             throw new IllegalArgumentException(ex.getMessage(), ex);
         }
@@ -76,7 +86,7 @@ public final class DatabaseTypeRecognizer {
         }
         Collection<DataSource> dataSources = databaseConfigs.values().stream()
                 .filter(DatabaseTypeRecognizer::isComplete).findFirst().map(optional -> optional.getDataSources().values()).orElseGet(Collections::emptyList);
-        return DatabaseTypeRecognizer.getDatabaseType(dataSources);
+        return getDatabaseType(dataSources);
     }
     
     private static Optional<DatabaseType> findConfiguredDatabaseType(final ConfigurationProperties props) {
@@ -87,4 +97,8 @@ public final class DatabaseTypeRecognizer {
     private static boolean isComplete(final DatabaseConfiguration databaseConfig) {
         return !databaseConfig.getRuleConfigurations().isEmpty() && !databaseConfig.getDataSources().isEmpty();
     }
+    
+    private static boolean matchURLs(final String url, final DatabaseType databaseType) {
+        return databaseType.getJdbcUrlPrefixes().stream().anyMatch(url::startsWith);
+    }
 }
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeRegistry.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeRegistry.java
index df494952c97..6ce85fef7e0 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeRegistry.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeRegistry.java
@@ -62,20 +62,6 @@ public final class DatabaseTypeRegistry {
         return DatabaseTypeFactory.newInstance(name);
     }
     
-    /**
-     * Get database type by URL.
-     * 
-     * @param url database URL
-     * @return database type
-     */
-    public static DatabaseType getDatabaseTypeByURL(final String url) {
-        return DatabaseTypeFactory.newInstances().stream().filter(each -> matchURLs(url, each)).findAny().orElseGet(() -> DatabaseTypeFactory.newInstance("SQL92"));
-    }
-    
-    private static boolean matchURLs(final String url, final DatabaseType databaseType) {
-        return databaseType.getJdbcUrlPrefixes().stream().anyMatch(url::startsWith);
-    }
-    
     /**
      * Get default database type.
      * 
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourceReflection.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourceReflection.java
index 0860469b7cd..cf22e95039b 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourceReflection.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourceReflection.java
@@ -21,7 +21,7 @@ import com.google.common.base.CaseFormat;
 import com.google.common.collect.Sets;
 import lombok.SneakyThrows;
 import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
+import org.apache.shardingsphere.infra.database.type.DatabaseTypeRecognizer;
 import org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData;
 import org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaDataFactory;
 import org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaDataReflection;
@@ -165,7 +165,7 @@ public final class DataSourceReflection {
         if (null == jdbcUrl || null == jdbcConnectionProps) {
             return;
         }
-        DataSourceMetaData dataSourceMetaData = DatabaseTypeRegistry.getDatabaseTypeByURL(jdbcUrl).getDataSourceMetaData(jdbcUrl, null);
+        DataSourceMetaData dataSourceMetaData = DatabaseTypeRecognizer.getDatabaseType(jdbcUrl).getDataSourceMetaData(jdbcUrl, null);
         Properties queryProps = dataSourceMetaData.getQueryProperties();
         for (Entry<Object, Object> entry : dataSourceMetaData.getDefaultQueryProperties().entrySet()) {
             String defaultPropertyKey = entry.getKey().toString();
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeRecognizerTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeRecognizerTest.java
index b1fcb45144d..2a819a1c892 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeRecognizerTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeRecognizerTest.java
@@ -144,4 +144,19 @@ public final class DatabaseTypeRecognizerTest {
         when(connection.getMetaData().getURL()).thenReturn(url);
         return result;
     }
+    
+    @Test
+    public void assertGetDatabaseTypeByStandardURL() {
+        assertThat(DatabaseTypeRecognizer.getDatabaseType("jdbc:mysql://localhost:3306/test").getType(), is("MySQL"));
+    }
+    
+    @Test
+    public void assertGetDatabaseTypeByURLAlias() {
+        assertThat(DatabaseTypeRecognizer.getDatabaseType("jdbc:mysqlx://localhost:3306/test").getType(), is("MySQL"));
+    }
+    
+    @Test
+    public void assertGetDatabaseTypeSQL92() {
+        assertThat(DatabaseTypeRecognizer.getDatabaseType("jdbc:sqlite:test").getType(), is("SQL92"));
+    }
 }
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeRegistryTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeRegistryTest.java
index f8dfd36eebc..223f92c8766 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeRegistryTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeRegistryTest.java
@@ -57,21 +57,6 @@ public final class DatabaseTypeRegistryTest {
         assertThat(DatabaseTypeRegistry.getTrunkDatabaseType("H2").getType(), is("MySQL"));
     }
     
-    @Test
-    public void assertGetDatabaseTypeByStandardURL() {
-        assertThat(DatabaseTypeRegistry.getDatabaseTypeByURL("jdbc:mysql://localhost:3306/test").getType(), is("MySQL"));
-    }
-    
-    @Test
-    public void assertGetDatabaseTypeByURLAlias() {
-        assertThat(DatabaseTypeRegistry.getDatabaseTypeByURL("jdbc:mysqlx://localhost:3306/test").getType(), is("MySQL"));
-    }
-    
-    @Test
-    public void assertGetDatabaseTypeSQL92() {
-        assertThat(DatabaseTypeRegistry.getDatabaseTypeByURL("jdbc:sqlite:test").getType(), is("SQL92"));
-    }
-    
     @Test
     public void assertGetDefaultDatabaseType() {
         assertThat(DatabaseTypeRegistry.getDefaultDatabaseType().getType(), is("MySQL"));
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/ShardingSpherePipelineDataSourceConfiguration.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/ShardingSpherePipelineDataSourceConfiguration.java
index 7b2ce4cd5f9..32023660737 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/ShardingSpherePipelineDataSourceConfiguration.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/ShardingSpherePipelineDataSourceConfiguration.java
@@ -26,7 +26,7 @@ import lombok.Setter;
 import org.apache.shardingsphere.data.pipeline.api.datasource.config.PipelineDataSourceConfiguration;
 import org.apache.shardingsphere.infra.database.metadata.url.JdbcUrlAppender;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
+import org.apache.shardingsphere.infra.database.type.DatabaseTypeRecognizer;
 import org.apache.shardingsphere.infra.yaml.config.pojo.YamlConfiguration;
 import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration;
 import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration;
@@ -57,7 +57,7 @@ public final class ShardingSpherePipelineDataSourceConfiguration implements Pipe
         this.parameter = parameter;
         rootConfig = YamlEngine.unmarshal(parameter, YamlRootConfiguration.class, true);
         Map<String, Object> props = rootConfig.getDataSources().values().iterator().next();
-        databaseType = DatabaseTypeRegistry.getDatabaseTypeByURL(getJdbcUrl(props));
+        databaseType = DatabaseTypeRecognizer.getDatabaseType(getJdbcUrl(props));
     }
     
     public ShardingSpherePipelineDataSourceConfiguration(final YamlRootConfiguration rootConfig) {
@@ -65,7 +65,7 @@ public final class ShardingSpherePipelineDataSourceConfiguration implements Pipe
         this.parameter = YamlEngine.marshal(parameterConfig);
         this.rootConfig = rootConfig;
         Map<String, Object> props = rootConfig.getDataSources().values().iterator().next();
-        databaseType = DatabaseTypeRegistry.getDatabaseTypeByURL(getJdbcUrl(props));
+        databaseType = DatabaseTypeRecognizer.getDatabaseType(getJdbcUrl(props));
     }
     
     private String getJdbcUrl(final Map<String, Object> props) {
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/StandardPipelineDataSourceConfiguration.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/StandardPipelineDataSourceConfiguration.java
index 3c758759e86..af44c7bcfe7 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/StandardPipelineDataSourceConfiguration.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/StandardPipelineDataSourceConfiguration.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.data.pipeline.api.datasource.config.PipelineDat
 import org.apache.shardingsphere.data.pipeline.api.datasource.config.yaml.YamlJdbcConfiguration;
 import org.apache.shardingsphere.infra.database.metadata.url.JdbcUrlAppender;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
+import org.apache.shardingsphere.infra.database.type.DatabaseTypeRecognizer;
 import org.apache.shardingsphere.infra.datasource.pool.metadata.type.hikari.HikariDataSourcePoolFieldMetaData;
 import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
 import org.apache.shardingsphere.infra.yaml.config.swapper.YamlDataSourceConfigurationSwapper;
@@ -71,7 +71,7 @@ public final class StandardPipelineDataSourceConfiguration implements PipelineDa
         dataSourceProperties = new YamlDataSourceConfigurationSwapper().swapToDataSourceProperties(yamlConfig);
         yamlConfig.remove(DATA_SOURCE_CLASS_NAME);
         jdbcConfig = YamlEngine.unmarshal(YamlEngine.marshal(yamlConfig), YamlJdbcConfiguration.class, true);
-        databaseType = DatabaseTypeRegistry.getDatabaseTypeByURL(jdbcConfig.getJdbcUrl());
+        databaseType = DatabaseTypeRecognizer.getDatabaseType(jdbcConfig.getJdbcUrl());
     }
     
     public StandardPipelineDataSourceConfiguration(final String jdbcUrl, final String username, final String password) {
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/rulealtered/RuleAlteredJobWorker.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/rulealtered/RuleAlteredJobWorker.java
index 3f2b908dd05..f1dad84883e 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/rulealtered/RuleAlteredJobWorker.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/rulealtered/RuleAlteredJobWorker.java
@@ -42,7 +42,7 @@ import org.apache.shardingsphere.infra.config.RuleConfiguration;
 import org.apache.shardingsphere.infra.config.rulealtered.OnRuleAlteredActionConfiguration;
 import org.apache.shardingsphere.infra.database.metadata.url.JdbcUrlAppender;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
+import org.apache.shardingsphere.infra.database.type.DatabaseTypeRecognizer;
 import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
 import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
 import org.apache.shardingsphere.infra.lock.LockContext;
@@ -259,7 +259,7 @@ public final class RuleAlteredJobWorker {
             log.warn("disableSSLForMySQL, could not get jdbcUrl, jdbcUrlKey={}", jdbcUrlKey);
             return;
         }
-        DatabaseType databaseType = DatabaseTypeRegistry.getDatabaseTypeByURL(jdbcUrl);
+        DatabaseType databaseType = DatabaseTypeRecognizer.getDatabaseType(jdbcUrl);
         if (!(databaseType instanceof MySQLDatabaseType)) {
             return;
         }
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/config/NarayanaConfigurationFileGenerator.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-x [...]
index 6deba10ac2c..cfde17f7398 100644
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/config/NarayanaConfigurationFileGenerator.java
+++ b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/config/NarayanaConfigurationFileGenerator.java
@@ -27,7 +27,7 @@ import com.arjuna.ats.internal.jta.recovery.arjunacore.JTATransactionLogXAResour
 import com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule;
 import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
+import org.apache.shardingsphere.infra.database.type.DatabaseTypeRecognizer;
 import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
 import org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
 import org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
@@ -176,7 +176,7 @@ public final class NarayanaConfigurationFileGenerator implements TransactionConf
     }
     
     private String getDataSourceClassNameByJdbcUrl(final String jdbcUrl) {
-        DatabaseType type = DatabaseTypeRegistry.getDatabaseTypeByURL(jdbcUrl);
+        DatabaseType type = DatabaseTypeRecognizer.getDatabaseType(jdbcUrl);
         if (type instanceof MySQLDatabaseType || type instanceof OpenGaussDatabaseType || type instanceof PostgreSQLDatabaseType) {
             if (type.getDataSourceClassName().isPresent()) {
                 return type.getDataSourceClassName().get();
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/scenario/dataset/DataSetEnvironmentManager.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/scenario/dataset/DataSetEnvironmentManager.java
index 9a8d5e670ea..b9201878d8a 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/scenario/dataset/DataSetEnvironmentManager.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/scenario/dataset/DataSetEnvironmentManager.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.test.integration.env.scenario.dataset;
 import com.google.common.base.Joiner;
 import lombok.RequiredArgsConstructor;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
+import org.apache.shardingsphere.infra.database.type.DatabaseTypeRecognizer;
 import org.apache.shardingsphere.infra.datanode.DataNode;
 import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
 import org.apache.shardingsphere.infra.executor.kernel.thread.ExecutorServiceManager;
@@ -87,7 +87,7 @@ public final class DataSetEnvironmentManager {
             }
             String insertSQL;
             try (Connection connection = dataSourceMap.get(dataNode.getDataSourceName()).getConnection()) {
-                DatabaseType databaseType = DatabaseTypeRegistry.getDatabaseTypeByURL(connection.getMetaData().getURL());
+                DatabaseType databaseType = DatabaseTypeRecognizer.getDatabaseType(connection.getMetaData().getURL());
                 insertSQL = generateInsertSQL(databaseType.getQuoteCharacter().wrap(dataNode.getTableName()), dataSetMetaData.getColumns(), databaseType.getType());
             }
             fillDataTasks.add(new InsertTask(dataSourceMap.get(dataNode.getDataSourceName()), insertSQL, sqlValueGroups));
@@ -214,7 +214,7 @@ public final class DataSetEnvironmentManager {
         public Void call() throws SQLException {
             try (Connection connection = dataSource.getConnection()) {
                 for (String each : tableNames) {
-                    DatabaseType databaseType = DatabaseTypeRegistry.getDatabaseTypeByURL(connection.getMetaData().getURL());
+                    DatabaseType databaseType = DatabaseTypeRecognizer.getDatabaseType(connection.getMetaData().getURL());
                     try (PreparedStatement preparedStatement = connection.prepareStatement(String.format("DELETE FROM %s", databaseType.getQuoteCharacter().wrap(each)))) {
                         preparedStatement.execute();
                     }