Search in sources :

Example 1 with YamlInlineShardingStrategyConfiguration

use of io.shardingjdbc.core.yaml.sharding.strategy.YamlInlineShardingStrategyConfiguration in project sharding-jdbc by shardingjdbc.

the class YamlShardingStrategyConfigurationTest method assertBuildWithMultipleSHardingStrategies.

@Test(expected = IllegalArgumentException.class)
public void assertBuildWithMultipleSHardingStrategies() {
    YamlShardingStrategyConfiguration actual = new YamlShardingStrategyConfiguration();
    YamlInlineShardingStrategyConfiguration inlineShardingStrategyConfig = new YamlInlineShardingStrategyConfiguration();
    inlineShardingStrategyConfig.setShardingColumn("order_id");
    inlineShardingStrategyConfig.setAlgorithmExpression("t_order_${order_id % 2}");
    actual.setInline(inlineShardingStrategyConfig);
    actual.setNone(new YamlNoneShardingStrategyConfiguration());
    actual.build();
}
Also used : YamlNoneShardingStrategyConfiguration(io.shardingjdbc.core.yaml.sharding.strategy.YamlNoneShardingStrategyConfiguration) YamlInlineShardingStrategyConfiguration(io.shardingjdbc.core.yaml.sharding.strategy.YamlInlineShardingStrategyConfiguration) Test(org.junit.Test)

Example 2 with YamlInlineShardingStrategyConfiguration

use of io.shardingjdbc.core.yaml.sharding.strategy.YamlInlineShardingStrategyConfiguration in project sharding-jdbc by shardingjdbc.

the class YamlShardingStrategyConfigurationTest method createInlineShardingStrategyConfig.

private YamlShardingStrategyConfiguration createInlineShardingStrategyConfig() {
    YamlInlineShardingStrategyConfiguration inlineShardingStrategyConfig = new YamlInlineShardingStrategyConfiguration();
    inlineShardingStrategyConfig.setShardingColumn("order_id");
    inlineShardingStrategyConfig.setAlgorithmExpression("t_order_${order_id % 2}");
    YamlShardingStrategyConfiguration result = new YamlShardingStrategyConfiguration();
    result.setInline(inlineShardingStrategyConfig);
    return result;
}
Also used : YamlInlineShardingStrategyConfiguration(io.shardingjdbc.core.yaml.sharding.strategy.YamlInlineShardingStrategyConfiguration)

Aggregations

YamlInlineShardingStrategyConfiguration (io.shardingjdbc.core.yaml.sharding.strategy.YamlInlineShardingStrategyConfiguration)2 YamlNoneShardingStrategyConfiguration (io.shardingjdbc.core.yaml.sharding.strategy.YamlNoneShardingStrategyConfiguration)1 Test (org.junit.Test)1