Search in sources :

Example 1 with MasterSlaveLoadBalanceAlgorithm

use of io.shardingjdbc.core.api.algorithm.masterslave.MasterSlaveLoadBalanceAlgorithm in project sharding-jdbc by shardingjdbc.

the class MasterSlaveNamespaceTest method assertRefMasterSlaveDataSource.

@Test
public void assertRefMasterSlaveDataSource() {
    MasterSlaveLoadBalanceAlgorithm randomStrategy = this.applicationContext.getBean("randomStrategy", MasterSlaveLoadBalanceAlgorithm.class);
    MasterSlaveRule masterSlaveRule = getMasterSlaveRule("refMasterSlaveDataSource");
    assertTrue(masterSlaveRule.getLoadBalanceAlgorithm() == randomStrategy);
}
Also used : MasterSlaveLoadBalanceAlgorithm(io.shardingjdbc.core.api.algorithm.masterslave.MasterSlaveLoadBalanceAlgorithm) RoundRobinMasterSlaveLoadBalanceAlgorithm(io.shardingjdbc.core.api.algorithm.masterslave.RoundRobinMasterSlaveLoadBalanceAlgorithm) RandomMasterSlaveLoadBalanceAlgorithm(io.shardingjdbc.core.api.algorithm.masterslave.RandomMasterSlaveLoadBalanceAlgorithm) MasterSlaveRule(io.shardingjdbc.core.rule.MasterSlaveRule) Test(org.junit.Test)

Example 2 with MasterSlaveLoadBalanceAlgorithm

use of io.shardingjdbc.core.api.algorithm.masterslave.MasterSlaveLoadBalanceAlgorithm in project sharding-jdbc by shardingjdbc.

the class OrchestrationMasterSlaveNamespaceTest method assertRefMasterSlaveDataSource.

@Test
public void assertRefMasterSlaveDataSource() {
    MasterSlaveLoadBalanceAlgorithm randomStrategy = this.applicationContext.getBean("randomStrategy", MasterSlaveLoadBalanceAlgorithm.class);
    MasterSlaveRule masterSlaveRule = getMasterSlaveRule("refMasterSlaveDataSource");
    assertTrue(EqualsBuilder.reflectionEquals(masterSlaveRule.getLoadBalanceAlgorithm(), randomStrategy));
}
Also used : MasterSlaveLoadBalanceAlgorithm(io.shardingjdbc.core.api.algorithm.masterslave.MasterSlaveLoadBalanceAlgorithm) RoundRobinMasterSlaveLoadBalanceAlgorithm(io.shardingjdbc.core.api.algorithm.masterslave.RoundRobinMasterSlaveLoadBalanceAlgorithm) RandomMasterSlaveLoadBalanceAlgorithm(io.shardingjdbc.core.api.algorithm.masterslave.RandomMasterSlaveLoadBalanceAlgorithm) MasterSlaveRule(io.shardingjdbc.core.rule.MasterSlaveRule) Test(org.junit.Test)

Aggregations

MasterSlaveLoadBalanceAlgorithm (io.shardingjdbc.core.api.algorithm.masterslave.MasterSlaveLoadBalanceAlgorithm)2 RandomMasterSlaveLoadBalanceAlgorithm (io.shardingjdbc.core.api.algorithm.masterslave.RandomMasterSlaveLoadBalanceAlgorithm)2 RoundRobinMasterSlaveLoadBalanceAlgorithm (io.shardingjdbc.core.api.algorithm.masterslave.RoundRobinMasterSlaveLoadBalanceAlgorithm)2 MasterSlaveRule (io.shardingjdbc.core.rule.MasterSlaveRule)2 Test (org.junit.Test)2