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/05/15 03:05:04 UTC

[GitHub] [shardingsphere] hitnewbee opened a new pull request #5616: Issue 5428

hitnewbee opened a new pull request #5616:
URL: https://github.com/apache/shardingsphere/pull/5616


   Fixes #5428 .
   
   Changes proposed in this pull request:
   - Move inline string to yaml file in resource folder
   - Add method to read yaml as string
   


----------------------------------------------------------------
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



[GitHub] [shardingsphere] codecov-io commented on pull request #5616: Issue 5428 for SchemaChangedListenerTest.java

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #5616:
URL: https://github.com/apache/shardingsphere/pull/5616#issuecomment-629116941


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/5616?src=pr&el=h1) Report
   > Merging [#5616](https://codecov.io/gh/apache/shardingsphere/pull/5616?src=pr&el=desc) into [master](https://codecov.io/gh/apache/shardingsphere/commit/3a518603d5f4ee0f7480865fd0ce457c70b96b53&el=desc) will **increase** coverage by `0.07%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/5616/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so)](https://codecov.io/gh/apache/shardingsphere/pull/5616?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #5616      +/-   ##
   ============================================
   + Coverage     55.90%   55.98%   +0.07%     
   - Complexity      433      434       +1     
   ============================================
     Files          1142     1142              
     Lines         20228    20219       -9     
     Branches       3676     3674       -2     
   ============================================
   + Hits          11309    11319      +10     
   + Misses         8241     8220      -21     
   - Partials        678      680       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/5616?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...here/underlying/common/yaml/engine/YamlEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/5616/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtdW5kZXJseWluZy9zaGFyZGluZ3NwaGVyZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3VuZGVybHlpbmcvY29tbW9uL3lhbWwvZW5naW5lL1lhbWxFbmdpbmUuamF2YQ==) | `16.66% <0.00%> (-24.51%)` | `0.00% <0.00%> (ø%)` | |
   | [...aml/representer/ShardingSphereYAMLRepresenter.java](https://codecov.io/gh/apache/shardingsphere/pull/5616/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtdW5kZXJseWluZy9zaGFyZGluZ3NwaGVyZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3VuZGVybHlpbmcvY29tbW9uL3lhbWwvcmVwcmVzZW50ZXIvU2hhcmRpbmdTcGhlcmVZQU1MUmVwcmVzZW50ZXIuamF2YQ==) | `66.66% <0.00%> (-4.77%)` | `0.00% <0.00%> (ø%)` | |
   | [...apache/shardingsphere/shardingproxy/Bootstrap.java](https://codecov.io/gh/apache/shardingsphere/pull/5616/diff?src=pr&el=tree#diff-c2hhcmRpbmctcHJveHkvc2hhcmRpbmctcHJveHktYm9vdHN0cmFwL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFyZGluZ3Byb3h5L0Jvb3RzdHJhcC5qYXZh) | `0.00% <0.00%> (ø)` | `0.00% <0.00%> (ø%)` | |
   | [...ere/underlying/common/log/ConfigurationLogger.java](https://codecov.io/gh/apache/shardingsphere/pull/5616/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtdW5kZXJseWluZy9zaGFyZGluZ3NwaGVyZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3VuZGVybHlpbmcvY29tbW9uL2xvZy9Db25maWd1cmF0aW9uTG9nZ2VyLmphdmE=) | `81.81% <0.00%> (ø)` | `0.00% <0.00%> (ø%)` | |
   | [...representer/processor/SkipUnsetTupleProcessor.java](https://codecov.io/gh/apache/shardingsphere/pull/5616/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtdW5kZXJseWluZy9zaGFyZGluZ3NwaGVyZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3VuZGVybHlpbmcvY29tbW9uL3lhbWwvcmVwcmVzZW50ZXIvcHJvY2Vzc29yL1NraXBVbnNldFR1cGxlUHJvY2Vzc29yLmphdmE=) | | | |
   | [...yaml/representer/processor/NoneTupleProcessor.java](https://codecov.io/gh/apache/shardingsphere/pull/5616/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtdW5kZXJseWluZy9zaGFyZGluZ3NwaGVyZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3VuZGVybHlpbmcvY29tbW9uL3lhbWwvcmVwcmVzZW50ZXIvcHJvY2Vzc29yL05vbmVUdXBsZVByb2Nlc3Nvci5qYXZh) | | | |
   | [...presenter/processor/DefaultYAMLTupleProcessor.java](https://codecov.io/gh/apache/shardingsphere/pull/5616/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtdW5kZXJseWluZy9zaGFyZGluZ3NwaGVyZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3VuZGVybHlpbmcvY29tbW9uL3lhbWwvcmVwcmVzZW50ZXIvcHJvY2Vzc29yL0RlZmF1bHRZQU1MVHVwbGVQcm9jZXNzb3IuamF2YQ==) | `100.00% <0.00%> (ø)` | `1.00% <0.00%> (?%)` | |
   | [...yaml/representer/processor/NoneTupleProcessor.java](https://codecov.io/gh/apache/shardingsphere/pull/5616/diff?src=pr&el=tree#diff-c2hhcmRpbmctY29yZS9zaGFyZGluZy1jb3JlLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcveWFtbC9yZXByZXNlbnRlci9wcm9jZXNzb3IvTm9uZVR1cGxlUHJvY2Vzc29yLmphdmE=) | `80.00% <0.00%> (ø)` | `1.00% <0.00%> (?%)` | |
   | [...ml/swapper/YamlRuleConfigurationSwapperEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/5616/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtdW5kZXJseWluZy9zaGFyZGluZ3NwaGVyZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3VuZGVybHlpbmcvY29tbW9uL3lhbWwvc3dhcHBlci9ZYW1sUnVsZUNvbmZpZ3VyYXRpb25Td2FwcGVyRW5naW5lLmphdmE=) | `25.92% <0.00%> (+0.92%)` | `1.00% <0.00%> (ø%)` | |
   | [...ner/PostShardingCenterRepositoryEventListener.java](https://codecov.io/gh/apache/shardingsphere/pull/5616/diff?src=pr&el=tree#diff-c2hhcmRpbmctb3JjaGVzdHJhdGlvbi9zaGFyZGluZy1vcmNoZXN0cmF0aW9uLWNvcmUvc2hhcmRpbmctb3JjaGVzdHJhdGlvbi1jb3JlLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvb3JjaGVzdHJhdGlvbi9jb3JlL2NvbW1vbi9saXN0ZW5lci9Qb3N0U2hhcmRpbmdDZW50ZXJSZXBvc2l0b3J5RXZlbnRMaXN0ZW5lci5qYXZh) | `90.00% <0.00%> (+20.00%)` | `0.00% <0.00%> (ø%)` | |
   | ... and [4 more](https://codecov.io/gh/apache/shardingsphere/pull/5616/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/5616?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/5616?src=pr&el=footer). Last update [3a51860...16e5dc5](https://codecov.io/gh/apache/shardingsphere/pull/5616?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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



[GitHub] [shardingsphere] terrymanu merged pull request #5616: Issue 5428 for SchemaChangedListenerTest.java

Posted by GitBox <gi...@apache.org>.
terrymanu merged pull request #5616:
URL: https://github.com/apache/shardingsphere/pull/5616


   


----------------------------------------------------------------
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



[GitHub] [shardingsphere] kimmking commented on pull request #5616: Issue 5428 for SchemaChangedListenerTest.java

Posted by GitBox <gi...@apache.org>.
kimmking commented on pull request #5616:
URL: https://github.com/apache/shardingsphere/pull/5616#issuecomment-629037840


   conflict should be solved.


----------------------------------------------------------------
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



[GitHub] [shardingsphere] terrymanu commented on a change in pull request #5616: Issue 5428 for SchemaChangedListenerTest.java

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #5616:
URL: https://github.com/apache/shardingsphere/pull/5616#discussion_r425546547



##########
File path: sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-configcenter/src/test/resources/sharding-rule.yaml
##########
@@ -0,0 +1,30 @@
+#
+# 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.
+#
+
+rules:
+- !!org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration
+  tables:
+    t_order:
+      logicTable: t_order
+      actualDataNodes: ds_${0..1}.t_order_${0..1}
+      tableStrategy:
+        standard:
+          shardingAlgorithm:
+            type: INLINE
+            props:
+              algorithm.expression: t_order_${order_id % 2}
+          shardingColumn: order_id

Review comment:
       Please leave a new line in the end of file




----------------------------------------------------------------
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



[GitHub] [shardingsphere] coveralls commented on pull request #5616: Issue 5428 for SchemaChangedListenerTest.java

Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #5616:
URL: https://github.com/apache/shardingsphere/pull/5616#issuecomment-629006121


   ## Pull Request Test Coverage Report for [Build 11755](https://coveralls.io/builds/30804776)
   
   * **0** of **0**   changed or added relevant lines in **0** files are covered.
   * No unchanged relevant lines lost coverage.
   * Overall coverage remained the same at **59.333%**
   
   ---
   
   
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/30804776/badge)](https://coveralls.io/builds/30804776) |
   | :-- | --: |
   | Change from base [Build 11754](https://coveralls.io/builds/30803652): |  0.0% |
   | Covered Lines: | 11990 |
   | Relevant Lines: | 20208 |
   
   ---
   ##### 💛  - [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



[GitHub] [shardingsphere] hitnewbee commented on a change in pull request #5616: Issue 5428 for SchemaChangedListenerTest.java

Posted by GitBox <gi...@apache.org>.
hitnewbee commented on a change in pull request #5616:
URL: https://github.com/apache/shardingsphere/pull/5616#discussion_r425551258



##########
File path: sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-configcenter/src/test/java/org/apache/shardingsphere/orchestration/core/configcenter/listener/SchemaChangedListenerTest.java
##########
@@ -120,16 +83,33 @@ public void assertCreateIgnoredEvent() {
     }
     
     @Test
-    public void assertCreateDataSourceChangedEventForExistedSchema() {
-        DataChangedEvent dataChangedEvent = new DataChangedEvent("/test/config/schema/sharding_db/datasource", DATA_SOURCE_YAML, ChangedType.UPDATED);
+    public void assertCreateDataSourceChangedEventForExistedSchema() throws IOException {
+        String dataSource = readYamlIntoString(DATA_SOURCE_YAML);
+        DataChangedEvent dataChangedEvent = new DataChangedEvent("/test/config/schema/sharding_db/datasource", dataSource, ChangedType.UPDATED);
         ShardingOrchestrationEvent actual = schemaChangedListener.createShardingOrchestrationEvent(dataChangedEvent);
         assertThat(actual, instanceOf(DataSourceChangedEvent.class));
         assertThat(((DataSourceChangedEvent) actual).getShardingSchemaName(), is("sharding_db"));
     }
+
+    private String readYamlIntoString(final String yamlFile) throws IOException {
+        File file = new File(Preconditions.checkNotNull(getClass().getClassLoader().getResource(yamlFile), "file resource `%s` must not be null.", yamlFile).getFile());
+        StringBuilder yamlContent = new StringBuilder();
+        FileReader fileReader = new FileReader(file);
+        BufferedReader reader = new BufferedReader(fileReader);
+        String line;
+        while (null != (line = reader.readLine())) {

Review comment:
       OK, I will try snake yaml




----------------------------------------------------------------
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



[GitHub] [shardingsphere] terrymanu commented on a change in pull request #5616: Issue 5428 for SchemaChangedListenerTest.java

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #5616:
URL: https://github.com/apache/shardingsphere/pull/5616#discussion_r425546319



##########
File path: sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-configcenter/src/test/java/org/apache/shardingsphere/orchestration/core/configcenter/listener/SchemaChangedListenerTest.java
##########
@@ -120,16 +83,33 @@ public void assertCreateIgnoredEvent() {
     }
     
     @Test
-    public void assertCreateDataSourceChangedEventForExistedSchema() {
-        DataChangedEvent dataChangedEvent = new DataChangedEvent("/test/config/schema/sharding_db/datasource", DATA_SOURCE_YAML, ChangedType.UPDATED);
+    public void assertCreateDataSourceChangedEventForExistedSchema() throws IOException {
+        String dataSource = readYamlIntoString(DATA_SOURCE_YAML);
+        DataChangedEvent dataChangedEvent = new DataChangedEvent("/test/config/schema/sharding_db/datasource", dataSource, ChangedType.UPDATED);
         ShardingOrchestrationEvent actual = schemaChangedListener.createShardingOrchestrationEvent(dataChangedEvent);
         assertThat(actual, instanceOf(DataSourceChangedEvent.class));
         assertThat(((DataSourceChangedEvent) actual).getShardingSchemaName(), is("sharding_db"));
     }
+
+    private String readYamlIntoString(final String yamlFile) throws IOException {
+        File file = new File(Preconditions.checkNotNull(getClass().getClassLoader().getResource(yamlFile), "file resource `%s` must not be null.", yamlFile).getFile());
+        StringBuilder yamlContent = new StringBuilder();
+        FileReader fileReader = new FileReader(file);
+        BufferedReader reader = new BufferedReader(fileReader);
+        String line;
+        while (null != (line = reader.readLine())) {

Review comment:
       Why need to skip comment here? Can snake yaml process the comment?




----------------------------------------------------------------
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



[GitHub] [shardingsphere] coveralls edited a comment on pull request #5616: Issue 5428 for SchemaChangedListenerTest.java

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #5616:
URL: https://github.com/apache/shardingsphere/pull/5616#issuecomment-629006121


   ## Pull Request Test Coverage Report for [Build 11770](https://coveralls.io/builds/30809420)
   
   * **0** of **0**   changed or added relevant lines in **0** files are covered.
   * **46** unchanged lines in **4** files lost coverage.
   * Overall coverage increased (+**0.09%**) to **59.419%**
   
   ---
   
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-----|--------------|--: |
   | [shardingsphere-underlying/shardingsphere-common/src/main/java/org/apache/shardingsphere/underlying/common/yaml/representer/ShardingSphereYAMLRepresenter.java](https://coveralls.io/builds/30809420/source?filename=shardingsphere-underlying%2Fshardingsphere-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Funderlying%2Fcommon%2Fyaml%2Frepresenter%2FShardingSphereYAMLRepresenter.java#L51) | 1 | 75.0% |
   | [shardingsphere-underlying/shardingsphere-common/src/main/java/org/apache/shardingsphere/underlying/common/yaml/engine/YamlEngine.java](https://coveralls.io/builds/30809420/source?filename=shardingsphere-underlying%2Fshardingsphere-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Funderlying%2Fcommon%2Fyaml%2Fengine%2FYamlEngine.java#L54) | 5 | 33.33% |
   | [shardingsphere-underlying/shardingsphere-common/src/main/java/org/apache/shardingsphere/underlying/common/yaml/swapper/YamlRuleConfigurationSwapperEngine.java](https://coveralls.io/builds/30809420/source?filename=shardingsphere-underlying%2Fshardingsphere-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Funderlying%2Fcommon%2Fyaml%2Fswapper%2FYamlRuleConfigurationSwapperEngine.java#L53) | 14 | 33.33% |
   | [sharding-proxy/sharding-proxy-bootstrap/src/main/java/org/apache/shardingsphere/shardingproxy/Bootstrap.java](https://coveralls.io/builds/30809420/source?filename=sharding-proxy%2Fsharding-proxy-bootstrap%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingproxy%2FBootstrap.java#L122) | 26 | 0% |
   <!-- | **Total:** | **46** |  | -->
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/30809420/badge)](https://coveralls.io/builds/30809420) |
   | :-- | --: |
   | Change from base [Build 11761](https://coveralls.io/builds/30807168): |  0.09% |
   | Covered Lines: | 12014 |
   | Relevant Lines: | 20219 |
   
   ---
   ##### 💛  - [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