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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to