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/09 20:35:41 UTC
[shardingsphere] branch master updated: Use ShardingSphereSPI for DatabaseTypeRegistry (#17499)
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 f8d1aab6fbf Use ShardingSphereSPI for DatabaseTypeRegistry (#17499)
f8d1aab6fbf is described below
commit f8d1aab6fbf1e76931675694af82eb37f515b445
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Tue May 10 04:35:25 2022 +0800
Use ShardingSphereSPI for DatabaseTypeRegistry (#17499)
---
.../generator/EncryptAlterTableTokenGenerator.java | 2 +-
.../metadata/EncryptSchemaMetaDataBuilderTest.java | 10 +++----
.../merge/dql/ShardingDQLResultMerger.java | 2 +-
.../ShardingSchemaMetaDataBuilderTest.java | 12 ++++----
...lterShardingTableRuleStatementPreprocessor.java | 1 -
.../infra/database/type/DatabaseType.java | 12 +++-----
.../infra/database/type/DatabaseTypeRegistry.java | 32 ++++++++++------------
.../database/type/dialect/H2DatabaseType.java | 12 ++++----
.../database/type/dialect/MariaDBDatabaseType.java | 12 ++++----
.../database/type/dialect/MySQLDatabaseType.java | 10 +++----
.../type/dialect/OpenGaussDatabaseType.java | 12 ++++----
.../database/type/dialect/OracleDatabaseType.java | 12 ++++----
.../type/dialect/PostgreSQLDatabaseType.java | 12 ++++----
.../database/type/dialect/SQL92DatabaseType.java | 10 +++----
.../type/dialect/SQLServerDatabaseType.java | 10 +++----
.../schema/builder/SystemSchemaBuilder.java | 4 +--
.../spi/DialectTableMetaDataLoaderFactory.java | 2 +-
.../metadata/schema/util/TableMetaDataUtil.java | 2 +-
.../database/type/DatabaseTypeRecognizerTest.java | 24 ++++++++--------
.../database/type/DatabaseTypeRegistryTest.java | 18 ++++++------
.../database/type/dialect/H2DatabaseTypeTest.java | 4 +--
.../type/dialect/MariaDBDatabaseTypeTest.java | 4 +--
.../type/dialect/MySQLDatabaseTypeTest.java | 2 +-
.../type/dialect/OracleDatabaseTypeTest.java | 2 +-
.../type/dialect/PostgreSQLDatabaseTypeTest.java | 2 +-
.../type/dialect/SQL92DatabaseTypeTest.java | 2 +-
.../type/dialect/SQLServerDatabaseTypeTest.java | 2 +-
.../builder/SystemSchemaBuilderRuleTest.java | 4 +--
.../type/DropSchemaStatementSchemaRefresher.java | 2 +-
.../DatabaseDatetimeServiceConfigurationTest.java | 2 +-
.../sane/JDBCSaneQueryResultEngineFactory.java | 2 +-
.../table/FilterableTableScanExecutor.java | 4 +--
.../dialect/OptimizerSQLDialectBuilderFactory.java | 2 +-
.../natived/builder/StoragePrivilegeBuilder.java | 2 +-
...llPermittedPrivilegesProviderAlgorithmTest.java | 2 +-
.../rulealtered/RuleAlteredJobConfiguration.java | 4 +--
.../DialectDDLSQLGeneratorFactory.java | 2 +-
...tandardPipelineDataSourceConfigurationTest.java | 2 +-
.../check/consistency/DataConsistencyChecker.java | 10 +++----
...RC32MatchDataConsistencyCalculateAlgorithm.java | 2 +-
.../pipeline/core/importer/AbstractImporter.java | 2 +-
.../ingest/dumper/AbstractInventoryDumper.java | 2 +-
.../metadata/generator/PipelineDDLGenerator.java | 2 +-
.../loader/PipelineTableMetaDataLoader.java | 2 +-
.../datasource/AbstractDataSourcePreparer.java | 2 +-
.../rulealtered/RuleAlteredJobPreparer.java | 2 +-
.../scaling/core/job/dumper/DumperFactory.java | 4 +--
.../scaling/core/job/importer/ImporterFactory.java | 2 +-
.../jta/connection/XAConnectionWrapperFactory.java | 2 +-
.../properties/XADataSourceDefinitionFactory.java | 2 +-
.../transaction/xa/fixture/DataSourceUtils.java | 4 +--
.../jdbc/statement/JDBCBackendStatement.java | 2 +-
.../header/query/QueryHeaderBuilderFactory.java | 2 +-
.../text/TextProtocolBackendHandlerFactory.java | 2 +-
.../admin/DatabaseAdminBackendHandlerFactory.java | 4 +--
.../ral/advanced/ParseDistSQLBackendHandler.java | 2 +-
.../rql/resource/DataSourceQueryResultSet.java | 2 +-
.../resource/UnusedDataSourceQueryResultSet.java | 2 +-
.../DatabaseProtocolFrontendEngineFactory.java | 2 +-
.../DatabaseProtocolFrontendEngineFixture.java | 2 +-
.../frontend/fixture/FixtureDatabaseType.java | 2 +-
.../FrontDatabaseProtocolTypeFactoryTest.java | 6 ++--
.../text/query/MySQLComQueryPacketExecutor.java | 2 +-
.../protocol/fixture/DummyDatabaseType.java | 2 +-
.../impl/OracleDDLStatementSQLVisitor.java | 2 +-
.../core/database/visitor/SQLVisitorRule.java | 2 +-
.../integration/env/DataSourceEnvironment.java | 12 ++++----
.../data/pipeline/cases/BaseITCase.java | 4 +--
.../pipeline/factory/DatabaseContainerFactory.java | 4 +--
.../database/DockerDatabaseContainer.java | 4 +--
.../proxy/ShardingSphereProxyDockerContainer.java | 2 +-
.../data/pipeline/util/DatabaseTypeUtil.java | 4 +--
.../integration/cases/dataset/DataSetLoader.java | 4 +--
.../test/integration/engine/ddl/BaseDDLIT.java | 4 +--
.../integration/engine/dml/AdditionalDMLIT.java | 8 +++---
.../dataset/DataSetEnvironmentManager.java | 2 +-
.../env/scenario/path/ScenarioDataPath.java | 2 +-
.../adapter/impl/ShardingSphereProxyContainer.java | 2 +-
.../atomic/storage/DockerStorageContainer.java | 2 +-
.../atomic/storage/StorageContainerFactory.java | 4 +--
.../compose/mode/ClusterComposedContainer.java | 2 +-
.../compose/mode/MemoryComposedContainer.java | 2 +-
.../database/DatabaseAssertionMetaDataFactory.java | 2 +-
.../param/model/AssertionParameterizedArray.java | 2 +-
.../param/model/CaseParameterizedArray.java | 2 +-
.../framework/param/model/ParameterizedArray.java | 2 +-
.../impl/ScenarioParallelRunnerExecutor.java | 2 +-
.../jaxb/cases/domain/SQLParserTestCases.java | 2 +-
88 files changed, 198 insertions(+), 207 deletions(-)
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGenerator.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGenerator.java
index 6472e5d2cf9..06e4e6799c8 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGenerator.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGenerator.java
@@ -67,7 +67,7 @@ public final class EncryptAlterTableTokenGenerator implements CollectionSQLToken
result.addAll(getModifyColumnTokens(tableName, alterTableStatementContext.getSqlStatement().getModifyColumnDefinitions()));
result.addAll(getChangeColumnTokens(tableName, alterTableStatementContext.getSqlStatement().getChangeColumnDefinitions()));
Collection<SQLToken> dropColumnTokens = getDropColumnTokens(tableName, alterTableStatementContext.getSqlStatement().getDropColumnDefinitions());
- String databaseName = alterTableStatementContext.getDatabaseType().getName();
+ String databaseName = alterTableStatementContext.getDatabaseType().getType();
if ("SQLServer".equals(databaseName)) {
result.addAll(mergeDropColumnStatement(dropColumnTokens, "", ""));
} else if ("Oracle".equals(databaseName)) {
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/metadata/EncryptSchemaMetaDataBuilderTest.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/metadata/EncryptSchemaMetaDataBuilderTest.java
index 5a6803c39ae..e35921ef4ca 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/metadata/EncryptSchemaMetaDataBuilderTest.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/metadata/EncryptSchemaMetaDataBuilderTest.java
@@ -188,7 +188,7 @@ public final class EncryptSchemaMetaDataBuilderTest {
private void loadByH2(final EncryptSchemaMetaDataBuilder loader, final Collection<String> tableNames, final Collection<ShardingSphereRule> rules,
final EncryptRule encryptRule) throws SQLException {
- when(databaseType.getName()).thenReturn("H2");
+ when(databaseType.getType()).thenReturn("H2");
Map<String, SchemaMetaData> actual = loader.load(tableNames, encryptRule,
new SchemaBuilderMaterials(databaseType, Collections.singletonMap("logic_db", dataSource), rules, props, "logic_db"));
assertResult(actual, "logic_db");
@@ -203,7 +203,7 @@ public final class EncryptSchemaMetaDataBuilderTest {
private void loadByMySQL(final EncryptSchemaMetaDataBuilder loader, final Collection<String> tableNames, final Collection<ShardingSphereRule> rules,
final EncryptRule encryptRule) throws SQLException {
- when(databaseType.getName()).thenReturn("MySQL");
+ when(databaseType.getType()).thenReturn("MySQL");
Map<String, SchemaMetaData> actual = loader.load(tableNames, encryptRule,
new SchemaBuilderMaterials(databaseType, Collections.singletonMap("logic_db", dataSource), rules, props, "logic_db"));
assertResult(actual, "logic_db");
@@ -218,7 +218,7 @@ public final class EncryptSchemaMetaDataBuilderTest {
private void loadByOracle(final EncryptSchemaMetaDataBuilder loader, final Collection<String> tableNames, final Collection<ShardingSphereRule> rules,
final EncryptRule encryptRule) throws SQLException {
- when(databaseType.getName()).thenReturn("Oracle");
+ when(databaseType.getType()).thenReturn("Oracle");
Map<String, SchemaMetaData> actual = loader.load(tableNames, encryptRule,
new SchemaBuilderMaterials(databaseType, Collections.singletonMap("logic_db", dataSource), rules, props, "logic_db"));
assertResult(actual, "logic_db");
@@ -233,7 +233,7 @@ public final class EncryptSchemaMetaDataBuilderTest {
private void loadByPostgreSQL(final EncryptSchemaMetaDataBuilder loader, final Collection<String> tableNames, final Collection<ShardingSphereRule> rules,
final EncryptRule encryptRule) throws SQLException {
- when(databaseType.getName()).thenReturn("PostgreSQL");
+ when(databaseType.getType()).thenReturn("PostgreSQL");
ResultSet roleTableGrantsResultSet = mockRoleTableGrantsResultSet();
when(dataSource.getConnection().prepareStatement(startsWith("SELECT table_name FROM information_schema.role_table_grants")).executeQuery()).thenReturn(roleTableGrantsResultSet);
ResultSet schemaMetaData = mockSchemaMetaData();
@@ -266,7 +266,7 @@ public final class EncryptSchemaMetaDataBuilderTest {
private void loadBySQLServer(final EncryptSchemaMetaDataBuilder loader, final Collection<String> tableNames, final Collection<ShardingSphereRule> rules,
final EncryptRule encryptRule) throws SQLException {
- when(databaseType.getName()).thenReturn("SQLServer");
+ when(databaseType.getType()).thenReturn("SQLServer");
Map<String, SchemaMetaData> actual = loader.load(tableNames, encryptRule,
new SchemaBuilderMaterials(databaseType, Collections.singletonMap("logic_db", dataSource), rules, props, "logic_db"));
assertResult(actual, "logic_db");
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMerger.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMerger.java
index d21dca3be3c..44d8ff0de12 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMerger.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMerger.java
@@ -126,7 +126,7 @@ public final class ShardingDQLResultMerger implements ResultMerger {
if (!paginationContext.isHasPagination() || 1 == queryResults.size()) {
return mergedResult;
}
- String trunkDatabaseName = DatabaseTypeRegistry.getTrunkDatabaseType(databaseType.getName()).getName();
+ String trunkDatabaseName = DatabaseTypeRegistry.getTrunkDatabaseType(databaseType.getType()).getType();
if ("MySQL".equals(trunkDatabaseName) || "PostgreSQL".equals(trunkDatabaseName) || "openGauss".equals(trunkDatabaseName)) {
return new LimitDecoratorMergedResult(mergedResult, paginationContext);
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/metadata/ShardingSchemaMetaDataBuilderTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/metadata/ShardingSchemaMetaDataBuilderTest.java
index 44b53cf71d5..609ce261677 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/metadata/ShardingSchemaMetaDataBuilderTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/metadata/ShardingSchemaMetaDataBuilderTest.java
@@ -245,7 +245,7 @@ public class ShardingSchemaMetaDataBuilderTest {
@Test
public void assertLoadTablesH2() throws SQLException {
when(props.getValue(ConfigurationPropertyKey.CHECK_TABLE_METADATA_ENABLED)).thenReturn(false);
- when(databaseType.getName()).thenReturn("H2");
+ when(databaseType.getType()).thenReturn("H2");
Collection<String> tableNames = new LinkedList<>();
tableNames.add(TABLE_NAME);
Collection<ShardingSphereRule> rules = Collections.singletonList(shardingRule);
@@ -257,7 +257,7 @@ public class ShardingSchemaMetaDataBuilderTest {
@Test
public void assertLoadTablesMySQL() throws SQLException {
when(props.getValue(ConfigurationPropertyKey.CHECK_TABLE_METADATA_ENABLED)).thenReturn(false);
- when(databaseType.getName()).thenReturn("MySQL");
+ when(databaseType.getType()).thenReturn("MySQL");
Collection<String> tableNames = new LinkedList<>();
tableNames.add(TABLE_NAME);
Collection<ShardingSphereRule> rules = Collections.singletonList(shardingRule);
@@ -273,7 +273,7 @@ public class ShardingSchemaMetaDataBuilderTest {
ShardingSchemaMetaDataBuilder loader = (ShardingSchemaMetaDataBuilder) RuleBasedSchemaMetaDataBuilderFactory.newInstance(rules).get(shardingRule);
when(props.getValue(ConfigurationPropertyKey.CHECK_TABLE_METADATA_ENABLED)).thenReturn(false);
DatabaseType databaseType = mock(OracleDatabaseType.class);
- when(databaseType.getName()).thenReturn("Oracle");
+ when(databaseType.getType()).thenReturn("Oracle");
Map<String, SchemaMetaData> actual = loader.load(Collections.singletonList(TABLE_NAME),
shardingRule, new SchemaBuilderMaterials(databaseType, Collections.singletonMap("ds", dataSource), rules, props, "sharding_db"));
assertThat(actual.get("sharding_db").getTables().keySet().iterator().next(), is("T_ORDER_0"));
@@ -295,7 +295,7 @@ public class ShardingSchemaMetaDataBuilderTest {
@Test
public void assertLoadTablesPGSQL() throws SQLException {
when(props.getValue(ConfigurationPropertyKey.CHECK_TABLE_METADATA_ENABLED)).thenReturn(false);
- when(databaseType.getName()).thenReturn("PostgreSQL");
+ when(databaseType.getType()).thenReturn("PostgreSQL");
Collection<String> tableNames = new LinkedList<>();
tableNames.add(TABLE_NAME);
Collection<ShardingSphereRule> rules = Collections.singletonList(shardingRule);
@@ -325,7 +325,7 @@ public class ShardingSchemaMetaDataBuilderTest {
@Test
public void assertLoadTablesSQLServer() throws SQLException {
when(props.getValue(ConfigurationPropertyKey.CHECK_TABLE_METADATA_ENABLED)).thenReturn(false);
- when(databaseType.getName()).thenReturn("SQLServer");
+ when(databaseType.getType()).thenReturn("SQLServer");
Collection<String> tableNames = new LinkedList<>();
tableNames.add(TABLE_NAME);
Collection<ShardingSphereRule> rules = Collections.singletonList(shardingRule);
@@ -347,7 +347,7 @@ public class ShardingSchemaMetaDataBuilderTest {
@Test
public void assertLoadTablesDefault() throws SQLException {
when(props.getValue(ConfigurationPropertyKey.CHECK_TABLE_METADATA_ENABLED)).thenReturn(false);
- when(databaseType.getName()).thenReturn("default");
+ when(databaseType.getType()).thenReturn("default");
when(databaseType.formatTableNamePattern("t_order_0")).thenReturn("t_order_0");
Collection<String> tableNames = new LinkedList<>();
tableNames.add(TABLE_NAME);
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/preprocess/AlterShardingTableRuleStatementPreprocessor.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/preprocess/AlterShardingTableRuleStatementPrepro [...]
index d9126963773..04f4426addb 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/preprocess/AlterShardingTableRuleStatementPreprocessor.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/preprocess/AlterShardingTableRuleStatementPreprocessor.java
@@ -26,7 +26,6 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.LinkedHashMap;
-
/**
* Alter sharding table rule statement preprocessor.
*/
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/DatabaseType.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/DatabaseType.java
index 05c202a4c55..09149392f74 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/DatabaseType.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/DatabaseType.java
@@ -18,6 +18,8 @@
package org.apache.shardingsphere.infra.database.type;
import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
+import org.apache.shardingsphere.spi.annotation.SingletonSPI;
+import org.apache.shardingsphere.spi.type.typed.TypedSPI;
import org.apache.shardingsphere.sql.parser.sql.common.constant.QuoteCharacter;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
@@ -30,14 +32,8 @@ import java.util.Optional;
/**
* Database type.
*/
-public interface DatabaseType {
-
- /**
- * Get database name.
- *
- * @return database name
- */
- String getName();
+@SingletonSPI
+public interface DatabaseType extends TypedSPI {
/**
* Get quote character.
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 664b34d3e09..447dd6e016d 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
@@ -19,14 +19,12 @@ package org.apache.shardingsphere.infra.database.type;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.exception.ShardingSphereException;
+import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
+import org.apache.shardingsphere.spi.type.typed.TypedSPI;
+import org.apache.shardingsphere.spi.type.typed.TypedSPIRegistry;
import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-import java.util.ServiceLoader;
+import java.util.stream.Collectors;
/**
* Database type registry.
@@ -34,14 +32,10 @@ import java.util.ServiceLoader;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class DatabaseTypeRegistry {
- private static final Map<String, DatabaseType> DATABASE_TYPES = new HashMap<>();
-
private static final String DEFAULT_DATABASE_TYPE = "MySQL";
static {
- for (DatabaseType each : ServiceLoader.load(DatabaseType.class)) {
- DATABASE_TYPES.put(each.getName(), each);
- }
+ ShardingSphereServiceLoader.register(DatabaseType.class);
}
/**
@@ -51,7 +45,7 @@ public final class DatabaseTypeRegistry {
* @return name of trunk database type
*/
public static String getTrunkDatabaseTypeName(final DatabaseType databaseType) {
- return databaseType instanceof BranchDatabaseType ? ((BranchDatabaseType) databaseType).getTrunkDatabaseType().getName() : databaseType.getName();
+ return databaseType instanceof BranchDatabaseType ? ((BranchDatabaseType) databaseType).getTrunkDatabaseType().getType() : databaseType.getType();
}
/**
@@ -61,7 +55,8 @@ public final class DatabaseTypeRegistry {
* @return trunk database type
*/
public static DatabaseType getTrunkDatabaseType(final String name) {
- return DATABASE_TYPES.get(name) instanceof BranchDatabaseType ? ((BranchDatabaseType) DATABASE_TYPES.get(name)).getTrunkDatabaseType() : getActualDatabaseType(name);
+ DatabaseType databaseType = TypedSPIRegistry.getRegisteredService(DatabaseType.class, name);
+ return databaseType instanceof BranchDatabaseType ? ((BranchDatabaseType) databaseType).getTrunkDatabaseType() : getActualDatabaseType(name);
}
/**
@@ -71,7 +66,7 @@ public final class DatabaseTypeRegistry {
* @return actual database type
*/
public static DatabaseType getActualDatabaseType(final String name) {
- return Optional.ofNullable(DATABASE_TYPES.get(name)).orElseThrow(() -> new ShardingSphereException("Unsupported database:'%s'", name));
+ return TypedSPIRegistry.getRegisteredService(DatabaseType.class, name);
}
/**
@@ -81,7 +76,8 @@ public final class DatabaseTypeRegistry {
* @return database type
*/
public static DatabaseType getDatabaseTypeByURL(final String url) {
- return DATABASE_TYPES.values().stream().filter(each -> matchURLs(url, each)).findAny().orElseGet(() -> DATABASE_TYPES.get("SQL92"));
+ Collection<DatabaseType> databaseType = ShardingSphereServiceLoader.getServiceInstances(DatabaseType.class);
+ return databaseType.stream().filter(each -> matchURLs(url, each)).findAny().orElseGet(() -> TypedSPIRegistry.getRegisteredService(DatabaseType.class, "SQL92"));
}
private static boolean matchURLs(final String url, final DatabaseType databaseType) {
@@ -94,15 +90,15 @@ public final class DatabaseTypeRegistry {
* @return default database type
*/
public static DatabaseType getDefaultDatabaseType() {
- return DATABASE_TYPES.get(DEFAULT_DATABASE_TYPE);
+ return TypedSPIRegistry.getRegisteredService(DatabaseType.class, DEFAULT_DATABASE_TYPE);
}
/**
- * Get names of all database types.
+ * Get all database type names.
*
* @return database type names
*/
public static Collection<String> getDatabaseTypeNames() {
- return Collections.unmodifiableSet(DATABASE_TYPES.keySet());
+ return ShardingSphereServiceLoader.getServiceInstances(DatabaseType.class).stream().map(TypedSPI::getType).collect(Collectors.toList());
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/H2DatabaseType.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/H2DatabaseType.java
index ec7a10c3222..109148ce3ba 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/H2DatabaseType.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/H2DatabaseType.java
@@ -33,11 +33,6 @@ import java.util.Optional;
*/
public final class H2DatabaseType implements BranchDatabaseType {
- @Override
- public String getName() {
- return "H2";
- }
-
@Override
public QuoteCharacter getQuoteCharacter() {
return QuoteCharacter.QUOTE;
@@ -45,7 +40,7 @@ public final class H2DatabaseType implements BranchDatabaseType {
@Override
public Collection<String> getJdbcUrlPrefixes() {
- return Collections.singleton(String.format("jdbc:%s:", getName().toLowerCase()));
+ return Collections.singleton(String.format("jdbc:%s:", getType().toLowerCase()));
}
@Override
@@ -72,4 +67,9 @@ public final class H2DatabaseType implements BranchDatabaseType {
public Collection<String> getSystemSchemas() {
return Collections.emptyList();
}
+
+ @Override
+ public String getType() {
+ return "H2";
+ }
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/MariaDBDatabaseType.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/MariaDBDatabaseType.java
index 89606d38de1..418f4e2ba06 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/MariaDBDatabaseType.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/MariaDBDatabaseType.java
@@ -33,11 +33,6 @@ import java.util.Optional;
*/
public final class MariaDBDatabaseType implements BranchDatabaseType {
- @Override
- public String getName() {
- return "MariaDB";
- }
-
@Override
public QuoteCharacter getQuoteCharacter() {
return QuoteCharacter.BACK_QUOTE;
@@ -45,7 +40,7 @@ public final class MariaDBDatabaseType implements BranchDatabaseType {
@Override
public Collection<String> getJdbcUrlPrefixes() {
- return Collections.singleton(String.format("jdbc:%s:", getName().toLowerCase()));
+ return Collections.singleton(String.format("jdbc:%s:", getType().toLowerCase()));
}
@Override
@@ -72,4 +67,9 @@ public final class MariaDBDatabaseType implements BranchDatabaseType {
public Collection<String> getSystemSchemas() {
return Collections.emptyList();
}
+
+ @Override
+ public String getType() {
+ return "MariaDB";
+ }
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/MySQLDatabaseType.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/MySQLDatabaseType.java
index cb37ad90e7c..adef4091c95 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/MySQLDatabaseType.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/MySQLDatabaseType.java
@@ -42,11 +42,6 @@ public final class MySQLDatabaseType implements DatabaseType {
SYSTEM_DATABASE_SCHEMA_MAP.put("sys", Collections.singletonList("sys"));
}
- @Override
- public String getName() {
- return "MySQL";
- }
-
@Override
public QuoteCharacter getQuoteCharacter() {
return QuoteCharacter.BACK_QUOTE;
@@ -76,4 +71,9 @@ public final class MySQLDatabaseType implements DatabaseType {
public Collection<String> getSystemSchemas() {
return SYSTEM_DATABASE_SCHEMA_MAP.keySet();
}
+
+ @Override
+ public String getType() {
+ return "MySQL";
+ }
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/OpenGaussDatabaseType.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/OpenGaussDatabaseType.java
index 7f3800e7cbe..95dad5cceee 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/OpenGaussDatabaseType.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/OpenGaussDatabaseType.java
@@ -47,11 +47,6 @@ public final class OpenGaussDatabaseType implements DatabaseType {
SYSTEM_DATABASE_SCHEMA_MAP.put("postgres", SYSTEM_SCHEMAS);
}
- @Override
- public String getName() {
- return "openGauss";
- }
-
@Override
public QuoteCharacter getQuoteCharacter() {
return QuoteCharacter.QUOTE;
@@ -59,7 +54,7 @@ public final class OpenGaussDatabaseType implements DatabaseType {
@Override
public Collection<String> getJdbcUrlPrefixes() {
- return Collections.singleton(String.format("jdbc:%s:", getName().toLowerCase()));
+ return Collections.singleton(String.format("jdbc:%s:", getType().toLowerCase()));
}
@Override
@@ -98,4 +93,9 @@ public final class OpenGaussDatabaseType implements DatabaseType {
public String getDefaultSchema(final String databaseName) {
return "public";
}
+
+ @Override
+ public String getType() {
+ return "openGauss";
+ }
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/OracleDatabaseType.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/OracleDatabaseType.java
index 9c49431e25d..a17525925ba 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/OracleDatabaseType.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/OracleDatabaseType.java
@@ -33,11 +33,6 @@ import java.util.Optional;
*/
public final class OracleDatabaseType implements DatabaseType {
- @Override
- public String getName() {
- return "Oracle";
- }
-
@Override
public QuoteCharacter getQuoteCharacter() {
return QuoteCharacter.QUOTE;
@@ -45,7 +40,7 @@ public final class OracleDatabaseType implements DatabaseType {
@Override
public Collection<String> getJdbcUrlPrefixes() {
- return Collections.singleton(String.format("jdbc:%s:", getName().toLowerCase()));
+ return Collections.singleton(String.format("jdbc:%s:", getType().toLowerCase()));
}
@Override
@@ -82,4 +77,9 @@ public final class OracleDatabaseType implements DatabaseType {
public Collection<String> getSystemSchemas() {
return Collections.emptyList();
}
+
+ @Override
+ public String getType() {
+ return "Oracle";
+ }
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/PostgreSQLDatabaseType.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/PostgreSQLDatabaseType.java
index 28581e47480..b06ba0be0a6 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/PostgreSQLDatabaseType.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/PostgreSQLDatabaseType.java
@@ -46,11 +46,6 @@ public final class PostgreSQLDatabaseType implements DatabaseType {
SYSTEM_DATABASE_SCHEMA_MAP.put("postgres", SYSTEM_SCHEMAS);
}
- @Override
- public String getName() {
- return "PostgreSQL";
- }
-
@Override
public QuoteCharacter getQuoteCharacter() {
return QuoteCharacter.QUOTE;
@@ -58,7 +53,7 @@ public final class PostgreSQLDatabaseType implements DatabaseType {
@Override
public Collection<String> getJdbcUrlPrefixes() {
- return Collections.singleton(String.format("jdbc:%s:", getName().toLowerCase()));
+ return Collections.singleton(String.format("jdbc:%s:", getType().toLowerCase()));
}
@Override
@@ -97,4 +92,9 @@ public final class PostgreSQLDatabaseType implements DatabaseType {
public String getDefaultSchema(final String databaseName) {
return "public";
}
+
+ @Override
+ public String getType() {
+ return "PostgreSQL";
+ }
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/SQL92DatabaseType.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/SQL92DatabaseType.java
index 4ebeaf7eab1..a1f32ffffc0 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/SQL92DatabaseType.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/SQL92DatabaseType.java
@@ -31,11 +31,6 @@ import java.util.Optional;
*/
public final class SQL92DatabaseType implements DatabaseType {
- @Override
- public String getName() {
- return "SQL92";
- }
-
@Override
public QuoteCharacter getQuoteCharacter() {
return QuoteCharacter.QUOTE;
@@ -65,4 +60,9 @@ public final class SQL92DatabaseType implements DatabaseType {
public Collection<String> getSystemSchemas() {
return Collections.emptyList();
}
+
+ @Override
+ public String getType() {
+ return "SQL92";
+ }
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/SQLServerDatabaseType.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/SQLServerDatabaseType.java
index cc68576d13c..b66cb58fa51 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/SQLServerDatabaseType.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/SQLServerDatabaseType.java
@@ -32,11 +32,6 @@ import java.util.Optional;
*/
public final class SQLServerDatabaseType implements DatabaseType {
- @Override
- public String getName() {
- return "SQLServer";
- }
-
@Override
public QuoteCharacter getQuoteCharacter() {
return QuoteCharacter.BRACKETS;
@@ -66,4 +61,9 @@ public final class SQLServerDatabaseType implements DatabaseType {
public Collection<String> getSystemSchemas() {
return Collections.emptyList();
}
+
+ @Override
+ public String getType() {
+ return "SQLServer";
+ }
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilder.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilder.java
index 3a1708f7ff4..5cdfd50a39b 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilder.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilder.java
@@ -64,10 +64,10 @@ public final class SystemSchemaBuilder {
}
private static Collection<InputStream> getSchemaStreams(final String schemaName, final DatabaseType databaseType) {
- SystemSchemaBuilderRule builderRule = SystemSchemaBuilderRule.valueOf(databaseType.getName(), schemaName);
+ SystemSchemaBuilderRule builderRule = SystemSchemaBuilderRule.valueOf(databaseType.getType(), schemaName);
Collection<InputStream> result = new LinkedList<>();
for (String each : builderRule.getTables()) {
- result.add(SystemSchemaBuilder.class.getClassLoader().getResourceAsStream("schema/" + databaseType.getName().toLowerCase() + "/" + schemaName + "/" + each + ".yaml"));
+ result.add(SystemSchemaBuilder.class.getClassLoader().getResourceAsStream("schema/" + databaseType.getType().toLowerCase() + "/" + schemaName + "/" + each + ".yaml"));
}
return result;
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/loader/spi/DialectTableMetaDataLoaderFactory.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/loader/spi/DialectTableMetaDataLoaderFactory.java
index f6d5d1cf0a0..53d87d47d17 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/loader/spi/DialectTableMetaDataLoaderFactory.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/loader/spi/DialectTableMetaDataLoaderFactory.java
@@ -42,6 +42,6 @@ public final class DialectTableMetaDataLoaderFactory {
* @return new instance of dialect table meta data loader
*/
public static Optional<DialectSchemaMetaDataLoader> newInstance(final DatabaseType databaseType) {
- return TypedSPIRegistry.findRegisteredService(DialectSchemaMetaDataLoader.class, databaseType.getName());
+ return TypedSPIRegistry.findRegisteredService(DialectSchemaMetaDataLoader.class, databaseType.getType());
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/util/TableMetaDataUtil.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/util/TableMetaDataUtil.java
index 895d5a98aa1..9d1fc9f12c5 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/util/TableMetaDataUtil.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/util/TableMetaDataUtil.java
@@ -66,7 +66,7 @@ public class TableMetaDataUtil {
private static void checkDataSourceTypeIncludeInstanceAndSetDatabaseTableMap(final DatabaseType databaseType, final DataNodes dataNodes, final String tableName) {
for (DataNode dataNode : dataNodes.getDataNodes(tableName)) {
- if (databaseType.getName() != null && !databaseType.getName().equals("MySQL") && dataNode.getDataSourceName().contains(".")) {
+ if (databaseType.getType() != null && !databaseType.getType().equals("MySQL") && dataNode.getDataSourceName().contains(".")) {
throw new ShardingSphereException("Unsupported jdbc: '%s', actualDataNode:'%s', database type is not mysql, but actual data is three-tier structure",
databaseType.getJdbcUrlPrefixes(), dataNode.getDataSourceName());
}
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 7d6543ea873..b1fcb45144d 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
@@ -38,54 +38,54 @@ public final class DatabaseTypeRecognizerTest {
public void assertGetH2DatabaseType() throws SQLException {
DataSource datasource = mockDataSource(DatabaseTypeRegistry.getActualDatabaseType("H2"));
Collection<DataSource> dataSources = Collections.singleton(datasource);
- assertThat(DatabaseTypeRecognizer.getDatabaseType(dataSources).getName(), is("H2"));
+ assertThat(DatabaseTypeRecognizer.getDatabaseType(dataSources).getType(), is("H2"));
}
@Test
public void assertGetMariaDBDatabaseType() throws SQLException {
DataSource datasource = mockDataSource(DatabaseTypeRegistry.getActualDatabaseType("MariaDB"));
Collection<DataSource> dataSources = Collections.singleton(datasource);
- assertThat(DatabaseTypeRecognizer.getDatabaseType(dataSources).getName(), is("MariaDB"));
+ assertThat(DatabaseTypeRecognizer.getDatabaseType(dataSources).getType(), is("MariaDB"));
}
@Test
public void assertGetMySQLDatabaseType() throws SQLException {
DataSource datasource = mockDataSource(DatabaseTypeRegistry.getActualDatabaseType("MySQL"));
Collection<DataSource> dataSources = Collections.singleton(datasource);
- assertThat(DatabaseTypeRecognizer.getDatabaseType(dataSources).getName(), is("MySQL"));
+ assertThat(DatabaseTypeRecognizer.getDatabaseType(dataSources).getType(), is("MySQL"));
}
@Test
public void assertGetOracleDatabaseType() throws SQLException {
DataSource datasource = mockDataSource(DatabaseTypeRegistry.getActualDatabaseType("Oracle"));
Collection<DataSource> dataSources = Collections.singleton(datasource);
- assertThat(DatabaseTypeRecognizer.getDatabaseType(dataSources).getName(), is("Oracle"));
+ assertThat(DatabaseTypeRecognizer.getDatabaseType(dataSources).getType(), is("Oracle"));
}
@Test
public void assertGetPostgreSQLDatabaseType() throws SQLException {
DataSource datasource = mockDataSource(DatabaseTypeRegistry.getActualDatabaseType("PostgreSQL"));
Collection<DataSource> dataSources = Collections.singleton(datasource);
- assertThat(DatabaseTypeRecognizer.getDatabaseType(dataSources).getName(), is("PostgreSQL"));
+ assertThat(DatabaseTypeRecognizer.getDatabaseType(dataSources).getType(), is("PostgreSQL"));
}
@Test
public void assertGetSQL92DatabaseType() throws SQLException {
DataSource datasource = mockDataSource(DatabaseTypeRegistry.getActualDatabaseType("SQL92"));
Collection<DataSource> dataSources = Collections.singleton(datasource);
- assertThat(DatabaseTypeRecognizer.getDatabaseType(dataSources).getName(), is("SQL92"));
+ assertThat(DatabaseTypeRecognizer.getDatabaseType(dataSources).getType(), is("SQL92"));
}
@Test
public void assertGetSQLServerDatabaseType() throws SQLException {
DataSource datasource = mockDataSource(DatabaseTypeRegistry.getActualDatabaseType("SQLServer"));
Collection<DataSource> dataSources = Collections.singleton(datasource);
- assertThat(DatabaseTypeRecognizer.getDatabaseType(dataSources).getName(), is("SQLServer"));
+ assertThat(DatabaseTypeRecognizer.getDatabaseType(dataSources).getType(), is("SQLServer"));
}
@Test
public void assertGetDefaultDatabaseType() {
- assertThat(DatabaseTypeRecognizer.getDatabaseType(Collections.emptyList()).getName(), is("MySQL"));
+ assertThat(DatabaseTypeRecognizer.getDatabaseType(Collections.emptyList()).getType(), is("MySQL"));
}
@Test
@@ -93,7 +93,7 @@ public final class DatabaseTypeRecognizerTest {
DataSource datasource1 = mockDataSource(DatabaseTypeRegistry.getActualDatabaseType("MySQL"));
DataSource datasource2 = mockDataSource(DatabaseTypeRegistry.getActualDatabaseType("MySQL"));
Collection<DataSource> sameDataSources = Arrays.asList(datasource1, datasource2);
- assertThat(DatabaseTypeRecognizer.getDatabaseType(sameDataSources).getName(), is("MySQL"));
+ assertThat(DatabaseTypeRecognizer.getDatabaseType(sameDataSources).getType(), is("MySQL"));
}
@Test(expected = IllegalStateException.class)
@@ -108,7 +108,7 @@ public final class DatabaseTypeRecognizerTest {
public void assertCantGetConnectionFromDataSource() throws SQLException {
DataSource mockDataSource = mock(DataSource.class);
when(mockDataSource.getConnection()).thenThrow(SQLException.class);
- DatabaseTypeRecognizer.getDatabaseType(Arrays.asList(mockDataSource));
+ DatabaseTypeRecognizer.getDatabaseType(Collections.singletonList(mockDataSource));
}
private DataSource mockDataSource(final DatabaseType databaseType) throws SQLException {
@@ -116,7 +116,7 @@ public final class DatabaseTypeRecognizerTest {
Connection connection = mock(Connection.class, RETURNS_DEEP_STUBS);
when(result.getConnection()).thenReturn(connection);
String url;
- switch (databaseType.getName()) {
+ switch (databaseType.getType()) {
case "H2":
url = "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL";
break;
@@ -139,7 +139,7 @@ public final class DatabaseTypeRecognizerTest {
url = "jdbc:microsoft:sqlserver://127.0.0.1;DatabaseName=test";
break;
default:
- throw new IllegalStateException("Unexpected value: " + databaseType.getName());
+ throw new IllegalStateException("Unexpected value: " + databaseType.getType());
}
when(connection.getMetaData().getURL()).thenReturn(url);
return result;
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 54bfb082e2f..f8dfd36eebc 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
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.infra.database.type;
import org.apache.shardingsphere.infra.database.type.dialect.MariaDBDatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
-import org.apache.shardingsphere.infra.exception.ShardingSphereException;
+import org.apache.shardingsphere.spi.exception.ServiceProviderNotFoundException;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
@@ -39,41 +39,41 @@ public final class DatabaseTypeRegistryTest {
@Test
public void assertGetActualDatabaseType() {
- assertThat(DatabaseTypeRegistry.getActualDatabaseType("MySQL").getName(), is("MySQL"));
+ assertThat(DatabaseTypeRegistry.getActualDatabaseType("MySQL").getType(), is("MySQL"));
}
- @Test(expected = ShardingSphereException.class)
+ @Test(expected = ServiceProviderNotFoundException.class)
public void assertGetActualDatabaseTypeWithNotExistedDatabaseType() {
DatabaseTypeRegistry.getActualDatabaseType("Invalid");
}
@Test
public void assertGetTrunkDatabaseTypeWithTrunkDatabaseType() {
- assertThat(DatabaseTypeRegistry.getTrunkDatabaseType("MySQL").getName(), is("MySQL"));
+ assertThat(DatabaseTypeRegistry.getTrunkDatabaseType("MySQL").getType(), is("MySQL"));
}
@Test
public void assertGetTrunkDatabaseTypeWithBranchDatabaseType() {
- assertThat(DatabaseTypeRegistry.getTrunkDatabaseType("H2").getName(), is("MySQL"));
+ assertThat(DatabaseTypeRegistry.getTrunkDatabaseType("H2").getType(), is("MySQL"));
}
@Test
public void assertGetDatabaseTypeByStandardURL() {
- assertThat(DatabaseTypeRegistry.getDatabaseTypeByURL("jdbc:mysql://localhost:3306/test").getName(), is("MySQL"));
+ assertThat(DatabaseTypeRegistry.getDatabaseTypeByURL("jdbc:mysql://localhost:3306/test").getType(), is("MySQL"));
}
@Test
public void assertGetDatabaseTypeByURLAlias() {
- assertThat(DatabaseTypeRegistry.getDatabaseTypeByURL("jdbc:mysqlx://localhost:3306/test").getName(), is("MySQL"));
+ assertThat(DatabaseTypeRegistry.getDatabaseTypeByURL("jdbc:mysqlx://localhost:3306/test").getType(), is("MySQL"));
}
@Test
public void assertGetDatabaseTypeSQL92() {
- assertThat(DatabaseTypeRegistry.getDatabaseTypeByURL("jdbc:sqlite:test").getName(), is("SQL92"));
+ assertThat(DatabaseTypeRegistry.getDatabaseTypeByURL("jdbc:sqlite:test").getType(), is("SQL92"));
}
@Test
public void assertGetDefaultDatabaseType() {
- assertThat(DatabaseTypeRegistry.getDefaultDatabaseType().getName(), is("MySQL"));
+ assertThat(DatabaseTypeRegistry.getDefaultDatabaseType().getType(), is("MySQL"));
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/H2DatabaseTypeTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/H2DatabaseTypeTest.java
index f9df90042c3..b8d8e603f94 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/H2DatabaseTypeTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/H2DatabaseTypeTest.java
@@ -35,7 +35,7 @@ public final class H2DatabaseTypeTest {
@Test
public void assertGetName() {
- assertThat(new H2DatabaseType().getName(), is("H2"));
+ assertThat(new H2DatabaseType().getType(), is("H2"));
}
@Test
@@ -51,7 +51,7 @@ public final class H2DatabaseTypeTest {
@Test
public void assertGetTrunkDatabaseType() {
- assertThat(new H2DatabaseType().getTrunkDatabaseType().getName(), is("MySQL"));
+ assertThat(new H2DatabaseType().getTrunkDatabaseType().getType(), is("MySQL"));
}
@Test
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/MariaDBDatabaseTypeTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/MariaDBDatabaseTypeTest.java
index f74ae2ca425..0610bd43497 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/MariaDBDatabaseTypeTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/MariaDBDatabaseTypeTest.java
@@ -35,7 +35,7 @@ public final class MariaDBDatabaseTypeTest {
@Test
public void assertGetName() {
- assertThat(new MariaDBDatabaseType().getName(), is("MariaDB"));
+ assertThat(new MariaDBDatabaseType().getType(), is("MariaDB"));
}
@Test
@@ -51,7 +51,7 @@ public final class MariaDBDatabaseTypeTest {
@Test
public void assertGetTrunkDatabaseType() {
- assertThat(new MariaDBDatabaseType().getTrunkDatabaseType().getName(), is("MySQL"));
+ assertThat(new MariaDBDatabaseType().getTrunkDatabaseType().getType(), is("MySQL"));
}
@Test
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/MySQLDatabaseTypeTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/MySQLDatabaseTypeTest.java
index 7e3260aec64..7508fefb2c4 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/MySQLDatabaseTypeTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/MySQLDatabaseTypeTest.java
@@ -37,7 +37,7 @@ public final class MySQLDatabaseTypeTest {
@Test
public void assertGetName() {
- assertThat(new MySQLDatabaseType().getName(), is("MySQL"));
+ assertThat(new MySQLDatabaseType().getType(), is("MySQL"));
}
@Test
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/OracleDatabaseTypeTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/OracleDatabaseTypeTest.java
index 7d0248a9d41..83530a6a0b6 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/OracleDatabaseTypeTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/OracleDatabaseTypeTest.java
@@ -36,7 +36,7 @@ public final class OracleDatabaseTypeTest {
@Test
public void assertGetName() {
- assertThat(new OracleDatabaseType().getName(), is("Oracle"));
+ assertThat(new OracleDatabaseType().getType(), is("Oracle"));
}
@Test
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/PostgreSQLDatabaseTypeTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/PostgreSQLDatabaseTypeTest.java
index f02eec0a11f..db7e8bd6335 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/PostgreSQLDatabaseTypeTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/PostgreSQLDatabaseTypeTest.java
@@ -37,7 +37,7 @@ public final class PostgreSQLDatabaseTypeTest {
@Test
public void assertGetName() {
- assertThat(new PostgreSQLDatabaseType().getName(), is("PostgreSQL"));
+ assertThat(new PostgreSQLDatabaseType().getType(), is("PostgreSQL"));
}
@Test
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/SQL92DatabaseTypeTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/SQL92DatabaseTypeTest.java
index 18e4c8edb62..376089ce8bd 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/SQL92DatabaseTypeTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/SQL92DatabaseTypeTest.java
@@ -35,7 +35,7 @@ public final class SQL92DatabaseTypeTest {
@Test
public void assertGetName() {
- assertThat(new SQL92DatabaseType().getName(), is("SQL92"));
+ assertThat(new SQL92DatabaseType().getType(), is("SQL92"));
}
@Test
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/SQLServerDatabaseTypeTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/SQLServerDatabaseTypeTest.java
index d6a2dbcc552..4668a816a2e 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/SQLServerDatabaseTypeTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/SQLServerDatabaseTypeTest.java
@@ -35,7 +35,7 @@ public final class SQLServerDatabaseTypeTest {
@Test
public void assertGetName() {
- assertThat(new SQLServerDatabaseType().getName(), is("SQLServer"));
+ assertThat(new SQLServerDatabaseType().getType(), is("SQLServer"));
}
@Test
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilderRuleTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilderRuleTest.java
index 60a1d74c7cb..ec3fc58bbcb 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilderRuleTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilderRuleTest.java
@@ -30,14 +30,14 @@ public final class SystemSchemaBuilderRuleTest {
@Test
public void assertValueOfSchemaPathSuccess() {
- SystemSchemaBuilderRule actual = SystemSchemaBuilderRule.valueOf(new MySQLDatabaseType().getName(), "information_schema");
+ SystemSchemaBuilderRule actual = SystemSchemaBuilderRule.valueOf(new MySQLDatabaseType().getType(), "information_schema");
assertThat(actual, is(SystemSchemaBuilderRule.MYSQL_INFORMATION_SCHEMA));
assertThat(actual.getTables(), is(Sets.newHashSet("columns", "engines", "parameters", "routines", "schemata", "tables", "views")));
}
@Test(expected = IllegalArgumentException.class)
public void assertValueOfSchemaPathFailure() {
- SystemSchemaBuilderRule.valueOf(new MySQLDatabaseType().getName(), "test");
+ SystemSchemaBuilderRule.valueOf(new MySQLDatabaseType().getType(), "test");
}
@Test
diff --git a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/type/DropSchemaStatementSchemaRefresher.java b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/type/DropSchemaStatementSchemaRefresher.java
index 86c62c27a6d..ccc28b08f8e 100644
--- a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/type/DropSchemaStatementSchemaRefresher.java
+++ b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/type/DropSchemaStatementSchemaRefresher.java
@@ -54,7 +54,7 @@ public final class DropSchemaStatementSchemaRefresher implements MetaDataRefresh
tobeRemovedTables.addAll(schema.getAllTableNames());
tobeRemovedSchemas.add(each.toLowerCase());
database.removeSchemaMetadata(each);
- optimizerPlanners.put(database.getName(), OptimizerPlannerContextFactory.create(database));
+ optimizerPlanners.put(database.getName(), OptimizerPlannerContextFactory.create(database));
}
Collection<MutableDataNodeRule> rules = metaData.getRuleMetaData().findRules(MutableDataNodeRule.class);
for (String each : tobeRemovedTables) {
diff --git a/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/test/java/org/apache/shardingsphere/datetime/database/config/DatabaseDatetimeServiceConfigurationTest.java b/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/test/java/org/apache/shardingsphere/datetime/database/config/DatabaseDatetimeServiceConfigurationTest.java
index 6c5aa8b4d1a..32bbf54c463 100644
--- a/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/test/java/org/apache/shardingsphere/datetime/database/config/DatabaseDatetimeServiceConfigurationTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/test/java/org/apache/shardingsphere/datetime/database/config/DatabaseDatetimeServiceConfigurationTest.java
@@ -28,7 +28,7 @@ public final class DatabaseDatetimeServiceConfigurationTest {
@Test
public void assertGetInstance() {
- assertThat(DatabaseDatetimeServiceConfiguration.getInstance().getDatabaseType().getName(), is("H2"));
+ assertThat(DatabaseDatetimeServiceConfiguration.getInstance().getDatabaseType().getType(), is("H2"));
assertThat(DatabaseDatetimeServiceConfiguration.getInstance().getDataSource(), instanceOf(HikariDataSource.class));
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/sane/JDBCSaneQueryResultEngineFactory.java b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/sane/JDBCSaneQueryResultEngineFactory.java
index d98ab782caf..de57c4d1d5e 100644
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/sane/JDBCSaneQueryResultEngineFactory.java
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/sane/JDBCSaneQueryResultEngineFactory.java
@@ -40,6 +40,6 @@ public final class JDBCSaneQueryResultEngineFactory {
* @return new instance of JDBC sane query result engine
*/
public static SaneQueryResultEngine newInstance(final DatabaseType databaseType) {
- return TypedSPIRegistry.findRegisteredService(SaneQueryResultEngine.class, databaseType.getName()).orElseGet(DefaultSaneQueryResultEngine::new);
+ return TypedSPIRegistry.findRegisteredService(SaneQueryResultEngine.class, databaseType.getType()).orElseGet(DefaultSaneQueryResultEngine::new);
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FilterableTableScanExecutor.java b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FilterableTableScanExecutor.java
index 7101cdb074e..47ca147a6ee 100644
--- a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FilterableTableScanExecutor.java
+++ b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FilterableTableScanExecutor.java
@@ -133,7 +133,7 @@ public final class FilterableTableScanExecutor {
public Enumerable<Object[]> execute(final FederationTableMetaData tableMetaData, final FilterableTableScanContext scanContext) {
String databaseName = executorContext.getDatabaseName();
String schemaName = executorContext.getSchemaName();
- DatabaseType databaseType = DatabaseTypeRegistry.getTrunkDatabaseType(optimizerContext.getParserContexts().get(databaseName).getDatabaseType().getName());
+ DatabaseType databaseType = DatabaseTypeRegistry.getTrunkDatabaseType(optimizerContext.getParserContexts().get(databaseName).getDatabaseType().getType());
SqlString sqlString = createSQLString(tableMetaData, scanContext, databaseType);
// TODO replace sql parse with sql convert
FederationContext federationContext = executorContext.getFederationContext();
@@ -256,7 +256,7 @@ public final class FilterableTableScanExecutor {
private LogicSQL createLogicSQL(final Map<String, ShardingSphereMetaData> metaDataMap, final SqlString sqlString, final DatabaseType databaseType) {
String sql = sqlString.getSql().replace("\n", " ");
- SQLStatement sqlStatement = new SQLStatementParserEngine(databaseType.getName(),
+ SQLStatement sqlStatement = new SQLStatementParserEngine(databaseType.getType(),
optimizerContext.getSqlParserRule().getSqlStatementCache(), optimizerContext.getSqlParserRule().getParseTreeCache(),
optimizerContext.getSqlParserRule().isSqlCommentParseEnabled()).parse(sql, false);
List<Object> parameters = getParameters(sqlString.getDynamicParameters());
diff --git a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/context/parser/dialect/OptimizerSQLDialectBuilderFactory.java b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/context/parser/dialect/OptimizerSQLDialectBuilderFactory.java
index 57c13be4dce..272b49a1faf 100644
--- a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/context/parser/dialect/OptimizerSQLDialectBuilderFactory.java
+++ b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/context/parser/dialect/OptimizerSQLDialectBuilderFactory.java
@@ -42,7 +42,7 @@ public final class OptimizerSQLDialectBuilderFactory {
public static Properties build(final DatabaseType databaseType) {
OptimizerSQLDialectBuilder builder = null == databaseType
? RequiredSPIRegistry.getRegisteredService(OptimizerSQLDialectBuilder.class)
- : TypedSPIRegistry.getRegisteredService(OptimizerSQLDialectBuilder.class, databaseType.getName());
+ : TypedSPIRegistry.getRegisteredService(OptimizerSQLDialectBuilder.class, databaseType.getType());
return builder.build();
}
}
diff --git a/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/main/java/org/apache/shardingsphere/authority/provider/natived/builder/StoragePrivilegeBuilder.java b/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/main/java/org/apache/shardingsphere/authority/provider/natived/builder/StoragePrivilegeBuilder.java
index 66c37bb67fa..c5a7b45cb31 100644
--- a/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/main/java/org/apache/shardingsphere/authority/provider/natived/builder/StoragePrivilegeBuilder.java
+++ b/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/main/java/org/apache/shardingsphere/authority/provider/natived/builder/StoragePrivilegeBuilder.java
@@ -78,7 +78,7 @@ public final class StoragePrivilegeBuilder {
private static Map<ShardingSphereUser, NativePrivileges> buildPrivilegesInStorage(final ShardingSphereMetaData metaData, final Collection<ShardingSphereUser> users) {
DatabaseType databaseType = DatabaseTypeRecognizer.getDatabaseType(metaData.getResource().getAllInstanceDataSources());
- Optional<StoragePrivilegeHandler> handler = StoragePrivilegeHandlerFactory.newInstance(databaseType.getName());
+ Optional<StoragePrivilegeHandler> handler = StoragePrivilegeHandlerFactory.newInstance(databaseType.getType());
if (!handler.isPresent()) {
return buildPrivilegesInCache(users);
}
diff --git a/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/test/java/org/apache/shardingsphere/authority/provider/simple/model/privilege/AllPermittedPrivilegesProviderAlgorithmTest.java b/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/test/java/org/apache/shardingsphere/authority/provider/simple/model/privilege/AllPermittedPrivilegesProviderAlgorithmTest.java
index 5606776462f..e1ca540f3d6 100644
--- a/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/test/java/org/apache/shardingsphere/authority/provider/simple/model/privilege/AllPermittedPrivilegesProviderAlgorithmTest.java
+++ b/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/test/java/org/apache/shardingsphere/authority/provider/simple/model/privilege/AllPermittedPrivilegesProviderAlgorithmTest.java
@@ -33,5 +33,5 @@ public final class AllPermittedPrivilegesProviderAlgorithmTest {
assertTrue(actual.hasPrivileges("testSchema"));
assertTrue(actual.hasPrivileges(Collections.emptyList()));
assertTrue(actual.hasPrivileges(new SchemaAccessSubject("testSchema"), Collections.emptyList()));
- }
+ }
}
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/config/rulealtered/RuleAlteredJobConfiguration.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/config/rulealtered/RuleAlteredJobConfiguration.java
index ac0bc618ca7..4df68a5c358 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/config/rulealtered/RuleAlteredJobConfiguration.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/config/rulealtered/RuleAlteredJobConfiguration.java
@@ -150,11 +150,11 @@ public final class RuleAlteredJobConfiguration implements PipelineJobConfigurati
}
if (Strings.isNullOrEmpty(getSourceDatabaseType())) {
PipelineDataSourceConfiguration sourceDataSourceConfig = PipelineDataSourceConfigurationFactory.newInstance(source.getType(), source.getParameter());
- setSourceDatabaseType(sourceDataSourceConfig.getDatabaseType().getName());
+ setSourceDatabaseType(sourceDataSourceConfig.getDatabaseType().getType());
}
if (Strings.isNullOrEmpty(getTargetDatabaseType())) {
PipelineDataSourceConfiguration targetDataSourceConfig = PipelineDataSourceConfigurationFactory.newInstance(target.getType(), target.getParameter());
- setTargetDatabaseType(targetDataSourceConfig.getDatabaseType().getName());
+ setTargetDatabaseType(targetDataSourceConfig.getDatabaseType().getType());
}
if (null == jobShardingItem) {
jobShardingItem = 0;
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/spi/ddlgenerator/DialectDDLSQLGeneratorFactory.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/spi/ddlgenerator/DialectDDLSQLGeneratorFactory.java
index c66a7b4bbac..8090a131928 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/spi/ddlgenerator/DialectDDLSQLGeneratorFactory.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/spi/ddlgenerator/DialectDDLSQLGeneratorFactory.java
@@ -42,6 +42,6 @@ public final class DialectDDLSQLGeneratorFactory {
* @return new instance of dialect DDL SQL generator
*/
public static Optional<DialectDDLGenerator> newInstance(final DatabaseType databaseType) {
- return TypedSPIRegistry.findRegisteredService(DialectDDLGenerator.class, databaseType.getName());
+ return TypedSPIRegistry.findRegisteredService(DialectDDLGenerator.class, databaseType.getType());
}
}
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/test/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/StandardPipelineDataSourceConfigurationTest.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/test/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/StandardPipelineDataSourceConfigurationTest.java
index 8bdd6f9c9bd..56cc562842f 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/test/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/StandardPipelineDataSourceConfigurationTest.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/test/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/StandardPipelineDataSourceConfigurationTest.java
@@ -46,7 +46,7 @@ public final class StandardPipelineDataSourceConfigurationTest {
}
private void assertGetConfig(final StandardPipelineDataSourceConfiguration actual) {
- assertThat(actual.getDatabaseType().getName(), is("MySQL"));
+ assertThat(actual.getDatabaseType().getType(), is("MySQL"));
assertThat(actual.getType(), is("JDBC"));
assertThat(((DataSourceProperties) actual.getDataSourceConfiguration()).getDataSourceClassName(), is("com.zaxxer.hikari.HikariDataSource"));
assertGetJdbcConfig(actual.getJdbcConfig());
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/DataConsistencyChecker.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/DataConsistencyChecker.java
index c44ef6bc6a9..d88a80e1efb 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/DataConsistencyChecker.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/DataConsistencyChecker.java
@@ -142,7 +142,7 @@ public final class DataConsistencyChecker {
}
private long count(final DataSource dataSource, final String tableName, final DatabaseType databaseType) {
- String sql = PipelineSQLBuilderFactory.newInstance(databaseType.getName()).buildCountSQL(tableNameSchemaNameMapping.getSchemaName(tableName), tableName);
+ String sql = PipelineSQLBuilderFactory.newInstance(databaseType.getType()).buildCountSQL(tableNameSchemaNameMapping.getSchemaName(tableName), tableName);
try (
Connection connection = dataSource.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(sql);
@@ -164,8 +164,8 @@ public final class DataConsistencyChecker {
try (
PipelineDataSourceWrapper sourceDataSource = PipelineDataSourceFactory.newInstance(sourceDataSourceConfig);
PipelineDataSourceWrapper targetDataSource = PipelineDataSourceFactory.newInstance(targetDataSourceConfig)) {
- String sourceDatabaseType = sourceDataSourceConfig.getDatabaseType().getName();
- String targetDatabaseType = targetDataSourceConfig.getDatabaseType().getName();
+ String sourceDatabaseType = sourceDataSourceConfig.getDatabaseType().getType();
+ String targetDatabaseType = targetDataSourceConfig.getDatabaseType().getType();
for (String each : logicTableNames) {
TableMetaData tableMetaData = getTableMetaData(jobConfig.getDatabaseName(), each);
if (null == tableMetaData) {
@@ -204,7 +204,7 @@ public final class DataConsistencyChecker {
private PipelineDataSourceConfiguration getPipelineDataSourceConfiguration(final DataConsistencyCalculateAlgorithm calculator, final YamlPipelineDataSourceConfiguration dataSourceConfig) {
PipelineDataSourceConfiguration result = PipelineDataSourceConfigurationFactory.newInstance(dataSourceConfig.getType(), dataSourceConfig.getParameter());
- checkDatabaseTypeSupported(calculator.getSupportedDatabaseTypes(), result.getDatabaseType().getName());
+ checkDatabaseTypeSupported(calculator.getSupportedDatabaseTypes(), result.getDatabaseType().getType());
addMySQLDataSourceConfig(result);
return result;
}
@@ -216,7 +216,7 @@ public final class DataConsistencyChecker {
}
private void addMySQLDataSourceConfig(final PipelineDataSourceConfiguration dataSourceConfig) {
- if (dataSourceConfig.getDatabaseType().getName().equalsIgnoreCase(new MySQLDatabaseType().getName())) {
+ if (dataSourceConfig.getDatabaseType().getType().equalsIgnoreCase(new MySQLDatabaseType().getType())) {
Properties queryProps = new Properties();
queryProps.setProperty("yearIsDateType", Boolean.FALSE.toString());
dataSourceConfig.appendJDBCQueryProperties(queryProps);
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/algorithm/CRC32MatchDataConsistencyCalculateAlgorithm.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/algorithm/CRC32MatchDataConsistencyCalculateAlgorithm.java
index 1d196f74fc6..49eba9d8004 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/algorithm/CRC32MatchDataConsistencyCalculateAlgorithm.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/algorithm/CRC32MatchDataConsistencyCalculateAlgorithm.java
@@ -42,7 +42,7 @@ import java.util.stream.Collectors;
@Getter
public final class CRC32MatchDataConsistencyCalculateAlgorithm implements DataConsistencyCalculateAlgorithm {
- private static final Collection<String> SUPPORTED_DATABASE_TYPES = Collections.singletonList(new MySQLDatabaseType().getName());
+ private static final Collection<String> SUPPORTED_DATABASE_TYPES = Collections.singletonList(new MySQLDatabaseType().getType());
private Properties props;
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/importer/AbstractImporter.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/importer/AbstractImporter.java
index 9e157ad1329..260147b08b5 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/importer/AbstractImporter.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/importer/AbstractImporter.java
@@ -66,7 +66,7 @@ public abstract class AbstractImporter extends AbstractLifecycleExecutor impleme
this.importerConfig = importerConfig;
this.dataSourceManager = dataSourceManager;
this.channel = channel;
- pipelineSqlBuilder = PipelineSQLBuilderFactory.newInstance(importerConfig.getDataSourceConfig().getDatabaseType().getName());
+ pipelineSqlBuilder = PipelineSQLBuilderFactory.newInstance(importerConfig.getDataSourceConfig().getDatabaseType().getType());
}
@Override
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/dumper/AbstractInventoryDumper.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/dumper/AbstractInventoryDumper.java
index c2485fc9779..9ea29d55694 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/dumper/AbstractInventoryDumper.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/dumper/AbstractInventoryDumper.java
@@ -82,7 +82,7 @@ public abstract class AbstractInventoryDumper extends AbstractLifecycleExecutor
}
this.inventoryDumperConfig = inventoryDumperConfig;
this.channel = channel;
- pipelineSQLBuilder = PipelineSQLBuilderFactory.newInstance(inventoryDumperConfig.getDataSourceConfig().getDatabaseType().getName());
+ pipelineSQLBuilder = PipelineSQLBuilderFactory.newInstance(inventoryDumperConfig.getDataSourceConfig().getDatabaseType().getType());
this.dataSource = dataSource;
batchSize = inventoryDumperConfig.getBatchSize();
rateLimitAlgorithm = inventoryDumperConfig.getRateLimitAlgorithm();
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/metadata/generator/PipelineDDLGenerator.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/metadata/generator/PipelineDDLGenerator.java
index 754f79bd231..1acfe571496 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/metadata/generator/PipelineDDLGenerator.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/metadata/generator/PipelineDDLGenerator.java
@@ -182,7 +182,7 @@ public final class PipelineDDLGenerator {
private LogicSQL getLogicSQL(final String sql, final DatabaseType databaseType, final String databaseName) {
Optional<SQLParserRule> sqlParserRule = contextManager.getMetaDataContexts().getGlobalRuleMetaData().findSingleRule(SQLParserRule.class);
Preconditions.checkState(sqlParserRule.isPresent());
- SQLStatement sqlStatement = new ShardingSphereSQLParserEngine(databaseType.getName(), sqlParserRule.get().toParserConfiguration()).parse(sql, false);
+ SQLStatement sqlStatement = new ShardingSphereSQLParserEngine(databaseType.getType(), sqlParserRule.get().toParserConfiguration()).parse(sql, false);
SQLStatementContext<?> sqlStatementContext = SQLStatementContextFactory.newInstance(contextManager.getMetaDataContexts().getMetaDataMap(),
sqlStatement, databaseName);
return new LogicSQL(sqlStatementContext, sql, Collections.emptyList());
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/metadata/loader/PipelineTableMetaDataLoader.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/metadata/loader/PipelineTableMetaDataLoader.java
index 04d0ce486f8..630520d1f3f 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/metadata/loader/PipelineTableMetaDataLoader.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/metadata/loader/PipelineTableMetaDataLoader.java
@@ -67,7 +67,7 @@ public final class PipelineTableMetaDataLoader {
}
private boolean isSchemaAvailable() {
- return DatabaseTypeRegistry.getActualDatabaseType(dataSource.getDatabaseType().getName()).isSchemaAvailable();
+ return DatabaseTypeRegistry.getActualDatabaseType(dataSource.getDatabaseType().getType()).isSchemaAvailable();
}
private Map<TableName, PipelineTableMetaData> loadTableMetaData0(final Connection connection, final String schemaName, final String tableNamePattern) throws SQLException {
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/prepare/datasource/AbstractDataSourcePreparer.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/prepare/datasource/AbstractDataSourcePreparer.java
index 040779e63d2..691ec9b44c3 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/prepare/datasource/AbstractDataSourcePreparer.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/prepare/datasource/AbstractDataSourcePreparer.java
@@ -73,7 +73,7 @@ public abstract class AbstractDataSourcePreparer implements DataSourcePreparer {
Set<String> schemaNames = getSchemaNames(parameter);
String defaultSchema = targetDatabaseType.getDefaultSchema(parameter.getTaskConfig().getJobConfig().getDatabaseName());
log.info("prepareTargetSchemas, schemaNames={}, defaultSchema={}", schemaNames, defaultSchema);
- PipelineSQLBuilder pipelineSQLBuilder = PipelineSQLBuilderFactory.newInstance(targetDatabaseType.getName());
+ PipelineSQLBuilder pipelineSQLBuilder = PipelineSQLBuilderFactory.newInstance(targetDatabaseType.getType());
try (Connection targetConnection = getTargetCachedDataSource(parameter.getTaskConfig(), parameter.getDataSourceManager()).getConnection()) {
for (String each : schemaNames) {
if (each.equalsIgnoreCase(defaultSchema)) {
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/rulealtered/RuleAlteredJobPreparer.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/rulealtered/RuleAlteredJobPreparer.java
index 75003daf862..c8406745f8f 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/rulealtered/RuleAlteredJobPreparer.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/rulealtered/RuleAlteredJobPreparer.java
@@ -201,7 +201,7 @@ public final class RuleAlteredJobPreparer {
private void cleanup0(final RuleAlteredJobConfiguration jobConfig) throws SQLException {
DatabaseType databaseType = DatabaseTypeRegistry.getActualDatabaseType(jobConfig.getSourceDatabaseType());
- PositionInitializer positionInitializer = PositionInitializerFactory.getPositionInitializer(databaseType.getName());
+ PositionInitializer positionInitializer = PositionInitializerFactory.getPositionInitializer(databaseType.getType());
ShardingSpherePipelineDataSourceConfiguration sourceDataSourceConfig = (ShardingSpherePipelineDataSourceConfiguration) PipelineDataSourceConfigurationFactory
.newInstance(jobConfig.getSource().getType(), jobConfig.getSource().getParameter());
for (DataSourceProperties each : new YamlDataSourceConfigurationSwapper().getDataSourcePropertiesMap(sourceDataSourceConfig.getRootConfig()).values()) {
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/scaling/core/job/dumper/DumperFactory.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/scaling/core/job/dumper/DumperFactory.java
index a87ce65404b..35d3fc767ca 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/scaling/core/job/dumper/DumperFactory.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/scaling/core/job/dumper/DumperFactory.java
@@ -51,7 +51,7 @@ public final class DumperFactory {
@SneakyThrows(ReflectiveOperationException.class)
public static InventoryDumper createInventoryDumper(final InventoryDumperConfiguration inventoryDumperConfig, final PipelineChannel channel,
final DataSource sourceDataSource, final PipelineTableMetaDataLoader sourceMetaDataLoader) {
- ScalingEntry scalingEntry = ScalingEntryFactory.getInstance(inventoryDumperConfig.getDataSourceConfig().getDatabaseType().getName());
+ ScalingEntry scalingEntry = ScalingEntryFactory.getInstance(inventoryDumperConfig.getDataSourceConfig().getDatabaseType().getType());
Constructor<? extends InventoryDumper> constructor = scalingEntry.getInventoryDumperClass()
.getConstructor(InventoryDumperConfiguration.class, PipelineChannel.class, DataSource.class, PipelineTableMetaDataLoader.class);
return constructor.newInstance(inventoryDumperConfig, channel, sourceDataSource, sourceMetaDataLoader);
@@ -69,7 +69,7 @@ public final class DumperFactory {
@SneakyThrows(ReflectiveOperationException.class)
public static IncrementalDumper createIncrementalDumper(final DumperConfiguration dumperConfig, final IngestPosition<?> position,
final PipelineChannel channel, final PipelineTableMetaDataLoader sourceMetaDataLoader) {
- String databaseType = dumperConfig.getDataSourceConfig().getDatabaseType().getName();
+ String databaseType = dumperConfig.getDataSourceConfig().getDatabaseType().getType();
ScalingEntry scalingEntry = ScalingEntryFactory.getInstance(databaseType);
Constructor<? extends IncrementalDumper> constructor = scalingEntry.getIncrementalDumperClass()
.getConstructor(DumperConfiguration.class, IngestPosition.class, PipelineChannel.class, PipelineTableMetaDataLoader.class);
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/scaling/core/job/importer/ImporterFactory.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/scaling/core/job/importer/ImporterFactory.java
index 328545aa5c4..430496219ca 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/scaling/core/job/importer/ImporterFactory.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/scaling/core/job/importer/ImporterFactory.java
@@ -45,7 +45,7 @@ public final class ImporterFactory {
*/
@SneakyThrows(ReflectiveOperationException.class)
public static Importer createImporter(final ImporterConfiguration importerConfig, final PipelineDataSourceManager dataSourceManager, final PipelineChannel channel) {
- String databaseType = importerConfig.getDataSourceConfig().getDatabaseType().getName();
+ String databaseType = importerConfig.getDataSourceConfig().getDatabaseType().getType();
ScalingEntry scalingEntry = ScalingEntryFactory.getInstance(databaseType);
Constructor<? extends Importer> constructor = scalingEntry.getImporterClass().getConstructor(ImporterConfiguration.class, PipelineDataSourceManager.class, PipelineChannel.class);
return constructor.newInstance(importerConfig, dataSourceManager, channel);
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/connection/XAConnectionWrapperFactory.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/connection/XAConnectionWr [...]
index 3efab8a2dda..09ac408af85 100644
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/connection/XAConnectionWrapperFactory.java
+++ b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/connection/XAConnectionWrapperFactory.java
@@ -40,6 +40,6 @@ public final class XAConnectionWrapperFactory {
* @return new instance of XA connection wrapper
*/
public static XAConnectionWrapper newInstance(final DatabaseType databaseType) {
- return TypedSPIRegistry.getRegisteredService(XAConnectionWrapper.class, databaseType.getName());
+ return TypedSPIRegistry.getRegisteredService(XAConnectionWrapper.class, databaseType.getType());
}
}
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/properties/XADataSourceDefinitionFactory.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/ [...]
index d101472e220..f8b6f579316 100644
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/properties/XADataSourceDefinitionFactory.java
+++ b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/properties/XADataSourceDefinitionFactory.java
@@ -40,6 +40,6 @@ public final class XADataSourceDefinitionFactory {
* @return XA data source definition
*/
public static XADataSourceDefinition getXADataSourceDefinition(final DatabaseType databaseType) {
- return TypedSPIRegistry.getRegisteredService(XADataSourceDefinition.class, databaseType.getName());
+ return TypedSPIRegistry.getRegisteredService(XADataSourceDefinition.class, databaseType.getType());
}
}
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/test/java/org/apache/shardingsphere/transaction/xa/fixture/DataSourceUtils.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/test/java/org/apache/shardingsphere/transaction/xa/fixture/DataSourceUtils.java
index 03704918305..d613ffff9ed 100644
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/test/java/org/apache/shardingsphere/transaction/xa/fixture/DataSourceUtils.java
+++ b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/test/java/org/apache/shardingsphere/transaction/xa/fixture/DataSourceUtils.java
@@ -70,7 +70,7 @@ public final class DataSourceUtils {
}
private static String getURL(final DatabaseType databaseType, final String databaseName) {
- switch (databaseType.getName()) {
+ switch (databaseType.getType()) {
case "MySQL":
return String.format("jdbc:mysql://localhost:3306/%s", databaseName);
case "MariaDB":
@@ -86,7 +86,7 @@ public final class DataSourceUtils {
case "H2":
return String.format("jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL", databaseName);
default:
- throw new UnsupportedOperationException(databaseType.getName());
+ throw new UnsupportedOperationException(databaseType.getType());
}
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/statement/JDBCBackendStatement.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/statement/JDBCBackendStatement.java
index 039eca02d17..923a0b6b7f5 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/statement/JDBCBackendStatement.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/statement/JDBCBackendStatement.java
@@ -78,7 +78,7 @@ public final class JDBCBackendStatement implements ExecutorJDBCStatementManager
private void setFetchSize(final Statement statement) throws SQLException {
DatabaseType databaseType = ProxyContext.getInstance().getContextManager().getMetaDataContexts()
.getMetaData(null == databaseName ? SQLStatementDatabaseHolder.get() : databaseName).getResource().getDatabaseType();
- Optional<StatementMemoryStrictlyFetchSizeSetter> fetchSizeSetter = StatementMemoryStrictlyFetchSizeSetterFactory.newInstance(databaseType.getName());
+ Optional<StatementMemoryStrictlyFetchSizeSetter> fetchSizeSetter = StatementMemoryStrictlyFetchSizeSetterFactory.newInstance(databaseType.getType());
if (fetchSizeSetter.isPresent()) {
fetchSizeSetter.get().setFetchSize(statement);
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/response/header/query/QueryHeaderBuilderFactory.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/response/header/query/QueryHeaderBuilderFactory.java
index a08831149f5..8222e67d7a4 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/response/header/query/QueryHeaderBuilderFactory.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/response/header/query/QueryHeaderBuilderFactory.java
@@ -41,6 +41,6 @@ public final class QueryHeaderBuilderFactory {
* @return new instance of query header builder
*/
public static QueryHeaderBuilder newInstance(final DatabaseType databaseType) {
- return TypedSPIRegistry.findRegisteredService(QueryHeaderBuilder.class, databaseType.getName()).orElseGet(() -> RequiredSPIRegistry.getRegisteredService(QueryHeaderBuilder.class));
+ return TypedSPIRegistry.findRegisteredService(QueryHeaderBuilder.class, databaseType.getType()).orElseGet(() -> RequiredSPIRegistry.getRegisteredService(QueryHeaderBuilder.class));
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/TextProtocolBackendHandlerFactory.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/TextProtocolBackendHandlerFactory.java
index ee75644ddb5..e22027ba5a3 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/TextProtocolBackendHandlerFactory.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/TextProtocolBackendHandlerFactory.java
@@ -89,7 +89,7 @@ public final class TextProtocolBackendHandlerFactory {
SQLStatement sqlStatement = sqlStatementSupplier.get().orElseGet(() -> {
Optional<SQLParserRule> sqlParserRule = ProxyContext.getInstance().getContextManager().getMetaDataContexts().getGlobalRuleMetaData().findSingleRule(SQLParserRule.class);
Preconditions.checkState(sqlParserRule.isPresent());
- return new ShardingSphereSQLParserEngine(getBackendDatabaseType(databaseType, connectionSession).getName(), sqlParserRule.get().toParserConfiguration()).parse(sql, false);
+ return new ShardingSphereSQLParserEngine(getBackendDatabaseType(databaseType, connectionSession).getType(), sqlParserRule.get().toParserConfiguration()).parse(sql, false);
});
databaseType.handleRollbackOnly(connectionSession.getTransactionStatus().isRollbackOnly(), sqlStatement);
checkUnsupportedSQLStatement(sqlStatement);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/DatabaseAdminBackendHandlerFactory.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/DatabaseAdminBackendHandlerFactory.java
index 8d70ee2f918..2cd22f4584e 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/DatabaseAdminBackendHandlerFactory.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/DatabaseAdminBackendHandlerFactory.java
@@ -53,7 +53,7 @@ public final class DatabaseAdminBackendHandlerFactory {
* @return new instance of database admin backend handler
*/
public static Optional<TextProtocolBackendHandler> newInstance(final DatabaseType databaseType, final SQLStatementContext<?> sqlStatementContext, final ConnectionSession connectionSession) {
- Optional<DatabaseAdminExecutorFactory> executorFactory = TypedSPIRegistry.findRegisteredService(DatabaseAdminExecutorFactory.class, databaseType.getName());
+ Optional<DatabaseAdminExecutorFactory> executorFactory = TypedSPIRegistry.findRegisteredService(DatabaseAdminExecutorFactory.class, databaseType.getType());
if (!executorFactory.isPresent()) {
return Optional.empty();
}
@@ -72,7 +72,7 @@ public final class DatabaseAdminBackendHandlerFactory {
*/
public static Optional<TextProtocolBackendHandler> newInstance(final DatabaseType databaseType, final SQLStatementContext<?> sqlStatementContext,
final ConnectionSession connectionSession, final String sql) {
- Optional<DatabaseAdminExecutorFactory> executorFactory = TypedSPIRegistry.findRegisteredService(DatabaseAdminExecutorFactory.class, databaseType.getName());
+ Optional<DatabaseAdminExecutorFactory> executorFactory = TypedSPIRegistry.findRegisteredService(DatabaseAdminExecutorFactory.class, databaseType.getType());
if (!executorFactory.isPresent()) {
return Optional.empty();
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/advanced/ParseDistSQLBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/advanced/ParseDistSQLBackendHandler.java
index 4ac57792a52..223666092e1 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/advanced/ParseDistSQLBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/advanced/ParseDistSQLBackendHandler.java
@@ -69,7 +69,7 @@ public final class ParseDistSQLBackendHandler extends QueryableRALBackendHandler
SQLStatement parsedSqlStatement;
try {
parsedSqlStatement = new ShardingSphereSQLParserEngine(
- getBackendDatabaseType(databaseType, connectionSession).getName(), sqlParserRule.get().toParserConfiguration()).parse(sqlStatement.getSql(), false);
+ getBackendDatabaseType(databaseType, connectionSession).getType(), sqlParserRule.get().toParserConfiguration()).parse(sqlStatement.getSql(), false);
} catch (SQLParsingException ex) {
throw new SQLParsingException("You have a syntax error in your parsed statement");
}
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 6f8d9c671c5..fa93016d393 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
@@ -86,7 +86,7 @@ public final class DataSourceQueryResultSet implements DistSQLResultSet {
DataSourceMetaData metaData = resource.getDataSourcesMetaData().getDataSourceMetaData(dataSourceName);
Collection<Object> result = new LinkedList<>();
result.add(dataSourceName);
- result.add(resource.getDatabaseType().getName());
+ result.add(resource.getDatabaseType().getType());
result.add(metaData.getHostname());
result.add(metaData.getPort());
result.add(metaData.getCatalog());
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 fb38952a107..cf5dda42fd9 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
@@ -131,7 +131,7 @@ public final class UnusedDataSourceQueryResultSet implements DistSQLResultSet {
DataSourceMetaData metaData = resource.getDataSourcesMetaData().getDataSourceMetaData(dataSourceName);
Collection<Object> result = new LinkedList<>();
result.add(dataSourceName);
- result.add(resource.getDatabaseType().getName());
+ result.add(resource.getDatabaseType().getType());
result.add(metaData.getHostname());
result.add(metaData.getPort());
result.add(metaData.getCatalog());
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/protocol/DatabaseProtocolFrontendEngineFactory.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/protocol/DatabaseProtocolFrontendEngineFactory.java
index 8cb3e944164..67764c9690c 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/protocol/DatabaseProtocolFrontendEngineFactory.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/protocol/DatabaseProtocolFrontendEngineFactory.java
@@ -43,6 +43,6 @@ public final class DatabaseProtocolFrontendEngineFactory {
* @return new instance of database protocol frontend engine
*/
public static DatabaseProtocolFrontendEngine newInstance(final DatabaseType databaseType) {
- return TypedSPIRegistry.getRegisteredService(DatabaseProtocolFrontendEngine.class, databaseType.getName(), new Properties());
+ return TypedSPIRegistry.getRegisteredService(DatabaseProtocolFrontendEngine.class, databaseType.getType(), new Properties());
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/DatabaseProtocolFrontendEngineFixture.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/DatabaseProtocolFrontendEngineFixture.java
index 97266bb82da..59286a4d4d3 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/DatabaseProtocolFrontendEngineFixture.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/DatabaseProtocolFrontendEngineFixture.java
@@ -56,6 +56,6 @@ public final class DatabaseProtocolFrontendEngineFixture implements DatabaseProt
@Override
public String getType() {
- return new FixtureDatabaseType().getName();
+ return new FixtureDatabaseType().getType();
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/FixtureDatabaseType.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/FixtureDatabaseType.java
index 7eed134970e..a4adda5df8a 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/FixtureDatabaseType.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/FixtureDatabaseType.java
@@ -31,7 +31,7 @@ import static org.mockito.Mockito.mock;
public final class FixtureDatabaseType implements DatabaseType {
@Override
- public String getName() {
+ public String getType() {
return "FixtureDB";
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/protocol/FrontDatabaseProtocolTypeFactoryTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/protocol/FrontDatabaseProtocolTypeFactoryTest.java
index dc648c84d6f..2b725588abd 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/protocol/FrontDatabaseProtocolTypeFactoryTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/protocol/FrontDatabaseProtocolTypeFactoryTest.java
@@ -55,7 +55,7 @@ public final class FrontDatabaseProtocolTypeFactoryTest {
mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class), mock(OptimizerContext.class), new ConfigurationProperties(new Properties()));
setContextManager(metaDataContexts);
assertTrue(metaDataContexts.getMetaDataMap().isEmpty());
- assertThat(FrontDatabaseProtocolTypeFactory.getDatabaseType().getName(), is("MySQL"));
+ assertThat(FrontDatabaseProtocolTypeFactory.getDatabaseType().getType(), is("MySQL"));
}
@Test
@@ -69,7 +69,7 @@ public final class FrontDatabaseProtocolTypeFactoryTest {
assertTrue(metaDataContexts.getAllDatabaseNames().contains(DefaultDatabase.LOGIC_NAME));
DatabaseType databaseType = FrontDatabaseProtocolTypeFactory.getDatabaseType();
assertThat(databaseType, instanceOf(DatabaseType.class));
- assertThat(databaseType.getName(), is("MySQL"));
+ assertThat(databaseType.getType(), is("MySQL"));
}
@Test
@@ -83,7 +83,7 @@ public final class FrontDatabaseProtocolTypeFactoryTest {
assertTrue(metaDataContexts.getAllDatabaseNames().contains(DefaultDatabase.LOGIC_NAME));
DatabaseType databaseType = FrontDatabaseProtocolTypeFactory.getDatabaseType();
assertThat(databaseType, instanceOf(DatabaseType.class));
- assertThat(databaseType.getName(), is("PostgreSQL"));
+ assertThat(databaseType.getType(), is("PostgreSQL"));
assertThat(metaDataContexts.getMetaData(DefaultDatabase.LOGIC_NAME).getResource().getDatabaseType(), instanceOf(MySQLDatabaseType.class));
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLComQueryPacketExecutor.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLComQueryPacketExecutor.java
index 16e0405201c..680005fb8f2 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLComQueryPacketExecutor.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLComQueryPacketExecutor.java
@@ -80,7 +80,7 @@ public final class MySQLComQueryPacketExecutor implements QueryCommandExecutor {
return new EmptyStatement();
}
MetaDataContexts metaDataContexts = ProxyContext.getInstance().getContextManager().getMetaDataContexts();
- ShardingSphereSQLParserEngine sqlStatementParserEngine = new ShardingSphereSQLParserEngine(databaseType.getName(),
+ ShardingSphereSQLParserEngine sqlStatementParserEngine = new ShardingSphereSQLParserEngine(databaseType.getType(),
metaDataContexts.getGlobalRuleMetaData().findSingleRule(SQLParserRule.class).orElseThrow(() -> new IllegalStateException("SQLParserRule not found")).toParserConfiguration());
return sqlStatementParserEngine.parse(sql, false);
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-reactive-core/src/test/java/org/apache/shardingsphere/proxy/frontend/reactive/protocol/fixture/DummyDatabaseType.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-reactive-core/src/test/java/org/apache/shardingsphere/proxy/frontend/reactive/protocol/fixture/DummyDatabaseType.java
index b23da2eccaf..69aa317e015 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-reactive-core/src/test/java/org/apache/shardingsphere/proxy/frontend/reactive/protocol/fixture/DummyDatabaseType.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-reactive-core/src/test/java/org/apache/shardingsphere/proxy/frontend/reactive/protocol/fixture/DummyDatabaseType.java
@@ -29,7 +29,7 @@ import java.util.Optional;
public final class DummyDatabaseType implements DatabaseType {
@Override
- public String getName() {
+ public String getType() {
return "Dummy";
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/impl/OracleDDLStatementSQLVisitor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/impl/OracleDDLStatementSQLVisitor.java
index 7aad8ddd710..f8e3843098d 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/impl/OracleDDLStatementSQLVisitor.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/impl/OracleDDLStatementSQLVisitor.java
@@ -687,7 +687,7 @@ public final class OracleDDLStatementSQLVisitor extends OracleStatementSQLVisito
public ASTNode visitDropEdition(final DropEditionContext ctx) {
return new OracleDropEditionStatement();
}
-
+
@Override
public ASTNode visitDropOutline(final DropOutlineContext ctx) {
return new OracleDropOutlineStatement();
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
index 4e3c1dcbdc6..f200f1743e7 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
@@ -497,7 +497,7 @@ public enum SQLVisitorRule {
DROP_ACCESS_METHOD("DropAccessMethod", SQLStatementType.DDL),
DROP_OUTLINE("DropOutline", SQLStatementType.DDL),
-
+
DROP_EDITION("DropEdition", SQLStatementType.DDL);
private final String name;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/DataSourceEnvironment.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/DataSourceEnvironment.java
index 46a093a3a87..d1e0f46d2f6 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/DataSourceEnvironment.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/DataSourceEnvironment.java
@@ -31,7 +31,7 @@ public final class DataSourceEnvironment {
* @return driver class name
*/
public static String getDriverClassName(final DatabaseType databaseType) {
- switch (databaseType.getName()) {
+ switch (databaseType.getType()) {
case "H2":
return "org.h2.Driver";
case "MySQL":
@@ -43,7 +43,7 @@ public final class DataSourceEnvironment {
case "Oracle":
return "oracle.jdbc.driver.OracleDriver";
default:
- throw new UnsupportedOperationException(databaseType.getName());
+ throw new UnsupportedOperationException(databaseType.getType());
}
}
@@ -56,7 +56,7 @@ public final class DataSourceEnvironment {
* @return URL
*/
public static String getURL(final DatabaseType databaseType, final String host, final int port) {
- switch (databaseType.getName()) {
+ switch (databaseType.getType()) {
case "H2":
return "jdbc:h2:mem:test_db;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL;USER=root;PASSWORD=root";
case "MySQL":
@@ -68,7 +68,7 @@ public final class DataSourceEnvironment {
case "Oracle":
return String.format("jdbc:oracle:thin:@%s:%s", host, port);
default:
- throw new UnsupportedOperationException(databaseType.getName());
+ throw new UnsupportedOperationException(databaseType.getType());
}
}
@@ -82,7 +82,7 @@ public final class DataSourceEnvironment {
* @return URL
*/
public static String getURL(final DatabaseType databaseType, final String host, final int port, final String dataSourceName) {
- switch (databaseType.getName()) {
+ switch (databaseType.getType()) {
case "H2":
return String.format("jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL;USER=root;PASSWORD=root", dataSourceName);
case "MySQL":
@@ -94,7 +94,7 @@ public final class DataSourceEnvironment {
case "Oracle":
return String.format("jdbc:oracle:thin:@%s:%s/%s", host, port, dataSourceName);
default:
- throw new UnsupportedOperationException(databaseType.getName());
+ throw new UnsupportedOperationException(databaseType.getType());
}
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/BaseITCase.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/BaseITCase.java
index b7bc5492305..abc6a9e5288 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/BaseITCase.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/BaseITCase.java
@@ -131,9 +131,9 @@ public abstract class BaseITCase {
private String getActualJdbcUrlTemplate(final String databaseName) {
final DockerDatabaseContainer databaseContainer = composedContainer.getDatabaseContainer();
if (ENV.getItEnvType() == ITEnvTypeEnum.DOCKER) {
- return String.format("jdbc:%s://%s:%s/%s", databaseContainer.getDatabaseType().getName().toLowerCase(), "db.host", databaseContainer.getPort(), databaseName);
+ return String.format("jdbc:%s://%s:%s/%s", databaseContainer.getDatabaseType().getType().toLowerCase(), "db.host", databaseContainer.getPort(), databaseName);
} else {
- return String.format("jdbc:%s://%s:%s/%s", databaseContainer.getDatabaseType().getName().toLowerCase(), "127.0.0.1", databaseContainer.getFirstMappedPort(), databaseName);
+ return String.format("jdbc:%s://%s:%s/%s", databaseContainer.getDatabaseType().getType().toLowerCase(), "127.0.0.1", databaseContainer.getFirstMappedPort(), databaseName);
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/factory/DatabaseContainerFactory.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/factory/DatabaseContainerFactory.java
index 77df87cbcf6..867de75992a 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/factory/DatabaseContainerFactory.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/factory/DatabaseContainerFactory.java
@@ -38,13 +38,13 @@ public final class DatabaseContainerFactory {
* @return new instance of storage container
*/
public static DockerDatabaseContainer newInstance(final DatabaseType databaseType, final String dockerImageName) {
- switch (databaseType.getName()) {
+ switch (databaseType.getType()) {
case "MySQL":
return new MySQLContainer(dockerImageName);
case "PostgreSQL":
return new PostgreSQLContainer(dockerImageName);
default:
- throw new RuntimeException(String.format("Database [%s] is unknown.", databaseType.getName()));
+ throw new RuntimeException(String.format("Database [%s] is unknown.", databaseType.getType()));
}
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/DockerDatabaseContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/DockerDatabaseContainer.java
index a00b222b979..4f9be63d70f 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/DockerDatabaseContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/DockerDatabaseContainer.java
@@ -31,13 +31,13 @@ public abstract class DockerDatabaseContainer extends DockerITContainer {
private final DatabaseType databaseType;
public DockerDatabaseContainer(final DatabaseType databaseType, final String dockerImageName) {
- super(databaseType.getName().toLowerCase(), dockerImageName);
+ super(databaseType.getType().toLowerCase(), dockerImageName);
this.databaseType = databaseType;
}
@Override
protected void configure() {
- withClasspathResourceMapping(String.format("/env/%s/initdb.sql", databaseType.getName().toLowerCase()), "/docker-entrypoint-initdb.d/", BindMode.READ_ONLY);
+ withClasspathResourceMapping(String.format("/env/%s/initdb.sql", databaseType.getType().toLowerCase()), "/docker-entrypoint-initdb.d/", BindMode.READ_ONLY);
}
/**
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/proxy/ShardingSphereProxyDockerContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/proxy/ShardingSphereProxyDockerContainer.java
index dd9a42c946f..3decd53f789 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/proxy/ShardingSphereProxyDockerContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/proxy/ShardingSphereProxyDockerContainer.java
@@ -55,7 +55,7 @@ public final class ShardingSphereProxyDockerContainer extends DockerITContainer
}
private void mapConfigurationFiles() {
- withClasspathResourceMapping(String.format("/env/%s/server.yaml", databaseType.getName().toLowerCase()), "/opt/shardingsphere-proxy/conf/server.yaml", BindMode.READ_ONLY);
+ withClasspathResourceMapping(String.format("/env/%s/server.yaml", databaseType.getType().toLowerCase()), "/opt/shardingsphere-proxy/conf/server.yaml", BindMode.READ_ONLY);
withClasspathResourceMapping("/env/logback.xml", "/opt/shardingsphere-proxy/conf/logback.xml", BindMode.READ_ONLY);
if (ITEnvTypeEnum.NATIVE == IntegrationTestEnvironment.getInstance().getItEnvType()) {
addFixedExposedPort(3307, 3307);
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/util/DatabaseTypeUtil.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/util/DatabaseTypeUtil.java
index 15823601d41..913e107b484 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/util/DatabaseTypeUtil.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/util/DatabaseTypeUtil.java
@@ -28,7 +28,7 @@ public final class DatabaseTypeUtil {
* @return true if database type is MySQL, false otherwise
*/
public static boolean isMySQL(final DatabaseType databaseType) {
- return databaseType.getName().equals("MySQL");
+ return databaseType.getType().equals("MySQL");
}
/**
@@ -38,6 +38,6 @@ public final class DatabaseTypeUtil {
* @return true if database type is PostgreSQL, false otherwise
*/
public static boolean isPostgreSQL(final DatabaseType databaseType) {
- return databaseType.getName().equals("PostgreSQL");
+ return databaseType.getType().equals("PostgreSQL");
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/dataset/DataSetLoader.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/dataset/DataSetLoader.java
index 384d55b9c4a..6c50a1f0c70 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/dataset/DataSetLoader.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/dataset/DataSetLoader.java
@@ -53,7 +53,7 @@ public final class DataSetLoader {
}
private static String getFile(final String parentPath, final String scenario, final DatabaseType databaseType, final String dataSetFile) {
- String result = String.join(File.separator, parentPath, DATA_SET_FOLDER_NAME, scenario, databaseType.getName().toLowerCase(), dataSetFile);
+ String result = String.join(File.separator, parentPath, DATA_SET_FOLDER_NAME, scenario, databaseType.getType().toLowerCase(), dataSetFile);
if (new File(result).exists()) {
return result;
}
@@ -65,6 +65,6 @@ public final class DataSetLoader {
if (new File(result).exists()) {
return result;
}
- throw new IllegalArgumentException(String.format("%s not found, path=%s, scenario=%s, databaseType=%s", dataSetFile, parentPath, scenario, databaseType.getName()));
+ throw new IllegalArgumentException(String.format("%s not found, path=%s, scenario=%s, databaseType=%s", dataSetFile, parentPath, scenario, databaseType.getType()));
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java
index 536c3bffb17..1b5f8ca7774 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java
@@ -169,9 +169,9 @@ public abstract class BaseDDLIT extends SingleITCase {
private void assertColumnMetaData(final DataSetColumn actual, final DataSetColumn expected) {
assertThat("Mismatched column name.", actual.getName(), is(expected.getName()));
- if ("MySQL".equals(getDatabaseType().getName()) && "integer".equals(expected.getType())) {
+ if ("MySQL".equals(getDatabaseType().getType()) && "integer".equals(expected.getType())) {
assertThat("Mismatched column type.", actual.getType(), is("int"));
- } else if ("PostgreSQL".equals(getDatabaseType().getName()) && "integer".equals(expected.getType())) {
+ } else if ("PostgreSQL".equals(getDatabaseType().getType()) && "integer".equals(expected.getType())) {
assertThat("Mismatched column type.", actual.getType(), is("int4"));
} else {
assertThat("Mismatched column type.", actual.getType(), is(expected.getType()));
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/AdditionalDMLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/AdditionalDMLIT.java
index acdee120aca..d50118fc7ec 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/AdditionalDMLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/AdditionalDMLIT.java
@@ -86,7 +86,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
@Test
public void assertExecuteUpdateWithColumnIndexes() throws SQLException, ParseException {
// TODO fix replica_query
- if ("PostgreSQL".equals(getDatabaseType().getName()) || "replica_query".equals(getScenario())) {
+ if ("PostgreSQL".equals(getDatabaseType().getType()) || "replica_query".equals(getScenario())) {
return;
}
int actualUpdateCount;
@@ -114,7 +114,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
@Test
public void assertExecuteUpdateWithColumnNames() throws SQLException, ParseException {
// TODO fix replica_query
- if ("PostgreSQL".equals(getDatabaseType().getName()) || "replica_query".equals(getScenario())) {
+ if ("PostgreSQL".equals(getDatabaseType().getType()) || "replica_query".equals(getScenario())) {
return;
}
int actualUpdateCount;
@@ -206,7 +206,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
@Test
public void assertExecuteWithColumnIndexes() throws SQLException, ParseException {
// TODO fix replica_query
- if ("PostgreSQL".equals(getDatabaseType().getName()) || "replica_query".equals(getScenario())) {
+ if ("PostgreSQL".equals(getDatabaseType().getType()) || "replica_query".equals(getScenario())) {
return;
}
int actualUpdateCount;
@@ -236,7 +236,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
@Test
public void assertExecuteWithColumnNames() throws SQLException, ParseException {
// TODO fix replica_query
- if ("PostgreSQL".equals(getDatabaseType().getName()) || "replica_query".equals(getScenario())) {
+ if ("PostgreSQL".equals(getDatabaseType().getType()) || "replica_query".equals(getScenario())) {
return;
}
int actualUpdateCount;
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 8dc43f8b318..9a8d5e670ea 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
@@ -88,7 +88,7 @@ public final class DataSetEnvironmentManager {
String insertSQL;
try (Connection connection = dataSourceMap.get(dataNode.getDataSourceName()).getConnection()) {
DatabaseType databaseType = DatabaseTypeRegistry.getDatabaseTypeByURL(connection.getMetaData().getURL());
- insertSQL = generateInsertSQL(databaseType.getQuoteCharacter().wrap(dataNode.getTableName()), dataSetMetaData.getColumns(), databaseType.getName());
+ insertSQL = generateInsertSQL(databaseType.getQuoteCharacter().wrap(dataNode.getTableName()), dataSetMetaData.getColumns(), databaseType.getType());
}
fillDataTasks.add(new InsertTask(dataSourceMap.get(dataNode.getDataSourceName()), insertSQL, sqlValueGroups));
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/scenario/path/ScenarioDataPath.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/scenario/path/ScenarioDataPath.java
index 7eb38f4c5b3..153dccc85ca 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/scenario/path/ScenarioDataPath.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/scenario/path/ScenarioDataPath.java
@@ -123,7 +123,7 @@ public final class ScenarioDataPath {
* @return init SQL resource path
*/
public String getInitSQLResourcePath(final Type type, final DatabaseType databaseType) {
- return String.join("/", getBasicPath(type), INIT_SQL_PATH, databaseType.getName().toLowerCase());
+ return String.join("/", getBasicPath(type), INIT_SQL_PATH, databaseType.getType().toLowerCase());
}
private String getBasicPath(final Type type) {
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/atomic/adapter/impl/ShardingSphereProxyContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/atomic/adapter/impl/ShardingSphereProxyContainer.java
index 7a921682c89..cc9f1fb5fbd 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/atomic/adapter/impl/ShardingSphereProxyContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/atomic/adapter/impl/ShardingSphereProxyContainer.java
@@ -79,7 +79,7 @@ public final class ShardingSphereProxyContainer extends DockerITContainer implem
private void mapConfigurationFiles() {
String containerPath = "/opt/shardingsphere-proxy/conf";
withClasspathResourceMapping("/env/common/proxy/conf/", containerPath, BindMode.READ_ONLY);
- withClasspathResourceMapping("/env/scenario/" + scenario + "/proxy/conf/" + databaseType.getName().toLowerCase(), containerPath, BindMode.READ_ONLY);
+ withClasspathResourceMapping("/env/scenario/" + scenario + "/proxy/conf/" + databaseType.getType().toLowerCase(), containerPath, BindMode.READ_ONLY);
}
@Override
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/atomic/storage/DockerStorageContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/atomic/storage/DockerStorageContainer.java
index 9bb8771462d..051160d2281 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/atomic/storage/DockerStorageContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/atomic/storage/DockerStorageContainer.java
@@ -49,7 +49,7 @@ public abstract class DockerStorageContainer extends DockerITContainer implement
private final Map<String, DataSource> expectedDataSourceMap;
public DockerStorageContainer(final DatabaseType databaseType, final String dockerImageName, final String scenario) {
- super(databaseType.getName().toLowerCase(), dockerImageName);
+ super(databaseType.getType().toLowerCase(), dockerImageName);
this.databaseType = databaseType;
this.scenario = scenario;
actualDataSourceMap = new LinkedHashMap<>();
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/atomic/storage/StorageContainerFactory.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/atomic/storage/StorageContainerFactory.java
index 5fa7f8bc2b5..967d5831439 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/atomic/storage/StorageContainerFactory.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/atomic/storage/StorageContainerFactory.java
@@ -38,7 +38,7 @@ public final class StorageContainerFactory {
* @return new instance of storage container
*/
public static StorageContainer newInstance(final DatabaseType databaseType, final String scenario) {
- switch (databaseType.getName()) {
+ switch (databaseType.getType()) {
case "MySQL":
return new MySQLContainer(scenario);
case "PostgreSQL":
@@ -46,7 +46,7 @@ public final class StorageContainerFactory {
case "H2":
return new H2Container(scenario);
default:
- throw new RuntimeException(String.format("Database [%s] is unknown.", databaseType.getName()));
+ throw new RuntimeException(String.format("Database [%s] is unknown.", databaseType.getType()));
}
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/compose/mode/ClusterComposedContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/compose/mode/ClusterComposedContainer.java
index 6465cba7feb..bfdeed9deed 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/compose/mode/ClusterComposedContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/compose/mode/ClusterComposedContainer.java
@@ -51,7 +51,7 @@ public final class ClusterComposedContainer implements ComposedContainer {
// TODO support other types of governance
governanceContainer = containers.registerContainer(GovernanceContainerFactory.newInstance("ZooKeeper"), NetworkAliasUtil.getNetworkAlias("zk"));
storageContainer = containers.registerContainer(StorageContainerFactory.newInstance(parameterizedArray.getDatabaseType(), scenario),
- NetworkAliasUtil.getNetworkAliasWithScenario(parameterizedArray.getDatabaseType().getName(), scenario));
+ NetworkAliasUtil.getNetworkAliasWithScenario(parameterizedArray.getDatabaseType().getType(), scenario));
adapterContainer = containers.registerContainer(AdapterContainerFactory.newInstance(parameterizedArray.getAdapter(), parameterizedArray.getDatabaseType(), storageContainer, scenario),
NetworkAliasUtil.getNetworkAliasWithScenario(parameterizedArray.getAdapter(), scenario));
if (adapterContainer instanceof DockerITContainer) {
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/compose/mode/MemoryComposedContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/compose/mode/MemoryComposedContainer.java
index 758a9b9cf8d..76d068b8f95 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/compose/mode/MemoryComposedContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/compose/mode/MemoryComposedContainer.java
@@ -45,7 +45,7 @@ public final class MemoryComposedContainer implements ComposedContainer {
String scenario = parameterizedArray.getScenario();
containers = new ITContainers(scenario);
storageContainer = containers.registerContainer(StorageContainerFactory.newInstance(parameterizedArray.getDatabaseType(), scenario),
- NetworkAliasUtil.getNetworkAliasWithScenario(parameterizedArray.getDatabaseType().getName(), scenario));
+ NetworkAliasUtil.getNetworkAliasWithScenario(parameterizedArray.getDatabaseType().getType(), scenario));
adapterContainer = containers.registerContainer(AdapterContainerFactory.newInstance(parameterizedArray.getAdapter(), parameterizedArray.getDatabaseType(), storageContainer, scenario),
NetworkAliasUtil.getNetworkAliasWithScenario(parameterizedArray.getAdapter(), scenario));
if (adapterContainer instanceof DockerITContainer) {
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/database/DatabaseAssertionMetaDataFactory.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/database/DatabaseAssertionMetaDataFactory.java
index 46314bc0528..bfc5d5bbe3c 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/database/DatabaseAssertionMetaDataFactory.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/database/DatabaseAssertionMetaDataFactory.java
@@ -38,7 +38,7 @@ public final class DatabaseAssertionMetaDataFactory {
*/
@SuppressWarnings("SwitchStatementWithTooFewBranches")
public static Optional<DatabaseAssertionMetaData> newInstance(final DatabaseType databaseType) {
- switch (databaseType.getName()) {
+ switch (databaseType.getType()) {
case "PostgreSQL":
return Optional.of(new PostgreSQLDatabaseAssertionMetaData());
default:
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/model/AssertionParameterizedArray.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/model/AssertionParameterizedArray.java
index 3e6d19fc932..1cb4280e86d 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/model/AssertionParameterizedArray.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/model/AssertionParameterizedArray.java
@@ -45,6 +45,6 @@ public final class AssertionParameterizedArray implements ParameterizedArray {
@Override
public String toString() {
- return String.format("%s: %s -> %s -> %s -> %s", adapter, scenario, databaseType.getName(), sqlExecuteType, testCaseContext.getTestCase().getSql());
+ return String.format("%s: %s -> %s -> %s -> %s", adapter, scenario, databaseType.getType(), sqlExecuteType, testCaseContext.getTestCase().getSql());
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/model/CaseParameterizedArray.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/model/CaseParameterizedArray.java
index b879ee5f08f..3b77fb509f3 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/model/CaseParameterizedArray.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/model/CaseParameterizedArray.java
@@ -39,6 +39,6 @@ public final class CaseParameterizedArray implements ParameterizedArray {
@Override
public String toString() {
- return String.format("%s: %s -> %s -> %s", adapter, scenario, databaseType.getName(), testCaseContext.getTestCase().getSql());
+ return String.format("%s: %s -> %s -> %s", adapter, scenario, databaseType.getType(), testCaseContext.getTestCase().getSql());
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/model/ParameterizedArray.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/model/ParameterizedArray.java
index 85bf016e011..515fc9f5d5c 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/model/ParameterizedArray.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/model/ParameterizedArray.java
@@ -59,6 +59,6 @@ public interface ParameterizedArray {
* @return key of parameterized array
*/
default String getKey() {
- return String.join("-", getScenario(), getAdapter(), getDatabaseType().getName());
+ return String.join("-", getScenario(), getAdapter(), getDatabaseType().getType());
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/impl/ScenarioParallelRunnerExecutor.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/impl/ScenarioParallelRunnerExecutor.java
index d3b756809d3..cac29458f2f 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/impl/ScenarioParallelRunnerExecutor.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/impl/ScenarioParallelRunnerExecutor.java
@@ -81,7 +81,7 @@ public final class ScenarioParallelRunnerExecutor implements ParallelRunnerExecu
private ScenarioKey(final ParameterizedArray parameterizedArray) {
adapter = parameterizedArray.getAdapter();
scenario = parameterizedArray.getScenario();
- databaseTypeName = parameterizedArray.getDatabaseType().getName();
+ databaseTypeName = parameterizedArray.getDatabaseType().getType();
}
@Override
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
index 18682b45dd5..e69a5f1d0e9 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
@@ -394,7 +394,7 @@ public final class SQLParserTestCases {
@XmlElement(name = "drop-outline")
private final List<DropOutlineStatementTestCase> dropOutlineTestCases = new LinkedList<>();
-
+
@XmlElement(name = "create-index")
private final List<CreateIndexStatementTestCase> createIndexTestCases = new LinkedList<>();