use of io.shardingjdbc.core.api.config.MasterSlaveRuleConfiguration in project sharding-jdbc by shardingjdbc.
the class YamlMasterSlaveRuleConfigurationTest method assertGetMasterSlaveRuleConfigurationWithLoadBalanceAlgorithmClassName.
@Test
public void assertGetMasterSlaveRuleConfigurationWithLoadBalanceAlgorithmClassName() {
YamlMasterSlaveRuleConfiguration yamlConfig = createYamlMasterSlaveRuleConfig();
yamlConfig.setLoadBalanceAlgorithmClassName(RoundRobinMasterSlaveLoadBalanceAlgorithm.class.getName());
MasterSlaveRuleConfiguration actual = yamlConfig.getMasterSlaveRuleConfiguration();
assertMasterSlaveRuleConfig(actual);
assertThat(actual.getLoadBalanceAlgorithm(), instanceOf(RoundRobinMasterSlaveLoadBalanceAlgorithm.class));
}
use of io.shardingjdbc.core.api.config.MasterSlaveRuleConfiguration in project sharding-jdbc by shardingjdbc.
the class YamlMasterSlaveRuleConfigurationTest method assertGetMasterSlaveRuleConfigurationWithLoadBalanceAlgorithmType.
@Test
public void assertGetMasterSlaveRuleConfigurationWithLoadBalanceAlgorithmType() {
YamlMasterSlaveRuleConfiguration yamlConfig = createYamlMasterSlaveRuleConfig();
yamlConfig.setLoadBalanceAlgorithmType(MasterSlaveLoadBalanceAlgorithmType.RANDOM);
MasterSlaveRuleConfiguration actual = yamlConfig.getMasterSlaveRuleConfiguration();
assertMasterSlaveRuleConfig(actual);
assertThat(actual.getLoadBalanceAlgorithm(), is(MasterSlaveLoadBalanceAlgorithmType.RANDOM.getAlgorithm()));
}
use of io.shardingjdbc.core.api.config.MasterSlaveRuleConfiguration in project sharding-jdbc by shardingjdbc.
the class MasterSlaveRuleTest method assertNewMasterSlaveRuleFailure.
@Test(expected = NullPointerException.class)
public void assertNewMasterSlaveRuleFailure() {
MasterSlaveRuleConfiguration masterSlaveRuleConfig = new MasterSlaveRuleConfiguration("", "", null, null);
new MasterSlaveRule(masterSlaveRuleConfig);
}
Aggregations