This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 1de8843 Add test case for MasterSlaveRule.getDataSourceMapper (#6888)
1de8843 is described below
commit 1de8843f391c927f999f8064aa2e29d619eabb3d
Author: Andrew <[email protected]>
AuthorDate: Mon Aug 17 12:30:06 2020 +0800
Add test case for MasterSlaveRule.getDataSourceMapper (#6888)
---
.../shardingsphere/masterslave/rule/MasterSlaveRuleTest.java | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git
a/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/test/java/org/apache/shardingsphere/masterslave/rule/MasterSlaveRuleTest.java
b/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/test/java/org/apache/shardingsphere/masterslave/rule/MasterSlaveRuleTest.java
index 027fd6e..8bab229 100644
---
a/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/test/java/org/apache/shardingsphere/masterslave/rule/MasterSlaveRuleTest.java
+++
b/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/test/java/org/apache/shardingsphere/masterslave/rule/MasterSlaveRuleTest.java
@@ -25,7 +25,9 @@ import
org.apache.shardingsphere.masterslave.api.config.rule.MasterSlaveDataSour
import org.junit.Test;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
+import java.util.Map;
import java.util.Optional;
import java.util.Properties;
@@ -87,4 +89,12 @@ public final class MasterSlaveRuleTest {
masterSlaveRule.updateRuleStatus(new
DataSourceNameDisabledEvent("slave_db_0", false));
assertThat(masterSlaveRule.getSingleDataSourceRule().getSlaveDataSourceNames(),
is(Arrays.asList("slave_db_0", "slave_db_1")));
}
+
+ @Test
+ public void assertGetDataSourceMapper() {
+ MasterSlaveRule masterSlaveRule = createMasterSlaveRule();
+ Map<String, Collection<String>> actual =
masterSlaveRule.getDataSourceMapper();
+ Map<String, Collection<String>> expected = ImmutableMap.of("test_ms",
Arrays.asList("master_db", "slave_db_0", "slave_db_1"));
+ assertThat(actual, is(expected));
+ }
}