use of io.shardingjdbc.core.rule.MasterSlaveRule in project sharding-jdbc by shardingjdbc.
the class MasterSlaveNamespaceTest method assertDefaultMaserSlaveDataSource.
@Test
public void assertDefaultMaserSlaveDataSource() {
MasterSlaveRule masterSlaveRule = getMasterSlaveRule("defaultMasterSlaveDataSource");
assertThat(masterSlaveRule.getMasterDataSourceName(), is("dbtbl_0_master"));
assertTrue(masterSlaveRule.getSlaveDataSourceNames().contains("dbtbl_0_slave_0"));
assertTrue(masterSlaveRule.getSlaveDataSourceNames().contains("dbtbl_0_slave_1"));
}
use of io.shardingjdbc.core.rule.MasterSlaveRule in project sharding-jdbc by shardingjdbc.
the class MasterSlaveNamespaceTest method assertTypeMasterSlaveDataSource.
@Test
public void assertTypeMasterSlaveDataSource() {
MasterSlaveRule randomSlaveRule = getMasterSlaveRule("randomMasterSlaveDataSource");
MasterSlaveRule roundRobinSlaveRule = getMasterSlaveRule("roundRobinMasterSlaveDataSource");
assertTrue(randomSlaveRule.getLoadBalanceAlgorithm() instanceof RandomMasterSlaveLoadBalanceAlgorithm);
assertTrue(roundRobinSlaveRule.getLoadBalanceAlgorithm() instanceof RoundRobinMasterSlaveLoadBalanceAlgorithm);
}
Aggregations