Search in sources :

Example 1 with YamlNoneShardingStrategyConfiguration

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

the class YamlShardingRuleConfigurationTest method createYamlShardingRuleConfigWithDefaultStrategy.

private YamlShardingRuleConfiguration createYamlShardingRuleConfigWithDefaultStrategy() {
    YamlShardingRuleConfiguration result = createYamlShardingRuleConfigWithoutDefaultStrategy();
    YamlShardingStrategyConfiguration yamlShardingStrategyConfig = new YamlShardingStrategyConfiguration();
    yamlShardingStrategyConfig.setNone(new YamlNoneShardingStrategyConfiguration());
    result.setDefaultDatabaseStrategy(yamlShardingStrategyConfig);
    result.setDefaultTableStrategy(yamlShardingStrategyConfig);
    return result;
}
Also used : YamlNoneShardingStrategyConfiguration(io.shardingjdbc.core.yaml.sharding.strategy.YamlNoneShardingStrategyConfiguration)

Example 2 with YamlNoneShardingStrategyConfiguration

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

the class YamlShardingStrategyConfigurationTest method createNoneShardingStrategyConfig.

private YamlShardingStrategyConfiguration createNoneShardingStrategyConfig() {
    YamlNoneShardingStrategyConfiguration noneShardingStrategyConfig = new YamlNoneShardingStrategyConfiguration();
    YamlShardingStrategyConfiguration result = new YamlShardingStrategyConfiguration();
    result.setNone(noneShardingStrategyConfig);
    return result;
}
Also used : YamlNoneShardingStrategyConfiguration(io.shardingjdbc.core.yaml.sharding.strategy.YamlNoneShardingStrategyConfiguration)

Example 3 with YamlNoneShardingStrategyConfiguration

use of io.shardingjdbc.core.yaml.sharding.strategy.YamlNoneShardingStrategyConfiguration 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 4 with YamlNoneShardingStrategyConfiguration

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

the class YamlTableRuleConfigurationTest method createYamlTableRuleConfigWithShardingStrategy.

private YamlTableRuleConfiguration createYamlTableRuleConfigWithShardingStrategy() {
    YamlTableRuleConfiguration result = createYamlTableRuleConfig();
    YamlShardingStrategyConfiguration yamlShardingStrategyConfig = new YamlShardingStrategyConfiguration();
    yamlShardingStrategyConfig.setNone(new YamlNoneShardingStrategyConfiguration());
    result.setDatabaseStrategy(yamlShardingStrategyConfig);
    result.setTableStrategy(yamlShardingStrategyConfig);
    return result;
}
Also used : YamlNoneShardingStrategyConfiguration(io.shardingjdbc.core.yaml.sharding.strategy.YamlNoneShardingStrategyConfiguration)

Aggregations

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