You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2022/04/13 13:30:14 UTC
[shardingsphere] branch master updated: Refactor names of some classes and variables due to databaseName configuration (#16797)
This is an automated email from the ASF dual-hosted git repository.
panjuan 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 89a3950d881 Refactor names of some classes and variables due to databaseName configuration (#16797)
89a3950d881 is described below
commit 89a3950d881943125a4ca98947a157ef5e8c85cd
Author: Zhengqiang Duan <du...@apache.org>
AuthorDate: Wed Apr 13 21:30:00 2022 +0800
Refactor names of some classes and variables due to databaseName configuration (#16797)
---
.../DatabaseConfiguration.java} | 6 ++--
.../DataSourceGeneratedDatabaseConfiguration.java} | 10 +++---
.../DataSourceProvidedDatabaseConfiguration.java} | 8 ++---
.../infra/database/type/DatabaseTypeFactory.java | 12 +++----
.../infra/metadata/ShardingSphereMetaData.java | 10 +++---
.../metadata/database/loader/DatabaseLoader.java | 8 ++---
.../rule/builder/schema/SchemaRulesBuilder.java | 22 ++++++------
.../builder/schema/SchemaRulesBuilderTest.java | 4 +--
.../core/datasource/ShardingSphereDataSource.java | 4 +--
.../spi/TransactionConfigurationFileGenerator.java | 6 ++--
.../config/NarayanaConfigurationFileGenerator.java | 10 +++---
.../mode/manager/ContextManager.java | 28 +++++++--------
.../manager/ContextManagerBuilderParameter.java | 4 +--
.../mode/metadata/MetaDataContextsBuilder.java | 40 +++++++++++-----------
.../metadata/persist/MetaDataPersistService.java | 18 +++++-----
.../metadata/persist/node/SchemaMetaDataNode.java | 16 ++++-----
.../service/SchemaMetaDataPersistService.java | 4 +--
.../service/impl/DataSourcePersistService.java | 21 ++++++------
.../ContextManagerBuilderParameterTest.java | 36 +++++++++----------
.../mode/metadata/MetaDataContextsBuilderTest.java | 8 ++---
.../persist/MetaDataPersistServiceTest.java | 10 +++---
.../cluster/ClusterContextManagerBuilder.java | 24 ++++++-------
.../memory/MemoryContextManagerBuilder.java | 8 ++---
.../StandaloneContextManagerBuilder.java | 22 ++++++------
.../StandaloneContextManagerBuilderTextTest.java | 4 +--
.../proxy/backend/config/ProxyConfiguration.java | 4 +--
.../swapper/YamlProxyConfigurationSwapper.java | 10 +++---
.../swapper/YamlProxyConfigurationSwapperTest.java | 6 ++--
.../AbstractSQLRewriterParameterizedTest.java | 10 +++---
29 files changed, 187 insertions(+), 186 deletions(-)
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/schema/SchemaConfiguration.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/database/DatabaseConfiguration.java
similarity index 90%
rename from shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/schema/SchemaConfiguration.java
rename to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/database/DatabaseConfiguration.java
index 9efd83e4ca1..937cc2421d4 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/schema/SchemaConfiguration.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/database/DatabaseConfiguration.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.config.schema;
+package org.apache.shardingsphere.infra.config.database;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
@@ -24,9 +24,9 @@ import java.util.Collection;
import java.util.Map;
/**
- * Schema configuration.
+ * Database configuration.
*/
-public interface SchemaConfiguration {
+public interface DatabaseConfiguration {
/**
* Get data sources.
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/schema/impl/DataSourceGeneratedSchemaConfiguration.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/database/impl/DataSourceGeneratedDatabaseConfiguration.java
similarity index 83%
rename from shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/schema/impl/DataSourceGeneratedSchemaConfiguration.java
rename to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/database/impl/DataSourceGeneratedDatabaseConfiguration.java
index 1c98a1f7e28..a709786c10f 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/schema/impl/DataSourceGeneratedSchemaConfiguration.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/database/impl/DataSourceGeneratedDatabaseConfiguration.java
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.config.schema.impl;
+package org.apache.shardingsphere.infra.config.database.impl;
import lombok.Getter;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
-import org.apache.shardingsphere.infra.config.schema.SchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
import org.apache.shardingsphere.infra.datasource.config.DataSourceConfiguration;
import org.apache.shardingsphere.infra.datasource.pool.creator.DataSourcePoolCreator;
import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
@@ -33,10 +33,10 @@ import java.util.Map.Entry;
import java.util.stream.Collectors;
/**
- * Data source generated schema configuration.
+ * Data source generated database configuration.
*/
@Getter
-public final class DataSourceGeneratedSchemaConfiguration implements SchemaConfiguration {
+public final class DataSourceGeneratedDatabaseConfiguration implements DatabaseConfiguration {
private final Map<String, DataSource> dataSources;
@@ -44,7 +44,7 @@ public final class DataSourceGeneratedSchemaConfiguration implements SchemaConfi
private final Map<String, DataSourceProperties> dataSourceProperties;
- public DataSourceGeneratedSchemaConfiguration(final Map<String, DataSourceConfiguration> dataSources, final Collection<RuleConfiguration> ruleConfigurations) {
+ public DataSourceGeneratedDatabaseConfiguration(final Map<String, DataSourceConfiguration> dataSources, final Collection<RuleConfiguration> ruleConfigurations) {
this.dataSources = DataSourcePoolCreator.create(createDataSourcePropertiesMap(dataSources));
this.ruleConfigurations = ruleConfigurations;
dataSourceProperties = createDataSourcePropertiesMap(dataSources);
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/schema/impl/DataSourceProvidedSchemaConfiguration.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/database/impl/DataSourceProvidedDatabaseConfiguration.java
similarity index 80%
rename from shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/schema/impl/DataSourceProvidedSchemaConfiguration.java
rename to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/database/impl/DataSourceProvidedDatabaseConfiguration.java
index b12e69ac933..e5acc6e813b 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/schema/impl/DataSourceProvidedSchemaConfiguration.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/database/impl/DataSourceProvidedDatabaseConfiguration.java
@@ -15,23 +15,23 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.config.schema.impl;
+package org.apache.shardingsphere.infra.config.database.impl;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
-import org.apache.shardingsphere.infra.config.schema.SchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
import javax.sql.DataSource;
import java.util.Collection;
import java.util.Map;
/**
- * Data source provided schema configuration.
+ * Data source provided database configuration.
*/
@RequiredArgsConstructor
@Getter
-public final class DataSourceProvidedSchemaConfiguration implements SchemaConfiguration {
+public final class DataSourceProvidedDatabaseConfiguration implements DatabaseConfiguration {
private final Map<String, DataSource> dataSources;
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeFactory.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeFactory.java
index 31ebb13c737..ba57a5b1cd9 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeFactory.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeFactory.java
@@ -21,7 +21,7 @@ import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
-import org.apache.shardingsphere.infra.config.schema.SchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
import javax.sql.DataSource;
import java.util.Collection;
@@ -38,16 +38,16 @@ public final class DatabaseTypeFactory {
/**
* Get database type.
*
- * @param schemaConfigs schema configs
+ * @param databaseConfigs database configs
* @param props props
* @return database type
*/
- public static DatabaseType getDatabaseType(final Map<String, ? extends SchemaConfiguration> schemaConfigs, final ConfigurationProperties props) {
+ public static DatabaseType getDatabaseType(final Map<String, ? extends DatabaseConfiguration> databaseConfigs, final ConfigurationProperties props) {
Optional<DatabaseType> configuredDatabaseType = findConfiguredDatabaseType(props);
if (configuredDatabaseType.isPresent()) {
return configuredDatabaseType.get();
}
- Collection<DataSource> dataSources = schemaConfigs.values().stream()
+ Collection<DataSource> dataSources = databaseConfigs.values().stream()
.filter(DatabaseTypeFactory::isComplete).findFirst().map(optional -> optional.getDataSources().values()).orElseGet(Collections::emptyList);
return DatabaseTypeRecognizer.getDatabaseType(dataSources);
}
@@ -57,7 +57,7 @@ public final class DatabaseTypeFactory {
return configuredDatabaseType.isEmpty() ? Optional.empty() : Optional.of(DatabaseTypeRegistry.getTrunkDatabaseType(configuredDatabaseType));
}
- private static boolean isComplete(final SchemaConfiguration schemaConfig) {
- return !schemaConfig.getRuleConfigurations().isEmpty() && !schemaConfig.getDataSources().isEmpty();
+ private static boolean isComplete(final DatabaseConfiguration databaseConfig) {
+ return !databaseConfig.getRuleConfigurations().isEmpty() && !databaseConfig.getDataSources().isEmpty();
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java
index fd34b5362dd..bbfab05518e 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.infra.metadata;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.infra.config.schema.SchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeRecognizer;
import org.apache.shardingsphere.infra.metadata.resource.CachedDatabaseMetaData;
@@ -56,16 +56,16 @@ public final class ShardingSphereMetaData {
*
* @param databaseName database name
* @param schemas schemas
- * @param schemaConfig schema configuration
+ * @param databaseConfig database configuration
* @param rules rules
* @param defaultDatabaseType default database type
* @return ShardingSphere meta data
* @throws SQLException SQL exception
*/
- public static ShardingSphereMetaData create(final String databaseName, final Map<String, ShardingSphereSchema> schemas, final SchemaConfiguration schemaConfig,
+ public static ShardingSphereMetaData create(final String databaseName, final Map<String, ShardingSphereSchema> schemas, final DatabaseConfiguration databaseConfig,
final Collection<ShardingSphereRule> rules, final DatabaseType defaultDatabaseType) throws SQLException {
- ShardingSphereResource resource = createResource(schemaConfig.getDataSources(), defaultDatabaseType);
- ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData(schemaConfig.getRuleConfigurations(), rules);
+ ShardingSphereResource resource = createResource(databaseConfig.getDataSources(), defaultDatabaseType);
+ ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData(databaseConfig.getRuleConfigurations(), rules);
return new ShardingSphereMetaData(databaseName, resource, ruleMetaData, schemas);
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/database/loader/DatabaseLoader.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/database/loader/DatabaseLoader.java
index 1335beb5df9..c796dfd3895 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/database/loader/DatabaseLoader.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/database/loader/DatabaseLoader.java
@@ -39,7 +39,7 @@ public final class DatabaseLoader {
/**
* Load database.
*
- * @param schemaName schema name
+ * @param databaseName database name
* @param databaseType database type
* @param dataSourceMap data source map
* @param rules rules
@@ -47,11 +47,11 @@ public final class DatabaseLoader {
* @return loaded database
* @throws SQLException SQL exception
*/
- public static ShardingSphereDatabase load(final String schemaName, final DatabaseType databaseType, final Map<String, DataSource> dataSourceMap,
+ public static ShardingSphereDatabase load(final String databaseName, final DatabaseType databaseType, final Map<String, DataSource> dataSourceMap,
final Collection<ShardingSphereRule> rules, final Properties props) throws SQLException {
Map<String, ShardingSphereSchema> schemas = new LinkedHashMap<>();
- schemas.put(schemaName, SchemaLoader.load(dataSourceMap, rules, props));
- schemas.putAll(SystemSchemaBuilder.build(schemaName, databaseType));
+ schemas.put(databaseName, SchemaLoader.load(dataSourceMap, rules, props));
+ schemas.putAll(SystemSchemaBuilder.build(databaseName, databaseType));
return new ShardingSphereDatabase(schemas);
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRulesBuilder.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRulesBuilder.java
index 1abd81a928d..de03375a93d 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRulesBuilder.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRulesBuilder.java
@@ -25,8 +25,8 @@ import org.apache.shardingsphere.infra.config.function.DistributedRuleConfigurat
import org.apache.shardingsphere.infra.config.function.EnhancedRuleConfiguration;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
-import org.apache.shardingsphere.infra.config.schema.SchemaConfiguration;
-import org.apache.shardingsphere.infra.config.schema.impl.DataSourceGeneratedSchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
+import org.apache.shardingsphere.infra.config.database.impl.DataSourceGeneratedDatabaseConfiguration;
import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
import org.apache.shardingsphere.infra.datasource.props.InvalidDataSourcePropertiesException;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
@@ -56,30 +56,30 @@ public final class SchemaRulesBuilder {
/**
* Build rules.
*
- * @param schemaName schema name
- * @param schemaConfig schema configuration
+ * @param databaseName database name
+ * @param databaseConfig schema configuration
* @param props configuration properties
* @return built rules
*/
@SuppressWarnings({"unchecked", "rawtypes"})
- public static Collection<ShardingSphereRule> buildRules(final String schemaName, final SchemaConfiguration schemaConfig, final ConfigurationProperties props) {
+ public static Collection<ShardingSphereRule> buildRules(final String databaseName, final DatabaseConfiguration databaseConfig, final ConfigurationProperties props) {
Collection<ShardingSphereRule> result = new LinkedList<>();
boolean isDataSourceAggregation = props.getProps().containsKey("data-source-aggregation-enabled") ? props.getValue(ConfigurationPropertyKey.DATA_SOURCE_AGGREGATION_ENABLED) : false;
- for (Entry<RuleConfiguration, SchemaRuleBuilder> entry : getRuleBuilderMap(schemaConfig).entrySet()) {
+ for (Entry<RuleConfiguration, SchemaRuleBuilder> entry : getRuleBuilderMap(databaseConfig).entrySet()) {
if (isDataSourceAggregation) {
- DataSourceGeneratedSchemaConfiguration configuration = (DataSourceGeneratedSchemaConfiguration) schemaConfig;
+ DataSourceGeneratedDatabaseConfiguration configuration = (DataSourceGeneratedDatabaseConfiguration) databaseConfig;
checkDataSourceAggregations(configuration.getDataSourceProperties());
}
- result.add(entry.getValue().build(entry.getKey(), schemaName, schemaConfig.getDataSources(), result, props));
+ result.add(entry.getValue().build(entry.getKey(), databaseName, databaseConfig.getDataSources(), result, props));
}
return result;
}
@SuppressWarnings("rawtypes")
- private static Map<RuleConfiguration, SchemaRuleBuilder> getRuleBuilderMap(final SchemaConfiguration schemaConfig) {
+ private static Map<RuleConfiguration, SchemaRuleBuilder> getRuleBuilderMap(final DatabaseConfiguration databaseConfig) {
Map<RuleConfiguration, SchemaRuleBuilder> result = new LinkedHashMap<>();
- result.putAll(getDistributedRuleBuilderMap(schemaConfig.getRuleConfigurations()));
- result.putAll(getEnhancedRuleBuilderMap(schemaConfig.getRuleConfigurations()));
+ result.putAll(getDistributedRuleBuilderMap(databaseConfig.getRuleConfigurations()));
+ result.putAll(getEnhancedRuleBuilderMap(databaseConfig.getRuleConfigurations()));
result.putAll(getMissedDefaultRuleBuilderMap(result.values()));
return result;
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRulesBuilderTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRulesBuilderTest.java
index e6c49ad520b..efd408b3851 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRulesBuilderTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRulesBuilderTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.infra.rule.builder.schema;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
-import org.apache.shardingsphere.infra.config.schema.impl.DataSourceProvidedSchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.impl.DataSourceProvidedDatabaseConfiguration;
import org.apache.shardingsphere.infra.fixture.TestRuleConfiguration;
import org.apache.shardingsphere.infra.fixture.TestShardingSphereRule;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
@@ -37,7 +37,7 @@ public final class SchemaRulesBuilderTest {
@Test
public void assertBuild() {
Collection<ShardingSphereRule> actual = SchemaRulesBuilder.buildRules(
- "schema_name", new DataSourceProvidedSchemaConfiguration(Collections.emptyMap(), Collections.singleton(new TestRuleConfiguration())), new ConfigurationProperties(new Properties()));
+ "schema_name", new DataSourceProvidedDatabaseConfiguration(Collections.emptyMap(), Collections.singleton(new TestRuleConfiguration())), new ConfigurationProperties(new Properties()));
assertThat(actual.size(), is(1));
assertThat(actual.iterator().next(), instanceOf(TestShardingSphereRule.class));
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/datasource/ShardingSphereDataSource.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/datasource/ShardingSphereDataSource.java
index 3bce804e894..97428dbc7a8 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/datasource/ShardingSphereDataSource.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/datasource/ShardingSphereDataSource.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.driver.state.DriverStateContext;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.config.checker.RuleConfigurationCheckerFactory;
import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
-import org.apache.shardingsphere.infra.config.schema.impl.DataSourceProvidedSchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.impl.DataSourceProvidedDatabaseConfiguration;
import org.apache.shardingsphere.infra.config.scope.GlobalRuleConfiguration;
import org.apache.shardingsphere.infra.instance.definition.InstanceDefinition;
import org.apache.shardingsphere.infra.instance.definition.InstanceType;
@@ -74,7 +74,7 @@ public final class ShardingSphereDataSource extends AbstractDataSourceAdapter im
Collection<RuleConfiguration> globalRuleConfigs = ruleConfigs.stream().filter(each -> each instanceof GlobalRuleConfiguration).collect(Collectors.toList());
ContextManagerBuilderParameter parameter = ContextManagerBuilderParameter.builder()
.modeConfig(modeConfig)
- .databaseConfigs(Collections.singletonMap(databaseName, new DataSourceProvidedSchemaConfiguration(dataSourceMap, ruleConfigs)))
+ .databaseConfigs(Collections.singletonMap(databaseName, new DataSourceProvidedDatabaseConfiguration(dataSourceMap, ruleConfigs)))
.globalRuleConfigs(globalRuleConfigs)
.props(props)
.instanceDefinition(new InstanceDefinition(InstanceType.JDBC)).build();
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/spi/TransactionConfigurationFileGenerator.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/spi/TransactionConfigurationFileGenerator.java
index ac8788fd5af..b8790e7a107 100644
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/spi/TransactionConfigurationFileGenerator.java
+++ b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/spi/TransactionConfigurationFileGenerator.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.transaction.spi;
-import org.apache.shardingsphere.infra.config.schema.SchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
import org.apache.shardingsphere.infra.instance.InstanceContext;
import org.apache.shardingsphere.spi.type.typed.StatelessTypedSPI;
@@ -40,9 +40,9 @@ public interface TransactionConfigurationFileGenerator extends StatelessTypedSPI
* Get transaction rule props.
*
* @param originTransactionProps origin transaction properties
- * @param schemaConfiguration schema configuration
+ * @param databaseConfiguration database configuration
* @param modeType mode type
* @return transaction rule props
*/
- Properties getTransactionProps(Properties originTransactionProps, SchemaConfiguration schemaConfiguration, String modeType);
+ Properties getTransactionProps(Properties originTransactionProps, DatabaseConfiguration databaseConfiguration, String modeType);
}
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/config/NarayanaConfigurationFileGenerator.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-x [...]
index 25349e37570..c205debfa86 100644
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/config/NarayanaConfigurationFileGenerator.java
+++ b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/config/NarayanaConfigurationFileGenerator.java
@@ -25,7 +25,7 @@ import com.arjuna.ats.internal.jta.recovery.arjunacore.JTAActionStatusServiceXAR
import com.arjuna.ats.internal.jta.recovery.arjunacore.JTANodeNameXAResourceOrphanFilter;
import com.arjuna.ats.internal.jta.recovery.arjunacore.JTATransactionLogXAResourceOrphanFilter;
import com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule;
-import org.apache.shardingsphere.infra.config.schema.SchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
@@ -140,12 +140,12 @@ public final class NarayanaConfigurationFileGenerator implements TransactionConf
}
@Override
- public Properties getTransactionProps(final Properties originTransactionProps, final SchemaConfiguration schemaConfiguration, final String modeType) {
+ public Properties getTransactionProps(final Properties originTransactionProps, final DatabaseConfiguration databaseConfiguration, final String modeType) {
Properties result = new Properties();
if (!originTransactionProps.isEmpty()) {
generateUserDefinedJdbcStoreConfiguration(originTransactionProps, result);
} else if ("Cluster".equals(modeType)) {
- generateDefaultJdbcStoreConfiguration(schemaConfiguration, result);
+ generateDefaultJdbcStoreConfiguration(databaseConfiguration, result);
}
return result;
}
@@ -158,8 +158,8 @@ public final class NarayanaConfigurationFileGenerator implements TransactionConf
generateTransactionProps(url, user, password, dataSourceClass, props);
}
- private void generateDefaultJdbcStoreConfiguration(final SchemaConfiguration schemaConfiguration, final Properties props) {
- Map<String, DataSource> datasourceMap = schemaConfiguration.getDataSources();
+ private void generateDefaultJdbcStoreConfiguration(final DatabaseConfiguration databaseConfiguration, final Properties props) {
+ Map<String, DataSource> datasourceMap = databaseConfiguration.getDataSources();
Optional<DataSource> dataSource = datasourceMap.values().stream().findFirst();
if (!dataSource.isPresent()) {
return;
diff --git a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java
index b4b7db3f240..6fa5cf46bca 100644
--- a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java
+++ b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java
@@ -22,8 +22,8 @@ import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
-import org.apache.shardingsphere.infra.config.schema.SchemaConfiguration;
-import org.apache.shardingsphere.infra.config.schema.impl.DataSourceProvidedSchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
+import org.apache.shardingsphere.infra.config.database.impl.DataSourceProvidedDatabaseConfiguration;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
import org.apache.shardingsphere.infra.datasource.pool.creator.DataSourcePoolCreator;
@@ -186,7 +186,7 @@ public final class ContextManager implements AutoCloseable {
}
private void refreshRules(final String schemaName, final ShardingSphereMetaData metaData) {
- Collection<ShardingSphereRule> rules = SchemaRulesBuilder.buildRules(schemaName, new DataSourceProvidedSchemaConfiguration(metaData.getResource().getDataSources(),
+ Collection<ShardingSphereRule> rules = SchemaRulesBuilder.buildRules(schemaName, new DataSourceProvidedDatabaseConfiguration(metaData.getResource().getDataSources(),
metaData.getRuleMetaData().getConfigurations()), new ConfigurationProperties(metaDataContexts.getProps().getProps()));
metaData.getRuleMetaData().getRules().clear();
metaData.getRuleMetaData().getRules().addAll(rules);
@@ -471,20 +471,20 @@ public final class ContextManager implements AutoCloseable {
Map<String, DataSource> dataSourceMap = new HashMap<>(originalMetaData.getResource().getDataSources());
dataSourceMap.putAll(DataSourcePoolCreator.create(addedDataSourceProps));
Properties props = metaDataContexts.getProps().getProps();
- SchemaConfiguration schemaConfiguration = new DataSourceProvidedSchemaConfiguration(dataSourceMap, originalMetaData.getRuleMetaData().getConfigurations());
+ DatabaseConfiguration databaseConfiguration = new DataSourceProvidedDatabaseConfiguration(dataSourceMap, originalMetaData.getRuleMetaData().getConfigurations());
Optional<MetaDataPersistService> metaDataPersistService = metaDataContexts.getMetaDataPersistService();
- metaDataPersistService.ifPresent(optional -> persistTransactionConfiguration(schemaConfiguration, optional));
+ metaDataPersistService.ifPresent(optional -> persistTransactionConfiguration(databaseConfiguration, optional));
MetaDataContextsBuilder metaDataContextsBuilder = new MetaDataContextsBuilder(metaDataContexts.getGlobalRuleMetaData().getConfigurations(), props);
- metaDataContextsBuilder.addSchema(originalMetaData.getName(), originalMetaData.getResource().getDatabaseType(), schemaConfiguration, props);
+ metaDataContextsBuilder.addDatabase(originalMetaData.getName(), originalMetaData.getResource().getDatabaseType(), databaseConfiguration, props);
metaDataContexts.getMetaDataPersistService().ifPresent(
optional -> optional.getSchemaMetaDataService().persist(originalMetaData.getName(), originalMetaData.getName(), metaDataContextsBuilder.getSchemaMap(originalMetaData.getName())));
return metaDataContextsBuilder.build(metaDataContexts.getMetaDataPersistService().orElse(null));
}
- private void persistTransactionConfiguration(final SchemaConfiguration schemaConfiguration, final MetaDataPersistService metaDataPersistService) {
+ private void persistTransactionConfiguration(final DatabaseConfiguration databaseConfiguration, final MetaDataPersistService metaDataPersistService) {
Optional<TransactionConfigurationFileGenerator> fileGenerator = TransactionConfigurationFileGeneratorFactory.newInstance(getTransactionRule().getProviderType());
if (fileGenerator.isPresent()) {
- Properties transactionProps = fileGenerator.get().getTransactionProps(getTransactionRule().getProps(), schemaConfiguration, instanceContext.getModeConfiguration().getType());
+ Properties transactionProps = fileGenerator.get().getTransactionProps(getTransactionRule().getProps(), databaseConfiguration, instanceContext.getModeConfiguration().getType());
metaDataPersistService.persistTransactionRule(transactionProps, true);
}
}
@@ -492,8 +492,8 @@ public final class ContextManager implements AutoCloseable {
private MetaDataContexts buildChangedMetaDataContext(final ShardingSphereMetaData originalMetaData, final Collection<RuleConfiguration> ruleConfigs) throws SQLException {
Properties props = metaDataContexts.getProps().getProps();
MetaDataContextsBuilder metaDataContextsBuilder = new MetaDataContextsBuilder(metaDataContexts.getGlobalRuleMetaData().getConfigurations(), props);
- metaDataContextsBuilder.addSchema(originalMetaData.getName(), originalMetaData.getResource().getDatabaseType(),
- new DataSourceProvidedSchemaConfiguration(originalMetaData.getResource().getDataSources(), ruleConfigs), props);
+ metaDataContextsBuilder.addDatabase(originalMetaData.getName(), originalMetaData.getResource().getDatabaseType(),
+ new DataSourceProvidedDatabaseConfiguration(originalMetaData.getResource().getDataSources(), ruleConfigs), props);
metaDataContexts.getMetaDataPersistService().ifPresent(
optional -> optional.getSchemaMetaDataService().persist(originalMetaData.getName(), originalMetaData.getName(), metaDataContextsBuilder.getSchemaMap(originalMetaData.getName())));
return metaDataContextsBuilder.build(metaDataContexts.getMetaDataPersistService().orElse(null));
@@ -505,7 +505,7 @@ public final class ContextManager implements AutoCloseable {
Map<String, DataSource> changedDataSources = buildChangedDataSources(originalMetaData, newDataSourceProps);
Properties props = metaDataContexts.getProps().getProps();
MetaDataContextsBuilder metaDataContextsBuilder = new MetaDataContextsBuilder(metaDataContexts.getGlobalRuleMetaData().getConfigurations(), props);
- metaDataContextsBuilder.addSchema(originalMetaData.getName(), originalMetaData.getResource().getDatabaseType(), new DataSourceProvidedSchemaConfiguration(
+ metaDataContextsBuilder.addDatabase(originalMetaData.getName(), originalMetaData.getResource().getDatabaseType(), new DataSourceProvidedDatabaseConfiguration(
getNewDataSources(originalMetaData.getResource().getDataSources(), getAddedDataSources(originalMetaData, newDataSourceProps), changedDataSources, deletedDataSources),
originalMetaData.getRuleMetaData().getConfigurations()), props);
metaDataContexts.getMetaDataPersistService().ifPresent(
@@ -519,8 +519,8 @@ public final class ContextManager implements AutoCloseable {
Map<String, DataSource> changedDataSources = buildChangedDataSources(originalMetaData, newDataSourceProps);
Properties props = metaDataContexts.getProps().getProps();
MetaDataContextsBuilder metaDataContextsBuilder = new MetaDataContextsBuilder(metaDataContexts.getGlobalRuleMetaData().getConfigurations(), props);
- metaDataContextsBuilder.addSchema(originalMetaData.getName(), originalMetaData.getResource().getDatabaseType(),
- new DataSourceProvidedSchemaConfiguration(getNewDataSources(originalMetaData.getResource().getDataSources(),
+ metaDataContextsBuilder.addDatabase(originalMetaData.getName(), originalMetaData.getResource().getDatabaseType(),
+ new DataSourceProvidedDatabaseConfiguration(getNewDataSources(originalMetaData.getResource().getDataSources(),
getAddedDataSources(originalMetaData, newDataSourceProps), changedDataSources, deletedDataSources), ruleConfigs), props);
metaDataContexts.getMetaDataPersistService().ifPresent(
optional -> optional.getSchemaMetaDataService().persist(originalMetaData.getName(), originalMetaData.getName(), metaDataContextsBuilder.getSchemaMap(originalMetaData.getName())));
@@ -578,7 +578,7 @@ public final class ContextManager implements AutoCloseable {
private MetaDataContexts buildNewMetaDataContext(final String schemaName) throws SQLException {
Properties props = metaDataContexts.getProps().getProps();
MetaDataContextsBuilder metaDataContextsBuilder = new MetaDataContextsBuilder(metaDataContexts.getGlobalRuleMetaData().getConfigurations(), props);
- metaDataContextsBuilder.addSchema(schemaName, DatabaseTypeRegistry.getDefaultDatabaseType(), new DataSourceProvidedSchemaConfiguration(new HashMap<>(), new LinkedList<>()), props);
+ metaDataContextsBuilder.addDatabase(schemaName, DatabaseTypeRegistry.getDefaultDatabaseType(), new DataSourceProvidedDatabaseConfiguration(new HashMap<>(), new LinkedList<>()), props);
return metaDataContextsBuilder.build(metaDataContexts.getMetaDataPersistService().orElse(null));
}
diff --git a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManagerBuilderParameter.java b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManagerBuilderParameter.java
index ff31b42aa00..918fdbb6e49 100644
--- a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManagerBuilderParameter.java
+++ b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManagerBuilderParameter.java
@@ -21,7 +21,7 @@ import lombok.Builder;
import lombok.Getter;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
-import org.apache.shardingsphere.infra.config.schema.SchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
import org.apache.shardingsphere.infra.instance.definition.InstanceDefinition;
import java.util.Collection;
@@ -37,7 +37,7 @@ public final class ContextManagerBuilderParameter {
private final ModeConfiguration modeConfig;
- private final Map<String, ? extends SchemaConfiguration> databaseConfigs;
+ private final Map<String, ? extends DatabaseConfiguration> databaseConfigs;
private final Collection<RuleConfiguration> globalRuleConfigs;
diff --git a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsBuilder.java b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsBuilder.java
index d1ad741675e..0e07d93e006 100644
--- a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsBuilder.java
+++ b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsBuilder.java
@@ -19,10 +19,10 @@ package org.apache.shardingsphere.mode.metadata;
import lombok.Getter;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
+import org.apache.shardingsphere.infra.config.database.impl.DataSourceProvidedDatabaseConfiguration;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
-import org.apache.shardingsphere.infra.config.schema.SchemaConfiguration;
-import org.apache.shardingsphere.infra.config.schema.impl.DataSourceProvidedSchemaConfiguration;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeFactory;
import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
@@ -51,9 +51,9 @@ import java.util.Properties;
*/
public final class MetaDataContextsBuilder {
- private final Map<String, SchemaConfiguration> schemaConfigMap = new LinkedHashMap<>();
+ private final Map<String, DatabaseConfiguration> databaseConfigMap = new LinkedHashMap<>();
- private final Map<String, Collection<ShardingSphereRule>> schemaRulesMap = new LinkedHashMap<>();
+ private final Map<String, Collection<ShardingSphereRule>> databaseRulesMap = new LinkedHashMap<>();
@Getter
private final Map<String, ShardingSphereDatabase> databaseMap = new LinkedHashMap<>();
@@ -71,20 +71,20 @@ public final class MetaDataContextsBuilder {
}
/**
- * Add schema information.
+ * Add database information.
*
- * @param schemaName schema name
+ * @param databaseName schema name
* @param databaseType database type
- * @param schemaConfig schema configuration
+ * @param databaseConfig database configuration
* @param props properties
* @throws SQLException SQL exception
*/
- public void addSchema(final String schemaName, final DatabaseType databaseType, final SchemaConfiguration schemaConfig, final Properties props) throws SQLException {
- Collection<ShardingSphereRule> schemaRules = getSchemaRules(schemaName, schemaConfig, props);
- ShardingSphereDatabase database = DatabaseLoader.load(schemaName, databaseType, schemaConfig.getDataSources(), schemaRules, props);
- schemaConfigMap.put(schemaName, schemaConfig);
- schemaRulesMap.put(schemaName, schemaRules);
- databaseMap.put(schemaName, database);
+ public void addDatabase(final String databaseName, final DatabaseType databaseType, final DatabaseConfiguration databaseConfig, final Properties props) throws SQLException {
+ Collection<ShardingSphereRule> databaseRules = getDatabaseRules(databaseName, databaseConfig, props);
+ ShardingSphereDatabase database = DatabaseLoader.load(databaseName, databaseType, databaseConfig.getDataSources(), databaseRules, props);
+ databaseConfigMap.put(databaseName, databaseConfig);
+ databaseRulesMap.put(databaseName, databaseRules);
+ databaseMap.put(databaseName, database);
}
/**
@@ -92,7 +92,7 @@ public final class MetaDataContextsBuilder {
*
* @param databaseType database type
*/
- public void addSystemSchemas(final DatabaseType databaseType) {
+ public void addSystemDatabases(final DatabaseType databaseType) {
for (String each : databaseType.getSystemDatabaseSchemaMap().keySet()) {
if (databaseMap.containsKey(each)) {
continue;
@@ -101,8 +101,8 @@ public final class MetaDataContextsBuilder {
}
}
- private Collection<ShardingSphereRule> getSchemaRules(final String databaseName, final SchemaConfiguration schemaConfig, final Properties props) {
- return SchemaRulesBuilder.buildRules(databaseName, schemaConfig, new ConfigurationProperties(props));
+ private Collection<ShardingSphereRule> getDatabaseRules(final String databaseName, final DatabaseConfiguration databaseConfig, final Properties props) {
+ return SchemaRulesBuilder.buildRules(databaseName, databaseConfig, new ConfigurationProperties(props));
}
/**
@@ -119,14 +119,14 @@ public final class MetaDataContextsBuilder {
}
private Map<String, ShardingSphereMetaData> getMetaDataMap() throws SQLException {
- DatabaseType defaultDatabaseType = DatabaseTypeFactory.getDatabaseType(schemaConfigMap, props);
+ DatabaseType defaultDatabaseType = DatabaseTypeFactory.getDatabaseType(databaseConfigMap, props);
Map<String, ShardingSphereMetaData> result = new HashMap<>(databaseMap.size(), 1);
for (Entry<String, ShardingSphereDatabase> entry : databaseMap.entrySet()) {
String databaseName = entry.getKey();
// TODO support database and schema configuration separately
- SchemaConfiguration schemaConfig = schemaConfigMap.getOrDefault(databaseName, new DataSourceProvidedSchemaConfiguration(new LinkedHashMap<>(), new LinkedList<>()));
- Collection<ShardingSphereRule> rules = schemaRulesMap.getOrDefault(databaseName, new LinkedList<>());
- result.put(databaseName, ShardingSphereMetaData.create(databaseName, entry.getValue().getSchemas(), schemaConfig, rules, defaultDatabaseType));
+ DatabaseConfiguration databaseConfig = databaseConfigMap.getOrDefault(databaseName, new DataSourceProvidedDatabaseConfiguration(new LinkedHashMap<>(), new LinkedList<>()));
+ Collection<ShardingSphereRule> rules = databaseRulesMap.getOrDefault(databaseName, new LinkedList<>());
+ result.put(databaseName, ShardingSphereMetaData.create(databaseName, entry.getValue().getSchemas(), databaseConfig, rules, defaultDatabaseType));
}
return result;
}
diff --git a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/MetaDataPersistService.java b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/MetaDataPersistService.java
index d571e7840e0..faa13215734 100644
--- a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/MetaDataPersistService.java
+++ b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/MetaDataPersistService.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.mode.metadata.persist;
import com.google.common.base.Preconditions;
import lombok.Getter;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
-import org.apache.shardingsphere.infra.config.schema.SchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
import org.apache.shardingsphere.infra.datasource.pool.creator.DataSourcePoolCreator;
import org.apache.shardingsphere.infra.datasource.pool.destroyer.DataSourcePoolDestroyer;
import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
@@ -84,11 +84,11 @@ public final class MetaDataPersistService {
* @param props properties
* @param isOverwrite whether overwrite registry center's configuration if existed
*/
- public void persistConfigurations(final Map<String, ? extends SchemaConfiguration> schemaConfigs,
+ public void persistConfigurations(final Map<String, ? extends DatabaseConfiguration> schemaConfigs,
final Collection<RuleConfiguration> globalRuleConfigs, final Properties props, final boolean isOverwrite) {
globalRuleService.persist(globalRuleConfigs, isOverwrite);
propsService.persist(props, isOverwrite);
- for (Entry<String, ? extends SchemaConfiguration> entry : schemaConfigs.entrySet()) {
+ for (Entry<String, ? extends DatabaseConfiguration> entry : schemaConfigs.entrySet()) {
String schemaName = entry.getKey();
dataSourceService.persist(schemaName, getDataSourcePropertiesMap(entry.getValue().getDataSources()), isOverwrite);
schemaRuleService.persist(schemaName, entry.getValue().getRuleConfigurations(), isOverwrite);
@@ -117,14 +117,14 @@ public final class MetaDataPersistService {
/**
* Get effective data sources.
*
- * @param schemaName schema name
- * @param schemaConfigs schema configurations
+ * @param databaseName database name
+ * @param databaseConfigs database configurations
* @return effective data sources
*/
- public Map<String, DataSource> getEffectiveDataSources(final String schemaName, final Map<String, ? extends SchemaConfiguration> schemaConfigs) {
- Map<String, DataSourceProperties> persistedDataPropsMap = dataSourceService.load(schemaName);
- return schemaConfigs.containsKey(schemaName)
- ? mergeEffectiveDataSources(persistedDataPropsMap, schemaConfigs.get(schemaName).getDataSources()) : DataSourcePoolCreator.create(persistedDataPropsMap);
+ public Map<String, DataSource> getEffectiveDataSources(final String databaseName, final Map<String, ? extends DatabaseConfiguration> databaseConfigs) {
+ Map<String, DataSourceProperties> persistedDataPropsMap = dataSourceService.load(databaseName);
+ return databaseConfigs.containsKey(databaseName)
+ ? mergeEffectiveDataSources(persistedDataPropsMap, databaseConfigs.get(databaseName).getDataSources()) : DataSourcePoolCreator.create(persistedDataPropsMap);
}
private Map<String, DataSource> mergeEffectiveDataSources(
diff --git a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/node/SchemaMetaDataNode.java b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/node/SchemaMetaDataNode.java
index 2576413eea7..2d4a15d0254 100644
--- a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/node/SchemaMetaDataNode.java
+++ b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/node/SchemaMetaDataNode.java
@@ -46,12 +46,12 @@ public final class SchemaMetaDataNode {
/**
* Get meta data data source path.
*
- * @param schemaName schema name
+ * @param databaseName database name
* @param version data source version
* @return data source path
*/
- public static String getMetaDataDataSourcePath(final String schemaName, final String version) {
- return Joiner.on("/").join(getFullMetaDataPath(schemaName, VERSIONS), version, DATA_SOURCE_NODE);
+ public static String getMetaDataDataSourcePath(final String databaseName, final String version) {
+ return Joiner.on("/").join(getFullMetaDataPath(databaseName, VERSIONS), version, DATA_SOURCE_NODE);
}
/**
@@ -117,8 +117,8 @@ public final class SchemaMetaDataNode {
return String.join("/", getMetaDataTablesPath(databaseName, schemaName), table);
}
- private static String getFullMetaDataPath(final String schemaName, final String node) {
- return String.join("/", "", ROOT_NODE, schemaName, schemaName, node);
+ private static String getFullMetaDataPath(final String databaseName, final String node) {
+ return String.join("/", "", ROOT_NODE, databaseName, databaseName, node);
}
/**
@@ -160,11 +160,11 @@ public final class SchemaMetaDataNode {
/**
* Get active version path.
*
- * @param schemaName schema name
+ * @param databaseName database name
* @return active version path
*/
- public static String getActiveVersionPath(final String schemaName) {
- return getFullMetaDataPath(schemaName, ACTIVE_VERSION);
+ public static String getActiveVersionPath(final String databaseName) {
+ return getFullMetaDataPath(databaseName, ACTIVE_VERSION);
}
/**
diff --git a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/SchemaMetaDataPersistService.java b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/SchemaMetaDataPersistService.java
index 037275ff552..ea2c1e21f65 100644
--- a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/SchemaMetaDataPersistService.java
+++ b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/SchemaMetaDataPersistService.java
@@ -165,9 +165,9 @@ public final class SchemaMetaDataPersistService {
}
/**
- * Load all schema names.
+ * Load all database names.
*
- * @return all schema names
+ * @return all database names
*/
public Collection<String> loadAllNames() {
return repository.getChildrenKeys(SchemaMetaDataNode.getMetaDataNodePath());
diff --git a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/impl/DataSourcePersistService.java b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/impl/DataSourcePersistService.java
index 0e191db3c41..dae6fa2cfdb 100644
--- a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/impl/DataSourcePersistService.java
+++ b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/impl/DataSourcePersistService.java
@@ -20,11 +20,11 @@ package org.apache.shardingsphere.mode.metadata.persist.service.impl;
import com.google.common.base.Strings;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
-import org.apache.shardingsphere.mode.persist.PersistRepository;
-import org.apache.shardingsphere.mode.metadata.persist.node.SchemaMetaDataNode;
-import org.apache.shardingsphere.mode.metadata.persist.service.SchemaBasedPersistService;
import org.apache.shardingsphere.infra.yaml.config.swapper.YamlDataSourceConfigurationSwapper;
import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
+import org.apache.shardingsphere.mode.metadata.persist.node.SchemaMetaDataNode;
+import org.apache.shardingsphere.mode.metadata.persist.service.SchemaBasedPersistService;
+import org.apache.shardingsphere.mode.persist.PersistRepository;
import java.util.Collection;
import java.util.LinkedHashMap;
@@ -68,8 +68,9 @@ public final class DataSourcePersistService implements SchemaBasedPersistService
}
@Override
- public Map<String, DataSourceProperties> load(final String schemaName) {
- return isExisted(schemaName) ? getDataSourceProperties(repository.get(SchemaMetaDataNode.getMetaDataDataSourcePath(schemaName, getSchemaActiveVersion(schemaName)))) : new LinkedHashMap<>();
+ public Map<String, DataSourceProperties> load(final String databaseName) {
+ return isExisted(databaseName) ? getDataSourceProperties(repository.get(
+ SchemaMetaDataNode.getMetaDataDataSourcePath(databaseName, getSchemaActiveVersion(databaseName)))) : new LinkedHashMap<>();
}
@Override
@@ -90,9 +91,9 @@ public final class DataSourcePersistService implements SchemaBasedPersistService
}
@Override
- public boolean isExisted(final String schemaName) {
- return !Strings.isNullOrEmpty(getSchemaActiveVersion(schemaName)) && !Strings.isNullOrEmpty(repository.get(SchemaMetaDataNode.getMetaDataDataSourcePath(schemaName,
- getSchemaActiveVersion(schemaName))));
+ public boolean isExisted(final String databaseName) {
+ return !Strings.isNullOrEmpty(getSchemaActiveVersion(databaseName)) && !Strings.isNullOrEmpty(repository.get(SchemaMetaDataNode.getMetaDataDataSourcePath(databaseName,
+ getSchemaActiveVersion(databaseName))));
}
/**
@@ -121,7 +122,7 @@ public final class DataSourcePersistService implements SchemaBasedPersistService
persist(schemaName, dataSourcePropsMap);
}
- private String getSchemaActiveVersion(final String schemaName) {
- return repository.get(SchemaMetaDataNode.getActiveVersionPath(schemaName));
+ private String getSchemaActiveVersion(final String databaseName) {
+ return repository.get(SchemaMetaDataNode.getActiveVersionPath(databaseName));
}
}
diff --git a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerBuilderParameterTest.java b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerBuilderParameterTest.java
index 0bb3fb5838b..8c866fadce1 100644
--- a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerBuilderParameterTest.java
+++ b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerBuilderParameterTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.mode.manager;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
-import org.apache.shardingsphere.infra.config.schema.SchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
import org.junit.Test;
import org.mockito.Mockito;
@@ -39,11 +39,11 @@ public final class ContextManagerBuilderParameterTest {
@Test
public void assertIsEmpty() {
- Map<String, SchemaConfiguration> mockSchemaConfigs = getMockSchemaConfiguration(true, true);
+ Map<String, DatabaseConfiguration> mockDatabaseConfigs = getMockSchemaConfiguration(true, true);
ContextManagerBuilderParameter contextManagerBuilderParameter = ContextManagerBuilderParameter.builder()
.globalRuleConfigs(Collections.emptyList())
.props(new Properties())
- .databaseConfigs(mockSchemaConfigs)
+ .databaseConfigs(mockDatabaseConfigs)
.build();
assertTrue(contextManagerBuilderParameter.isEmpty());
}
@@ -65,11 +65,11 @@ public final class ContextManagerBuilderParameterTest {
when(mockProperties.isEmpty()).thenReturn(false);
Collection<RuleConfiguration> mockGlobalRuleConfigs = mock(Collection.class);
lenient().when(mockGlobalRuleConfigs.isEmpty()).thenReturn(false);
- Map<String, SchemaConfiguration> mockSchemaConfigs = getMockSchemaConfiguration(false, false);
+ Map<String, DatabaseConfiguration> mockDatabaseConfigs = getMockSchemaConfiguration(false, false);
ContextManagerBuilderParameter contextManagerBuilderParameter = ContextManagerBuilderParameter.builder()
.globalRuleConfigs(mockGlobalRuleConfigs)
.props(mockProperties)
- .databaseConfigs(mockSchemaConfigs)
+ .databaseConfigs(mockDatabaseConfigs)
.build();
assertFalse(contextManagerBuilderParameter.isEmpty());
}
@@ -101,33 +101,33 @@ public final class ContextManagerBuilderParameterTest {
@Test
public void assertIsEmptyWhenSchemaConfigsIsNotEmpty() {
- Map<String, SchemaConfiguration> mockSchemaConfigs = getMockSchemaConfiguration(false, false);
+ Map<String, DatabaseConfiguration> mockDatabaseConfigs = getMockSchemaConfiguration(false, false);
ContextManagerBuilderParameter contextManagerBuilderParameter = ContextManagerBuilderParameter.builder()
.globalRuleConfigs(Collections.emptyList())
.props(new Properties())
- .databaseConfigs(mockSchemaConfigs)
+ .databaseConfigs(mockDatabaseConfigs)
.build();
assertFalse(contextManagerBuilderParameter.isEmpty());
}
@Test
public void assertIsEmptyWhenDataSourcesIsNotEmpty() {
- Map<String, SchemaConfiguration> mockSchemaConfigs = getMockSchemaConfiguration(false, true);
+ Map<String, DatabaseConfiguration> mockDatabaseConfigs = getMockSchemaConfiguration(false, true);
ContextManagerBuilderParameter contextManagerBuilderParameter = ContextManagerBuilderParameter.builder()
.globalRuleConfigs(Collections.emptyList())
.props(new Properties())
- .databaseConfigs(mockSchemaConfigs)
+ .databaseConfigs(mockDatabaseConfigs)
.build();
assertFalse(contextManagerBuilderParameter.isEmpty());
}
@Test
public void assertIsEmptyWhenRuleConfigurationsIsNotEmpty() {
- Map<String, SchemaConfiguration> mockSchemaConfigs = getMockSchemaConfiguration(true, false);
+ Map<String, DatabaseConfiguration> mockDatabaseConfigs = getMockSchemaConfiguration(true, false);
ContextManagerBuilderParameter contextManagerBuilderParameter = ContextManagerBuilderParameter.builder()
.globalRuleConfigs(Collections.emptyList())
.props(new Properties())
- .databaseConfigs(mockSchemaConfigs)
+ .databaseConfigs(mockDatabaseConfigs)
.build();
assertFalse(contextManagerBuilderParameter.isEmpty());
}
@@ -135,26 +135,26 @@ public final class ContextManagerBuilderParameterTest {
@Test
@SuppressWarnings("unchecked")
public void assertIsEmptyWhenOnlyPropsIsEmpty() {
- Map<String, SchemaConfiguration> mockSchemaConfigs = getMockSchemaConfiguration(true, true);
+ Map<String, DatabaseConfiguration> mockDatabaseConfigs = getMockSchemaConfiguration(true, true);
Collection<RuleConfiguration> mockGlobalRuleConfigs = mock(Collection.class);
lenient().when(mockGlobalRuleConfigs.isEmpty()).thenReturn(false);
ContextManagerBuilderParameter contextManagerBuilderParameter = ContextManagerBuilderParameter.builder()
.globalRuleConfigs(mockGlobalRuleConfigs)
.props(new Properties())
- .databaseConfigs(mockSchemaConfigs)
+ .databaseConfigs(mockDatabaseConfigs)
.build();
assertFalse(contextManagerBuilderParameter.isEmpty());
}
@Test
public void assertIsEmptyWhenOnlyGlobalRuleConfigsIsEmpty() {
- Map<String, SchemaConfiguration> mockSchemaConfigs = getMockSchemaConfiguration(true, true);
+ Map<String, DatabaseConfiguration> mockDatabaseConfigs = getMockSchemaConfiguration(true, true);
Properties mockProperties = mock(Properties.class);
lenient().when(mockProperties.isEmpty()).thenReturn(false);
ContextManagerBuilderParameter contextManagerBuilderParameter = ContextManagerBuilderParameter.builder()
.globalRuleConfigs(Collections.emptyList())
.props(mockProperties)
- .databaseConfigs(mockSchemaConfigs)
+ .databaseConfigs(mockDatabaseConfigs)
.build();
assertFalse(contextManagerBuilderParameter.isEmpty());
}
@@ -174,11 +174,11 @@ public final class ContextManagerBuilderParameterTest {
assertFalse(contextManagerBuilderParameter.isEmpty());
}
- private Map<String, SchemaConfiguration> getMockSchemaConfiguration(final boolean dataSourcesIsEmpty, final boolean ruleConfigurationsIsEmpty) {
- SchemaConfiguration mockSchemaConfiguration = Mockito.mock(SchemaConfiguration.class, RETURNS_DEEP_STUBS);
+ private Map<String, DatabaseConfiguration> getMockSchemaConfiguration(final boolean dataSourcesIsEmpty, final boolean ruleConfigurationsIsEmpty) {
+ DatabaseConfiguration mockSchemaConfiguration = Mockito.mock(DatabaseConfiguration.class, RETURNS_DEEP_STUBS);
lenient().when(mockSchemaConfiguration.getDataSources().isEmpty()).thenReturn(dataSourcesIsEmpty);
lenient().when(mockSchemaConfiguration.getRuleConfigurations().isEmpty()).thenReturn(ruleConfigurationsIsEmpty);
- Map<String, SchemaConfiguration> result = new HashMap<>();
+ Map<String, DatabaseConfiguration> result = new HashMap<>();
result.put("logic", mockSchemaConfiguration);
return result;
}
diff --git a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsBuilderTest.java b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsBuilderTest.java
index 3d70ed9681a..32610f6c697 100644
--- a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsBuilderTest.java
+++ b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsBuilderTest.java
@@ -21,7 +21,7 @@ import org.apache.shardingsphere.authority.config.AuthorityRuleConfiguration;
import org.apache.shardingsphere.authority.rule.AuthorityRule;
import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
-import org.apache.shardingsphere.infra.config.schema.impl.DataSourceProvidedSchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.impl.DataSourceProvidedDatabaseConfiguration;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
@@ -55,8 +55,8 @@ public final class MetaDataContextsBuilderTest {
AuthorityRuleConfiguration authorityRuleConfig = new AuthorityRuleConfiguration(Collections.singleton(user),
new ShardingSphereAlgorithmConfiguration("ALL_PRIVILEGES_PERMITTED", new Properties()));
MetaDataContextsBuilder builder = new MetaDataContextsBuilder(Collections.singleton(authorityRuleConfig), props);
- builder.addSchema("logic_db", DatabaseTypeRegistry.getDefaultDatabaseType(),
- new DataSourceProvidedSchemaConfiguration(Collections.emptyMap(), Collections.singletonList(new FixtureRuleConfiguration())), props);
+ builder.addDatabase("logic_db", DatabaseTypeRegistry.getDefaultDatabaseType(),
+ new DataSourceProvidedDatabaseConfiguration(Collections.emptyMap(), Collections.singletonList(new FixtureRuleConfiguration())), props);
MetaDataContexts actual = builder.build(mock(MetaDataPersistService.class));
assertRules(actual);
assertTrue(actual.getMetaData("logic_db").getResource().getDataSources().isEmpty());
@@ -76,7 +76,7 @@ public final class MetaDataContextsBuilderTest {
@Test
public void assertBuildWithEmptyRuleConfigurations() throws SQLException {
MetaDataContextsBuilder builder = new MetaDataContextsBuilder(Collections.emptyList(), new Properties());
- builder.addSystemSchemas(new MySQLDatabaseType());
+ builder.addSystemDatabases(new MySQLDatabaseType());
MetaDataContexts actual = builder.build(mock(MetaDataPersistService.class));
assertThat(actual.getMetaDataMap().size(), is(4));
assertTrue(actual.getMetaDataMap().containsKey("information_schema"));
diff --git a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/MetaDataPersistServiceTest.java b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/MetaDataPersistServiceTest.java
index 614dd32cc6c..2209dbfe0b3 100644
--- a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/MetaDataPersistServiceTest.java
+++ b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/MetaDataPersistServiceTest.java
@@ -19,9 +19,9 @@ package org.apache.shardingsphere.mode.metadata.persist;
import lombok.SneakyThrows;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
+import org.apache.shardingsphere.infra.config.database.impl.DataSourceProvidedDatabaseConfiguration;
import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
-import org.apache.shardingsphere.infra.config.schema.SchemaConfiguration;
-import org.apache.shardingsphere.infra.config.schema.impl.DataSourceProvidedSchemaConfiguration;
import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
import org.apache.shardingsphere.infra.datasource.props.DataSourcePropertiesCreator;
import org.apache.shardingsphere.infra.yaml.config.swapper.YamlRuleConfigurationSwapperEngine;
@@ -102,7 +102,7 @@ public final class MetaDataPersistServiceTest {
Collection<RuleConfiguration> globalRuleConfigs = createGlobalRuleConfigurations();
Properties props = createProperties();
metaDataPersistService.persistConfigurations(
- Collections.singletonMap("foo_db", new DataSourceProvidedSchemaConfiguration(dataSourceMap, ruleConfigs)), globalRuleConfigs, props, false);
+ Collections.singletonMap("foo_db", new DataSourceProvidedDatabaseConfiguration(dataSourceMap, ruleConfigs)), globalRuleConfigs, props, false);
verify(dataSourceService).persist("foo_db", createDataSourcePropertiesMap(dataSourceMap), false);
verify(schemaRuleService).persist("foo_db", ruleConfigs, false);
verify(globalRuleService).persist(globalRuleConfigs, false);
@@ -160,8 +160,8 @@ public final class MetaDataPersistServiceTest {
public void assertGetEffectiveDataSources() {
Map<String, DataSource> dataSourceMap = createDataSourceMap();
Collection<RuleConfiguration> ruleConfigs = createRuleConfigurations();
- Map<String, SchemaConfiguration> schemaConfigs = Collections.singletonMap("foo_db", new DataSourceProvidedSchemaConfiguration(dataSourceMap, ruleConfigs));
- Map<String, DataSource> resultEffectiveDataSources = metaDataPersistService.getEffectiveDataSources("foo_db", schemaConfigs);
+ Map<String, DatabaseConfiguration> databaseConfigs = Collections.singletonMap("foo_db", new DataSourceProvidedDatabaseConfiguration(dataSourceMap, ruleConfigs));
+ Map<String, DataSource> resultEffectiveDataSources = metaDataPersistService.getEffectiveDataSources("foo_db", databaseConfigs);
assertTrue(resultEffectiveDataSources.isEmpty());
}
}
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
index ada4213f4e1..9a3e2c65929 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
@@ -21,8 +21,8 @@ import com.google.common.base.Preconditions;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
-import org.apache.shardingsphere.infra.config.schema.SchemaConfiguration;
-import org.apache.shardingsphere.infra.config.schema.impl.DataSourceProvidedSchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
+import org.apache.shardingsphere.infra.config.database.impl.DataSourceProvidedDatabaseConfiguration;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeFactory;
import org.apache.shardingsphere.infra.instance.ComputeNodeInstance;
@@ -103,7 +103,7 @@ public final class ClusterContextManagerBuilder implements ContextManagerBuilder
}
ShardingSphereMetaData metaData = metaDataContexts.getMetaData(schemaName.get());
Properties result = fileGenerator.get().getTransactionProps(transactionRule.get().getProps(),
- new DataSourceProvidedSchemaConfiguration(metaData.getResource().getDataSources(), metaData.getRuleMetaData().getConfigurations()), getType());
+ new DataSourceProvidedDatabaseConfiguration(metaData.getResource().getDataSources(), metaData.getRuleMetaData().getConfigurations()), getType());
Optional<TransactionRuleConfiguration> transactionRuleConfig = metaDataContexts.getGlobalRuleMetaData().findSingleRuleConfiguration(TransactionRuleConfiguration.class);
Preconditions.checkState(transactionRuleConfig.isPresent());
transactionRuleConfig.get().getProps().clear();
@@ -124,27 +124,27 @@ public final class ClusterContextManagerBuilder implements ContextManagerBuilder
}
private MetaDataContextsBuilder createMetaDataContextsBuilder(final MetaDataPersistService metaDataPersistService, final ContextManagerBuilderParameter parameter) throws SQLException {
- Collection<String> schemaNames = InstanceType.JDBC == parameter.getInstanceDefinition().getInstanceType()
+ Collection<String> databaseNames = InstanceType.JDBC == parameter.getInstanceDefinition().getInstanceType()
? parameter.getDatabaseConfigs().keySet() : metaDataPersistService.getSchemaMetaDataService().loadAllNames();
Collection<RuleConfiguration> globalRuleConfigs = metaDataPersistService.getGlobalRuleService().load();
Properties props = metaDataPersistService.getPropsService().load();
MetaDataContextsBuilder result = new MetaDataContextsBuilder(globalRuleConfigs, props);
DatabaseType databaseType = DatabaseTypeFactory.getDatabaseType(parameter.getDatabaseConfigs(), new ConfigurationProperties(parameter.getProps()));
- for (String each : schemaNames) {
+ for (String each : databaseNames) {
if (databaseType.getSystemSchemas().contains(each)) {
continue;
}
- result.addSchema(each, databaseType, createSchemaConfiguration(each, metaDataPersistService, parameter), props);
+ result.addDatabase(each, databaseType, createDatabaseConfiguration(each, metaDataPersistService, parameter), props);
}
- result.addSystemSchemas(databaseType);
+ result.addSystemDatabases(databaseType);
return result;
}
- private SchemaConfiguration createSchemaConfiguration(final String schemaName, final MetaDataPersistService metaDataPersistService,
- final ContextManagerBuilderParameter parameter) {
- Map<String, DataSource> dataSources = metaDataPersistService.getEffectiveDataSources(schemaName, parameter.getDatabaseConfigs());
- Collection<RuleConfiguration> schemaRuleConfigs = metaDataPersistService.getSchemaRuleService().load(schemaName);
- return new DataSourceProvidedSchemaConfiguration(dataSources, schemaRuleConfigs);
+ private DatabaseConfiguration createDatabaseConfiguration(final String databaseName, final MetaDataPersistService metaDataPersistService,
+ final ContextManagerBuilderParameter parameter) {
+ Map<String, DataSource> dataSources = metaDataPersistService.getEffectiveDataSources(databaseName, parameter.getDatabaseConfigs());
+ Collection<RuleConfiguration> databaseRuleConfigs = metaDataPersistService.getSchemaRuleService().load(databaseName);
+ return new DataSourceProvidedDatabaseConfiguration(dataSources, databaseRuleConfigs);
}
private void persistMetaData(final MetaDataPersistService metaDataPersistService, final Map<String, ShardingSphereDatabase> databaseMap) {
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/MemoryContextManagerBuilder.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/MemoryContextManagerBuilder.java
index 105dc1478f2..619c6b16867 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/MemoryContextManagerBuilder.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/MemoryContextManagerBuilder.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.mode.manager.memory;
import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
-import org.apache.shardingsphere.infra.config.schema.SchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeFactory;
import org.apache.shardingsphere.infra.instance.ComputeNodeInstance;
@@ -51,10 +51,10 @@ public final class MemoryContextManagerBuilder implements ContextManagerBuilder
public ContextManager build(final ContextManagerBuilderParameter parameter) throws SQLException {
MetaDataContextsBuilder metaDataContextsBuilder = new MetaDataContextsBuilder(parameter.getGlobalRuleConfigs(), parameter.getProps());
DatabaseType databaseType = DatabaseTypeFactory.getDatabaseType(parameter.getDatabaseConfigs(), new ConfigurationProperties(parameter.getProps()));
- for (Entry<String, ? extends SchemaConfiguration> entry : parameter.getDatabaseConfigs().entrySet()) {
- metaDataContextsBuilder.addSchema(entry.getKey(), databaseType, entry.getValue(), parameter.getProps());
+ for (Entry<String, ? extends DatabaseConfiguration> entry : parameter.getDatabaseConfigs().entrySet()) {
+ metaDataContextsBuilder.addDatabase(entry.getKey(), databaseType, entry.getValue(), parameter.getProps());
}
- metaDataContextsBuilder.addSystemSchemas(databaseType);
+ metaDataContextsBuilder.addSystemDatabases(databaseType);
MetaDataContexts metaDataContexts = metaDataContextsBuilder.build(null);
InstanceContext instanceContext = buildInstanceContext(parameter);
generateTransactionConfigurationFile(instanceContext, metaDataContexts);
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java
index caf9541501e..cbabcac2c2b 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java
@@ -18,9 +18,9 @@
package org.apache.shardingsphere.mode.manager.standalone;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
+import org.apache.shardingsphere.infra.config.database.impl.DataSourceProvidedDatabaseConfiguration;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
-import org.apache.shardingsphere.infra.config.schema.SchemaConfiguration;
-import org.apache.shardingsphere.infra.config.schema.impl.DataSourceProvidedSchemaConfiguration;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeFactory;
import org.apache.shardingsphere.infra.instance.InstanceContext;
@@ -71,24 +71,24 @@ public final class StandaloneContextManagerBuilder implements ContextManagerBuil
Collection<RuleConfiguration> globalRuleConfigs = metaDataPersistService.getGlobalRuleService().load();
Properties props = metaDataPersistService.getPropsService().load();
MetaDataContextsBuilder builder = new MetaDataContextsBuilder(globalRuleConfigs, props);
- Collection<String> schemaNames = InstanceType.JDBC == parameter.getInstanceDefinition().getInstanceType()
+ Collection<String> databaseNames = InstanceType.JDBC == parameter.getInstanceDefinition().getInstanceType()
? parameter.getDatabaseConfigs().keySet() : metaDataPersistService.getSchemaMetaDataService().loadAllNames();
DatabaseType databaseType = DatabaseTypeFactory.getDatabaseType(parameter.getDatabaseConfigs(), new ConfigurationProperties(parameter.getProps()));
- for (String each : schemaNames) {
+ for (String each : databaseNames) {
if (databaseType.getSystemSchemas().contains(each)) {
continue;
}
- builder.addSchema(each, databaseType, createSchemaConfiguration(each, metaDataPersistService, parameter), props);
+ builder.addDatabase(each, databaseType, createDatabaseConfiguration(each, metaDataPersistService, parameter), props);
}
- builder.addSystemSchemas(databaseType);
+ builder.addSystemDatabases(databaseType);
return builder.build(metaDataPersistService);
}
- private SchemaConfiguration createSchemaConfiguration(final String schemaName, final MetaDataPersistService metaDataPersistService,
- final ContextManagerBuilderParameter parameter) {
- Map<String, DataSource> dataSources = metaDataPersistService.getEffectiveDataSources(schemaName, parameter.getDatabaseConfigs());
- Collection<RuleConfiguration> schemaRuleConfigs = metaDataPersistService.getSchemaRuleService().load(schemaName);
- return new DataSourceProvidedSchemaConfiguration(dataSources, schemaRuleConfigs);
+ private DatabaseConfiguration createDatabaseConfiguration(final String databaseName, final MetaDataPersistService metaDataPersistService,
+ final ContextManagerBuilderParameter parameter) {
+ Map<String, DataSource> dataSources = metaDataPersistService.getEffectiveDataSources(databaseName, parameter.getDatabaseConfigs());
+ Collection<RuleConfiguration> databaseRuleConfigs = metaDataPersistService.getSchemaRuleService().load(databaseName);
+ return new DataSourceProvidedDatabaseConfiguration(dataSources, databaseRuleConfigs);
}
private ContextManager createContextManager(final MetaDataPersistService metaDataPersistService, final ContextManagerBuilderParameter parameter, final MetaDataContexts metaDataContexts) {
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilderTextTest.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilderTextTest.java
index 1ad28f2788d..bac8229f21f 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilderTextTest.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilderTextTest.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.mode.manager.standalone;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
-import org.apache.shardingsphere.infra.config.schema.impl.DataSourceProvidedSchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.impl.DataSourceProvidedDatabaseConfiguration;
import org.apache.shardingsphere.infra.instance.definition.InstanceDefinition;
import org.apache.shardingsphere.infra.instance.definition.InstanceType;
import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -44,7 +44,7 @@ public final class StandaloneContextManagerBuilderTextTest {
public void assertBuild() throws SQLException {
ContextManager actual = new StandaloneContextManagerBuilder().build(ContextManagerBuilderParameter.builder().modeConfig(new ModeConfiguration("Standalone", null, false))
.databaseConfigs(Collections.singletonMap("foo_schema",
- new DataSourceProvidedSchemaConfiguration(Collections.singletonMap("foo_ds", new MockedDataSource()), Collections.singleton(mock(RuleConfiguration.class)))))
+ new DataSourceProvidedDatabaseConfiguration(Collections.singletonMap("foo_ds", new MockedDataSource()), Collections.singleton(mock(RuleConfiguration.class)))))
.globalRuleConfigs(Collections.singleton(mock(RuleConfiguration.class))).props(new Properties())
.instanceDefinition(new InstanceDefinition(InstanceType.PROXY, 3307)).build());
assertNotNull(actual.getMetaDataContexts().getMetaDataMap().get("foo_schema"));
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfiguration.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfiguration.java
index fff29fdda99..273b7c62aab 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfiguration.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfiguration.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.proxy.backend.config;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.infra.config.schema.impl.DataSourceGeneratedSchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.impl.DataSourceGeneratedDatabaseConfiguration;
import java.util.Map;
@@ -30,7 +30,7 @@ import java.util.Map;
@Getter
public final class ProxyConfiguration {
- private final Map<String, DataSourceGeneratedSchemaConfiguration> databaseConfigurations;
+ private final Map<String, DataSourceGeneratedDatabaseConfiguration> databaseConfigurations;
private final ProxyGlobalConfiguration globalConfiguration;
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapper.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapper.java
index 7fcbf212447..5ddfdc6a547 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapper.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapper.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.proxy.backend.config.yaml.swapper;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
-import org.apache.shardingsphere.infra.config.schema.impl.DataSourceGeneratedSchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.impl.DataSourceGeneratedDatabaseConfiguration;
import org.apache.shardingsphere.infra.datasource.config.DataSourceConfiguration;
import org.apache.shardingsphere.infra.yaml.config.swapper.YamlRuleConfigurationSwapperEngine;
import org.apache.shardingsphere.proxy.backend.config.ProxyConfiguration;
@@ -48,21 +48,21 @@ public final class YamlProxyConfigurationSwapper {
* @return proxy configuration
*/
public ProxyConfiguration swap(final YamlProxyConfiguration yamlConfig) {
- Map<String, DataSourceGeneratedSchemaConfiguration> databaseConfigs = swapDatabaseConfigurations(yamlConfig);
+ Map<String, DataSourceGeneratedDatabaseConfiguration> databaseConfigs = swapDatabaseConfigurations(yamlConfig);
ProxyGlobalConfiguration globalConfig = new ProxyGlobalConfiguration(ruleConfigSwapperEngine.swapToRuleConfigurations(yamlConfig.getServerConfiguration().getRules()),
yamlConfig.getServerConfiguration().getProps(), yamlConfig.getServerConfiguration().getLabels());
return new ProxyConfiguration(databaseConfigs, globalConfig);
}
- private Map<String, DataSourceGeneratedSchemaConfiguration> swapDatabaseConfigurations(final YamlProxyConfiguration yamlConfig) {
- Map<String, DataSourceGeneratedSchemaConfiguration> result = new LinkedHashMap<>(yamlConfig.getDatabaseConfigurations().size(), 1);
+ private Map<String, DataSourceGeneratedDatabaseConfiguration> swapDatabaseConfigurations(final YamlProxyConfiguration yamlConfig) {
+ Map<String, DataSourceGeneratedDatabaseConfiguration> result = new LinkedHashMap<>(yamlConfig.getDatabaseConfigurations().size(), 1);
boolean isDataSourceAggregation = yamlConfig.getServerConfiguration().getProps().containsKey("data-source-aggregation-enabled")
&& (boolean) yamlConfig.getServerConfiguration().getProps().get("data-source-aggregation-enabled");
for (Entry<String, YamlProxyDatabaseConfiguration> entry : yamlConfig.getDatabaseConfigurations().entrySet()) {
Map<String, DataSourceConfiguration> databaseDataSourceConfigs
= swapDataSourceConfigurations(entry.getValue().getDataSources(), entry.getValue().getDatabaseName(), isDataSourceAggregation);
Collection<RuleConfiguration> databaseRuleConfigs = ruleConfigSwapperEngine.swapToRuleConfigurations(entry.getValue().getRules());
- result.put(entry.getKey(), new DataSourceGeneratedSchemaConfiguration(databaseDataSourceConfigs, databaseRuleConfigs));
+ result.put(entry.getKey(), new DataSourceGeneratedDatabaseConfiguration(databaseDataSourceConfigs, databaseRuleConfigs));
}
return result;
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
index a1d42aefa98..ae499dd4f7d 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
@@ -21,7 +21,7 @@ import com.zaxxer.hikari.HikariDataSource;
import org.apache.shardingsphere.authority.config.AuthorityRuleConfiguration;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
-import org.apache.shardingsphere.infra.config.schema.impl.DataSourceGeneratedSchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.impl.DataSourceGeneratedDatabaseConfiguration;
import org.apache.shardingsphere.infra.metadata.user.Grantee;
import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUsers;
@@ -56,7 +56,7 @@ public final class YamlProxyConfigurationSwapperTest {
}
private void assertSchemaDataSources(final ProxyConfiguration proxyConfig) {
- Map<String, DataSourceGeneratedSchemaConfiguration> actual = proxyConfig.getDatabaseConfigurations();
+ Map<String, DataSourceGeneratedDatabaseConfiguration> actual = proxyConfig.getDatabaseConfigurations();
assertThat(actual.size(), is(1));
HikariDataSource dataSource = (HikariDataSource) actual.get("swapper_test").getDataSources().get("foo_db");
assertThat(dataSource.getJdbcUrl(), is("jdbc:h2:mem:foo_db;DB_CLOSE_DELAY=-1"));
@@ -71,7 +71,7 @@ public final class YamlProxyConfigurationSwapperTest {
}
private void assertSchemaRules(final ProxyConfiguration proxyConfig) {
- Map<String, DataSourceGeneratedSchemaConfiguration> actual = proxyConfig.getDatabaseConfigurations();
+ Map<String, DataSourceGeneratedDatabaseConfiguration> actual = proxyConfig.getDatabaseConfigurations();
assertThat(actual.size(), is(1));
Collection<RuleConfiguration> ruleConfigs = actual.get("swapper_test").getRuleConfigurations();
assertThat(ruleConfigs.size(), is(1));
diff --git a/shardingsphere-test/shardingsphere-rewrite-test/src/test/java/org/apache/shardingsphere/sharding/rewrite/parameterized/engine/AbstractSQLRewriterParameterizedTest.java b/shardingsphere-test/shardingsphere-rewrite-test/src/test/java/org/apache/shardingsphere/sharding/rewrite/parameterized/engine/AbstractSQLRewriterParameterizedTest.java
index 0b1b206a1f7..fdf8c303baf 100644
--- a/shardingsphere-test/shardingsphere-rewrite-test/src/test/java/org/apache/shardingsphere/sharding/rewrite/parameterized/engine/AbstractSQLRewriterParameterizedTest.java
+++ b/shardingsphere-test/shardingsphere-rewrite-test/src/test/java/org/apache/shardingsphere/sharding/rewrite/parameterized/engine/AbstractSQLRewriterParameterizedTest.java
@@ -24,8 +24,8 @@ import org.apache.shardingsphere.infra.binder.SQLStatementContextFactory;
import org.apache.shardingsphere.infra.binder.aware.ParameterAware;
import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
-import org.apache.shardingsphere.infra.config.schema.SchemaConfiguration;
-import org.apache.shardingsphere.infra.config.schema.impl.DataSourceProvidedSchemaConfiguration;
+import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
+import org.apache.shardingsphere.infra.config.database.impl.DataSourceProvidedDatabaseConfiguration;
import org.apache.shardingsphere.infra.database.DefaultSchema;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
@@ -95,10 +95,10 @@ public abstract class AbstractSQLRewriterParameterizedTest {
private Collection<SQLRewriteUnit> createSQLRewriteUnits() throws IOException, SQLException {
YamlRootConfiguration rootConfig = createRootConfiguration();
- SchemaConfiguration schemaConfig = new DataSourceProvidedSchemaConfiguration(
+ DatabaseConfiguration databaseConfig = new DataSourceProvidedDatabaseConfiguration(
new YamlDataSourceConfigurationSwapper().swapToDataSources(rootConfig.getDataSources()), new YamlRuleConfigurationSwapperEngine().swapToRuleConfigurations(rootConfig.getRules()));
- mockDataSource(schemaConfig.getDataSources());
- Collection<ShardingSphereRule> rules = SchemaRulesBuilder.buildRules("schema_name", schemaConfig, new ConfigurationProperties(new Properties()));
+ mockDataSource(databaseConfig.getDataSources());
+ Collection<ShardingSphereRule> rules = SchemaRulesBuilder.buildRules("schema_name", databaseConfig, new ConfigurationProperties(new Properties()));
mockRules(rules);
rules.add(sqlParserRule);
SQLStatementParserEngine sqlStatementParserEngine = new SQLStatementParserEngine(getTestParameters().getDatabaseType(),