Search in sources :

Example 1 with NoneKeyModuloDatabaseShardingAlgorithm

use of com.dangdang.ddframe.rdb.integrate.fixture.NoneKeyModuloDatabaseShardingAlgorithm in project sharding-jdbc by dangdangdotcom.

the class AbstractRoutingDatabaseOnlyTest method initDataSource.

protected ShardingDataSource initDataSource() {
    DataSourceRule dataSourceRule = new DataSourceRule(createDataSourceMap("dataSource_%s"));
    ShardingRule shardingRule = ShardingRule.builder().dataSourceRule(dataSourceRule).databaseShardingStrategy(new DatabaseShardingStrategy(new NoneKeyModuloDatabaseShardingAlgorithm())).build();
    return new ShardingDataSource(shardingRule);
}
Also used : DatabaseShardingStrategy(com.dangdang.ddframe.rdb.sharding.api.strategy.database.DatabaseShardingStrategy) ShardingDataSource(com.dangdang.ddframe.rdb.sharding.jdbc.ShardingDataSource) DataSourceRule(com.dangdang.ddframe.rdb.sharding.api.rule.DataSourceRule) NoneKeyModuloDatabaseShardingAlgorithm(com.dangdang.ddframe.rdb.integrate.fixture.NoneKeyModuloDatabaseShardingAlgorithm) ShardingRule(com.dangdang.ddframe.rdb.sharding.api.rule.ShardingRule)

Aggregations

NoneKeyModuloDatabaseShardingAlgorithm (com.dangdang.ddframe.rdb.integrate.fixture.NoneKeyModuloDatabaseShardingAlgorithm)1 DataSourceRule (com.dangdang.ddframe.rdb.sharding.api.rule.DataSourceRule)1 ShardingRule (com.dangdang.ddframe.rdb.sharding.api.rule.ShardingRule)1 DatabaseShardingStrategy (com.dangdang.ddframe.rdb.sharding.api.strategy.database.DatabaseShardingStrategy)1 ShardingDataSource (com.dangdang.ddframe.rdb.sharding.jdbc.ShardingDataSource)1