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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]