You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/01/24 16:19:44 UTC

[shardingsphere] branch master updated: Rename YamlProxyResourceConfiguration to YamlProxyDataSourceConfiguration (#15027)

This is an automated email from the ASF dual-hosted git repository.

zhangliang 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 ad8b39d  Rename YamlProxyResourceConfiguration to YamlProxyDataSourceConfiguration (#15027)
ad8b39d is described below

commit ad8b39d6481058404089a068a8fe0688d881e1c2
Author: Liang Zhang <te...@163.com>
AuthorDate: Tue Jan 25 00:16:55 2022 +0800

    Rename YamlProxyResourceConfiguration to YamlProxyDataSourceConfiguration (#15027)
---
 .../config/ProxyDataSourceConfigurationConverter.java    |  6 +++---
 ...ration.java => YamlProxyDataSourceConfiguration.java} |  4 ++--
 .../proxy/config/yaml/YamlProxySchemaConfiguration.java  |  2 +-
 .../proxy/config/ProxyConfigurationLoaderTest.java       | 16 ++++++++--------
 .../ProxyDataSourceConfigurationConverterTest.java       | 10 +++++-----
 .../yaml/swapper/YamlProxyConfigurationSwapperTest.java  |  6 +++---
 6 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/ProxyDataSourceConfigurationConverter.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/ProxyDataSourceConfigurationConverter.java
index bc2b8ab..8d1d501 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/ProxyDataSourceConfigurationConverter.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/ProxyDataSourceConfigurationConverter.java
@@ -22,7 +22,7 @@ import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.infra.datasource.config.ConnectionConfiguration;
 import org.apache.shardingsphere.infra.datasource.config.DataSourceConfiguration;
 import org.apache.shardingsphere.infra.datasource.config.PoolConfiguration;
-import org.apache.shardingsphere.proxy.config.yaml.YamlProxyResourceConfiguration;
+import org.apache.shardingsphere.proxy.config.yaml.YamlProxyDataSourceConfiguration;
 
 import java.util.LinkedHashMap;
 import java.util.Map;
@@ -41,12 +41,12 @@ public final class ProxyDataSourceConfigurationConverter {
      * @param yamlResourceConfigMap yaml resource configuration map
      * @return data source configuration map
      */
-    public static Map<String, DataSourceConfiguration> getDataSourceConfigurationMap(final Map<String, YamlProxyResourceConfiguration> yamlResourceConfigMap) {
+    public static Map<String, DataSourceConfiguration> getDataSourceConfigurationMap(final Map<String, YamlProxyDataSourceConfiguration> yamlResourceConfigMap) {
         return yamlResourceConfigMap.entrySet().stream()
                 .collect(Collectors.toMap(Entry::getKey, entry -> createDataSourceConfiguration(entry.getValue()), (oldValue, currentValue) -> oldValue, LinkedHashMap::new));
     }
     
-    private static DataSourceConfiguration createDataSourceConfiguration(final YamlProxyResourceConfiguration yamlConfig) {
+    private static DataSourceConfiguration createDataSourceConfiguration(final YamlProxyDataSourceConfiguration yamlConfig) {
         ConnectionConfiguration connectionConfig = new ConnectionConfiguration(yamlConfig.getUrl(), yamlConfig.getUsername(), yamlConfig.getPassword());
         PoolConfiguration poolConfig = new PoolConfiguration(yamlConfig.getConnectionTimeoutMilliseconds(), yamlConfig.getIdleTimeoutMilliseconds(), 
                 yamlConfig.getMaxLifetimeMilliseconds(), yamlConfig.getMaxPoolSize(), yamlConfig.getMinPoolSize(), yamlConfig.getReadOnly(), 
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyResourceConfiguration.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyDataSourceConfiguration.java
similarity index 90%
rename from shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyResourceConfiguration.java
rename to shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyDataSourceConfiguration.java
index 287ec82..227002a 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyResourceConfiguration.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyDataSourceConfiguration.java
@@ -24,11 +24,11 @@ import org.apache.shardingsphere.infra.yaml.config.pojo.YamlConfiguration;
 import java.util.Properties;
 
 /**
- *  YAML resource configuration for ShardingSphere-Proxy.
+ * YAML data source configuration for ShardingSphere-Proxy.
  */
 @Getter
 @Setter
-public final class YamlProxyResourceConfiguration implements YamlConfiguration {
+public final class YamlProxyDataSourceConfiguration implements YamlConfiguration {
     
     private String url;
     
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxySchemaConfiguration.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxySchemaConfiguration.java
index 820c20b..b185865 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxySchemaConfiguration.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxySchemaConfiguration.java
@@ -36,7 +36,7 @@ public final class YamlProxySchemaConfiguration implements YamlConfiguration {
     
     private String schemaName;
     
-    private Map<String, YamlProxyResourceConfiguration> dataSources = new HashMap<>();
+    private Map<String, YamlProxyDataSourceConfiguration> dataSources = new HashMap<>();
     
     private Collection<YamlRuleConfiguration> rules = new LinkedList<>();
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/ProxyConfigurationLoaderTest.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/ProxyConfigurationLoaderTest.java
index 847eb95..a4836d7 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/ProxyConfigurationLoaderTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/ProxyConfigurationLoaderTest.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.proxy.config;
 import org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguration;
 import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration;
 import org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlShardingSphereAlgorithmConfiguration;
-import org.apache.shardingsphere.proxy.config.yaml.YamlProxyResourceConfiguration;
+import org.apache.shardingsphere.proxy.config.yaml.YamlProxyDataSourceConfiguration;
 import org.apache.shardingsphere.proxy.config.yaml.YamlProxySchemaConfiguration;
 import org.apache.shardingsphere.readwritesplitting.yaml.config.YamlReadwriteSplittingRuleConfiguration;
 import org.apache.shardingsphere.readwritesplitting.yaml.config.rule.YamlReadwriteSplittingDataSourceRuleConfiguration;
@@ -56,8 +56,8 @@ public final class ProxyConfigurationLoaderTest {
     private void assertShardingRuleConfiguration(final YamlProxySchemaConfiguration actual) {
         assertThat(actual.getSchemaName(), is("sharding_db"));
         assertThat(actual.getDataSources().size(), is(2));
-        assertResourceConfiguration(actual.getDataSources().get("ds_0"), "jdbc:mysql://127.0.0.1:3306/ds_0");
-        assertResourceConfiguration(actual.getDataSources().get("ds_1"), "jdbc:mysql://127.0.0.1:3306/ds_1");
+        assertDataSourceConfiguration(actual.getDataSources().get("ds_0"), "jdbc:mysql://127.0.0.1:3306/ds_0");
+        assertDataSourceConfiguration(actual.getDataSources().get("ds_1"), "jdbc:mysql://127.0.0.1:3306/ds_1");
         Optional<YamlShardingRuleConfiguration> shardingRuleConfig = actual.getRules().stream().filter(
             each -> each instanceof YamlShardingRuleConfiguration).findFirst().map(config -> (YamlShardingRuleConfiguration) config);
         assertTrue(shardingRuleConfig.isPresent());
@@ -79,9 +79,9 @@ public final class ProxyConfigurationLoaderTest {
     private void assertReadwriteSplittingRuleConfiguration(final YamlProxySchemaConfiguration actual) {
         assertThat(actual.getSchemaName(), is("readwrite_splitting_db"));
         assertThat(actual.getDataSources().size(), is(3));
-        assertResourceConfiguration(actual.getDataSources().get("write_ds"), "jdbc:mysql://127.0.0.1:3306/write_ds");
-        assertResourceConfiguration(actual.getDataSources().get("read_ds_0"), "jdbc:mysql://127.0.0.1:3306/read_ds_0");
-        assertResourceConfiguration(actual.getDataSources().get("read_ds_1"), "jdbc:mysql://127.0.0.1:3306/read_ds_1");
+        assertDataSourceConfiguration(actual.getDataSources().get("write_ds"), "jdbc:mysql://127.0.0.1:3306/write_ds");
+        assertDataSourceConfiguration(actual.getDataSources().get("read_ds_0"), "jdbc:mysql://127.0.0.1:3306/read_ds_0");
+        assertDataSourceConfiguration(actual.getDataSources().get("read_ds_1"), "jdbc:mysql://127.0.0.1:3306/read_ds_1");
         assertFalse(actual.getRules().stream().filter(
             each -> each instanceof YamlShardingRuleConfiguration).findFirst().map(configuration -> (YamlShardingRuleConfiguration) configuration).isPresent());
         assertFalse(actual.getRules().stream().filter(
@@ -103,7 +103,7 @@ public final class ProxyConfigurationLoaderTest {
     private void assertEncryptRuleConfiguration(final YamlProxySchemaConfiguration actual) {
         assertThat(actual.getSchemaName(), is("encrypt_db"));
         assertThat(actual.getDataSources().size(), is(1));
-        assertResourceConfiguration(actual.getDataSources().get("ds_0"), "jdbc:mysql://127.0.0.1:3306/encrypt_ds");
+        assertDataSourceConfiguration(actual.getDataSources().get("ds_0"), "jdbc:mysql://127.0.0.1:3306/encrypt_ds");
         assertFalse(actual.getRules().stream().filter(
             each -> each instanceof YamlShardingRuleConfiguration).findFirst().map(configuration -> (YamlShardingRuleConfiguration) configuration).isPresent());
         Optional<YamlEncryptRuleConfiguration> encryptRuleConfig = actual.getRules().stream().filter(
@@ -123,7 +123,7 @@ public final class ProxyConfigurationLoaderTest {
         assertThat(md5EncryptAlgorithmConfig.getType(), is("MD5"));
     }
     
-    private void assertResourceConfiguration(final YamlProxyResourceConfiguration actual, final String expectedURL) {
+    private void assertDataSourceConfiguration(final YamlProxyDataSourceConfiguration actual, final String expectedURL) {
         assertThat(actual.getUrl(), is(expectedURL));
         assertThat(actual.getUsername(), is("root"));
         assertNull(actual.getPassword());
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/ProxyDataSourceConfigurationConverterTest.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/ProxyDataSourceConfigurationConverterTest.java
index cb80016..3b6a04a 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/ProxyDataSourceConfigurationConverterTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/ProxyDataSourceConfigurationConverterTest.java
@@ -18,7 +18,7 @@
 package org.apache.shardingsphere.proxy.config;
 
 import org.apache.shardingsphere.infra.datasource.config.DataSourceConfiguration;
-import org.apache.shardingsphere.proxy.config.yaml.YamlProxyResourceConfiguration;
+import org.apache.shardingsphere.proxy.config.yaml.YamlProxyDataSourceConfiguration;
 import org.junit.Test;
 
 import java.util.HashMap;
@@ -32,15 +32,15 @@ public final class ProxyDataSourceConfigurationConverterTest {
     
     @Test
     public void assertGetResourceConfigurationMap() {
-        YamlProxyResourceConfiguration yamlResourceConfig0 = new YamlProxyResourceConfiguration();
+        YamlProxyDataSourceConfiguration yamlResourceConfig0 = new YamlProxyDataSourceConfiguration();
         yamlResourceConfig0.setUrl("jdbc:mysql://localhost:3306/ds_0");
         yamlResourceConfig0.setCustomPoolProps(getCustomPoolProperties());
         setYamlResourceConfigurationPropertyWithoutUrl(yamlResourceConfig0);
-        YamlProxyResourceConfiguration yamlResourceConfig1 = new YamlProxyResourceConfiguration();
+        YamlProxyDataSourceConfiguration yamlResourceConfig1 = new YamlProxyDataSourceConfiguration();
         yamlResourceConfig1.setUrl("jdbc:mysql://localhost:3306/ds_1");
         yamlResourceConfig1.setCustomPoolProps(getCustomPoolProperties());
         setYamlResourceConfigurationPropertyWithoutUrl(yamlResourceConfig1);
-        Map<String, YamlProxyResourceConfiguration> yamlResourceConfigs = new HashMap<>(2, 1);
+        Map<String, YamlProxyDataSourceConfiguration> yamlResourceConfigs = new HashMap<>(2, 1);
         yamlResourceConfigs.put("ds_0", yamlResourceConfig0);
         yamlResourceConfigs.put("ds_1", yamlResourceConfig1);
         Map<String, DataSourceConfiguration> actualResourceConfig = ProxyDataSourceConfigurationConverter.getDataSourceConfigurationMap(yamlResourceConfigs);
@@ -51,7 +51,7 @@ public final class ProxyDataSourceConfigurationConverterTest {
         assertResourceConfiguration(actualResourceConfig.get("ds_1"));
     }
     
-    private void setYamlResourceConfigurationPropertyWithoutUrl(final YamlProxyResourceConfiguration yamlResourceConfig) {
+    private void setYamlResourceConfigurationPropertyWithoutUrl(final YamlProxyDataSourceConfiguration yamlResourceConfig) {
         yamlResourceConfig.setUsername("root");
         yamlResourceConfig.setPassword("root");
         yamlResourceConfig.setConnectionTimeoutMilliseconds(30 * 1000L);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
index d10e448..49664e5 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
@@ -27,7 +27,7 @@ import org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlShardingSp
 import org.apache.shardingsphere.proxy.config.ProxyConfiguration;
 import org.apache.shardingsphere.proxy.config.YamlProxyConfiguration;
 import org.apache.shardingsphere.infra.datasource.config.DataSourceConfiguration;
-import org.apache.shardingsphere.proxy.config.yaml.YamlProxyResourceConfiguration;
+import org.apache.shardingsphere.proxy.config.yaml.YamlProxyDataSourceConfiguration;
 import org.apache.shardingsphere.proxy.config.yaml.YamlProxySchemaConfiguration;
 import org.apache.shardingsphere.proxy.config.yaml.YamlProxyServerConfiguration;
 import org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
@@ -139,7 +139,7 @@ public final class YamlProxyConfigurationSwapperTest {
     }
     
     private void mockResources(final YamlProxySchemaConfiguration yamlProxySchemaConfig) {
-        YamlProxyResourceConfiguration yamlResourceConfig = new YamlProxyResourceConfiguration();
+        YamlProxyDataSourceConfiguration yamlResourceConfig = new YamlProxyDataSourceConfiguration();
         yamlResourceConfig.setUrl("url1");
         yamlResourceConfig.setUsername("username1");
         yamlResourceConfig.setPassword("password1");
@@ -149,7 +149,7 @@ public final class YamlProxyConfigurationSwapperTest {
         yamlResourceConfig.setMaxPoolSize(4);
         yamlResourceConfig.setMinPoolSize(5);
         yamlResourceConfig.setReadOnly(true);
-        Map<String, YamlProxyResourceConfiguration> yamlResources = new HashMap<>(1, 1);
+        Map<String, YamlProxyDataSourceConfiguration> yamlResources = new HashMap<>(1, 1);
         yamlResources.put("ds1", yamlResourceConfig);
         when(yamlProxySchemaConfig.getDataSources()).thenReturn(yamlResources);
     }