use of com.dangdang.ddframe.rdb.sharding.fixture.TestDataSource in project sharding-jdbc by dangdangdotcom.
the class DataSourceRuleTest method setUp.
@Before
public void setUp() {
dataSourceMap.put("ds0", new TestDataSource("ds0"));
dataSourceMap.put("ds1", new TestDataSource("ds1"));
dataSourceMap.put("ds2", new TestDataSource("ds2"));
dataSourceRule = new DataSourceRule(dataSourceMap);
}
use of com.dangdang.ddframe.rdb.sharding.fixture.TestDataSource in project sharding-jdbc by dangdangdotcom.
the class DataSourceRuleTest method assertGetDefaultDataSourceWithSingleDataSource.
@Test
public void assertGetDefaultDataSourceWithSingleDataSource() {
Map<String, DataSource> dataSourceMap = new HashMap<>(1);
dataSourceMap.put("ds0", new TestDataSource("ds0"));
dataSourceRule = new DataSourceRule(dataSourceMap);
assertThat(dataSourceRule.getDefaultDataSource().get(), is(dataSourceRule.getDataSource("ds0")));
}
use of com.dangdang.ddframe.rdb.sharding.fixture.TestDataSource in project sharding-jdbc by dangdangdotcom.
the class RoundRobinSlaveLoadBalanceStrategyTest method assertGetDataSource.
@Test
public void assertGetDataSource() {
DataSource slaveDataSource1 = new TestDataSource("test_ds_slave_1");
DataSource slaveDataSource2 = new TestDataSource("test_ds_slave_2");
assertThat(roundRobinSlaveLoadBalanceStrategy.getDataSource("ds", Arrays.asList(slaveDataSource1, slaveDataSource2)), is(slaveDataSource1));
assertThat(roundRobinSlaveLoadBalanceStrategy.getDataSource("ds", Arrays.asList(slaveDataSource1, slaveDataSource2)), is(slaveDataSource2));
assertThat(roundRobinSlaveLoadBalanceStrategy.getDataSource("ds", Arrays.asList(slaveDataSource1, slaveDataSource2)), is(slaveDataSource1));
}
Aggregations