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 2022/01/09 10:09:30 UTC
[GitHub] [shardingsphere] zzs52 opened a new pull request #14635: Update SingleTableRuleTest.java
zzs52 opened a new pull request #14635:
URL: https://github.com/apache/shardingsphere/pull/14635
Add test cases for SingleTableRule #12215.
Changes proposed in this pull request:
-
-
-
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] codecov-commenter commented on pull request #14635: Update SingleTableRuleTest.java
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #14635:
URL: https://github.com/apache/shardingsphere/pull/14635#issuecomment-1008509526
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/14635?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#14635](https://codecov.io/gh/apache/shardingsphere/pull/14635?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7a13f7d) into [master](https://codecov.io/gh/apache/shardingsphere/commit/903dcfa05da9f169ad8b9c866a21be602616295e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (903dcfa) will **decrease** coverage by `0.24%`.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/apache/shardingsphere/pull/14635?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #14635 +/- ##
============================================
- Coverage 59.82% 59.57% -0.25%
- Complexity 1814 1849 +35
============================================
Files 2997 3032 +35
Lines 44561 45180 +619
Branches 7564 7637 +73
============================================
+ Hits 26658 26918 +260
- Misses 15837 16160 +323
- Partials 2066 2102 +36
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/14635?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...ext/data/impl/BroadcastDatabaseBackendHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/14635/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2RhdGEvaW1wbC9Ccm9hZGNhc3REYXRhYmFzZUJhY2tlbmRIYW5kbGVyLmphdmE=) | `40.90% <0.00%> (-50.01%)` | :arrow_down: |
| [...munication/DatabaseCommunicationEngineFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/14635/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC9jb21tdW5pY2F0aW9uL0RhdGFiYXNlQ29tbXVuaWNhdGlvbkVuZ2luZUZhY3RvcnkuamF2YQ==) | `72.72% <0.00%> (-27.28%)` | :arrow_down: |
| [...he/shardingsphere/mode/manager/ContextManager.java](https://codecov.io/gh/apache/shardingsphere/pull/14635/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtbW9kZS9zaGFyZGluZ3NwaGVyZS1tb2RlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL21vZGUvbWFuYWdlci9Db250ZXh0TWFuYWdlci5qYXZh) | `62.11% <0.00%> (-20.35%)` | :arrow_down: |
| [...d/OnRuleAlteredActionConfigurationYamlSwapper.java](https://codecov.io/gh/apache/shardingsphere/pull/14635/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS95YW1sL2NvbmZpZy9zd2FwcGVyL3J1bGVhbHRlcmVkL09uUnVsZUFsdGVyZWRBY3Rpb25Db25maWd1cmF0aW9uWWFtbFN3YXBwZXIuamF2YQ==) | `81.39% <0.00%> (-18.61%)` | :arrow_down: |
| [...nd/text/transaction/TransactionBackendHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/14635/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L3RyYW5zYWN0aW9uL1RyYW5zYWN0aW9uQmFja2VuZEhhbmRsZXIuamF2YQ==) | `24.39% <0.00%> (-14.08%)` | :arrow_down: |
| [.../ddl/impl/ShardingAlterViewStatementValidator.java](https://codecov.io/gh/apache/shardingsphere/pull/14635/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcm91dGUvZW5naW5lL3ZhbGlkYXRvci9kZGwvaW1wbC9TaGFyZGluZ0FsdGVyVmlld1N0YXRlbWVudFZhbGlkYXRvci5qYXZh) | `75.00% <0.00%> (-13.89%)` | :arrow_down: |
| [...ddl/impl/ShardingCreateViewStatementValidator.java](https://codecov.io/gh/apache/shardingsphere/pull/14635/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcm91dGUvZW5naW5lL3ZhbGlkYXRvci9kZGwvaW1wbC9TaGFyZGluZ0NyZWF0ZVZpZXdTdGF0ZW1lbnRWYWxpZGF0b3IuamF2YQ==) | `75.00% <0.00%> (-13.89%)` | :arrow_down: |
| [...ompute/subscriber/ComputeNodeStatusSubscriber.java](https://codecov.io/gh/apache/shardingsphere/pull/14635/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtbW9kZS9zaGFyZGluZ3NwaGVyZS1tb2RlLXR5cGUvc2hhcmRpbmdzcGhlcmUtY2x1c3Rlci1tb2RlL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItbW9kZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9tb2RlL21hbmFnZXIvY2x1c3Rlci9jb29yZGluYXRvci9yZWdpc3RyeS9zdGF0dXMvY29tcHV0ZS9zdWJzY3JpYmVyL0NvbXB1dGVOb2RlU3RhdHVzU3Vic2NyaWJlci5qYXZh) | `33.33% <0.00%> (-11.12%)` | :arrow_down: |
| [...impl/ShardingCreateFunctionStatementValidator.java](https://codecov.io/gh/apache/shardingsphere/pull/14635/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcm91dGUvZW5naW5lL3ZhbGlkYXRvci9kZGwvaW1wbC9TaGFyZGluZ0NyZWF0ZUZ1bmN0aW9uU3RhdGVtZW50VmFsaWRhdG9yLmphdmE=) | `80.00% <0.00%> (-10.91%)` | :arrow_down: |
| [...mpl/ShardingCreateProcedureStatementValidator.java](https://codecov.io/gh/apache/shardingsphere/pull/14635/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcm91dGUvZW5naW5lL3ZhbGlkYXRvci9kZGwvaW1wbC9TaGFyZGluZ0NyZWF0ZVByb2NlZHVyZVN0YXRlbWVudFZhbGlkYXRvci5qYXZh) | `80.00% <0.00%> (-10.91%)` | :arrow_down: |
| ... and [184 more](https://codecov.io/gh/apache/shardingsphere/pull/14635/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/14635?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/14635?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [903dcfa...7a13f7d](https://codecov.io/gh/apache/shardingsphere/pull/14635?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on a change in pull request #14635: Update SingleTableRuleTest.java
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on a change in pull request #14635:
URL: https://github.com/apache/shardingsphere/pull/14635#discussion_r780850600
##########
File path: shardingsphere-kernel/shardingsphere-single-table/shardingsphere-single-table-core/src/test/java/org/apache/shardingsphere/singletable/rule/SingleTableRuleTest.java
##########
@@ -87,7 +91,7 @@ public void assertGetRuleType() {
Collections.emptyMap(), Collections.emptyList(), new ConfigurationProperties(new Properties()));
assertThat(singleTableRule.getType(), is(SingleTableRule.class.getSimpleName()));
}
-
Review comment:
@zzs52 Please keep indents consistent with the previous one.
##########
File path: shardingsphere-kernel/shardingsphere-single-table/shardingsphere-single-table-core/src/test/java/org/apache/shardingsphere/singletable/rule/SingleTableRuleTest.java
##########
@@ -133,4 +137,138 @@ public void assertFindSingleTableDataNodeWithUpperCase() {
assertThat(actual.get().getDataSourceName(), is("ds_0"));
assertThat(actual.get().getTableName(), is("employee"));
}
+
+ @Test
+ public void assertIsSingleTablesInSameDataSource() {
+ DataNodeContainedRule dataNodeContainedRule = mock(DataNodeContainedRule.class);
+ SingleTableRule singleTableRule = new SingleTableRule(new SingleTableRuleConfiguration(), mock(DatabaseType.class), dataSourceMap,
+ Collections.singletonList(dataNodeContainedRule), new ConfigurationProperties(new Properties()));
+ Collection<String> singleTableNames = new ArrayList<>();
Review comment:
LinkedList may be better.
##########
File path: shardingsphere-kernel/shardingsphere-single-table/shardingsphere-single-table-core/src/test/java/org/apache/shardingsphere/singletable/rule/SingleTableRuleTest.java
##########
@@ -133,4 +137,138 @@ public void assertFindSingleTableDataNodeWithUpperCase() {
assertThat(actual.get().getDataSourceName(), is("ds_0"));
assertThat(actual.get().getTableName(), is("employee"));
}
+
+ @Test
+ public void assertIsSingleTablesInSameDataSource() {
+ DataNodeContainedRule dataNodeContainedRule = mock(DataNodeContainedRule.class);
+ SingleTableRule singleTableRule = new SingleTableRule(new SingleTableRuleConfiguration(), mock(DatabaseType.class), dataSourceMap,
+ Collections.singletonList(dataNodeContainedRule), new ConfigurationProperties(new Properties()));
+ Collection<String> singleTableNames = new ArrayList<>();
+ singleTableNames.add("employee");
+ assertTrue(singleTableRule.isSingleTablesInSameDataSource(singleTableNames));
+ }
+
+ @Test
+ public void assertIsAllTablesInSameDataSource() {
+ DataNodeContainedRule dataNodeContainedRule = mock(DataNodeContainedRule.class);
+ SingleTableRule singleTableRule = new SingleTableRule(new SingleTableRuleConfiguration(), mock(DatabaseType.class), dataSourceMap,
+ Collections.singletonList(dataNodeContainedRule), new ConfigurationProperties(new Properties()));
+ Collection<String> singleTableNames = new ArrayList<>();
+ singleTableNames.add("employee");
+ RouteMapper dataSourceMapper = new RouteMapper("ds_0", null);
+ Collection<RouteMapper> tableMappers = new ArrayList<>();
Review comment:
Same problem.
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] zzs52 commented on pull request #14635: Update SingleTableRuleTest.java
Posted by GitBox <gi...@apache.org>.
zzs52 commented on pull request #14635:
URL: https://github.com/apache/shardingsphere/pull/14635#issuecomment-1008727551
> @zzs52 Good job, please go ahead.
Thanks for the encouragement, I will.
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] zzs52 commented on pull request #14635: Update SingleTableRuleTest.java
Posted by GitBox <gi...@apache.org>.
zzs52 commented on pull request #14635:
URL: https://github.com/apache/shardingsphere/pull/14635#issuecomment-1008299859
Hi,CI prompts me to have 1 Checkstyle violation.But I didn't check it out.Can you tell me where is the problem I would be grateful?
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu merged pull request #14635: Update SingleTableRuleTest.java
Posted by GitBox <gi...@apache.org>.
strongduanmu merged pull request #14635:
URL: https://github.com/apache/shardingsphere/pull/14635
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] zzs52 commented on a change in pull request #14635: Update SingleTableRuleTest.java
Posted by GitBox <gi...@apache.org>.
zzs52 commented on a change in pull request #14635:
URL: https://github.com/apache/shardingsphere/pull/14635#discussion_r780878277
##########
File path: shardingsphere-kernel/shardingsphere-single-table/shardingsphere-single-table-core/src/test/java/org/apache/shardingsphere/singletable/rule/SingleTableRuleTest.java
##########
@@ -133,4 +137,138 @@ public void assertFindSingleTableDataNodeWithUpperCase() {
assertThat(actual.get().getDataSourceName(), is("ds_0"));
assertThat(actual.get().getTableName(), is("employee"));
}
+
+ @Test
+ public void assertIsSingleTablesInSameDataSource() {
+ DataNodeContainedRule dataNodeContainedRule = mock(DataNodeContainedRule.class);
+ SingleTableRule singleTableRule = new SingleTableRule(new SingleTableRuleConfiguration(), mock(DatabaseType.class), dataSourceMap,
+ Collections.singletonList(dataNodeContainedRule), new ConfigurationProperties(new Properties()));
+ Collection<String> singleTableNames = new ArrayList<>();
+ singleTableNames.add("employee");
+ assertTrue(singleTableRule.isSingleTablesInSameDataSource(singleTableNames));
+ }
+
+ @Test
+ public void assertIsAllTablesInSameDataSource() {
+ DataNodeContainedRule dataNodeContainedRule = mock(DataNodeContainedRule.class);
+ SingleTableRule singleTableRule = new SingleTableRule(new SingleTableRuleConfiguration(), mock(DatabaseType.class), dataSourceMap,
+ Collections.singletonList(dataNodeContainedRule), new ConfigurationProperties(new Properties()));
+ Collection<String> singleTableNames = new ArrayList<>();
+ singleTableNames.add("employee");
+ RouteMapper dataSourceMapper = new RouteMapper("ds_0", null);
+ Collection<RouteMapper> tableMappers = new ArrayList<>();
Review comment:
> Same problem.
Thank you so much.
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on a change in pull request #14635: Update SingleTableRuleTest.java
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on a change in pull request #14635:
URL: https://github.com/apache/shardingsphere/pull/14635#discussion_r780905545
##########
File path: shardingsphere-kernel/shardingsphere-single-table/shardingsphere-single-table-core/src/test/java/org/apache/shardingsphere/singletable/rule/SingleTableRuleTest.java
##########
@@ -32,44 +34,46 @@
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;
import java.util.stream.Collectors;
import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public final class SingleTableRuleTest {
-
+
private static final String TABLE_TYPE = "TABLE";
-
Review comment:
@zzs52 Please keep indents consistent with the previous one.
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on pull request #14635: Update SingleTableRuleTest.java
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on pull request #14635:
URL: https://github.com/apache/shardingsphere/pull/14635#issuecomment-1008453338
> Can
@zzs52 src/test/java/org/apache/shardingsphere/singletable/rule/SingleTableRuleTest.java:[154] (coding) VariableDeclarationUsageDistance: Distance between variable 'singleTableRule' declaration and its first usage is 4, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org