You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/03/10 02:55:26 UTC

[GitHub] [incubator-shardingsphere] kimmking opened a new pull request #4682: Refactor orchestration phase 1

kimmking opened a new pull request #4682: Refactor orchestration phase 1 
URL: https://github.com/apache/incubator-shardingsphere/pull/4682
 
 
   
   Changes proposed in this pull request:
   - 1.1 refactoring for java8 and polish codes

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull request #4682: Refactor orchestration phase 1.1

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #4682: Refactor orchestration phase 1.1
URL: https://github.com/apache/incubator-shardingsphere/pull/4682#discussion_r390073977
 
 

 ##########
 File path: sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/constant/OrchestrationType.java
 ##########
 @@ -39,11 +40,6 @@
      * @return OrchestrationType enum, return {@code null} if not found
      */
     public static OrchestrationType findByValue(final String value) {
-        for (OrchestrationType each : OrchestrationType.values()) {
-            if (each.getValue().equals(value)) {
-                return each;
-            }
-        }
-        return null;
+        return Lists.newArrayList(OrchestrationType.values()).stream().filter(each -> each.getValue().equals(value)).findFirst().get();
 
 Review comment:
   We need to avoid using guava, Arrays.asList can replace Lists.newArrayList

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] kimmking commented on a change in pull request #4682: Refactor orchestration phase 1.1

Posted by GitBox <gi...@apache.org>.
kimmking commented on a change in pull request #4682: Refactor orchestration phase 1.1
URL: https://github.com/apache/incubator-shardingsphere/pull/4682#discussion_r390074242
 
 

 ##########
 File path: sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/constant/OrchestrationType.java
 ##########
 @@ -39,11 +40,6 @@
      * @return OrchestrationType enum, return {@code null} if not found
      */
     public static OrchestrationType findByValue(final String value) {
-        for (OrchestrationType each : OrchestrationType.values()) {
-            if (each.getValue().equals(value)) {
-                return each;
-            }
-        }
-        return null;
+        return Lists.newArrayList(OrchestrationType.values()).stream().filter(each -> each.getValue().equals(value)).findFirst().get();
 
 Review comment:
   > We need to avoid using guava, Arrays.asList can replace Lists.newArrayList
   
   OK

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] kimmking commented on a change in pull request #4682: Refactor orchestration phase 1.1

Posted by GitBox <gi...@apache.org>.
kimmking commented on a change in pull request #4682: Refactor orchestration phase 1.1
URL: https://github.com/apache/incubator-shardingsphere/pull/4682#discussion_r390074343
 
 

 ##########
 File path: sharding-orchestration/sharding-orchestration-center/sharding-orchestration-center-api/src/main/java/org/apache/shardingsphere/orchestration/center/yaml/swapper/InstanceConfigurationYamlSwapper.java
 ##########
 @@ -34,13 +34,13 @@
      */
     @Override
     public YamlInstanceConfiguration swap(final InstanceConfiguration data) {
-        YamlInstanceConfiguration result = new YamlInstanceConfiguration();
-        result.setOrchestrationType(data.getOrchestrationType());
-        result.setInstanceType(data.getType());
-        result.setServerLists(data.getServerLists());
-        result.setNamespace(data.getNamespace());
-        result.setProps(data.getProperties());
-        return result;
+        YamlInstanceConfiguration yamlInstanceConfiguration = new YamlInstanceConfiguration();
+        yamlInstanceConfiguration.setOrchestrationType(data.getOrchestrationType());
+        yamlInstanceConfiguration.setInstanceType(data.getType());
+        yamlInstanceConfiguration.setServerLists(data.getServerLists());
+        yamlInstanceConfiguration.setNamespace(data.getNamespace());
+        yamlInstanceConfiguration.setProps(data.getProperties());
+        return yamlInstanceConfiguration;
 
 Review comment:
   > The result variable need to rename as result
   
   why use result as variable name?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull request #4682: Refactor orchestration phase 1.1

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #4682: Refactor orchestration phase 1.1
URL: https://github.com/apache/incubator-shardingsphere/pull/4682#discussion_r390073518
 
 

 ##########
 File path: sharding-orchestration/sharding-orchestration-center/sharding-orchestration-center-api/src/main/java/org/apache/shardingsphere/orchestration/center/yaml/swapper/InstanceConfigurationYamlSwapper.java
 ##########
 @@ -34,13 +34,13 @@
      */
     @Override
     public YamlInstanceConfiguration swap(final InstanceConfiguration data) {
-        YamlInstanceConfiguration result = new YamlInstanceConfiguration();
-        result.setOrchestrationType(data.getOrchestrationType());
-        result.setInstanceType(data.getType());
-        result.setServerLists(data.getServerLists());
-        result.setNamespace(data.getNamespace());
-        result.setProps(data.getProperties());
-        return result;
+        YamlInstanceConfiguration yamlInstanceConfiguration = new YamlInstanceConfiguration();
+        yamlInstanceConfiguration.setOrchestrationType(data.getOrchestrationType());
+        yamlInstanceConfiguration.setInstanceType(data.getType());
+        yamlInstanceConfiguration.setServerLists(data.getServerLists());
+        yamlInstanceConfiguration.setNamespace(data.getNamespace());
+        yamlInstanceConfiguration.setProps(data.getProperties());
+        return yamlInstanceConfiguration;
 
 Review comment:
   The result variable need to rename as result

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull request #4682: Refactor orchestration phase 1.1

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #4682: Refactor orchestration phase 1.1
URL: https://github.com/apache/incubator-shardingsphere/pull/4682#discussion_r390080460
 
 

 ##########
 File path: sharding-orchestration/sharding-orchestration-center/sharding-orchestration-center-api/src/main/java/org/apache/shardingsphere/orchestration/center/yaml/swapper/InstanceConfigurationYamlSwapper.java
 ##########
 @@ -34,13 +34,13 @@
      */
     @Override
     public YamlInstanceConfiguration swap(final InstanceConfiguration data) {
-        YamlInstanceConfiguration result = new YamlInstanceConfiguration();
-        result.setOrchestrationType(data.getOrchestrationType());
-        result.setInstanceType(data.getType());
-        result.setServerLists(data.getServerLists());
-        result.setNamespace(data.getNamespace());
-        result.setProps(data.getProperties());
-        return result;
+        YamlInstanceConfiguration yamlInstanceConfiguration = new YamlInstanceConfiguration();
+        yamlInstanceConfiguration.setOrchestrationType(data.getOrchestrationType());
+        yamlInstanceConfiguration.setInstanceType(data.getType());
+        yamlInstanceConfiguration.setServerLists(data.getServerLists());
+        yamlInstanceConfiguration.setNamespace(data.getNamespace());
+        yamlInstanceConfiguration.setProps(data.getProperties());
+        return yamlInstanceConfiguration;
 
 Review comment:
   FIY: https://shardingsphere.apache.org/community/en/contribute/code-conduct/
   
   `Return values are named with result; Variables in the loop structure are named with each; Replace each with entry in map.`
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] coveralls commented on issue #4682: Refactor orchestration phase 1.1

Posted by GitBox <gi...@apache.org>.
coveralls commented on issue #4682: Refactor orchestration phase 1.1
URL: https://github.com/apache/incubator-shardingsphere/pull/4682#issuecomment-596883076
 
 
   ## Pull Request Test Coverage Report for [Build 2049](https://coveralls.io/builds/29239023)
   
   * **47** of **48**   **(97.92%)**  changed or added relevant lines in **16** files are covered.
   * No unchanged relevant lines lost coverage.
   * Overall coverage decreased (**-0.02%**) to **59.101%**
   
   ---
   
   |  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
   | :-----|--------------|--------|---: |
   | [sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/constant/OrchestrationType.java](https://coveralls.io/builds/29239023/source?filename=sharding-orchestration%2Fsharding-orchestration-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Forchestration%2Fconstant%2FOrchestrationType.java#L43) | 0 | 1 | 0.0%
   <!-- | **Total:** | **47** | **48** | **97.92%** | -->
   
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/29239023/badge)](https://coveralls.io/builds/29239023) |
   | :-- | --: |
   | Change from base [Build 1034](https://coveralls.io/builds/29226389): |  -0.02% |
   | Covered Lines: | 12111 |
   | Relevant Lines: | 20492 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] coveralls edited a comment on issue #4682: Refactor orchestration phase 1.1

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on issue #4682: Refactor orchestration phase 1.1
URL: https://github.com/apache/incubator-shardingsphere/pull/4682#issuecomment-596883076
 
 
   ## Pull Request Test Coverage Report for [Build 2051](https://coveralls.io/builds/29240348)
   
   * **38** of **40**   **(95.0%)**  changed or added relevant lines in **18** files are covered.
   * No unchanged relevant lines lost coverage.
   * Overall coverage decreased (**-0.02%**) to **59.101%**
   
   ---
   
   |  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
   | :-----|--------------|--------|---: |
   | [sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/constant/OrchestrationType.java](https://coveralls.io/builds/29240348/source?filename=sharding-orchestration%2Fsharding-orchestration-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Forchestration%2Fconstant%2FOrchestrationType.java#L44) | 0 | 1 | 0.0%
   | [sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/registry/config/service/ConfigurationService.java](https://coveralls.io/builds/29240348/source?filename=sharding-orchestration%2Fsharding-orchestration-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Forchestration%2Finternal%2Fregistry%2Fconfig%2Fservice%2FConfigurationService.java#L176) | 1 | 2 | 50.0%
   <!-- | **Total:** | **38** | **40** | **95.0%** | -->
   
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/29240348/badge)](https://coveralls.io/builds/29240348) |
   | :-- | --: |
   | Change from base [Build 1034](https://coveralls.io/builds/29226389): |  -0.02% |
   | Covered Lines: | 12111 |
   | Relevant Lines: | 20492 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu merged pull request #4682: Refactor orchestration phase 1.1

Posted by GitBox <gi...@apache.org>.
terrymanu merged pull request #4682: Refactor orchestration phase 1.1
URL: https://github.com/apache/incubator-shardingsphere/pull/4682
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services