wenweibin commented on a change in pull request #8141:
URL: https://github.com/apache/shardingsphere/pull/8141#discussion_r525008247
##########
File path:
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/DataNodesTest.java
##########
@@ -79,18 +77,19 @@ public void assertGetDataNodeGroups() {
}
private DataNodes getRoutedRuleDataNodes() {
- TestTableRule tableRule1 = new TestTableRule(dataSourceNames1,
logicTableName1);
- TestTableRule tableRule2 = new TestTableRule(dataSourceNames2,
logicTableName2);
- List<TestTableRule> tableRules = Arrays.asList(tableRule1, tableRule2);
- ShardingSphereRule rule1 = new TestShardingRule(tableRules);
+ Map<String, Collection<DataNode>> nodeMap = new HashMap<>();
+ nodeMap.put(logicTableName1, getExpectedDataNodes(dataSourceNames1,
logicTableName1));
+ nodeMap.put(logicTableName2, getExpectedDataNodes(dataSourceNames2,
logicTableName2));
+ DataNodeContainedRule rule1 = mock(DataNodeContainedRule.class);
+ when(rule1.getAllDataNodes()).thenReturn(nodeMap);
Map<String, Collection<String>> dataSourceMapper =
Collections.singletonMap(logicDataSourceName, replicaDataSourceNames);
DataSourceContainedRule rule2 = mock(DataSourceContainedRule.class);
when(rule2.getDataSourceMapper()).thenReturn(dataSourceMapper);
return new DataNodes(Arrays.asList(rule1, rule2));
}
private DataNodes getNonRoutedRuleDataNodes() {
- return new DataNodes(Collections.singleton(new
TestShardingSphereRule()));
Review comment:
OK.I will finish it in next pr.
----------------------------------------------------------------
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:
[email protected]