Search in sources :

Example 1 with OrderDatabaseHintShardingAlgorithm

use of io.shardingjdbc.core.fixture.OrderDatabaseHintShardingAlgorithm in project sharding-jdbc by shardingjdbc.

the class DatabaseTest method setRouteRuleContext.

@Before
public void setRouteRuleContext() {
    ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration();
    shardingRuleConfig.setDefaultDatabaseShardingStrategyConfig(new HintShardingStrategyConfiguration(new OrderDatabaseHintShardingAlgorithm()));
    dataSourceMap = new LinkedHashMap<>(2, 1);
    dataSourceMap.put("ds_0", null);
    dataSourceMap.put("ds_1", null);
    shardingRule = new ShardingRule(shardingRuleConfig, dataSourceMap.keySet());
}
Also used : ShardingRuleConfiguration(io.shardingjdbc.core.api.config.ShardingRuleConfiguration) HintShardingStrategyConfiguration(io.shardingjdbc.core.api.config.strategy.HintShardingStrategyConfiguration) ShardingRule(io.shardingjdbc.core.rule.ShardingRule) OrderDatabaseHintShardingAlgorithm(io.shardingjdbc.core.fixture.OrderDatabaseHintShardingAlgorithm) Before(org.junit.Before)

Aggregations

ShardingRuleConfiguration (io.shardingjdbc.core.api.config.ShardingRuleConfiguration)1 HintShardingStrategyConfiguration (io.shardingjdbc.core.api.config.strategy.HintShardingStrategyConfiguration)1 OrderDatabaseHintShardingAlgorithm (io.shardingjdbc.core.fixture.OrderDatabaseHintShardingAlgorithm)1 ShardingRule (io.shardingjdbc.core.rule.ShardingRule)1 Before (org.junit.Before)1