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 d40bd47 Separate sharding related code from scaling-core module part
1 (#13907)
d40bd47 is described below
commit d40bd47fe48f9fc657f9ab29c23b1f9518d481a5
Author: Hongsheng Zhong <[email protected]>
AuthorDate: Fri Dec 3 10:24:12 2021 +0800
Separate sharding related code from scaling-core module part 1 (#13907)
* Separate ScalingWorker
* Separate AbstractDataSourcePreparer
* Separate ShardingRuleConfigurationSwapper and rename
* Rename ScalingDataSourceConfiguration to TypedDataSourceConfiguration,
refactor it as SPI
* Refactor JdbcUtil into JdbcUri and TypedDataSourceConfiguration
* Unmarshal yaml with skipMissingProperties when structure changed
* Fix unit test
---
.../ShardingRuleConfigurationConverter.java | 12 +--
.../infra/config}/datasource/JdbcUri.java | 31 +++++-
.../StandardJDBCDataSourceConfiguration.java | 58 ++++++-----
.../typed/TypedDataSourceConfiguration.java | 26 ++++-
.../typed/TypedDataSourceConfigurationWrap.java | 52 ++++++++++
.../infra/yaml/engine/YamlEngine.java | 16 +++
...g.datasource.typed.TypedDataSourceConfiguration | 18 ++++
.../infra/config}/datasource/JdbcUriTest.java | 10 +-
.../StandardJDBCDataSourceConfigurationTest.java | 60 ++++++++++++
.../infra/yaml/engine/YamlEngineTest.java | 6 ++
.../resources/config_standard_jdbc_target.yaml | 29 ++++++
.../ShardingSphereJDBCDataSourceConfiguration.java | 96 ++++++++++++++----
...g.datasource.typed.TypedDataSourceConfiguration | 18 ++++
...rdingSphereJDBCDataSourceConfigurationTest.java | 17 +---
.../shardingsphere-migration-common/pom.xml | 26 +++++
.../proxy/backend/context/ProxyContext.java | 2 +-
.../proxy/initializer/BootstrapInitializer.java | 2 +-
.../shardingsphere-scaling-core/pom.xml | 15 ---
.../common}/api/ScalingWorker.java | 9 +-
.../job/preparer/AbstractDataSourcePreparer.java | 19 ++--
.../scaling/core/api/DataCalculateParameter.java | 4 +-
.../impl/AbstractSingleTableDataCalculator.java | 4 +-
.../scaling/core/api/impl/ScalingAPIImpl.java | 11 ++-
.../core/common/datasource/DataSourceFactory.java | 6 +-
.../core/common/datasource/DataSourceManager.java | 16 +--
.../scaling/core/config/DumperConfiguration.java | 4 +-
.../scaling/core/config/ImporterConfiguration.java | 4 +-
.../scaling/core/config/RuleConfiguration.java | 12 +--
.../ScalingDataSourceConfigurationWrap.java | 63 ------------
.../config/yaml/YamlParameterConfiguration.java | 44 ---------
.../executor/dumper/AbstractInventoryDumper.java | 6 +-
.../core/executor/job/ScalingJobExecutor.java | 2 +-
.../scaling/core/job/FinishedCheckJob.java | 2 +-
.../scaling/core/job/ScalingJob.java | 2 +-
.../consistency/DataConsistencyCheckerImpl.java | 12 +--
.../shardingsphere/scaling/core/util/JDBCUtil.java | 109 ---------------------
.../scaling/core/util/JobConfigurationUtil.java | 22 ++---
.../preparer/AbstractDataSourcePreparerTest.java | 3 +-
.../StandardJDBCDataSourceConfigurationTest.java | 30 ------
.../executor/importer/AbstractImporterTest.java | 4 +-
.../job/check/DataConsistencyCheckerImplTest.java | 4 +-
.../scaling/core/util/ResourceUtil.java | 4 +-
.../scaling/mysql/component/MySQLImporter.java | 3 +-
.../mysql/component/MySQLIncrementalDumper.java | 4 +-
.../mysql/component/MySQLInventoryDumper.java | 3 +-
.../component/checker/MySQLDataSourcePreparer.java | 2 +-
.../component/MySQLDataSourcePreparerTest.java | 16 +--
.../scaling/mysql/component/MySQLImporterTest.java | 4 +
.../component/MySQLIncrementalDumperTest.java | 4 +-
.../mysql/component/MySQLJdbcDumperTest.java | 2 +-
.../opengauss/component/OpenGaussWalDumper.java | 2 +-
.../checker/OpenGaussDataSourcePreparer.java | 2 +-
.../opengauss/wal/OpenGaussLogicalReplication.java | 2 +-
.../postgresql/component/PostgreSQLWalDumper.java | 2 +-
.../scaling/postgresql/wal/LogicalReplication.java | 2 +-
.../component/PostgreSQLJdbcDumperTest.java | 2 +-
.../component/PostgreSQLWalDumperTest.java | 2 +-
.../postgresql/wal/LogicalReplicationTest.java | 2 +-
.../postgresql/wal/WalEventConverterTest.java | 2 +-
.../test/mysql/env/config/SourceConfiguration.java | 2 +-
.../test/mysql/env/config/TargetConfiguration.java | 2 +-
61 files changed, 513 insertions(+), 437 deletions(-)
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/ShardingRuleConfigurationSwapper.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleConfigurationConverter.java
similarity index 83%
rename from
shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/ShardingRuleConfigurationSwapper.java
rename to
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleConfigurationConverter.java
index 5f2eee5..2171a02 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/ShardingRuleConfigurationSwapper.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleConfigurationConverter.java
@@ -15,31 +15,31 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.scaling.core.config.yaml;
+package org.apache.shardingsphere.sharding.yaml.swapper;
import com.google.common.base.Preconditions;
import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration;
-import
org.apache.shardingsphere.sharding.yaml.swapper.ShardingRuleConfigurationYamlSwapper;
import java.util.Collection;
import java.util.Optional;
/**
- * Sharding rule configuration swapper.
+ * Sharding rule configuration converter.
*/
-public final class ShardingRuleConfigurationSwapper {
+public final class ShardingRuleConfigurationConverter {
/**
- * Find and convert sharding rule configuration from YAML .
+ * Find and convert sharding rule configuration from YAML.
*
* @param yamlRuleConfigs YAML rule configurations
* @return sharding rule configuration
+ * @throws IllegalStateException if there is no available sharding rule
*/
public static ShardingRuleConfiguration
findAndConvertShardingRuleConfiguration(final Collection<YamlRuleConfiguration>
yamlRuleConfigs) {
Optional<YamlRuleConfiguration> ruleConfig =
yamlRuleConfigs.stream().filter(each -> each instanceof
YamlShardingRuleConfiguration).findFirst();
- Preconditions.checkState(ruleConfig.isPresent(), "No available
sharding rule to load for governance.");
+ Preconditions.checkState(ruleConfig.isPresent(), "No available
sharding rule.");
return new
ShardingRuleConfigurationYamlSwapper().swapToObject((YamlShardingRuleConfiguration)
ruleConfig.get());
}
}
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/common/datasource/JdbcUri.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/JdbcUri.java
similarity index 68%
rename from
shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/common/datasource/JdbcUri.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/JdbcUri.java
index c40680c..f01da4f 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/common/datasource/JdbcUri.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/JdbcUri.java
@@ -15,13 +15,14 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.scaling.core.common.datasource;
+package org.apache.shardingsphere.infra.config.datasource;
import com.google.common.base.Strings;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
+import java.util.Map.Entry;
/**
* Jdbc uri.
@@ -95,4 +96,32 @@ public final class JdbcUri {
}
return result;
}
+
+ /**
+ * Append parameters.
+ *
+ * @param parameters JDBC parameters
+ * @return new JDBC url
+ */
+ public String appendParameters(final Map<String, String> parameters) {
+ return String.format("jdbc:%s://%s/%s?%s", getScheme(), getHost(),
getDatabase(), mergeParameters(getParameters(), parameters));
+ }
+
+ private String mergeParameters(final Map<String, String> parameters, final
Map<String, String> appendParameters) {
+ parameters.putAll(appendParameters);
+ return formatParameters(parameters);
+ }
+
+ private String formatParameters(final Map<String, String> parameters) {
+ StringBuilder result = new StringBuilder();
+ for (Entry<String, String> entry : parameters.entrySet()) {
+ result.append(entry.getKey());
+ if (null != entry.getValue()) {
+ result.append("=").append(entry.getValue());
+ }
+ result.append("&");
+ }
+ result.deleteCharAt(result.length() - 1);
+ return result.toString();
+ }
}
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/StandardJDBCDataSourceConfiguration.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/typed/StandardJDBCDataSourceConfiguration.java
similarity index 74%
rename from
shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/StandardJDBCDataSourceConfiguration.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/typed/StandardJDBCDataSourceConfiguration.java
index 11d306f..f7a3ff6 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/StandardJDBCDataSourceConfiguration.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/typed/StandardJDBCDataSourceConfiguration.java
@@ -15,20 +15,18 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.scaling.core.config.datasource;
+package org.apache.shardingsphere.infra.config.datasource.typed;
import com.zaxxer.hikari.HikariConfig;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import
org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.config.datasource.DataSourceConverter;
+import org.apache.shardingsphere.infra.config.datasource.JdbcUri;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
import
org.apache.shardingsphere.infra.yaml.config.swapper.YamlDataSourceConfigurationSwapper;
import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.constructor.Constructor;
-import org.yaml.snakeyaml.representer.Representer;
import javax.sql.DataSource;
import java.util.HashMap;
@@ -39,25 +37,39 @@ import java.util.Map;
*/
@Getter
@EqualsAndHashCode(of = "parameter")
-public final class StandardJDBCDataSourceConfiguration implements
ScalingDataSourceConfiguration {
+public final class StandardJDBCDataSourceConfiguration implements
TypedDataSourceConfiguration {
- /**
- * Type.
- */
- public static final String TYPE = "JDBC";
+ private static final String TYPE = "JDBC";
private static final String DATA_SOURCE_CLASS_NAME = "dataSourceClassName";
- private final String parameter;
+ private volatile String parameter;
- private final DataSourceConfiguration dataSourceConfig;
+ private volatile DataSourceConfiguration dataSourceConfig;
- private final HikariConfig hikariConfig;
+ private volatile HikariConfig hikariConfig;
- private final DatabaseType databaseType;
+ private volatile DatabaseType databaseType;
+
+ public StandardJDBCDataSourceConfiguration() {
+ }
- @SuppressWarnings("unchecked")
public StandardJDBCDataSourceConfiguration(final String parameter) {
+ init(parameter);
+ }
+
+ public StandardJDBCDataSourceConfiguration(final String jdbcUrl, final
String username, final String password) {
+ this(wrapParameter(jdbcUrl, username, password));
+ }
+
+ @Override
+ public String getType() {
+ return TYPE;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void init(final String parameter) {
this.parameter = parameter;
Map<String, Object> yamlConfig = YamlEngine.unmarshal(parameter,
Map.class);
if (!yamlConfig.containsKey(DATA_SOURCE_CLASS_NAME)) {
@@ -65,19 +77,13 @@ public final class StandardJDBCDataSourceConfiguration
implements ScalingDataSou
}
dataSourceConfig = new
YamlDataSourceConfigurationSwapper().swapToDataSourceConfiguration(yamlConfig);
yamlConfig.remove(DATA_SOURCE_CLASS_NAME);
- hikariConfig =
unmarshalSkipMissingProperties(YamlEngine.marshal(yamlConfig),
HikariConfig.class);
+ hikariConfig = YamlEngine.unmarshal(YamlEngine.marshal(yamlConfig),
HikariConfig.class, true);
databaseType =
DatabaseTypeRegistry.getDatabaseTypeByURL(hikariConfig.getJdbcUrl());
}
- public StandardJDBCDataSourceConfiguration(final String jdbcUrl, final
String username, final String password) {
- this(wrapParameter(jdbcUrl, username, password));
- }
-
- private <T> T unmarshalSkipMissingProperties(final String yamlContent,
final Class<T> classType) {
- Representer representer = new Representer();
- representer.getPropertyUtils().setSkipMissingProperties(true);
- Yaml yaml = new Yaml(new Constructor(classType), representer);
- return yaml.loadAs(yamlContent, classType);
+ @Override
+ public void appendJDBCParameters(final Map<String, String> parameters) {
+ hikariConfig.setJdbcUrl(new
JdbcUri(hikariConfig.getJdbcUrl()).appendParameters(parameters));
}
private static String wrapParameter(final String jdbcUrl, final String
username, final String password) {
@@ -89,8 +95,8 @@ public final class StandardJDBCDataSourceConfiguration
implements ScalingDataSou
}
@Override
- public ScalingDataSourceConfigurationWrap wrap() {
- ScalingDataSourceConfigurationWrap result = new
ScalingDataSourceConfigurationWrap();
+ public TypedDataSourceConfigurationWrap wrap() {
+ TypedDataSourceConfigurationWrap result = new
TypedDataSourceConfigurationWrap();
result.setType(TYPE);
result.setParameter(parameter);
return result;
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/ScalingDataSourceConfiguration.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/typed/TypedDataSourceConfiguration.java
similarity index 66%
rename from
shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/ScalingDataSourceConfiguration.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/typed/TypedDataSourceConfiguration.java
index f34a3f2..15c4127 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/ScalingDataSourceConfiguration.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/typed/TypedDataSourceConfiguration.java
@@ -15,17 +15,33 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.scaling.core.config.datasource;
+package org.apache.shardingsphere.infra.config.datasource.typed;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.spi.typed.TypedSPI;
import javax.sql.DataSource;
import java.sql.SQLException;
+import java.util.Map;
/**
- * Scaling data source configuration.
+ * Typed data source configuration, SPI interface.
*/
-public interface ScalingDataSourceConfiguration {
+public interface TypedDataSourceConfiguration extends TypedSPI {
+
+ /**
+ * Initialization.
+ *
+ * @param parameter data source configuration
+ */
+ void init(String parameter);
+
+ /**
+ * Append JDBC parameters.
+ *
+ * @param parameters JDBC parameters
+ */
+ void appendJDBCParameters(Map<String, String> parameters);
/**
* Get database type.
@@ -37,9 +53,9 @@ public interface ScalingDataSourceConfiguration {
/**
* Wrap.
*
- * @return scaling data source configuration wrap
+ * @return typed data source configuration wrap
*/
- ScalingDataSourceConfigurationWrap wrap();
+ TypedDataSourceConfigurationWrap wrap();
/**
* To data source.
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/typed/TypedDataSourceConfigurationWrap.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/typed/TypedDataSourceConfigurationWrap.java
new file mode 100644
index 0000000..71e5763
--- /dev/null
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/typed/TypedDataSourceConfigurationWrap.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.config.datasource.typed;
+
+import com.google.common.base.Preconditions;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
+import org.apache.shardingsphere.spi.typed.TypedSPIRegistry;
+
+import java.util.Optional;
+
+@Getter
+@Setter
+public final class TypedDataSourceConfigurationWrap {
+
+ static {
+
ShardingSphereServiceLoader.register(TypedDataSourceConfiguration.class);
+ }
+
+ private String type;
+
+ private String parameter;
+
+ /**
+ * Unwrap.
+ *
+ * @return typed data source configuration
+ */
+ public TypedDataSourceConfiguration unwrap() {
+ Optional<TypedDataSourceConfiguration> configOptional =
TypedSPIRegistry.findRegisteredService(TypedDataSourceConfiguration.class,
type, null);
+ Preconditions.checkArgument(configOptional.isPresent(), "Unsupported
data source type '%s'", type);
+ TypedDataSourceConfiguration result = configOptional.get();
+ result.init(parameter);
+ return result;
+ }
+}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/engine/YamlEngine.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/engine/YamlEngine.java
index 0624839..f93b26e 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/engine/YamlEngine.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/engine/YamlEngine.java
@@ -24,6 +24,7 @@ import
org.apache.shardingsphere.infra.yaml.engine.constructor.ShardingSphereYam
import
org.apache.shardingsphere.infra.yaml.engine.representer.ShardingSphereYamlRepresenter;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.representer.Representer;
import java.io.ByteArrayInputStream;
import java.io.File;
@@ -85,6 +86,21 @@ public final class YamlEngine {
}
/**
+ * Unmarshal YAML.
+ *
+ * @param yamlContent YAML content
+ * @param classType class type
+ * @param skipMissingProperties true if missing properties should be
skipped, false otherwise
+ * @param <T> type of class
+ * @return object from YAML
+ */
+ public static <T> T unmarshal(final String yamlContent, final Class<T>
classType, final boolean skipMissingProperties) {
+ Representer representer = new Representer();
+
representer.getPropertyUtils().setSkipMissingProperties(skipMissingProperties);
+ return new Yaml(new ShardingSphereYamlConstructor(classType),
representer).loadAs(yamlContent, classType);
+ }
+
+ /**
* Marshal YAML.
*
* @param value object to be marshaled
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration
b/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration
new file mode 100644
index 0000000..7c83a98
--- /dev/null
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.apache.shardingsphere.infra.config.datasource.typed.StandardJDBCDataSourceConfiguration
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/common/datasource/JdbcUriTest.java
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/datasource/JdbcUriTest.java
similarity index 75%
rename from
shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/common/datasource/JdbcUriTest.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/datasource/JdbcUriTest.java
index 57bfc58..4df9e10 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/common/datasource/JdbcUriTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/datasource/JdbcUriTest.java
@@ -15,8 +15,9 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.scaling.core.common.datasource;
+package org.apache.shardingsphere.infra.config.datasource;
+import com.google.common.collect.ImmutableMap;
import org.junit.Test;
import java.util.Map;
@@ -43,4 +44,11 @@ public final class JdbcUriTest {
assertThat(parameters.get("useSSL"), is("true"));
assertThat(parameters.get("maxReconnects"), is("30"));
}
+
+ @Test
+ public void assertAppendJDBCParameters() {
+ JdbcUri jdbcUri = new
JdbcUri("jdbc:mysql://192.168.0.1:3306/scaling?serverTimezone=UTC&useSSL=false");
+ String jdbcUrl = jdbcUri.appendParameters(ImmutableMap.<String,
String>builder().put("rewriteBatchedStatements", "true").build());
+ assertThat(jdbcUrl,
is("jdbc:mysql://192.168.0.1:3306/scaling?rewriteBatchedStatements=true&serverTimezone=UTC&useSSL=false"));
+ }
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/datasource/typed/StandardJDBCDataSourceConfigurationTest.java
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/datasource/typed/StandardJDBCDataSourceConfigurationTest.java
new file mode 100644
index 0000000..223de05
--- /dev/null
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/datasource/typed/StandardJDBCDataSourceConfigurationTest.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.config.datasource.typed;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableMap;
+import lombok.SneakyThrows;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.stream.Collectors;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public final class StandardJDBCDataSourceConfigurationTest {
+
+ @Test
+ public void assertConstructionByParameter() {
+ String parameter =
readFileAndIgnoreComments("config_standard_jdbc_target.yaml");
+ new StandardJDBCDataSourceConfiguration(parameter);
+ }
+
+ /**
+ * Ignore comments to read configuration from YAML.
+ *
+ * @param fileName YAML file name.
+ * @return YAML configuration.
+ */
+ @SneakyThrows({IOException.class, URISyntaxException.class})
+ private static String readFileAndIgnoreComments(final String fileName) {
+ return
Files.readAllLines(Paths.get(ClassLoader.getSystemResource(fileName).toURI()))
+ .stream().filter(each -> !Strings.isNullOrEmpty(each) &&
!each.startsWith("#")).map(each -> each +
System.lineSeparator()).collect(Collectors.joining());
+ }
+
+ @Test
+ public void assertAppendJDBCParameters() {
+ StandardJDBCDataSourceConfiguration dataSourceConfig = new
StandardJDBCDataSourceConfiguration("jdbc:mysql://192.168.0.1:3306/scaling?serverTimezone=UTC&useSSL=false",
null, null);
+ dataSourceConfig.appendJDBCParameters(ImmutableMap.<String,
String>builder().put("rewriteBatchedStatements", "true").build());
+ assertThat(dataSourceConfig.getHikariConfig().getJdbcUrl(),
is("jdbc:mysql://192.168.0.1:3306/scaling?rewriteBatchedStatements=true&serverTimezone=UTC&useSSL=false"));
+ }
+}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/yaml/engine/YamlEngineTest.java
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/yaml/engine/YamlEngineTest.java
index 606a0f8..45d1397 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/yaml/engine/YamlEngineTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/yaml/engine/YamlEngineTest.java
@@ -68,6 +68,12 @@ public final class YamlEngineTest {
}
@Test
+ public void assertUnmarshalWithYamlContentClassTypeSkipMissingProperties()
{
+ YamlRuleConfigurationFixture actual = YamlEngine.unmarshal("name:
test\nnotExistsField: test", YamlRuleConfigurationFixture.class, true);
+ assertThat(actual.getName(), is("test"));
+ }
+
+ @Test
public void assertUnmarshalProperties() {
Properties actual = YamlEngine.unmarshal("password: pwd",
Properties.class);
assertThat(actual.getProperty("password"), is("pwd"));
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/resources/config_standard_jdbc_target.yaml
b/shardingsphere-infra/shardingsphere-infra-common/src/test/resources/config_standard_jdbc_target.yaml
new file mode 100644
index 0000000..136010e
--- /dev/null
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/resources/config_standard_jdbc_target.yaml
@@ -0,0 +1,29 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+jdbcUrl:
jdbc:h2:mem:test_ds_3;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL
+username: root
+password: root
+dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+minimumIdle: 1
+minPoolSize: 1
+maxPoolSize: 50
+maximumPoolSize: 50
+readOnly: false
+idleTimeout: 60000
+connectionTimeout: 30000
+maxLifetime: 1800000
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/ShardingSphereJDBCDataSourceConfiguration.java
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/config/datasource/ShardingSphereJDBCDataSourceConfiguration.java
similarity index 51%
rename from
shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/ShardingSphereJDBCDataSourceConfiguration.java
rename to
shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/config/datasource/ShardingSphereJDBCDataSourceConfiguration.java
index 423d5c7..ac573f9 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/ShardingSphereJDBCDataSourceConfiguration.java
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/config/datasource/ShardingSphereJDBCDataSourceConfiguration.java
@@ -15,23 +15,33 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.scaling.core.config.datasource;
+package org.apache.shardingsphere.driver.config.datasource;
+import com.google.common.base.Preconditions;
+import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import org.apache.shardingsphere.driver.api.ShardingSphereDataSourceFactory;
+import org.apache.shardingsphere.infra.config.datasource.JdbcUri;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
+import org.apache.shardingsphere.infra.yaml.config.pojo.YamlConfiguration;
import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration;
+import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration;
import
org.apache.shardingsphere.infra.yaml.config.swapper.YamlDataSourceConfigurationSwapper;
import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
-import
org.apache.shardingsphere.scaling.core.config.yaml.ShardingRuleConfigurationSwapper;
-import
org.apache.shardingsphere.scaling.core.config.yaml.YamlParameterConfiguration;
-import org.apache.shardingsphere.scaling.core.util.JDBCUtil;
+import
org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration;
+import
org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfigurationWrap;
+import
org.apache.shardingsphere.sharding.yaml.swapper.ShardingRuleConfigurationConverter;
import javax.sql.DataSource;
import java.sql.SQLException;
+import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
import java.util.Map;
/**
@@ -39,24 +49,21 @@ import java.util.Map;
*/
@Getter
@EqualsAndHashCode(of = "parameter")
-public final class ShardingSphereJDBCDataSourceConfiguration implements
ScalingDataSourceConfiguration {
+public final class ShardingSphereJDBCDataSourceConfiguration implements
TypedDataSourceConfiguration {
- /**
- * Type.
- */
- public static final String TYPE = "ShardingSphereJDBC";
+ private static final String TYPE = "ShardingSphereJDBC";
- private final String parameter;
+ private volatile String parameter;
- private final YamlRootConfiguration rootConfig;
+ private volatile YamlRootConfiguration rootConfig;
- private final DatabaseType databaseType;
+ private volatile DatabaseType databaseType;
+
+ public ShardingSphereJDBCDataSourceConfiguration() {
+ }
public ShardingSphereJDBCDataSourceConfiguration(final String parameter) {
- this.parameter = parameter;
- rootConfig = YamlEngine.unmarshal(parameter,
YamlRootConfiguration.class);
- Map<String, Object> props =
rootConfig.getDataSources().values().iterator().next();
- databaseType =
DatabaseTypeRegistry.getDatabaseTypeByURL(JDBCUtil.getJdbcUrl(props));
+ init(parameter);
}
public ShardingSphereJDBCDataSourceConfiguration(final
YamlRootConfiguration rootConfig) {
@@ -64,13 +71,46 @@ public final class
ShardingSphereJDBCDataSourceConfiguration implements ScalingD
this.parameter = YamlEngine.marshal(parameterConfig);
this.rootConfig = rootConfig;
Map<String, Object> props =
rootConfig.getDataSources().values().iterator().next();
- databaseType =
DatabaseTypeRegistry.getDatabaseTypeByURL(JDBCUtil.getJdbcUrl(props));
+ databaseType =
DatabaseTypeRegistry.getDatabaseTypeByURL(getJdbcUrl(props));
+ }
+
+ /**
+ * Get jdbc url from parameters, the key can be url or jdbcUrl.
+ *
+ * @param parameters parameters
+ * @return jdbc url
+ */
+ private String getJdbcUrl(final Map<String, Object> parameters) {
+ Object result = parameters.getOrDefault("url",
parameters.get("jdbcUrl"));
+ Preconditions.checkNotNull(result, "url or jdbcUrl is required.");
+ return result.toString();
+ }
+
+ @Override
+ public String getType() {
+ return TYPE;
}
@Override
- public ScalingDataSourceConfigurationWrap wrap() {
- ScalingDataSourceConfigurationWrap result = new
ScalingDataSourceConfigurationWrap();
- result.setSchemaName(rootConfig.getSchemaName());
+ public void init(final String parameter) {
+ this.parameter = parameter;
+ rootConfig = YamlEngine.unmarshal(parameter,
YamlRootConfiguration.class);
+ Map<String, Object> props =
rootConfig.getDataSources().values().iterator().next();
+ databaseType =
DatabaseTypeRegistry.getDatabaseTypeByURL(getJdbcUrl(props));
+ }
+
+ @Override
+ public void appendJDBCParameters(final Map<String, String> parameters) {
+ rootConfig.getDataSources()
+ .forEach((key, value) -> {
+ String jdbcUrlKey = value.containsKey("url") ? "url" :
"jdbcUrl";
+ value.replace(jdbcUrlKey, new
JdbcUri(value.get(jdbcUrlKey).toString()).appendParameters(parameters));
+ });
+ }
+
+ @Override
+ public TypedDataSourceConfigurationWrap wrap() {
+ TypedDataSourceConfigurationWrap result = new
TypedDataSourceConfigurationWrap();
result.setType(TYPE);
result.setParameter(parameter);
return result;
@@ -79,6 +119,20 @@ public final class
ShardingSphereJDBCDataSourceConfiguration implements ScalingD
@Override
public DataSource toDataSource() throws SQLException {
return
ShardingSphereDataSourceFactory.createDataSource(rootConfig.getSchemaName(),
new YamlDataSourceConfigurationSwapper().swapToDataSources(
- rootConfig.getDataSources()),
Collections.singletonList(ShardingRuleConfigurationSwapper.findAndConvertShardingRuleConfiguration(rootConfig.getRules())),
null);
+ rootConfig.getDataSources()),
Collections.singletonList(ShardingRuleConfigurationConverter.findAndConvertShardingRuleConfiguration(rootConfig.getRules())),
null);
+ }
+
+ /**
+ * YAML parameter configuration.
+ */
+ @NoArgsConstructor
+ @AllArgsConstructor
+ @Getter
+ @Setter
+ private static class YamlParameterConfiguration implements
YamlConfiguration {
+
+ private Map<String, Map<String, Object>> dataSources = new HashMap<>();
+
+ private Collection<YamlRuleConfiguration> rules = new LinkedList<>();
}
}
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration
new file mode 100644
index 0000000..c71bd9d
--- /dev/null
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.apache.shardingsphere.driver.config.datasource.ShardingSphereJDBCDataSourceConfiguration
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/util/JDBCUtilTest.java
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/config/datasource/ShardingSphereJDBCDataSourceConfigurationTest.java
similarity index 72%
rename from
shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/util/JDBCUtilTest.java
rename to
shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/config/datasource/ShardingSphereJDBCDataSourceConfigurationTest.java
index 6d6d7be..f165bec 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/util/JDBCUtilTest.java
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/config/datasource/ShardingSphereJDBCDataSourceConfigurationTest.java
@@ -15,13 +15,11 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.scaling.core.util;
+package org.apache.shardingsphere.driver.config.datasource;
import com.google.common.collect.ImmutableMap;
import
org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import
org.apache.shardingsphere.infra.yaml.config.swapper.YamlDataSourceConfigurationSwapper;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ShardingSphereJDBCDataSourceConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.StandardJDBCDataSourceConfiguration;
import org.junit.Test;
import java.util.ArrayList;
@@ -32,19 +30,12 @@ import java.util.Map;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
-public final class JDBCUtilTest {
+public final class ShardingSphereJDBCDataSourceConfigurationTest {
@Test
- public void assertAppendStandardJDBCDataSourceConfiguration() {
- StandardJDBCDataSourceConfiguration dataSourceConfig = new
StandardJDBCDataSourceConfiguration("jdbc:mysql://192.168.0.1:3306/scaling?serverTimezone=UTC&useSSL=false",
null, null);
- JDBCUtil.appendJDBCParameter(dataSourceConfig, ImmutableMap.<String,
String>builder().put("rewriteBatchedStatements", "true").build());
- assertThat(dataSourceConfig.getHikariConfig().getJdbcUrl(),
is("jdbc:mysql://192.168.0.1:3306/scaling?rewriteBatchedStatements=true&serverTimezone=UTC&useSSL=false"));
- }
-
- @Test
- public void assertAppendShardingSphereJDBCDataSourceConfig() {
+ public void assertAppendJDBCParameters() {
ShardingSphereJDBCDataSourceConfiguration dataSourceConfig = new
ShardingSphereJDBCDataSourceConfiguration(getDataSourceYaml());
- JDBCUtil.appendJDBCParameter(dataSourceConfig, ImmutableMap.<String,
String>builder().put("rewriteBatchedStatements", "true").build());
+ dataSourceConfig.appendJDBCParameters(ImmutableMap.<String,
String>builder().put("rewriteBatchedStatements", "true").build());
List<DataSourceConfiguration> actual = new
ArrayList<>(getDataSourceConfigurations(dataSourceConfig.getRootConfig().getDataSources()).values());
assertThat(actual.get(0).getProps().get("url"),
is("jdbc:mysql://192.168.0.2:3306/scaling?rewriteBatchedStatements=true&serverTimezone=UTC&useSSL=false"));
assertThat(actual.get(1).getProps().get("url"),
is("jdbc:mysql://192.168.0.1:3306/scaling?rewriteBatchedStatements=true&serverTimezone=UTC&useSSL=false"));
diff --git
a/shardingsphere-kernel/shardingsphere-schedule/shardingsphere-migration-common/pom.xml
b/shardingsphere-kernel/shardingsphere-schedule/shardingsphere-migration-common/pom.xml
index 7a26cd3..3a96cfc 100644
---
a/shardingsphere-kernel/shardingsphere-schedule/shardingsphere-migration-common/pom.xml
+++
b/shardingsphere-kernel/shardingsphere-schedule/shardingsphere-migration-common/pom.xml
@@ -34,5 +34,31 @@
<artifactId>shardingsphere-cdc-core</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-executor</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-cluster-mode-repository-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.zaxxer</groupId>
+ <artifactId>HikariCP</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>${commons-io.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/context/ProxyContext.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/context/ProxyContext.java
index 6982fca..3a106be 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/context/ProxyContext.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/context/ProxyContext.java
@@ -27,7 +27,7 @@ import org.apache.shardingsphere.infra.state.StateContext;
import org.apache.shardingsphere.mode.manager.ContextManager;
import
org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource;
import
org.apache.shardingsphere.proxy.backend.exception.NoDatabaseSelectedException;
-import org.apache.shardingsphere.scaling.core.api.ScalingWorker;
+import org.apache.shardingsphere.migration.common.api.ScalingWorker;
import java.util.Collection;
import java.util.LinkedList;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializer.java
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializer.java
index 4783d55..b20f976 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializer.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializer.java
@@ -39,7 +39,7 @@ import
org.apache.shardingsphere.proxy.config.YamlProxyConfiguration;
import
org.apache.shardingsphere.proxy.config.util.DataSourceParameterConverter;
import
org.apache.shardingsphere.proxy.config.yaml.swapper.YamlProxyConfigurationSwapper;
import org.apache.shardingsphere.proxy.database.DatabaseServerInfo;
-import org.apache.shardingsphere.scaling.core.api.ScalingWorker;
+import org.apache.shardingsphere.migration.common.api.ScalingWorker;
import org.apache.shardingsphere.scaling.core.config.ScalingContext;
import org.apache.shardingsphere.scaling.core.config.ServerConfiguration;
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/pom.xml
b/shardingsphere-scaling/shardingsphere-scaling-core/pom.xml
index b197512..8252491 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/pom.xml
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/pom.xml
@@ -41,21 +41,11 @@
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-infra-executor</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-cluster-mode-repository-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-cluster-mode-repository-zookeeper-curator</artifactId>
<version>${project.version}</version>
</dependency>
@@ -92,11 +82,6 @@
<artifactId>HikariCP</artifactId>
<scope>compile</scope>
</dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>${commons-io.version}</version>
- </dependency>
<dependency>
<groupId>com.h2database</groupId>
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingWorker.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/migration/common/api/ScalingWorker.java
similarity index 95%
rename from
shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingWorker.java
rename to
shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/migration/common/api/ScalingWorker.java
index 897206f..626c537 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingWorker.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/migration/common/api/ScalingWorker.java
@@ -15,12 +15,14 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.scaling.core.api;
+package org.apache.shardingsphere.migration.common.api;
import com.google.common.collect.ImmutableMap;
import com.google.common.eventbus.Subscribe;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
+import
org.apache.shardingsphere.driver.config.datasource.ShardingSphereJDBCDataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.JdbcUri;
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;
@@ -30,14 +32,13 @@ import
org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration;
import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.cache.event.StartScalingEvent;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.config.event.rule.ScalingTaskFinishedEvent;
+import org.apache.shardingsphere.scaling.core.api.ScalingAPIFactory;
import org.apache.shardingsphere.scaling.core.config.HandleConfiguration;
import org.apache.shardingsphere.scaling.core.config.JobConfiguration;
import org.apache.shardingsphere.scaling.core.config.RuleConfiguration;
import org.apache.shardingsphere.scaling.core.config.WorkflowConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ShardingSphereJDBCDataSourceConfiguration;
import
org.apache.shardingsphere.scaling.core.executor.job.FinishedCheckJobExecutor;
import org.apache.shardingsphere.scaling.core.executor.job.ScalingJobExecutor;
-import org.apache.shardingsphere.scaling.core.util.JDBCUtil;
import
org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfiguration;
@@ -147,7 +148,7 @@ public final class ScalingWorker {
Map<String, String> parameters = ImmutableMap.of("useSSL", "false");
for (Entry<String, Map<String, Object>> entry :
yamlDataSources.entrySet()) {
jdbcUrl = (String) entry.getValue().get("jdbcUrl");
- entry.getValue().put("jdbcUrl",
JDBCUtil.appendJDBCParameter(jdbcUrl, parameters));
+ entry.getValue().put("jdbcUrl", new
JdbcUri(jdbcUrl).appendParameters(parameters));
}
}
}
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/preparer/AbstractDataSourcePreparer.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/migration/common/job/preparer/AbstractDataSourcePreparer.java
similarity index 88%
rename from
shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/preparer/AbstractDataSourcePreparer.java
rename to
shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/migration/common/job/preparer/AbstractDataSourcePreparer.java
index af6a78d..743f1e6 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/preparer/AbstractDataSourcePreparer.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/migration/common/job/preparer/AbstractDataSourcePreparer.java
@@ -15,18 +15,21 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.scaling.core.job.preparer;
+package org.apache.shardingsphere.migration.common.job.preparer;
import lombok.extern.slf4j.Slf4j;
import
org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.config.datasource.DataSourceConverter;
import org.apache.shardingsphere.infra.datanode.DataNode;
+import
org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration;
import
org.apache.shardingsphere.scaling.core.common.datasource.DataSourceFactory;
import
org.apache.shardingsphere.scaling.core.common.datasource.DataSourceWrapper;
import org.apache.shardingsphere.scaling.core.config.JobConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ScalingDataSourceConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ShardingSphereJDBCDataSourceConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.yaml.ShardingRuleConfigurationSwapper;
+import
org.apache.shardingsphere.driver.config.datasource.ShardingSphereJDBCDataSourceConfiguration;
+import
org.apache.shardingsphere.sharding.yaml.swapper.ShardingRuleConfigurationConverter;
+import
org.apache.shardingsphere.scaling.core.job.preparer.ActualTableDefinition;
+import org.apache.shardingsphere.scaling.core.job.preparer.DataSourcePreparer;
+import
org.apache.shardingsphere.scaling.core.job.preparer.TableDefinitionSQLType;
import org.apache.shardingsphere.scaling.core.util.JobConfigurationUtil;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
@@ -72,9 +75,9 @@ public abstract class AbstractDataSourcePreparer implements
DataSourcePreparer {
return
dataSourceFactory.newInstance(jobConfig.getRuleConfig().getTarget().unwrap());
}
- protected Collection<String> getLogicTableNames(final
ScalingDataSourceConfiguration sourceConfig) {
+ protected Collection<String> getLogicTableNames(final
TypedDataSourceConfiguration sourceConfig) {
ShardingSphereJDBCDataSourceConfiguration source =
(ShardingSphereJDBCDataSourceConfiguration) sourceConfig;
- ShardingRuleConfiguration ruleConfig =
ShardingRuleConfigurationSwapper.findAndConvertShardingRuleConfiguration(source.getRootConfig().getRules());
+ ShardingRuleConfiguration ruleConfig =
ShardingRuleConfigurationConverter.findAndConvertShardingRuleConfiguration(source.getRootConfig().getRules());
return getLogicTableNames(ruleConfig);
}
@@ -93,9 +96,9 @@ public abstract class AbstractDataSourcePreparer implements
DataSourcePreparer {
* @param sourceConfig source data source configuration
* @return data source table names map. map(data source, map(first actual
table name of logic table, logic table name)).
*/
- protected Map<DataSource, Map<String, String>>
getDataSourceTableNamesMap(final ScalingDataSourceConfiguration sourceConfig) {
+ protected Map<DataSource, Map<String, String>>
getDataSourceTableNamesMap(final TypedDataSourceConfiguration sourceConfig) {
ShardingSphereJDBCDataSourceConfiguration source =
(ShardingSphereJDBCDataSourceConfiguration) sourceConfig;
- ShardingRuleConfiguration ruleConfig =
ShardingRuleConfigurationSwapper.findAndConvertShardingRuleConfiguration(source.getRootConfig().getRules());
+ ShardingRuleConfiguration ruleConfig =
ShardingRuleConfigurationConverter.findAndConvertShardingRuleConfiguration(source.getRootConfig().getRules());
Map<String, DataSourceConfiguration> dataSourceConfigs =
JobConfigurationUtil.getDataSourceConfigurations(source.getRootConfig());
ShardingRule shardingRule = new ShardingRule(ruleConfig,
source.getRootConfig().getDataSources().keySet());
Collection<String> logicTableNames = getLogicTableNames(ruleConfig);
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/DataCalculateParameter.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/DataCalculateParameter.java
index b98dcfb..d64a24f 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/DataCalculateParameter.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/DataCalculateParameter.java
@@ -21,7 +21,7 @@ import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ScalingDataSourceConfiguration;
+import
org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration;
import java.util.Collection;
@@ -37,7 +37,7 @@ public final class DataCalculateParameter {
/**
* Data source configuration of source side or target side.
*/
- private ScalingDataSourceConfiguration dataSourceConfig;
+ private TypedDataSourceConfiguration dataSourceConfig;
private String logicTableName;
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/impl/AbstractSingleTableDataCalculator.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/impl/AbstractSingleTableDataCalculator.java
index 369fc15..174e5fa 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/impl/AbstractSingleTableDataCalculator.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/impl/AbstractSingleTableDataCalculator.java
@@ -20,10 +20,10 @@ package org.apache.shardingsphere.scaling.core.api.impl;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import
org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.api.SingleTableDataCalculator;
import
org.apache.shardingsphere.scaling.core.common.datasource.DataSourceFactory;
import
org.apache.shardingsphere.scaling.core.common.datasource.DataSourceWrapper;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ScalingDataSourceConfiguration;
/**
* Abstract single table data calculator.
@@ -35,7 +35,7 @@ public abstract class AbstractSingleTableDataCalculator
implements SingleTableDa
private final DataSourceFactory dataSourceFactory = new
DataSourceFactory();
- protected final DataSourceWrapper getDataSource(final
ScalingDataSourceConfiguration dataSourceConfig) {
+ protected final DataSourceWrapper getDataSource(final
TypedDataSourceConfiguration dataSourceConfig) {
return dataSourceFactory.newInstance(dataSourceConfig);
}
}
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingAPIImpl.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingAPIImpl.java
index ec8f979..c34b97c 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingAPIImpl.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingAPIImpl.java
@@ -40,7 +40,7 @@ import
org.apache.shardingsphere.scaling.core.config.HandleConfiguration;
import org.apache.shardingsphere.scaling.core.config.JobConfiguration;
import org.apache.shardingsphere.scaling.core.config.ScalingContext;
import org.apache.shardingsphere.scaling.core.config.WorkflowConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ScalingDataSourceConfigurationWrap;
+import
org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfigurationWrap;
import org.apache.shardingsphere.scaling.core.job.JobContext;
import org.apache.shardingsphere.scaling.core.job.JobStatus;
import org.apache.shardingsphere.scaling.core.job.ScalingJob;
@@ -259,11 +259,12 @@ public final class ScalingAPIImpl implements ScalingAPI {
JobConfiguration jobConfig = getJobConfig(jobId);
Optional<Collection<JobContext>> optionalJobContexts =
JobSchedulerCenter.getJobContexts(jobId);
optionalJobContexts.ifPresent(jobContexts -> jobContexts.forEach(each
-> each.setStatus(JobStatus.ALMOST_FINISHED)));
- ScalingDataSourceConfigurationWrap targetConfig =
jobConfig.getRuleConfig().getTarget();
+ TypedDataSourceConfigurationWrap targetConfig =
jobConfig.getRuleConfig().getTarget();
YamlRootConfiguration yamlRootConfig =
YamlEngine.unmarshal(targetConfig.getParameter(), YamlRootConfiguration.class);
WorkflowConfiguration workflowConfig =
jobConfig.getHandleConfig().getWorkflowConfig();
- String ruleCacheId = null != workflowConfig ?
workflowConfig.getRuleCacheId() : null;
- ScalingTaskFinishedEvent taskFinishedEvent = new
ScalingTaskFinishedEvent(targetConfig.getSchemaName(), yamlRootConfig,
ruleCacheId);
+ String schemaName = workflowConfig.getSchemaName();
+ String ruleCacheId = workflowConfig.getRuleCacheId();
+ ScalingTaskFinishedEvent taskFinishedEvent = new
ScalingTaskFinishedEvent(schemaName, yamlRootConfig, ruleCacheId);
ShardingSphereEventBus.getInstance().post(taskFinishedEvent);
optionalJobContexts.ifPresent(jobContexts -> jobContexts.forEach(each
-> {
each.setStatus(JobStatus.FINISHED);
@@ -285,7 +286,7 @@ public final class ScalingAPIImpl implements ScalingAPI {
}
private JobConfiguration getJobConfig(final JobConfigurationPOJO
elasticJobConfigPOJO) {
- return YamlEngine.unmarshal(elasticJobConfigPOJO.getJobParameter(),
JobConfiguration.class);
+ return YamlEngine.unmarshal(elasticJobConfigPOJO.getJobParameter(),
JobConfiguration.class, true);
}
private JobConfigurationPOJO getElasticJobConfigPOJO(final long jobId) {
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/common/datasource/DataSourceFactory.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/common/datasource/DataSourceFactory.java
index d8f2a96..22d96d7 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/common/datasource/DataSourceFactory.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/common/datasource/DataSourceFactory.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.scaling.core.common.datasource;
import lombok.SneakyThrows;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ScalingDataSourceConfiguration;
+import
org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration;
import java.sql.SQLException;
@@ -30,11 +30,11 @@ public final class DataSourceFactory {
/**
* New instance data source wrapper.
*
- * @param dataSourceConfig scaling data source configuration
+ * @param dataSourceConfig data source configuration
* @return new data source wrapper
*/
@SneakyThrows(SQLException.class)
- public DataSourceWrapper newInstance(final ScalingDataSourceConfiguration
dataSourceConfig) {
+ public DataSourceWrapper newInstance(final TypedDataSourceConfiguration
dataSourceConfig) {
return new DataSourceWrapper(dataSourceConfig.toDataSource());
}
}
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/common/datasource/DataSourceManager.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/common/datasource/DataSourceManager.java
index 81d1721..2fcd23f 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/common/datasource/DataSourceManager.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/common/datasource/DataSourceManager.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.scaling.core.common.datasource;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import
org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.config.TaskConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ScalingDataSourceConfiguration;
import javax.sql.DataSource;
import java.sql.SQLException;
@@ -39,11 +39,11 @@ public final class DataSourceManager implements
AutoCloseable {
private final DataSourceFactory dataSourceFactory = new
DataSourceFactory();
- private final Map<ScalingDataSourceConfiguration, DataSourceWrapper>
cachedDataSources = new ConcurrentHashMap<>();
+ private final Map<TypedDataSourceConfiguration, DataSourceWrapper>
cachedDataSources = new ConcurrentHashMap<>();
- private final Map<ScalingDataSourceConfiguration, DataSourceWrapper>
sourceDataSources = new ConcurrentHashMap<>();
+ private final Map<TypedDataSourceConfiguration, DataSourceWrapper>
sourceDataSources = new ConcurrentHashMap<>();
- private final Map<ScalingDataSourceConfiguration, DataSourceWrapper>
targetDataSources = new ConcurrentHashMap<>();
+ private final Map<TypedDataSourceConfiguration, DataSourceWrapper>
targetDataSources = new ConcurrentHashMap<>();
public DataSourceManager(final List<TaskConfiguration> taskConfigs) {
createDataSources(taskConfigs);
@@ -56,26 +56,26 @@ public final class DataSourceManager implements
AutoCloseable {
private void createSourceDataSources(final List<TaskConfiguration>
taskConfigs) {
for (TaskConfiguration taskConfig : taskConfigs) {
- ScalingDataSourceConfiguration dataSourceConfig =
taskConfig.getDumperConfig().getDataSourceConfig();
+ TypedDataSourceConfiguration dataSourceConfig =
taskConfig.getDumperConfig().getDataSourceConfig();
DataSourceWrapper dataSource =
dataSourceFactory.newInstance(dataSourceConfig);
cachedDataSources.put(dataSourceConfig, dataSource);
sourceDataSources.put(dataSourceConfig, dataSource);
}
}
- private void createTargetDataSources(final ScalingDataSourceConfiguration
dataSourceConfig) {
+ private void createTargetDataSources(final TypedDataSourceConfiguration
dataSourceConfig) {
DataSourceWrapper dataSource =
dataSourceFactory.newInstance(dataSourceConfig);
cachedDataSources.put(dataSourceConfig, dataSource);
targetDataSources.put(dataSourceConfig, dataSource);
}
/**
- * Get data source by {@code DataSourceConfiguration}.
+ * Get data source.
*
* @param dataSourceConfig data source configuration
* @return data source
*/
- public DataSource getDataSource(final ScalingDataSourceConfiguration
dataSourceConfig) {
+ public DataSource getDataSource(final TypedDataSourceConfiguration
dataSourceConfig) {
if (cachedDataSources.containsKey(dataSourceConfig)) {
return cachedDataSources.get(dataSourceConfig);
}
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/DumperConfiguration.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/DumperConfiguration.java
index 403997f..3e64378 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/DumperConfiguration.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/DumperConfiguration.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.scaling.core.config;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ScalingDataSourceConfiguration;
+import
org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.job.position.ScalingPosition;
import java.util.Map;
@@ -35,7 +35,7 @@ public class DumperConfiguration {
private String dataSourceName;
- private ScalingDataSourceConfiguration dataSourceConfig;
+ private TypedDataSourceConfiguration dataSourceConfig;
private ScalingPosition<?> position;
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/ImporterConfiguration.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/ImporterConfiguration.java
index 4670f36..f208018 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/ImporterConfiguration.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/ImporterConfiguration.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.scaling.core.config;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ScalingDataSourceConfiguration;
+import
org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration;
import java.util.Map;
import java.util.Set;
@@ -33,7 +33,7 @@ import java.util.Set;
@ToString(exclude = "dataSourceConfig")
public final class ImporterConfiguration {
- private ScalingDataSourceConfiguration dataSourceConfig;
+ private TypedDataSourceConfiguration dataSourceConfig;
private Map<String, Set<String>> shardingColumnsMap;
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/RuleConfiguration.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/RuleConfiguration.java
index 93597ca..772d2ce 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/RuleConfiguration.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/RuleConfiguration.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.scaling.core.config;
import com.google.common.base.Preconditions;
import lombok.Getter;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ScalingDataSourceConfigurationWrap;
+import
org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfigurationWrap;
/**
* Rule configuration.
@@ -27,21 +27,21 @@ import
org.apache.shardingsphere.scaling.core.config.datasource.ScalingDataSourc
@Getter
public final class RuleConfiguration {
- private ScalingDataSourceConfigurationWrap source;
+ private TypedDataSourceConfigurationWrap source;
- private ScalingDataSourceConfigurationWrap target;
+ private TypedDataSourceConfigurationWrap target;
/**
* Set source.
*
* @param source source configuration
*/
- public void setSource(final ScalingDataSourceConfigurationWrap source) {
+ public void setSource(final TypedDataSourceConfigurationWrap source) {
checkParameters(source);
this.source = source;
}
- private void checkParameters(final ScalingDataSourceConfigurationWrap
wrap) {
+ private void checkParameters(final TypedDataSourceConfigurationWrap wrap) {
Preconditions.checkNotNull(wrap);
Preconditions.checkNotNull(wrap.getType());
Preconditions.checkNotNull(wrap.getParameter());
@@ -52,7 +52,7 @@ public final class RuleConfiguration {
*
* @param target target configuration
*/
- public void setTarget(final ScalingDataSourceConfigurationWrap target) {
+ public void setTarget(final TypedDataSourceConfigurationWrap target) {
checkParameters(target);
this.target = target;
}
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/ScalingDataSourceConfigurationWrap.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/ScalingDataSourceConfigurationWrap.java
deleted file mode 100644
index 02e3983..0000000
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/ScalingDataSourceConfigurationWrap.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.scaling.core.config.datasource;
-
-import com.google.common.base.Preconditions;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.SneakyThrows;
-
-import java.util.HashMap;
-import java.util.Map;
-
-@Getter
-@Setter
-public class ScalingDataSourceConfigurationWrap {
-
- private String schemaName;
-
- private String type;
-
- private String parameter;
-
- /**
- * Unwrap.
- *
- * @return scaling data source configuration
- */
- @SneakyThrows(ReflectiveOperationException.class)
- public ScalingDataSourceConfiguration unwrap() {
- Map<String, Class<?>> classMap =
DataSourceConfigurationHolder.getInstances();
- Preconditions.checkArgument(classMap.containsKey(type.toLowerCase()),
"Unsupported data source type '%s'", type);
- return (ScalingDataSourceConfiguration)
classMap.get(type.toLowerCase()).getConstructor(String.class).newInstance(parameter);
- }
-
- private static class DataSourceConfigurationHolder {
-
- private static final Map<String, Class<?>> INSTANCES = new
HashMap<>(2, 1);
-
- static {
-
INSTANCES.put(StandardJDBCDataSourceConfiguration.TYPE.toLowerCase(),
StandardJDBCDataSourceConfiguration.class);
-
INSTANCES.put(ShardingSphereJDBCDataSourceConfiguration.TYPE.toLowerCase(),
ShardingSphereJDBCDataSourceConfiguration.class);
- }
-
- private static Map<String, Class<?>> getInstances() {
- return INSTANCES;
- }
- }
-}
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/YamlParameterConfiguration.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/YamlParameterConfiguration.java
deleted file mode 100644
index 635a692..0000000
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/YamlParameterConfiguration.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.scaling.core.config.yaml;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import org.apache.shardingsphere.infra.yaml.config.pojo.YamlConfiguration;
-import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.Map;
-
-/**
- * YAML parameter configuration.
- */
-@NoArgsConstructor
-@AllArgsConstructor
-@Getter
-@Setter
-public final class YamlParameterConfiguration implements YamlConfiguration {
-
- private Map<String, Map<String, Object>> dataSources = new HashMap<>();
-
- private Collection<YamlRuleConfiguration> rules = new LinkedList<>();
-}
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/executor/dumper/AbstractInventoryDumper.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/executor/dumper/AbstractInventoryDumper.java
index e7d3e82..8f33644 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/executor/dumper/AbstractInventoryDumper.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/executor/dumper/AbstractInventoryDumper.java
@@ -22,6 +22,8 @@ import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.infra.metadata.schema.model.TableMetaData;
+import
org.apache.shardingsphere.infra.config.datasource.typed.StandardJDBCDataSourceConfiguration;
+import
org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.common.channel.Channel;
import org.apache.shardingsphere.scaling.core.common.constant.ScalingConstant;
import
org.apache.shardingsphere.scaling.core.common.datasource.DataSourceManager;
@@ -32,8 +34,6 @@ import
org.apache.shardingsphere.scaling.core.common.record.DataRecord;
import org.apache.shardingsphere.scaling.core.common.record.FinishedRecord;
import org.apache.shardingsphere.scaling.core.common.record.Record;
import
org.apache.shardingsphere.scaling.core.config.InventoryDumperConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ScalingDataSourceConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.StandardJDBCDataSourceConfiguration;
import
org.apache.shardingsphere.schedule.core.executor.AbstractLifecycleExecutor;
import org.apache.shardingsphere.scaling.core.job.position.FinishedPosition;
import org.apache.shardingsphere.scaling.core.job.position.PlaceholderPosition;
@@ -72,7 +72,7 @@ public abstract class AbstractInventoryDumper extends
AbstractLifecycleExecutor
}
private TableMetaData createTableMetaData() {
- ScalingDataSourceConfiguration dataSourceConfig =
inventoryDumperConfig.getDataSourceConfig();
+ TypedDataSourceConfiguration dataSourceConfig =
inventoryDumperConfig.getDataSourceConfig();
MetaDataManager metaDataManager = new
MetaDataManager(dataSourceManager.getDataSource(dataSourceConfig));
return
metaDataManager.getTableMetaData(inventoryDumperConfig.getTableName(),
dataSourceConfig.getDatabaseType());
}
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/executor/job/ScalingJobExecutor.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/executor/job/ScalingJobExecutor.java
index 5abcf37..6951f2d 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/executor/job/ScalingJobExecutor.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/executor/job/ScalingJobExecutor.java
@@ -78,7 +78,7 @@ public final class ScalingJobExecutor extends
AbstractLifecycleExecutor {
try {
if (CONFIG_PATTERN.matcher(event.getKey()).matches()) {
log.info("{} job config: {}", event.getType(), event.getKey());
- return Optional.of(YamlEngine.unmarshal(event.getValue(),
JobConfigurationPOJO.class));
+ return Optional.of(YamlEngine.unmarshal(event.getValue(),
JobConfigurationPOJO.class, true));
}
// CHECKSTYLE:OFF
} catch (final Exception ex) {
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/FinishedCheckJob.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/FinishedCheckJob.java
index fba4628..acab811 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/FinishedCheckJob.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/FinishedCheckJob.java
@@ -45,7 +45,7 @@ public final class FinishedCheckJob implements SimpleJob {
}
long jobId = jobInfo.getJobId();
try {
- JobConfiguration jobConfig =
YamlEngine.unmarshal(jobInfo.getJobParameter(), JobConfiguration.class);
+ JobConfiguration jobConfig =
YamlEngine.unmarshal(jobInfo.getJobParameter(), JobConfiguration.class, true);
if
(!ScalingTaskUtil.almostFinished(scalingAPI.getProgress(jobId),
jobConfig.getHandleConfig())) {
continue;
}
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/ScalingJob.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/ScalingJob.java
index ce641a4..dd6fd09 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/ScalingJob.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/ScalingJob.java
@@ -40,7 +40,7 @@ public final class ScalingJob implements SimpleJob {
@Override
public void execute(final ShardingContext shardingContext) {
log.info("Execute scaling job {}-{}", shardingContext.getJobName(),
shardingContext.getShardingItem());
- JobConfiguration jobConfig =
YamlEngine.unmarshal(shardingContext.getJobParameter(), JobConfiguration.class);
+ JobConfiguration jobConfig =
YamlEngine.unmarshal(shardingContext.getJobParameter(), JobConfiguration.class,
true);
jobConfig.getHandleConfig().setShardingItem(shardingContext.getShardingItem());
JobContext jobContext = new JobContext(jobConfig);
jobContext.setInitProgress(governanceRepositoryAPI.getJobProgress(jobContext.getJobId(),
jobContext.getShardingItem()));
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/check/consistency/DataConsistencyCheckerImpl.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/check/consistency/DataConsistencyCheckerImpl.java
index 5c53005..b2fc6f0 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/check/consistency/DataConsistencyCheckerImpl.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/check/consistency/DataConsistencyCheckerImpl.java
@@ -22,6 +22,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import
org.apache.shardingsphere.infra.executor.kernel.thread.ExecutorThreadFactoryBuilder;
+import
org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.api.DataCalculateParameter;
import
org.apache.shardingsphere.scaling.core.api.ScalingDataConsistencyCheckAlgorithm;
import org.apache.shardingsphere.scaling.core.api.SingleTableDataCalculator;
@@ -29,7 +30,6 @@ import
org.apache.shardingsphere.scaling.core.common.datasource.DataSourceFactor
import
org.apache.shardingsphere.scaling.core.common.datasource.DataSourceWrapper;
import
org.apache.shardingsphere.scaling.core.common.exception.DataCheckFailException;
import
org.apache.shardingsphere.scaling.core.common.sqlbuilder.ScalingSQLBuilderFactory;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ScalingDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.job.JobContext;
import javax.sql.DataSource;
@@ -79,8 +79,8 @@ public final class DataConsistencyCheckerImpl implements
DataConsistencyChecker
}
private DataConsistencyCheckResult countCheck(final String table, final
ThreadPoolExecutor executor) {
- ScalingDataSourceConfiguration sourceConfig =
jobContext.getJobConfig().getRuleConfig().getSource().unwrap();
- ScalingDataSourceConfiguration targetConfig =
jobContext.getJobConfig().getRuleConfig().getTarget().unwrap();
+ TypedDataSourceConfiguration sourceConfig =
jobContext.getJobConfig().getRuleConfig().getSource().unwrap();
+ TypedDataSourceConfiguration targetConfig =
jobContext.getJobConfig().getRuleConfig().getTarget().unwrap();
try (DataSourceWrapper sourceDataSource =
dataSourceFactory.newInstance(sourceConfig);
DataSourceWrapper targetDataSource =
dataSourceFactory.newInstance(targetConfig)) {
Future<Long> sourceFuture = executor.submit(() ->
count(sourceDataSource, table, sourceConfig.getDatabaseType()));
@@ -107,9 +107,9 @@ public final class DataConsistencyCheckerImpl implements
DataConsistencyChecker
@Override
public Map<String, Boolean> dataCheck(final
ScalingDataConsistencyCheckAlgorithm checkAlgorithm) {
Collection<String> supportedDatabaseTypes =
checkAlgorithm.getSupportedDatabaseTypes();
- ScalingDataSourceConfiguration sourceConfig =
jobContext.getJobConfig().getRuleConfig().getSource().unwrap();
+ TypedDataSourceConfiguration sourceConfig =
jobContext.getJobConfig().getRuleConfig().getSource().unwrap();
checkDatabaseTypeSupportedOrNot(supportedDatabaseTypes,
sourceConfig.getDatabaseType().getName());
- ScalingDataSourceConfiguration targetConfig =
jobContext.getJobConfig().getRuleConfig().getTarget().unwrap();
+ TypedDataSourceConfiguration targetConfig =
jobContext.getJobConfig().getRuleConfig().getTarget().unwrap();
checkDatabaseTypeSupportedOrNot(supportedDatabaseTypes,
targetConfig.getDatabaseType().getName());
Collection<String> logicTableNames =
jobContext.getTaskConfigs().stream().flatMap(each ->
each.getDumperConfig().getTableNameMap().values().stream())
.distinct().collect(Collectors.toList());
@@ -152,7 +152,7 @@ public final class DataConsistencyCheckerImpl implements
DataConsistencyChecker
}
}
- private Map<String, Collection<String>> getTablesColumnNamesMap(final
ScalingDataSourceConfiguration dataSourceConfig) {
+ private Map<String, Collection<String>> getTablesColumnNamesMap(final
TypedDataSourceConfiguration dataSourceConfig) {
try (DataSourceWrapper dataSource =
dataSourceFactory.newInstance(dataSourceConfig);
Connection connection = dataSource.getConnection()) {
Map<String, Collection<String>> result = new LinkedHashMap<>();
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/util/JDBCUtil.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/util/JDBCUtil.java
deleted file mode 100644
index dd794d5..0000000
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/util/JDBCUtil.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.scaling.core.util;
-
-import com.google.common.base.Preconditions;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.scaling.core.common.datasource.JdbcUri;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ScalingDataSourceConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ShardingSphereJDBCDataSourceConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.StandardJDBCDataSourceConfiguration;
-
-import java.util.Map;
-import java.util.Map.Entry;
-
-/**
- * JDBC util.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class JDBCUtil {
-
- /**
- * Append jdbc parameter.
- *
- * @param scalingDataSourceConfiguration data source configuration
- * @param parameters parameters
- */
- public static void appendJDBCParameter(final
ScalingDataSourceConfiguration scalingDataSourceConfiguration, final
Map<String, String> parameters) {
- if (scalingDataSourceConfiguration instanceof
StandardJDBCDataSourceConfiguration) {
- append((StandardJDBCDataSourceConfiguration)
scalingDataSourceConfiguration, parameters);
- } else if (scalingDataSourceConfiguration instanceof
ShardingSphereJDBCDataSourceConfiguration) {
- append((ShardingSphereJDBCDataSourceConfiguration)
scalingDataSourceConfiguration, parameters);
- }
- }
-
- /**
- * Append jdbc parameter.
- *
- * @param jdbcUrl jdbc url
- * @param parameters parameters
- *
- * @return new jdbc url
- */
- public static String appendJDBCParameter(final String jdbcUrl, final
Map<String, String> parameters) {
- return append(jdbcUrl, parameters);
- }
-
- private static void append(final StandardJDBCDataSourceConfiguration
dataSourceConfig, final Map<String, String> parameters) {
-
dataSourceConfig.getHikariConfig().setJdbcUrl(append(dataSourceConfig.getHikariConfig().getJdbcUrl(),
parameters));
- }
-
- private static void append(final ShardingSphereJDBCDataSourceConfiguration
dataSourceConfig, final Map<String, String> parameters) {
- dataSourceConfig.getRootConfig().getDataSources()
- .forEach((key, value) -> {
- String jdbcUrlKey = value.containsKey("url") ? "url" :
"jdbcUrl";
- value.replace(jdbcUrlKey,
append(value.get(jdbcUrlKey).toString(), parameters));
- });
- }
-
- private static String append(final String url, final Map<String, String>
parameters) {
- JdbcUri uri = new JdbcUri(url);
- return String.format("jdbc:%s://%s/%s?%s", uri.getScheme(),
uri.getHost(), uri.getDatabase(), mergeParameters(uri.getParameters(),
parameters));
- }
-
- private static String mergeParameters(final Map<String, String>
parameters, final Map<String, String> appendParameters) {
- parameters.putAll(appendParameters);
- return formatParameters(parameters);
- }
-
- private static String formatParameters(final Map<String, String>
parameters) {
- StringBuilder result = new StringBuilder();
- for (Entry<String, String> entry : parameters.entrySet()) {
- result.append(entry.getKey());
- if (null != entry.getValue()) {
- result.append("=").append(entry.getValue());
- }
- result.append("&");
- }
- result.deleteCharAt(result.length() - 1);
- return result.toString();
- }
-
- /**
- * Get jdbc url from parameters, the key can be url or jdbcUrl.
- *
- * @param parameters parameters
- * @return jdbc url
- */
- public static String getJdbcUrl(final Map<String, Object> parameters) {
- Object result = parameters.getOrDefault("url",
parameters.get("jdbcUrl"));
- Preconditions.checkNotNull(result, "url or jdbcUrl is required.");
- return result.toString();
- }
-}
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/util/JobConfigurationUtil.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/util/JobConfigurationUtil.java
index 23054b8..68706ff 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/util/JobConfigurationUtil.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/util/JobConfigurationUtil.java
@@ -29,15 +29,15 @@ import org.apache.shardingsphere.infra.datanode.DataNode;
import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration;
import
org.apache.shardingsphere.infra.yaml.config.swapper.YamlDataSourceConfigurationSwapper;
import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
+import
org.apache.shardingsphere.infra.config.datasource.typed.StandardJDBCDataSourceConfiguration;
+import
org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.config.DumperConfiguration;
import org.apache.shardingsphere.scaling.core.config.HandleConfiguration;
import org.apache.shardingsphere.scaling.core.config.ImporterConfiguration;
import org.apache.shardingsphere.scaling.core.config.JobConfiguration;
import org.apache.shardingsphere.scaling.core.config.TaskConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ScalingDataSourceConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ShardingSphereJDBCDataSourceConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.StandardJDBCDataSourceConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.yaml.ShardingRuleConfigurationSwapper;
+import
org.apache.shardingsphere.driver.config.datasource.ShardingSphereJDBCDataSourceConfiguration;
+import
org.apache.shardingsphere.sharding.yaml.swapper.ShardingRuleConfigurationConverter;
import
org.apache.shardingsphere.sharding.algorithm.keygen.SnowflakeKeyGenerateAlgorithm;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
@@ -107,11 +107,11 @@ public final class JobConfigurationUtil {
}
private static Map<String, List<DataNode>>
getShouldScalingActualDataNodes(final JobConfiguration jobConfig) {
- ScalingDataSourceConfiguration sourceConfig =
jobConfig.getRuleConfig().getSource().unwrap();
+ TypedDataSourceConfiguration sourceConfig =
jobConfig.getRuleConfig().getSource().unwrap();
Preconditions.checkState(sourceConfig instanceof
ShardingSphereJDBCDataSourceConfiguration,
- "Only ShardingSphereJdbc type of source
ScalingDataSourceConfiguration is supported.");
+ "Only ShardingSphereJdbc type of source
TypedDataSourceConfiguration is supported.");
ShardingSphereJDBCDataSourceConfiguration source =
(ShardingSphereJDBCDataSourceConfiguration) sourceConfig;
- ShardingRuleConfiguration sourceRuleConfig =
ShardingRuleConfigurationSwapper.findAndConvertShardingRuleConfiguration(source.getRootConfig().getRules());
+ ShardingRuleConfiguration sourceRuleConfig =
ShardingRuleConfigurationConverter.findAndConvertShardingRuleConfiguration(source.getRootConfig().getRules());
ShardingRule shardingRule = new ShardingRule(sourceRuleConfig,
source.getRootConfig().getDataSources().keySet());
Map<String, TableRule> tableRules = shardingRule.getTableRules();
Map<String, List<DataNode>> result = new LinkedHashMap<>();
@@ -145,7 +145,7 @@ public final class JobConfigurationUtil {
public static List<TaskConfiguration> toTaskConfigs(final JobConfiguration
jobConfig) {
List<TaskConfiguration> result = new LinkedList<>();
ShardingSphereJDBCDataSourceConfiguration sourceConfig =
getSourceConfiguration(jobConfig);
- ShardingRuleConfiguration sourceRuleConfig =
ShardingRuleConfigurationSwapper.findAndConvertShardingRuleConfiguration(sourceConfig.getRootConfig().getRules());
+ ShardingRuleConfiguration sourceRuleConfig =
ShardingRuleConfigurationConverter.findAndConvertShardingRuleConfiguration(sourceConfig.getRootConfig().getRules());
Map<String, DataSourceConfiguration> sourceDataSource =
getDataSourceConfigurations(sourceConfig.getRootConfig());
Map<String, Map<String, String>> dataSourceTableNameMap =
toDataSourceTableNameMap(new ShardingRule(sourceRuleConfig,
sourceConfig.getRootConfig().getDataSources().keySet()));
Optional<ShardingRuleConfiguration> targetRuleConfig =
getTargetRuleConfiguration(jobConfig);
@@ -162,7 +162,7 @@ public final class JobConfigurationUtil {
}
private static ShardingSphereJDBCDataSourceConfiguration
getSourceConfiguration(final JobConfiguration jobConfig) {
- ScalingDataSourceConfiguration result =
jobConfig.getRuleConfig().getSource().unwrap();
+ TypedDataSourceConfiguration result =
jobConfig.getRuleConfig().getSource().unwrap();
Preconditions.checkArgument(result instanceof
ShardingSphereJDBCDataSourceConfiguration, "Only support ShardingSphere source
data source.");
return (ShardingSphereJDBCDataSourceConfiguration) result;
}
@@ -181,10 +181,10 @@ public final class JobConfigurationUtil {
}
private static Optional<ShardingRuleConfiguration>
getTargetRuleConfiguration(final JobConfiguration jobConfig) {
- ScalingDataSourceConfiguration dataSourceConfig =
jobConfig.getRuleConfig().getTarget().unwrap();
+ TypedDataSourceConfiguration dataSourceConfig =
jobConfig.getRuleConfig().getTarget().unwrap();
if (dataSourceConfig instanceof
ShardingSphereJDBCDataSourceConfiguration) {
return Optional.of(
-
ShardingRuleConfigurationSwapper.findAndConvertShardingRuleConfiguration(((ShardingSphereJDBCDataSourceConfiguration)
dataSourceConfig).getRootConfig().getRules()));
+
ShardingRuleConfigurationConverter.findAndConvertShardingRuleConfiguration(((ShardingSphereJDBCDataSourceConfiguration)
dataSourceConfig).getRootConfig().getRules()));
}
return Optional.empty();
}
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/job/preparer/AbstractDataSourcePreparerTest.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/migration/common/job/preparer/AbstractDataSourcePreparerTest.java
similarity index 95%
rename from
shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/job/preparer/AbstractDataSourcePreparerTest.java
rename to
shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/migration/common/job/preparer/AbstractDataSourcePreparerTest.java
index fc328c2..5c70ce2 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/job/preparer/AbstractDataSourcePreparerTest.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/migration/common/job/preparer/AbstractDataSourcePreparerTest.java
@@ -15,10 +15,11 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.scaling.core.job.preparer;
+package org.apache.shardingsphere.migration.common.job.preparer;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.shardingsphere.scaling.core.config.JobConfiguration;
+import
org.apache.shardingsphere.scaling.core.job.preparer.TableDefinitionSQLType;
import org.junit.Test;
import java.util.ArrayList;
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/config/datasource/StandardJDBCDataSourceConfigurationTest.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/config/datasource/StandardJDBCDataSourceConfigurationTest.java
deleted file mode 100644
index dd7715c..0000000
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/config/datasource/StandardJDBCDataSourceConfigurationTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.scaling.core.config.datasource;
-
-import org.apache.shardingsphere.scaling.core.util.ResourceUtil;
-import org.junit.Test;
-
-public final class StandardJDBCDataSourceConfigurationTest {
-
- @Test
- public void assertConstructionByParameter() {
- String parameter =
ResourceUtil.readFileAndIgnoreComments("config_standard_jdbc_target.yaml");
- new StandardJDBCDataSourceConfiguration(parameter);
- }
-}
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/executor/importer/AbstractImporterTest.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/executor/importer/AbstractImporterTest.java
index 2936740..9a908b8 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/executor/importer/AbstractImporterTest.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/executor/importer/AbstractImporterTest.java
@@ -17,6 +17,7 @@
package org.apache.shardingsphere.scaling.core.executor.importer;
+import
org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.common.channel.Channel;
import
org.apache.shardingsphere.scaling.core.common.datasource.DataSourceManager;
import org.apache.shardingsphere.scaling.core.common.record.Column;
@@ -26,7 +27,6 @@ import
org.apache.shardingsphere.scaling.core.common.record.Record;
import org.apache.shardingsphere.scaling.core.common.record.RecordUtil;
import
org.apache.shardingsphere.scaling.core.common.sqlbuilder.ScalingSQLBuilder;
import org.apache.shardingsphere.scaling.core.config.ImporterConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ScalingDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.job.position.PlaceholderPosition;
import org.junit.Before;
import org.junit.Test;
@@ -70,7 +70,7 @@ public final class AbstractImporterTest {
private ScalingSQLBuilder scalingSqlBuilder;
@Mock
- private ScalingDataSourceConfiguration dataSourceConfig;
+ private TypedDataSourceConfiguration dataSourceConfig;
@Mock
private Channel channel;
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/job/check/DataConsistencyCheckerImplTest.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/job/check/DataConsistencyCheckerImplTest.java
index c9d98e9..456b975 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/job/check/DataConsistencyCheckerImplTest.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/job/check/DataConsistencyCheckerImplTest.java
@@ -18,9 +18,9 @@
package org.apache.shardingsphere.scaling.core.job.check;
import lombok.SneakyThrows;
+import
org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration;
import
org.apache.shardingsphere.scaling.core.api.impl.ScalingFixtureDataConsistencyCheckAlgorithm;
import
org.apache.shardingsphere.scaling.core.common.datasource.DataSourceManager;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ScalingDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.job.JobContext;
import
org.apache.shardingsphere.scaling.core.job.check.consistency.DataConsistencyCheckResult;
import
org.apache.shardingsphere.scaling.core.job.check.consistency.DataConsistencyChecker;
@@ -57,7 +57,7 @@ public final class DataConsistencyCheckerImplTest {
}
@SneakyThrows(SQLException.class)
- private void initTableData(final ScalingDataSourceConfiguration
dataSourceConfig) {
+ private void initTableData(final TypedDataSourceConfiguration
dataSourceConfig) {
DataSource dataSource = new
DataSourceManager().getDataSource(dataSourceConfig);
try (Connection connection = dataSource.getConnection();
Statement statement = connection.createStatement()) {
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/util/ResourceUtil.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/util/ResourceUtil.java
index c789ef9..93186b1 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/util/ResourceUtil.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/util/ResourceUtil.java
@@ -20,10 +20,10 @@ package org.apache.shardingsphere.scaling.core.util;
import lombok.SneakyThrows;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
+import
org.apache.shardingsphere.infra.config.datasource.typed.StandardJDBCDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.config.JobConfiguration;
import org.apache.shardingsphere.scaling.core.config.RuleConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ShardingSphereJDBCDataSourceConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.StandardJDBCDataSourceConfiguration;
+import
org.apache.shardingsphere.driver.config.datasource.ShardingSphereJDBCDataSourceConfiguration;
import java.io.IOException;
import java.io.InputStream;
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/component/MySQLImporter.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/component/MySQLImporter.java
index f34272d..ae7d242 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/component/MySQLImporter.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/component/MySQLImporter.java
@@ -22,7 +22,6 @@ import
org.apache.shardingsphere.scaling.core.common.datasource.DataSourceManage
import
org.apache.shardingsphere.scaling.core.common.sqlbuilder.ScalingSQLBuilder;
import org.apache.shardingsphere.scaling.core.config.ImporterConfiguration;
import
org.apache.shardingsphere.scaling.core.executor.importer.AbstractImporter;
-import org.apache.shardingsphere.scaling.core.util.JDBCUtil;
import java.util.Map;
import java.util.Set;
@@ -34,7 +33,7 @@ public final class MySQLImporter extends AbstractImporter {
public MySQLImporter(final ImporterConfiguration importerConfig, final
DataSourceManager dataSourceManager) {
super(importerConfig, dataSourceManager);
- JDBCUtil.appendJDBCParameter(importerConfig.getDataSourceConfig(),
ImmutableMap.<String, String>builder().put("rewriteBatchedStatements",
"true").build());
+
importerConfig.getDataSourceConfig().appendJDBCParameters(ImmutableMap.<String,
String>builder().put("rewriteBatchedStatements", "true").build());
}
@Override
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/component/MySQLIncrementalDumper.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/component/MySQLIncrementalDumper.java
index 3d527f9..977d7e9 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/component/MySQLIncrementalDumper.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/component/MySQLIncrementalDumper.java
@@ -21,17 +21,17 @@ import com.google.common.base.Preconditions;
import com.zaxxer.hikari.HikariConfig;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
+import
org.apache.shardingsphere.infra.config.datasource.typed.StandardJDBCDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.common.channel.Channel;
import org.apache.shardingsphere.scaling.core.common.constant.ScalingConstant;
import
org.apache.shardingsphere.scaling.core.common.datasource.DataSourceFactory;
-import org.apache.shardingsphere.scaling.core.common.datasource.JdbcUri;
+import org.apache.shardingsphere.infra.config.datasource.JdbcUri;
import org.apache.shardingsphere.scaling.core.common.record.Column;
import org.apache.shardingsphere.scaling.core.common.record.DataRecord;
import org.apache.shardingsphere.scaling.core.common.record.FinishedRecord;
import org.apache.shardingsphere.scaling.core.common.record.PlaceholderRecord;
import org.apache.shardingsphere.scaling.core.common.record.Record;
import org.apache.shardingsphere.scaling.core.config.DumperConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.StandardJDBCDataSourceConfiguration;
import
org.apache.shardingsphere.schedule.core.executor.AbstractLifecycleExecutor;
import
org.apache.shardingsphere.scaling.core.executor.dumper.IncrementalDumper;
import org.apache.shardingsphere.scaling.core.job.position.PlaceholderPosition;
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/component/MySQLInventoryDumper.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/component/MySQLInventoryDumper.java
index 8959052..5de3c90 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/component/MySQLInventoryDumper.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/component/MySQLInventoryDumper.java
@@ -21,7 +21,6 @@ import com.google.common.collect.ImmutableMap;
import
org.apache.shardingsphere.scaling.core.common.datasource.DataSourceManager;
import
org.apache.shardingsphere.scaling.core.config.InventoryDumperConfiguration;
import
org.apache.shardingsphere.scaling.core.executor.dumper.AbstractInventoryDumper;
-import org.apache.shardingsphere.scaling.core.util.JDBCUtil;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -36,7 +35,7 @@ public final class MySQLInventoryDumper extends
AbstractInventoryDumper {
public MySQLInventoryDumper(final InventoryDumperConfiguration
inventoryDumperConfig, final DataSourceManager dataSourceManager) {
super(inventoryDumperConfig, dataSourceManager);
-
JDBCUtil.appendJDBCParameter(inventoryDumperConfig.getDataSourceConfig(),
ImmutableMap.<String, String>builder().put("yearIsDateType", "false").build());
+
inventoryDumperConfig.getDataSourceConfig().appendJDBCParameters(ImmutableMap.<String,
String>builder().put("yearIsDateType", "false").build());
}
@Override
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/component/checker/MySQLDataSourcePreparer.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/component/checker/MySQLDataSourcePreparer.java
index 7a7e1d7..bb13ed1 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/component/checker/MySQLDataSourcePreparer.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/component/checker/MySQLDataSourcePreparer.java
@@ -21,7 +21,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.shardingsphere.scaling.core.common.datasource.DataSourceWrapper;
import
org.apache.shardingsphere.scaling.core.common.exception.PrepareFailedException;
import org.apache.shardingsphere.scaling.core.config.JobConfiguration;
-import
org.apache.shardingsphere.scaling.core.job.preparer.AbstractDataSourcePreparer;
+import
org.apache.shardingsphere.migration.common.job.preparer.AbstractDataSourcePreparer;
import
org.apache.shardingsphere.scaling.mysql.component.MySQLScalingSQLBuilder;
import java.sql.Connection;
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/component/MySQLDataSourcePreparerTest.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/component/MySQLDataSourcePreparerTest.java
index d00632c..1d217fb 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/component/MySQLDataSourcePreparerTest.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/component/MySQLDataSourcePreparerTest.java
@@ -27,8 +27,8 @@ import
org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration;
import
org.apache.shardingsphere.scaling.core.common.exception.PrepareFailedException;
import org.apache.shardingsphere.scaling.core.config.JobConfiguration;
import org.apache.shardingsphere.scaling.core.config.RuleConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ScalingDataSourceConfigurationWrap;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ShardingSphereJDBCDataSourceConfiguration;
+import
org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfigurationWrap;
+import
org.apache.shardingsphere.driver.config.datasource.ShardingSphereJDBCDataSourceConfiguration;
import
org.apache.shardingsphere.scaling.mysql.component.checker.MySQLDataSourcePreparer;
import
org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration;
import org.junit.Before;
@@ -47,10 +47,10 @@ public final class MySQLDataSourcePreparerTest {
private RuleConfiguration ruleConfiguration;
@Mock
- private ScalingDataSourceConfigurationWrap
sourceScalingDataSourceConfigurationWrap;
+ private TypedDataSourceConfigurationWrap sourceDataSourceConfigurationWrap;
@Mock
- private ScalingDataSourceConfigurationWrap
targetScalingDataSourceConfigurationWrap;
+ private TypedDataSourceConfigurationWrap targetDataSourceConfigurationWrap;
@Mock
private ShardingSphereJDBCDataSourceConfiguration
sourceScalingDataSourceConfiguration;
@@ -73,13 +73,13 @@ public final class MySQLDataSourcePreparerTest {
@Before
public void setUp() throws SQLException {
when(jobConfiguration.getRuleConfig()).thenReturn(ruleConfiguration);
-
when(ruleConfiguration.getSource()).thenReturn(sourceScalingDataSourceConfigurationWrap);
-
when(sourceScalingDataSourceConfigurationWrap.unwrap()).thenReturn(sourceScalingDataSourceConfiguration);
+
when(ruleConfiguration.getSource()).thenReturn(sourceDataSourceConfigurationWrap);
+
when(sourceDataSourceConfigurationWrap.unwrap()).thenReturn(sourceScalingDataSourceConfiguration);
when(sourceScalingDataSourceConfiguration.toDataSource()).thenReturn(sourceDataSource);
when(sourceScalingDataSourceConfiguration.getRootConfig()).thenReturn(yamlRootConfiguration);
when(yamlRootConfiguration.getRules()).thenReturn(Collections.singletonList(yamlShardingRuleConfiguration));
-
when(ruleConfiguration.getTarget()).thenReturn(targetScalingDataSourceConfigurationWrap);
-
when(targetScalingDataSourceConfigurationWrap.unwrap()).thenReturn(targetScalingDataSourceConfiguration);
+
when(ruleConfiguration.getTarget()).thenReturn(targetDataSourceConfigurationWrap);
+
when(targetDataSourceConfigurationWrap.unwrap()).thenReturn(targetScalingDataSourceConfiguration);
when(targetScalingDataSourceConfiguration.toDataSource()).thenReturn(targetDataSource);
}
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/component/MySQLImporterTest.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/component/MySQLImporterTest.java
index 0ab8b90..ff3042f 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/component/MySQLImporterTest.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/component/MySQLImporterTest.java
@@ -17,6 +17,7 @@
package org.apache.shardingsphere.scaling.mysql.component;
+import
org.apache.shardingsphere.infra.config.datasource.typed.TypedDataSourceConfiguration;
import
org.apache.shardingsphere.scaling.core.common.datasource.DataSourceManager;
import org.apache.shardingsphere.scaling.core.common.record.Column;
import org.apache.shardingsphere.scaling.core.common.record.DataRecord;
@@ -31,6 +32,8 @@ import java.util.Collections;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public final class MySQLImporterTest {
@@ -43,6 +46,7 @@ public final class MySQLImporterTest {
@Test
public void assertCreateSqlBuilder() {
+
when(importerConfig.getDataSourceConfig()).thenReturn(mock(TypedDataSourceConfiguration.class));
MySQLImporter mysqlImporter = new MySQLImporter(importerConfig,
dataSourceManager);
String insertSQL =
mysqlImporter.createSQLBuilder(Collections.emptyMap()).buildInsertSQL(mockDataRecord());
assertThat(insertSQL, is("INSERT INTO `t_order`(`id`,`name`)
VALUES(?,?) ON DUPLICATE KEY UPDATE `name`=VALUES(`name`)"));
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/component/MySQLIncrementalDumperTest.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/component/MySQLIncrementalDumperTest.java
index 8c029e7..ba4bede 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/component/MySQLIncrementalDumperTest.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/component/MySQLIncrementalDumperTest.java
@@ -22,14 +22,14 @@ import org.apache.commons.collections4.map.HashedMap;
import org.apache.shardingsphere.scaling.core.common.channel.MemoryChannel;
import org.apache.shardingsphere.scaling.core.common.constant.ScalingConstant;
import
org.apache.shardingsphere.scaling.core.common.datasource.DataSourceManager;
-import org.apache.shardingsphere.scaling.core.common.datasource.JdbcUri;
+import org.apache.shardingsphere.infra.config.datasource.JdbcUri;
import org.apache.shardingsphere.scaling.core.common.record.DataRecord;
import org.apache.shardingsphere.scaling.core.common.record.PlaceholderRecord;
import org.apache.shardingsphere.scaling.core.common.record.Record;
import org.apache.shardingsphere.scaling.core.config.DumperConfiguration;
import org.apache.shardingsphere.scaling.core.config.ScalingContext;
import org.apache.shardingsphere.scaling.core.config.ServerConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.StandardJDBCDataSourceConfiguration;
+import
org.apache.shardingsphere.infra.config.datasource.typed.StandardJDBCDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.util.ReflectionUtil;
import org.apache.shardingsphere.scaling.mysql.binlog.BinlogPosition;
import
org.apache.shardingsphere.scaling.mysql.binlog.event.AbstractBinlogEvent;
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/component/MySQLJdbcDumperTest.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/component/MySQLJdbcDumperTest.java
index ac01360..f14fe8a 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/component/MySQLJdbcDumperTest.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/component/MySQLJdbcDumperTest.java
@@ -18,10 +18,10 @@
package org.apache.shardingsphere.scaling.mysql.component;
import lombok.SneakyThrows;
+import
org.apache.shardingsphere.infra.config.datasource.typed.StandardJDBCDataSourceConfiguration;
import
org.apache.shardingsphere.scaling.core.common.datasource.DataSourceManager;
import org.apache.shardingsphere.scaling.core.config.DumperConfiguration;
import
org.apache.shardingsphere.scaling.core.config.InventoryDumperConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.StandardJDBCDataSourceConfiguration;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-opengauss/src/main/java/org/apache/shardingsphere/scaling/opengauss/component/OpenGaussWalDumper.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-opengauss/src/main/java/org/apache/shardingsphere/scaling/opengauss/component/OpenGaussWalDumper.java
index 58ddb62..ea0b3c3 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-opengauss/src/main/java/org/apache/shardingsphere/scaling/opengauss/component/OpenGaussWalDumper.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-opengauss/src/main/java/org/apache/shardingsphere/scaling/opengauss/component/OpenGaussWalDumper.java
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.scaling.opengauss.component;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
+import
org.apache.shardingsphere.infra.config.datasource.typed.StandardJDBCDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.common.channel.Channel;
import org.apache.shardingsphere.scaling.core.common.constant.ScalingConstant;
import
org.apache.shardingsphere.scaling.core.common.exception.ScalingTaskExecuteException;
@@ -26,7 +27,6 @@ import
org.apache.shardingsphere.scaling.core.common.record.Column;
import org.apache.shardingsphere.scaling.core.common.record.DataRecord;
import org.apache.shardingsphere.scaling.core.common.record.Record;
import org.apache.shardingsphere.scaling.core.config.DumperConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.StandardJDBCDataSourceConfiguration;
import
org.apache.shardingsphere.schedule.core.executor.AbstractLifecycleExecutor;
import
org.apache.shardingsphere.scaling.core.executor.dumper.IncrementalDumper;
import org.apache.shardingsphere.scaling.core.job.position.ScalingPosition;
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-opengauss/src/main/java/org/apache/shardingsphere/scaling/opengauss/component/checker/OpenGaussDataSourcePreparer.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-opengauss/src/main/java/org/apache/shardingsphere/scaling/opengauss/component/checker/OpenGaussDataSourcePreparer.java
index 97c8619..7621da9 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-opengauss/src/main/java/org/apache/shardingsphere/scaling/opengauss/component/checker/OpenGaussDataSourcePreparer.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-opengauss/src/main/java/org/apache/shardingsphere/scaling/opengauss/component/checker/OpenGaussDataSourcePreparer.java
@@ -21,7 +21,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.shardingsphere.scaling.core.common.datasource.DataSourceWrapper;
import
org.apache.shardingsphere.scaling.core.common.exception.PrepareFailedException;
import org.apache.shardingsphere.scaling.core.config.JobConfiguration;
-import
org.apache.shardingsphere.scaling.core.job.preparer.AbstractDataSourcePreparer;
+import
org.apache.shardingsphere.migration.common.job.preparer.AbstractDataSourcePreparer;
import
org.apache.shardingsphere.scaling.core.job.preparer.ActualTableDefinition;
import
org.apache.shardingsphere.scaling.core.job.preparer.TableDefinitionSQLType;
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-opengauss/src/main/java/org/apache/shardingsphere/scaling/opengauss/wal/OpenGaussLogicalReplication.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-opengauss/src/main/java/org/apache/shardingsphere/scaling/opengauss/wal/OpenGaussLogicalReplication.java
index ff0fe0a..56b8e71 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-opengauss/src/main/java/org/apache/shardingsphere/scaling/opengauss/wal/OpenGaussLogicalReplication.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-opengauss/src/main/java/org/apache/shardingsphere/scaling/opengauss/wal/OpenGaussLogicalReplication.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.scaling.opengauss.wal;
-import
org.apache.shardingsphere.scaling.core.config.datasource.StandardJDBCDataSourceConfiguration;
+import
org.apache.shardingsphere.infra.config.datasource.typed.StandardJDBCDataSourceConfiguration;
import
org.apache.shardingsphere.scaling.postgresql.wal.decode.BaseLogSequenceNumber;
import org.opengauss.PGProperty;
import org.opengauss.jdbc.PgConnection;
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/component/PostgreSQLWalDumper.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/component/PostgreSQLWalDumper.java
index 1068162..c517f77 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/component/PostgreSQLWalDumper.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/component/PostgreSQLWalDumper.java
@@ -19,11 +19,11 @@ package
org.apache.shardingsphere.scaling.postgresql.component;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
+import
org.apache.shardingsphere.infra.config.datasource.typed.StandardJDBCDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.common.channel.Channel;
import
org.apache.shardingsphere.scaling.core.common.exception.ScalingTaskExecuteException;
import org.apache.shardingsphere.scaling.core.common.record.Record;
import org.apache.shardingsphere.scaling.core.config.DumperConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.StandardJDBCDataSourceConfiguration;
import
org.apache.shardingsphere.schedule.core.executor.AbstractLifecycleExecutor;
import
org.apache.shardingsphere.scaling.core.executor.dumper.IncrementalDumper;
import org.apache.shardingsphere.scaling.core.job.position.ScalingPosition;
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/wal/LogicalReplication.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/wal/LogicalReplication.java
index 5c30f7c..fe6351f 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/wal/LogicalReplication.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/wal/LogicalReplication.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.scaling.postgresql.wal;
-import
org.apache.shardingsphere.scaling.core.config.datasource.StandardJDBCDataSourceConfiguration;
+import
org.apache.shardingsphere.infra.config.datasource.typed.StandardJDBCDataSourceConfiguration;
import
org.apache.shardingsphere.scaling.postgresql.wal.decode.BaseLogSequenceNumber;
import org.postgresql.PGConnection;
import org.postgresql.PGProperty;
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/component/PostgreSQLJdbcDumperTest.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/component/PostgreSQLJdbcDumperTest.java
index aa6ad5a..5768610 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/component/PostgreSQLJdbcDumperTest.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/component/PostgreSQLJdbcDumperTest.java
@@ -21,7 +21,7 @@ import lombok.SneakyThrows;
import
org.apache.shardingsphere.scaling.core.common.datasource.DataSourceManager;
import org.apache.shardingsphere.scaling.core.config.DumperConfiguration;
import
org.apache.shardingsphere.scaling.core.config.InventoryDumperConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.StandardJDBCDataSourceConfiguration;
+import
org.apache.shardingsphere.infra.config.datasource.typed.StandardJDBCDataSourceConfiguration;
import org.junit.Before;
import org.junit.Test;
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/component/PostgreSQLWalDumperTest.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/component/PostgreSQLWalDumperTest.java
index 3cd6e0b..8a9a2d4 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/component/PostgreSQLWalDumperTest.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/component/PostgreSQLWalDumperTest.java
@@ -17,12 +17,12 @@
package org.apache.shardingsphere.scaling.postgresql.component;
+import
org.apache.shardingsphere.infra.config.datasource.typed.StandardJDBCDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.common.channel.MemoryChannel;
import
org.apache.shardingsphere.scaling.core.common.exception.ScalingTaskExecuteException;
import org.apache.shardingsphere.scaling.core.config.DumperConfiguration;
import org.apache.shardingsphere.scaling.core.config.ScalingContext;
import org.apache.shardingsphere.scaling.core.config.ServerConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.StandardJDBCDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.util.ReflectionUtil;
import org.apache.shardingsphere.scaling.postgresql.wal.LogicalReplication;
import org.apache.shardingsphere.scaling.postgresql.wal.WalPosition;
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/wal/LogicalReplicationTest.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/wal/LogicalReplicationTest.java
index f4d16a4..62b5dfb 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/wal/LogicalReplicationTest.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/wal/LogicalReplicationTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.scaling.postgresql.wal;
import lombok.SneakyThrows;
-import
org.apache.shardingsphere.scaling.core.config.datasource.StandardJDBCDataSourceConfiguration;
+import
org.apache.shardingsphere.infra.config.datasource.typed.StandardJDBCDataSourceConfiguration;
import
org.apache.shardingsphere.scaling.postgresql.wal.decode.BaseLogSequenceNumber;
import
org.apache.shardingsphere.scaling.postgresql.wal.decode.PostgreSQLLogSequenceNumber;
import org.junit.Before;
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/wal/WalEventConverterTest.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/wal/WalEventConverterTest.java
index d181767..d25795c 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/wal/WalEventConverterTest.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/wal/WalEventConverterTest.java
@@ -18,13 +18,13 @@
package org.apache.shardingsphere.scaling.postgresql.wal;
import lombok.SneakyThrows;
+import
org.apache.shardingsphere.infra.config.datasource.typed.StandardJDBCDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.common.constant.ScalingConstant;
import
org.apache.shardingsphere.scaling.core.common.datasource.DataSourceManager;
import org.apache.shardingsphere.scaling.core.common.record.DataRecord;
import org.apache.shardingsphere.scaling.core.common.record.PlaceholderRecord;
import org.apache.shardingsphere.scaling.core.common.record.Record;
import org.apache.shardingsphere.scaling.core.config.DumperConfiguration;
-import
org.apache.shardingsphere.scaling.core.config.datasource.StandardJDBCDataSourceConfiguration;
import org.apache.shardingsphere.scaling.postgresql.wal.event.AbstractRowEvent;
import org.apache.shardingsphere.scaling.postgresql.wal.event.DeleteRowEvent;
import org.apache.shardingsphere.scaling.postgresql.wal.event.PlaceholderEvent;
diff --git
a/shardingsphere-test/shardingsphere-integration-scaling-test/shardingsphere-integration-scaling-test-mysql/src/test/java/org/apache/shardingsphere/integration/scaling/test/mysql/env/config/SourceConfiguration.java
b/shardingsphere-test/shardingsphere-integration-scaling-test/shardingsphere-integration-scaling-test-mysql/src/test/java/org/apache/shardingsphere/integration/scaling/test/mysql/env/config/SourceConfiguration.java
index 33f5bfe..2531695 100644
---
a/shardingsphere-test/shardingsphere-integration-scaling-test/shardingsphere-integration-scaling-test-mysql/src/test/java/org/apache/shardingsphere/integration/scaling/test/mysql/env/config/SourceConfiguration.java
+++
b/shardingsphere-test/shardingsphere-integration-scaling-test/shardingsphere-integration-scaling-test-mysql/src/test/java/org/apache/shardingsphere/integration/scaling/test/mysql/env/config/SourceConfiguration.java
@@ -25,7 +25,7 @@ import
org.apache.shardingsphere.infra.yaml.config.swapper.YamlDataSourceConfigu
import
org.apache.shardingsphere.infra.yaml.config.swapper.YamlRuleConfigurationSwapperEngine;
import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
import
org.apache.shardingsphere.integration.scaling.test.mysql.env.IntegrationTestEnvironment;
-import
org.apache.shardingsphere.scaling.core.config.datasource.ShardingSphereJDBCDataSourceConfiguration;
+import
org.apache.shardingsphere.driver.config.datasource.ShardingSphereJDBCDataSourceConfiguration;
import
org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfiguration;
diff --git
a/shardingsphere-test/shardingsphere-integration-scaling-test/shardingsphere-integration-scaling-test-mysql/src/test/java/org/apache/shardingsphere/integration/scaling/test/mysql/env/config/TargetConfiguration.java
b/shardingsphere-test/shardingsphere-integration-scaling-test/shardingsphere-integration-scaling-test-mysql/src/test/java/org/apache/shardingsphere/integration/scaling/test/mysql/env/config/TargetConfiguration.java
index 5c75984..6acea41 100644
---
a/shardingsphere-test/shardingsphere-integration-scaling-test/shardingsphere-integration-scaling-test-mysql/src/test/java/org/apache/shardingsphere/integration/scaling/test/mysql/env/config/TargetConfiguration.java
+++
b/shardingsphere-test/shardingsphere-integration-scaling-test/shardingsphere-integration-scaling-test-mysql/src/test/java/org/apache/shardingsphere/integration/scaling/test/mysql/env/config/TargetConfiguration.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.integration.scaling.test.mysql.env.config;
import com.zaxxer.hikari.HikariDataSource;
import
org.apache.shardingsphere.integration.scaling.test.mysql.env.IntegrationTestEnvironment;
-import
org.apache.shardingsphere.scaling.core.config.datasource.StandardJDBCDataSourceConfiguration;
+import
org.apache.shardingsphere.infra.config.datasource.typed.StandardJDBCDataSourceConfiguration;
import javax.sql.DataSource;
import java.util.Properties;