You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by do...@apache.org on 2020/06/14 12:25:28 UTC
[shardingsphere] branch master updated: Add
YamlShardingSphereAlgorithmConfiguration to abstract yaml algorithm (#6033)
This is an automated email from the ASF dual-hosted git repository.
dongzonglei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new d7ac54f Add YamlShardingSphereAlgorithmConfiguration to abstract yaml algorithm (#6033)
d7ac54f is described below
commit d7ac54f904174de6681a38c35bd543fad3b2704b
Author: Liang Zhang <te...@163.com>
AuthorDate: Sun Jun 14 20:25:17 2020 +0800
Add YamlShardingSphereAlgorithmConfiguration to abstract yaml algorithm (#6033)
* remove YamlKeyGenerateAlgorithmConfiguration
* remove YamlShardingAlgorithmConfiguration
* remove YamlMasterSlaveLoadBalanceAlgorithmConfiguration
* remove YamlEncryptAlgorithmConfiguration
---
.../yaml/config/YamlEncryptRuleConfiguration.java | 4 +--
.../YamlEncryptAlgorithmConfiguration.java | 36 ----------------------
.../EncryptRuleConfigurationYamlSwapper.java | 8 ++---
.../EncryptAlgorithmConfigurationYamlSwapper.java | 10 +++---
.../config/YamlMasterSlaveRuleConfiguration.java | 4 +--
...sterSlaveLoadBalanceAlgorithmConfiguration.java | 36 ----------------------
.../MasterSlaveRuleConfigurationYamlSwapper.java | 8 ++---
.../yaml/config/YamlShardingRuleConfiguration.java | 7 ++---
.../YamlKeyGenerateAlgorithmConfiguration.java | 36 ----------------------
...yGenerateAlgorithmConfigurationYamlSwapper.java | 10 +++---
.../ShardingAlgorithmConfigurationYamlSwapper.java | 10 +++---
...erateAlgorithmConfigurationYamlSwapperTest.java | 6 ++--
.../YamlShardingSphereAlgorithmConfiguration.java | 6 ++--
.../config/ShardingConfigurationLoaderTest.java | 12 ++++----
14 files changed, 42 insertions(+), 151 deletions(-)
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/yaml/config/YamlEncryptRuleConfiguration.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/yaml/config/YamlEncryptRuleConfiguration.java
index c9c146c..d7f603c 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/yaml/config/YamlEncryptRuleConfiguration.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/yaml/config/YamlEncryptRuleConfiguration.java
@@ -20,9 +20,9 @@ package org.apache.shardingsphere.encrypt.yaml.config;
import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
-import org.apache.shardingsphere.encrypt.yaml.config.algorithm.YamlEncryptAlgorithmConfiguration;
import org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfiguration;
import org.apache.shardingsphere.infra.yaml.config.YamlRuleConfiguration;
+import org.apache.shardingsphere.infra.yaml.config.algorithm.YamlShardingSphereAlgorithmConfiguration;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -36,7 +36,7 @@ public final class YamlEncryptRuleConfiguration implements YamlRuleConfiguration
private Map<String, YamlEncryptTableRuleConfiguration> tables = new LinkedHashMap<>();
- private Map<String, YamlEncryptAlgorithmConfiguration> encryptors = new LinkedHashMap<>();
+ private Map<String, YamlShardingSphereAlgorithmConfiguration> encryptors = new LinkedHashMap<>();
@Override
public Class<EncryptRuleConfiguration> getRuleConfigurationType() {
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/yaml/config/algorithm/YamlEncryptAlgorithmConfiguration.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/yaml/config/algorithm/YamlEncryptAlgorithmConfiguration.java
deleted file mode 100644
index 5238a6b..0000000
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/yaml/config/algorithm/YamlEncryptAlgorithmConfiguration.java
+++ /dev/null
@@ -1,36 +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.encrypt.yaml.config.algorithm;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.shardingsphere.infra.yaml.config.YamlConfiguration;
-
-import java.util.Properties;
-
-/**
- * Encrypt algorithm configuration for YAML.
- */
-@Getter
-@Setter
-public final class YamlEncryptAlgorithmConfiguration implements YamlConfiguration {
-
- private String type;
-
- private Properties props = new Properties();
-}
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/EncryptRuleConfigurationYamlSwapper.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/EncryptRuleConfigurationYamlSwapper.java
index f074b26..01818ad 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/EncryptRuleConfigurationYamlSwapper.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/EncryptRuleConfigurationYamlSwapper.java
@@ -18,14 +18,14 @@
package org.apache.shardingsphere.encrypt.yaml.swapper;
import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
-import org.apache.shardingsphere.encrypt.api.config.rule.EncryptTableRuleConfiguration;
import org.apache.shardingsphere.encrypt.api.config.algorithm.EncryptAlgorithmConfiguration;
+import org.apache.shardingsphere.encrypt.api.config.rule.EncryptTableRuleConfiguration;
import org.apache.shardingsphere.encrypt.constant.EncryptOrder;
import org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguration;
-import org.apache.shardingsphere.encrypt.yaml.config.algorithm.YamlEncryptAlgorithmConfiguration;
import org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfiguration;
import org.apache.shardingsphere.encrypt.yaml.swapper.algorithm.EncryptAlgorithmConfigurationYamlSwapper;
import org.apache.shardingsphere.encrypt.yaml.swapper.rule.EncryptTableRuleConfigurationYamlSwapper;
+import org.apache.shardingsphere.infra.yaml.config.algorithm.YamlShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.infra.yaml.swapper.YamlRuleConfigurationSwapper;
import java.util.Collection;
@@ -68,8 +68,8 @@ public final class EncryptRuleConfigurationYamlSwapper implements YamlRuleConfig
private Map<String, EncryptAlgorithmConfiguration> swapEncryptAlgorithm(final YamlEncryptRuleConfiguration yamlConfiguration) {
Map<String, EncryptAlgorithmConfiguration> result = new LinkedHashMap<>();
- for (Entry<String, YamlEncryptAlgorithmConfiguration> entry : yamlConfiguration.getEncryptors().entrySet()) {
- YamlEncryptAlgorithmConfiguration yamlEncryptAlgorithmConfiguration = entry.getValue();
+ for (Entry<String, YamlShardingSphereAlgorithmConfiguration> entry : yamlConfiguration.getEncryptors().entrySet()) {
+ YamlShardingSphereAlgorithmConfiguration yamlEncryptAlgorithmConfiguration = entry.getValue();
result.put(entry.getKey(), encryptAlgorithmConfigurationYamlSwapper.swap(yamlEncryptAlgorithmConfiguration));
}
return result;
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/algorithm/EncryptAlgorithmConfigurationYamlSwapper.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/algorithm/EncryptAlgorithmConfigurationYamlSwapper.java
index 49b2754..83bd633 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/algorithm/EncryptAlgorithmConfigurationYamlSwapper.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/algorithm/EncryptAlgorithmConfigurationYamlSwapper.java
@@ -18,24 +18,24 @@
package org.apache.shardingsphere.encrypt.yaml.swapper.algorithm;
import org.apache.shardingsphere.encrypt.api.config.algorithm.EncryptAlgorithmConfiguration;
-import org.apache.shardingsphere.encrypt.yaml.config.algorithm.YamlEncryptAlgorithmConfiguration;
+import org.apache.shardingsphere.infra.yaml.config.algorithm.YamlShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.infra.yaml.swapper.YamlSwapper;
/**
* Encrypt algorithm configuration YAML swapper.
*/
-public final class EncryptAlgorithmConfigurationYamlSwapper implements YamlSwapper<YamlEncryptAlgorithmConfiguration, EncryptAlgorithmConfiguration> {
+public final class EncryptAlgorithmConfigurationYamlSwapper implements YamlSwapper<YamlShardingSphereAlgorithmConfiguration, EncryptAlgorithmConfiguration> {
@Override
- public YamlEncryptAlgorithmConfiguration swap(final EncryptAlgorithmConfiguration data) {
- YamlEncryptAlgorithmConfiguration result = new YamlEncryptAlgorithmConfiguration();
+ public YamlShardingSphereAlgorithmConfiguration swap(final EncryptAlgorithmConfiguration data) {
+ YamlShardingSphereAlgorithmConfiguration result = new YamlShardingSphereAlgorithmConfiguration();
result.setType(data.getType());
result.setProps(data.getProps());
return result;
}
@Override
- public EncryptAlgorithmConfiguration swap(final YamlEncryptAlgorithmConfiguration yamlConfiguration) {
+ public EncryptAlgorithmConfiguration swap(final YamlShardingSphereAlgorithmConfiguration yamlConfiguration) {
return new EncryptAlgorithmConfiguration(yamlConfiguration.getType(), yamlConfiguration.getProps());
}
}
diff --git a/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/main/java/org/apache/shardingsphere/masterslave/yaml/config/YamlMasterSlaveRuleConfiguration.java b/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/main/java/org/apache/shardingsphere/masterslave/yaml/config/YamlMasterSlaveRuleConfiguration.java
index e341089..40e0cf8 100644
--- a/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/main/java/org/apache/shardingsphere/masterslave/yaml/config/YamlMasterSlaveRuleConfiguration.java
+++ b/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/main/java/org/apache/shardingsphere/masterslave/yaml/config/YamlMasterSlaveRuleConfiguration.java
@@ -20,8 +20,8 @@ package org.apache.shardingsphere.masterslave.yaml.config;
import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.infra.yaml.config.YamlRuleConfiguration;
+import org.apache.shardingsphere.infra.yaml.config.algorithm.YamlShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.masterslave.api.config.MasterSlaveRuleConfiguration;
-import org.apache.shardingsphere.masterslave.yaml.config.algorithm.YamlMasterSlaveLoadBalanceAlgorithmConfiguration;
import org.apache.shardingsphere.masterslave.yaml.config.rule.YamlMasterSlaveDataSourceRuleConfiguration;
import java.util.LinkedHashMap;
@@ -36,7 +36,7 @@ public final class YamlMasterSlaveRuleConfiguration implements YamlRuleConfigura
private Map<String, YamlMasterSlaveDataSourceRuleConfiguration> dataSources = new LinkedHashMap<>();
- private Map<String, YamlMasterSlaveLoadBalanceAlgorithmConfiguration> loadBalancers = new LinkedHashMap<>();
+ private Map<String, YamlShardingSphereAlgorithmConfiguration> loadBalancers = new LinkedHashMap<>();
@Override
public Class<MasterSlaveRuleConfiguration> getRuleConfigurationType() {
diff --git a/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/main/java/org/apache/shardingsphere/masterslave/yaml/config/algorithm/YamlMasterSlaveLoadBalanceAlgorithmConfiguration.java b/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/main/java/org/apache/shardingsphere/masterslave/yaml/config/algorithm/YamlMasterSlaveLoadBalanceAlgorithmConfiguration.java
deleted file mode 100644
index 55fc779..0000000
--- a/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/main/java/org/apache/shardingsphere/masterslave/yaml/config/algorithm/YamlMasterSlaveLoadBalanceAlgorithmConfiguration.java
+++ /dev/null
@@ -1,36 +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.masterslave.yaml.config.algorithm;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.shardingsphere.infra.yaml.config.YamlConfiguration;
-
-import java.util.Properties;
-
-/**
- * Master-slave load balance algorithm configuration for YAML.
- */
-@Getter
-@Setter
-public final class YamlMasterSlaveLoadBalanceAlgorithmConfiguration implements YamlConfiguration {
-
- private String type;
-
- private Properties props = new Properties();
-}
diff --git a/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/main/java/org/apache/shardingsphere/masterslave/yaml/swapper/MasterSlaveRuleConfigurationYamlSwapper.java b/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/main/java/org/apache/shardingsphere/masterslave/yaml/swapper/MasterSlaveRuleConfigurationYamlSwapper.java
index 93d9930..a5c1d5d 100644
--- a/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/main/java/org/apache/shardingsphere/masterslave/yaml/swapper/MasterSlaveRuleConfigurationYamlSwapper.java
+++ b/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/main/java/org/apache/shardingsphere/masterslave/yaml/swapper/MasterSlaveRuleConfigurationYamlSwapper.java
@@ -17,14 +17,14 @@
package org.apache.shardingsphere.masterslave.yaml.swapper;
+import org.apache.shardingsphere.infra.yaml.config.algorithm.YamlShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.infra.yaml.swapper.YamlRuleConfigurationSwapper;
import org.apache.shardingsphere.masterslave.api.config.MasterSlaveRuleConfiguration;
import org.apache.shardingsphere.masterslave.api.config.algorithm.LoadBalanceAlgorithmConfiguration;
import org.apache.shardingsphere.masterslave.api.config.rule.MasterSlaveDataSourceRuleConfiguration;
import org.apache.shardingsphere.masterslave.constant.MasterSlaveOrder;
-import org.apache.shardingsphere.masterslave.yaml.config.rule.YamlMasterSlaveDataSourceRuleConfiguration;
-import org.apache.shardingsphere.masterslave.yaml.config.algorithm.YamlMasterSlaveLoadBalanceAlgorithmConfiguration;
import org.apache.shardingsphere.masterslave.yaml.config.YamlMasterSlaveRuleConfiguration;
+import org.apache.shardingsphere.masterslave.yaml.config.rule.YamlMasterSlaveDataSourceRuleConfiguration;
import java.util.Collection;
import java.util.LinkedHashMap;
@@ -61,7 +61,7 @@ public final class MasterSlaveRuleConfigurationYamlSwapper implements YamlRuleCo
dataSources.add(swap(entry.getKey(), entry.getValue()));
}
Map<String, LoadBalanceAlgorithmConfiguration> loadBalancers = new LinkedHashMap<>(yamlConfiguration.getLoadBalancers().entrySet().size(), 1);
- for (Entry<String, YamlMasterSlaveLoadBalanceAlgorithmConfiguration> entry : yamlConfiguration.getLoadBalancers().entrySet()) {
+ for (Entry<String, YamlShardingSphereAlgorithmConfiguration> entry : yamlConfiguration.getLoadBalancers().entrySet()) {
loadBalancers.put(entry.getKey(), swap(entry.getValue()));
}
return new MasterSlaveRuleConfiguration(dataSources, loadBalancers);
@@ -72,7 +72,7 @@ public final class MasterSlaveRuleConfigurationYamlSwapper implements YamlRuleCo
yamlDataSourceRuleConfiguration.getMasterDataSourceName(), yamlDataSourceRuleConfiguration.getSlaveDataSourceNames(), yamlDataSourceRuleConfiguration.getLoadBalancerName());
}
- private LoadBalanceAlgorithmConfiguration swap(final YamlMasterSlaveLoadBalanceAlgorithmConfiguration yamlLoadBalanceAlgorithmConfiguration) {
+ private LoadBalanceAlgorithmConfiguration swap(final YamlShardingSphereAlgorithmConfiguration yamlLoadBalanceAlgorithmConfiguration) {
return new LoadBalanceAlgorithmConfiguration(yamlLoadBalanceAlgorithmConfiguration.getType(), yamlLoadBalanceAlgorithmConfiguration.getProps());
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/yaml/config/YamlShardingRuleConfiguration.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/yaml/config/YamlShardingRuleConfiguration.java
index bb14c17..b57d573 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/yaml/config/YamlShardingRuleConfiguration.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/yaml/config/YamlShardingRuleConfiguration.java
@@ -20,9 +20,8 @@ package org.apache.shardingsphere.sharding.yaml.config;
import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.infra.yaml.config.YamlRuleConfiguration;
+import org.apache.shardingsphere.infra.yaml.config.algorithm.YamlShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import org.apache.shardingsphere.sharding.yaml.config.algorithm.YamlKeyGenerateAlgorithmConfiguration;
-import org.apache.shardingsphere.sharding.yaml.config.algorithm.YamlShardingAlgorithmConfiguration;
import org.apache.shardingsphere.sharding.yaml.config.rule.YamlShardingAutoTableRuleConfiguration;
import org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfiguration;
import org.apache.shardingsphere.sharding.yaml.config.strategy.keygen.YamlKeyGenerateStrategyConfiguration;
@@ -54,9 +53,9 @@ public final class YamlShardingRuleConfiguration implements YamlRuleConfiguratio
private YamlKeyGenerateStrategyConfiguration defaultKeyGenerateStrategy;
- private Map<String, YamlShardingAlgorithmConfiguration> shardingAlgorithms = new LinkedHashMap<>();
+ private Map<String, YamlShardingSphereAlgorithmConfiguration> shardingAlgorithms = new LinkedHashMap<>();
- private Map<String, YamlKeyGenerateAlgorithmConfiguration> keyGenerators = new LinkedHashMap<>();
+ private Map<String, YamlShardingSphereAlgorithmConfiguration> keyGenerators = new LinkedHashMap<>();
@Override
public Class<ShardingRuleConfiguration> getRuleConfigurationType() {
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/yaml/config/algorithm/YamlKeyGenerateAlgorithmConfiguration.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/yaml/config/algorithm/YamlKeyGenerateAlgorithmConfiguration.java
deleted file mode 100644
index c820393..0000000
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/yaml/config/algorithm/YamlKeyGenerateAlgorithmConfiguration.java
+++ /dev/null
@@ -1,36 +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.sharding.yaml.config.algorithm;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.shardingsphere.infra.yaml.config.YamlConfiguration;
-
-import java.util.Properties;
-
-/**
- * Key generate algorithm configuration for YAML.
- */
-@Getter
-@Setter
-public final class YamlKeyGenerateAlgorithmConfiguration implements YamlConfiguration {
-
- private String type;
-
- private Properties props = new Properties();
-}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/algorithm/KeyGenerateAlgorithmConfigurationYamlSwapper.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/algorithm/KeyGenerateAlgorithmConfigurationYamlSwapper.java
index cd638d7..0069028 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/algorithm/KeyGenerateAlgorithmConfigurationYamlSwapper.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/algorithm/KeyGenerateAlgorithmConfigurationYamlSwapper.java
@@ -18,30 +18,30 @@
package org.apache.shardingsphere.sharding.yaml.swapper.algorithm;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
+import org.apache.shardingsphere.infra.yaml.config.algorithm.YamlShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.infra.yaml.swapper.YamlSwapper;
import org.apache.shardingsphere.sharding.api.config.algorithm.KeyGenerateAlgorithmConfiguration;
import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
-import org.apache.shardingsphere.sharding.yaml.config.algorithm.YamlKeyGenerateAlgorithmConfiguration;
/**
* Key generate algorithm configuration YAML swapper.
*/
-public final class KeyGenerateAlgorithmConfigurationYamlSwapper implements YamlSwapper<YamlKeyGenerateAlgorithmConfiguration, KeyGenerateAlgorithmConfiguration> {
+public final class KeyGenerateAlgorithmConfigurationYamlSwapper implements YamlSwapper<YamlShardingSphereAlgorithmConfiguration, KeyGenerateAlgorithmConfiguration> {
static {
ShardingSphereServiceLoader.register(KeyGenerateAlgorithm.class);
}
@Override
- public YamlKeyGenerateAlgorithmConfiguration swap(final KeyGenerateAlgorithmConfiguration data) {
- YamlKeyGenerateAlgorithmConfiguration result = new YamlKeyGenerateAlgorithmConfiguration();
+ public YamlShardingSphereAlgorithmConfiguration swap(final KeyGenerateAlgorithmConfiguration data) {
+ YamlShardingSphereAlgorithmConfiguration result = new YamlShardingSphereAlgorithmConfiguration();
result.setType(data.getType());
result.setProps(data.getProps());
return result;
}
@Override
- public KeyGenerateAlgorithmConfiguration swap(final YamlKeyGenerateAlgorithmConfiguration yamlConfiguration) {
+ public KeyGenerateAlgorithmConfiguration swap(final YamlShardingSphereAlgorithmConfiguration yamlConfiguration) {
return new KeyGenerateAlgorithmConfiguration(yamlConfiguration.getType(), yamlConfiguration.getProps());
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/algorithm/ShardingAlgorithmConfigurationYamlSwapper.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/algorithm/ShardingAlgorithmConfigurationYamlSwapper.java
index f8f6c78..c87a70c 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/algorithm/ShardingAlgorithmConfigurationYamlSwapper.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/algorithm/ShardingAlgorithmConfigurationYamlSwapper.java
@@ -18,30 +18,30 @@
package org.apache.shardingsphere.sharding.yaml.swapper.algorithm;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
+import org.apache.shardingsphere.infra.yaml.config.algorithm.YamlShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.infra.yaml.swapper.YamlSwapper;
import org.apache.shardingsphere.sharding.api.config.algorithm.ShardingAlgorithmConfiguration;
import org.apache.shardingsphere.sharding.spi.ShardingAlgorithm;
-import org.apache.shardingsphere.sharding.yaml.config.algorithm.YamlShardingAlgorithmConfiguration;
/**
* Sharding algorithm configuration YAML swapper.
*/
-public final class ShardingAlgorithmConfigurationYamlSwapper implements YamlSwapper<YamlShardingAlgorithmConfiguration, ShardingAlgorithmConfiguration> {
+public final class ShardingAlgorithmConfigurationYamlSwapper implements YamlSwapper<YamlShardingSphereAlgorithmConfiguration, ShardingAlgorithmConfiguration> {
static {
ShardingSphereServiceLoader.register(ShardingAlgorithm.class);
}
@Override
- public YamlShardingAlgorithmConfiguration swap(final ShardingAlgorithmConfiguration data) {
- YamlShardingAlgorithmConfiguration result = new YamlShardingAlgorithmConfiguration();
+ public YamlShardingSphereAlgorithmConfiguration swap(final ShardingAlgorithmConfiguration data) {
+ YamlShardingSphereAlgorithmConfiguration result = new YamlShardingSphereAlgorithmConfiguration();
result.setType(data.getType());
result.setProps(data.getProps());
return result;
}
@Override
- public ShardingAlgorithmConfiguration swap(final YamlShardingAlgorithmConfiguration yamlConfiguration) {
+ public ShardingAlgorithmConfiguration swap(final YamlShardingSphereAlgorithmConfiguration yamlConfiguration) {
return new ShardingAlgorithmConfiguration(yamlConfiguration.getType(), yamlConfiguration.getProps());
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/algorithm/KeyGenerateAlgorithmConfigurationYamlSwapperTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/algorithm/KeyGenerateAlgorithmConfigurationYamlSwapperTest.java
index b72dda9..407dc9b 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/algorithm/KeyGenerateAlgorithmConfigurationYamlSwapperTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/algorithm/KeyGenerateAlgorithmConfigurationYamlSwapperTest.java
@@ -17,8 +17,8 @@
package org.apache.shardingsphere.sharding.yaml.swapper.algorithm;
+import org.apache.shardingsphere.infra.yaml.config.algorithm.YamlShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.sharding.api.config.algorithm.KeyGenerateAlgorithmConfiguration;
-import org.apache.shardingsphere.sharding.yaml.config.algorithm.YamlKeyGenerateAlgorithmConfiguration;
import org.junit.Test;
import java.util.Properties;
@@ -30,14 +30,14 @@ public final class KeyGenerateAlgorithmConfigurationYamlSwapperTest {
@Test
public void assertSwapToYaml() {
- YamlKeyGenerateAlgorithmConfiguration actual = new KeyGenerateAlgorithmConfigurationYamlSwapper().swap(new KeyGenerateAlgorithmConfiguration("UUID", new Properties()));
+ YamlShardingSphereAlgorithmConfiguration actual = new KeyGenerateAlgorithmConfigurationYamlSwapper().swap(new KeyGenerateAlgorithmConfiguration("UUID", new Properties()));
assertThat(actual.getType(), is("UUID"));
assertThat(actual.getProps(), is(new Properties()));
}
@Test
public void assertSwapToObject() {
- YamlKeyGenerateAlgorithmConfiguration yamlConfiguration = new YamlKeyGenerateAlgorithmConfiguration();
+ YamlShardingSphereAlgorithmConfiguration yamlConfiguration = new YamlShardingSphereAlgorithmConfiguration();
yamlConfiguration.setType("UUID");
KeyGenerateAlgorithmConfiguration actual = new KeyGenerateAlgorithmConfigurationYamlSwapper().swap(yamlConfiguration);
assertThat(actual.getType(), is("UUID"));
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/yaml/config/algorithm/YamlShardingAlgorithmConfiguration.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/algorithm/YamlShardingSphereAlgorithmConfiguration.java
similarity index 83%
rename from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/yaml/config/algorithm/YamlShardingAlgorithmConfiguration.java
rename to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/algorithm/YamlShardingSphereAlgorithmConfiguration.java
index 339677d..d9f9747 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/yaml/config/algorithm/YamlShardingAlgorithmConfiguration.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/algorithm/YamlShardingSphereAlgorithmConfiguration.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.yaml.config.algorithm;
+package org.apache.shardingsphere.infra.yaml.config.algorithm;
import lombok.Getter;
import lombok.Setter;
@@ -24,11 +24,11 @@ import org.apache.shardingsphere.infra.yaml.config.YamlConfiguration;
import java.util.Properties;
/**
- * Sharding algorithm configuration for YAML.
+ * ShardingSphere algorithm configuration for YAML.
*/
@Getter
@Setter
-public final class YamlShardingAlgorithmConfiguration implements YamlConfiguration {
+public final class YamlShardingSphereAlgorithmConfiguration implements YamlConfiguration {
private String type;
diff --git a/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/ShardingConfigurationLoaderTest.java b/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/ShardingConfigurationLoaderTest.java
index 5bd07f0..9bbf0f4 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/ShardingConfigurationLoaderTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/ShardingConfigurationLoaderTest.java
@@ -18,13 +18,13 @@
package org.apache.shardingsphere.proxy.config;
import org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguration;
-import org.apache.shardingsphere.encrypt.yaml.config.algorithm.YamlEncryptAlgorithmConfiguration;
-import org.apache.shardingsphere.orchestration.center.yaml.config.YamlCenterRepositoryConfiguration;
-import org.apache.shardingsphere.masterslave.yaml.config.rule.YamlMasterSlaveDataSourceRuleConfiguration;
+import org.apache.shardingsphere.infra.yaml.config.algorithm.YamlShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.masterslave.yaml.config.YamlMasterSlaveRuleConfiguration;
-import org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration;
+import org.apache.shardingsphere.masterslave.yaml.config.rule.YamlMasterSlaveDataSourceRuleConfiguration;
+import org.apache.shardingsphere.orchestration.center.yaml.config.YamlCenterRepositoryConfiguration;
import org.apache.shardingsphere.proxy.config.yaml.YamlDataSourceParameter;
import org.apache.shardingsphere.proxy.config.yaml.YamlProxyRuleConfiguration;
+import org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration;
import org.junit.Test;
import java.io.IOException;
@@ -127,10 +127,10 @@ public final class ShardingConfigurationLoaderTest {
assertThat(actual.getEncryptors().size(), is(2));
assertTrue(actual.getEncryptors().containsKey("aes_encryptor"));
assertTrue(actual.getEncryptors().containsKey("md5_encryptor"));
- YamlEncryptAlgorithmConfiguration aesEncryptAlgorithmConfiguration = actual.getEncryptors().get("aes_encryptor");
+ YamlShardingSphereAlgorithmConfiguration aesEncryptAlgorithmConfiguration = actual.getEncryptors().get("aes_encryptor");
assertThat(aesEncryptAlgorithmConfiguration.getType(), is("AES"));
assertThat(aesEncryptAlgorithmConfiguration.getProps().getProperty("aes.key.value"), is("123456abc"));
- YamlEncryptAlgorithmConfiguration md5EncryptAlgorithmConfiguration = actual.getEncryptors().get("md5_encryptor");
+ YamlShardingSphereAlgorithmConfiguration md5EncryptAlgorithmConfiguration = actual.getEncryptors().get("md5_encryptor");
assertThat(md5EncryptAlgorithmConfiguration.getType(), is("MD5"));
}