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/09 04:53:13 UTC

[shardingsphere] branch master updated: Rename YamlResourceConfiguration to YamlProxyResourceConfiguration (#14626)

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

zhonghongsheng 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 7aaf889  Rename YamlResourceConfiguration to YamlProxyResourceConfiguration (#14626)
7aaf889 is described below

commit 7aaf889556a80372b4068984b1f5518e81b17863
Author: Liang Zhang <te...@163.com>
AuthorDate: Sun Jan 9 12:52:23 2022 +0800

    Rename YamlResourceConfiguration to YamlProxyResourceConfiguration (#14626)
---
 .../shardingsphere/proxy/config/YamlProxyConfiguration.java    |  2 +-
 .../config/resource/ProxyResourceConfigurationConverter.java   |  6 +++---
 ...eConfiguration.java => YamlProxyResourceConfiguration.java} |  4 ++--
 .../proxy/config/yaml/YamlProxyRuleConfiguration.java          |  4 ++--
 .../proxy/config/yaml/YamlProxyServerConfiguration.java        |  2 +-
 .../proxy/config/ProxyConfigurationLoaderTest.java             |  4 ++--
 .../resource/ProxyProxyResourceConfigurationConverterTest.java | 10 +++++-----
 .../config/yaml/swapper/YamlProxyConfigurationSwapperTest.java |  6 +++---
 8 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/YamlProxyConfiguration.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/YamlProxyConfiguration.java
index f2a7177..e80ac2e 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/YamlProxyConfiguration.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/YamlProxyConfiguration.java
@@ -25,7 +25,7 @@ import org.apache.shardingsphere.proxy.config.yaml.YamlProxyServerConfiguration;
 import java.util.Map;
 
 /**
- * YAML proxy configuration.
+ * YAML configuration for ShardingSphere-Proxy.
  */
 @RequiredArgsConstructor
 @Getter
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/resource/ProxyResourceConfigurationConverter.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/resource/ProxyResourceConfigurationConverter.java
index f83ceb2..6b865ae 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/resource/ProxyResourceConfigurationConverter.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/resource/ProxyResourceConfigurationConverter.java
@@ -21,7 +21,7 @@ import com.zaxxer.hikari.HikariDataSource;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
-import org.apache.shardingsphere.proxy.config.yaml.YamlResourceConfiguration;
+import org.apache.shardingsphere.proxy.config.yaml.YamlProxyResourceConfiguration;
 
 import java.util.LinkedHashMap;
 import java.util.Map;
@@ -40,12 +40,12 @@ public final class ProxyResourceConfigurationConverter {
      * @param yamlResourceConfigMap yaml resource configuration map
      * @return resource configuration map
      */
-    public static Map<String, ProxyResourceConfiguration> getResourceConfigurationMap(final Map<String, YamlResourceConfiguration> yamlResourceConfigMap) {
+    public static Map<String, ProxyResourceConfiguration> getResourceConfigurationMap(final Map<String, YamlProxyResourceConfiguration> yamlResourceConfigMap) {
         return yamlResourceConfigMap.entrySet().stream()
                 .collect(Collectors.toMap(Entry::getKey, entry -> createResourceConfiguration(entry.getValue()), (oldValue, currentValue) -> oldValue, LinkedHashMap::new));
     }
     
-    private static ProxyResourceConfiguration createResourceConfiguration(final YamlResourceConfiguration yamlConfig) {
+    private static ProxyResourceConfiguration createResourceConfiguration(final YamlProxyResourceConfiguration 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/YamlResourceConfiguration.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyResourceConfiguration.java
similarity index 91%
rename from shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlResourceConfiguration.java
rename to shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyResourceConfiguration.java
index e0e87a5..287ec82 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlResourceConfiguration.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyResourceConfiguration.java
@@ -24,11 +24,11 @@ import org.apache.shardingsphere.infra.yaml.config.pojo.YamlConfiguration;
 import java.util.Properties;
 
 /**
- * Resource configuration for YAML.
+ *  YAML resource configuration for ShardingSphere-Proxy.
  */
 @Getter
 @Setter
-public final class YamlResourceConfiguration implements YamlConfiguration {
+public final class YamlProxyResourceConfiguration implements YamlConfiguration {
     
     private String url;
     
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyRuleConfiguration.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyRuleConfiguration.java
index 4376040..3f67d13 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyRuleConfiguration.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyRuleConfiguration.java
@@ -28,7 +28,7 @@ import java.util.LinkedList;
 import java.util.Map;
 
 /**
- * Rule configuration for YAML.
+ * YAML rule configuration for ShardingSphere-Proxy.
  */
 @Getter
 @Setter
@@ -36,7 +36,7 @@ public final class YamlProxyRuleConfiguration implements YamlConfiguration {
     
     private String schemaName;
     
-    private Map<String, YamlResourceConfiguration> dataSources = new HashMap<>();
+    private Map<String, YamlProxyResourceConfiguration> dataSources = new HashMap<>();
     
     private Collection<YamlRuleConfiguration> rules = new LinkedList<>();
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyServerConfiguration.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyServerConfiguration.java
index 2c1324d..1f8d057 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyServerConfiguration.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyServerConfiguration.java
@@ -28,7 +28,7 @@ import java.util.LinkedList;
 import java.util.Properties;
 
 /**
- * Server configuration for YAML.
+ * YAML server configuration for ShardingSphere-Proxy.
  */
 @Getter
 @Setter
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 531855d..9c5b3c7 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.YamlResourceConfiguration;
+import org.apache.shardingsphere.proxy.config.yaml.YamlProxyResourceConfiguration;
 import org.apache.shardingsphere.proxy.config.yaml.YamlProxyRuleConfiguration;
 import org.apache.shardingsphere.readwritesplitting.yaml.config.YamlReadwriteSplittingRuleConfiguration;
 import org.apache.shardingsphere.readwritesplitting.yaml.config.rule.YamlReadwriteSplittingDataSourceRuleConfiguration;
@@ -125,7 +125,7 @@ public final class ProxyConfigurationLoaderTest {
         assertThat(md5EncryptAlgorithmConfig.getType(), is("MD5"));
     }
     
-    private void assertResourceConfiguration(final YamlResourceConfiguration actual, final String expectedURL) {
+    private void assertResourceConfiguration(final YamlProxyResourceConfiguration 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/resource/ProxyProxyResourceConfigurationConverterTest.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/resource/ProxyProxyResourceConfigurationConverterTest.java
index 8759db1..ec9c966 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/resource/ProxyProxyResourceConfigurationConverterTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/resource/ProxyProxyResourceConfigurationConverterTest.java
@@ -18,7 +18,7 @@
 package org.apache.shardingsphere.proxy.config.resource;
 
 import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
-import org.apache.shardingsphere.proxy.config.yaml.YamlResourceConfiguration;
+import org.apache.shardingsphere.proxy.config.yaml.YamlProxyResourceConfiguration;
 import org.junit.Test;
 
 import java.util.HashMap;
@@ -63,15 +63,15 @@ public final class ProxyProxyResourceConfigurationConverterTest {
     
     @Test
     public void assertGetResourceConfigurationMap() {
-        YamlResourceConfiguration yamlResourceConfig0 = new YamlResourceConfiguration();
+        YamlProxyResourceConfiguration yamlResourceConfig0 = new YamlProxyResourceConfiguration();
         yamlResourceConfig0.setUrl("jdbc:mysql://localhost:3306/ds_0");
         yamlResourceConfig0.setCustomPoolProps(getCustomPoolProperties());
         setYamlResourceConfigurationPropertyWithoutUrl(yamlResourceConfig0);
-        YamlResourceConfiguration yamlResourceConfig1 = new YamlResourceConfiguration();
+        YamlProxyResourceConfiguration yamlResourceConfig1 = new YamlProxyResourceConfiguration();
         yamlResourceConfig1.setUrl("jdbc:mysql://localhost:3306/ds_1");
         yamlResourceConfig1.setCustomPoolProps(getCustomPoolProperties());
         setYamlResourceConfigurationPropertyWithoutUrl(yamlResourceConfig1);
-        Map<String, YamlResourceConfiguration> yamlResourceConfigs = new HashMap<>(2, 1);
+        Map<String, YamlProxyResourceConfiguration> yamlResourceConfigs = new HashMap<>(2, 1);
         yamlResourceConfigs.put("ds_0", yamlResourceConfig0);
         yamlResourceConfigs.put("ds_1", yamlResourceConfig1);
         Map<String, ProxyResourceConfiguration> actualResourceConfig = ProxyResourceConfigurationConverter.getResourceConfigurationMap(yamlResourceConfigs);
@@ -82,7 +82,7 @@ public final class ProxyProxyResourceConfigurationConverterTest {
         assertResourceConfiguration(actualResourceConfig.get("ds_1"));
     }
     
-    private void setYamlResourceConfigurationPropertyWithoutUrl(final YamlResourceConfiguration yamlResourceConfig) {
+    private void setYamlResourceConfigurationPropertyWithoutUrl(final YamlProxyResourceConfiguration 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 2e49056..db936ef 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
@@ -28,7 +28,7 @@ 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.ProxyConfiguration;
 import org.apache.shardingsphere.proxy.config.YamlProxyConfiguration;
-import org.apache.shardingsphere.proxy.config.yaml.YamlResourceConfiguration;
+import org.apache.shardingsphere.proxy.config.yaml.YamlProxyResourceConfiguration;
 import org.apache.shardingsphere.proxy.config.yaml.YamlProxyRuleConfiguration;
 import org.apache.shardingsphere.proxy.config.yaml.YamlProxyServerConfiguration;
 import org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
@@ -142,7 +142,7 @@ public final class YamlProxyConfigurationSwapperTest {
     }
     
     private void mockDataSources(final YamlProxyRuleConfiguration yamlProxyRuleConfig) {
-        YamlResourceConfiguration yamlResourceConfig = new YamlResourceConfiguration();
+        YamlProxyResourceConfiguration yamlResourceConfig = new YamlProxyResourceConfiguration();
         yamlResourceConfig.setUrl("url1");
         yamlResourceConfig.setUsername("username1");
         yamlResourceConfig.setPassword("password1");
@@ -152,7 +152,7 @@ public final class YamlProxyConfigurationSwapperTest {
         yamlResourceConfig.setMaxPoolSize(4);
         yamlResourceConfig.setMinPoolSize(5);
         yamlResourceConfig.setReadOnly(true);
-        Map<String, YamlResourceConfiguration> yamlResourceMap = new HashMap<>(1, 1);
+        Map<String, YamlProxyResourceConfiguration> yamlResourceMap = new HashMap<>(1, 1);
         yamlResourceMap.put("ds1", yamlResourceConfig);
         when(yamlProxyRuleConfig.getDataSources()).thenReturn(yamlResourceMap);
     }