Search in sources :

Example 1 with OrderDatabaseShardingAlgorithm

use of com.dangdang.ddframe.rdb.sharding.router.fixture.OrderDatabaseShardingAlgorithm in project sharding-jdbc by dangdangdotcom.

the class DatabaseTest method setRouteRuleContext.

@Before
public void setRouteRuleContext() {
    Map<String, DataSource> dataSourceMap = new HashMap<>();
    dataSourceMap.put("ds_0", null);
    dataSourceMap.put("ds_1", null);
    DataSourceRule dataSourceRule = new DataSourceRule(dataSourceMap);
    shardingRule = ShardingRule.builder().dataSourceRule(dataSourceRule).databaseShardingStrategy(new DatabaseShardingStrategy(new OrderDatabaseShardingAlgorithm())).build();
}
Also used : DatabaseShardingStrategy(com.dangdang.ddframe.rdb.sharding.api.strategy.database.DatabaseShardingStrategy) HashMap(java.util.HashMap) DataSourceRule(com.dangdang.ddframe.rdb.sharding.api.rule.DataSourceRule) OrderDatabaseShardingAlgorithm(com.dangdang.ddframe.rdb.sharding.router.fixture.OrderDatabaseShardingAlgorithm) DataSource(javax.sql.DataSource) Before(org.junit.Before)

Aggregations

DataSourceRule (com.dangdang.ddframe.rdb.sharding.api.rule.DataSourceRule)1 DatabaseShardingStrategy (com.dangdang.ddframe.rdb.sharding.api.strategy.database.DatabaseShardingStrategy)1 OrderDatabaseShardingAlgorithm (com.dangdang.ddframe.rdb.sharding.router.fixture.OrderDatabaseShardingAlgorithm)1 HashMap (java.util.HashMap)1 DataSource (javax.sql.DataSource)1 Before (org.junit.Before)1