You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/08/17 04:31:06 UTC
[shardingsphere] branch master updated: Add test case for
MasterSlaveDataSourceRule.getDataSourceMapper (#6889)
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 c958611 Add test case for MasterSlaveDataSourceRule.getDataSourceMapper (#6889)
c958611 is described below
commit c95861116cc9a22c980b699bac9c8b329b5a1d63
Author: Andrew <zh...@aliyun.com>
AuthorDate: Mon Aug 17 12:30:52 2020 +0800
Add test case for MasterSlaveDataSourceRule.getDataSourceMapper (#6889)
---
.../masterslave/rule/MasterSlaveDataSourceRuleTest.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/MasterSlaveDataSourceRuleTest.java b/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/test/java/org/apache/shardingsphere/masterslave/rule/MasterSlaveDataSourceRuleTest.java
index 03753eb..e88dcf1 100644
--- a/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/test/java/org/apache/shardingsphere/masterslave/rule/MasterSlaveDataSourceRuleTest.java
+++ b/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/test/java/org/apache/shardingsphere/masterslave/rule/MasterSlaveDataSourceRuleTest.java
@@ -17,13 +17,16 @@
package org.apache.shardingsphere.masterslave.rule;
+import com.google.common.collect.ImmutableMap;
import org.apache.shardingsphere.masterslave.api.config.rule.MasterSlaveDataSourceRuleConfiguration;
import org.apache.shardingsphere.masterslave.algorithm.RandomMasterSlaveLoadBalanceAlgorithm;
import org.apache.shardingsphere.masterslave.algorithm.RoundRobinMasterSlaveLoadBalanceAlgorithm;
import org.junit.Test;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
+import java.util.Map;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
@@ -76,4 +79,11 @@ public final class MasterSlaveDataSourceRuleTest {
masterSlaveDataSourceRule.updateDisabledDataSourceNames("slave_db_0", false);
assertThat(masterSlaveDataSourceRule.getSlaveDataSourceNames(), is(Arrays.asList("slave_db_0", "slave_db_1")));
}
+
+ @Test
+ public void assertGetDataSourceMapper() {
+ Map<String, Collection<String>> actual = masterSlaveDataSourceRule.getDataSourceMapper();
+ Map<String, Collection<String>> expected = ImmutableMap.of("test_ms", Arrays.asList("master_db", "slave_db_0", "slave_db_1"));
+ assertThat(actual, is(expected));
+ }
}