use of io.shardingjdbc.core.api.config.strategy.NoneShardingStrategyConfiguration in project sharding-jdbc by shardingjdbc.
the class ShardingRuleConfigurationConverterTest method assertToJsonForNoneStrategy.
@Test
public void assertToJsonForNoneStrategy() {
NoneShardingStrategyConfiguration actual = new NoneShardingStrategyConfiguration();
assertThat(ShardingRuleConfigurationConverter.toJson(getCommonShardingRuleConfig(actual)), is(getJsonForNoneStrategy()));
}
use of io.shardingjdbc.core.api.config.strategy.NoneShardingStrategyConfiguration in project sharding-jdbc by shardingjdbc.
the class ShardingRuleTest method assertGetTableShardingStrategyForNullValue.
@Test
public void assertGetTableShardingStrategyForNullValue() {
ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration();
TableRuleConfiguration tableRuleConfig = createTableRuleConfig();
shardingRuleConfig.getTableRuleConfigs().add(tableRuleConfig);
shardingRuleConfig.setDefaultDatabaseShardingStrategyConfig(new NoneShardingStrategyConfiguration());
ShardingRule actual = new ShardingRule(shardingRuleConfig, createDataSourceNames());
assertNotNull(actual.getTableShardingStrategy(actual.getTableRule("logic_Table")));
}
use of io.shardingjdbc.core.api.config.strategy.NoneShardingStrategyConfiguration in project sharding-jdbc by shardingjdbc.
the class ShardingRuleTest method assertFindTableRule.
@Test
public void assertFindTableRule() {
ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration();
TableRuleConfiguration tableRuleConfig = createTableRuleConfig();
shardingRuleConfig.getTableRuleConfigs().add(tableRuleConfig);
shardingRuleConfig.setDefaultDatabaseShardingStrategyConfig(new NoneShardingStrategyConfiguration());
shardingRuleConfig.setDefaultTableShardingStrategyConfig(new NoneShardingStrategyConfiguration());
ShardingRule actual = new ShardingRule(shardingRuleConfig, createDataSourceNames());
assertTrue(actual.tryFindTableRuleByLogicTable("logic_Table").isPresent());
assertFalse(actual.tryFindTableRuleByLogicTable("null").isPresent());
}
use of io.shardingjdbc.core.api.config.strategy.NoneShardingStrategyConfiguration in project sharding-jdbc by shardingjdbc.
the class ShardingRuleTest method assertShardingRuleWithTableStrategy.
@Test
public void assertShardingRuleWithTableStrategy() {
ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration();
TableRuleConfiguration tableRuleConfig = createTableRuleConfig();
shardingRuleConfig.getTableRuleConfigs().add(tableRuleConfig);
shardingRuleConfig.setDefaultTableShardingStrategyConfig(new NoneShardingStrategyConfiguration());
ShardingRule actual = new ShardingRule(shardingRuleConfig, createDataSourceNames());
assertTrue(actual.getDefaultDatabaseShardingStrategy().getShardingColumns().isEmpty());
assertTrue(actual.getDefaultDatabaseShardingStrategy().getShardingColumns().isEmpty());
}
use of io.shardingjdbc.core.api.config.strategy.NoneShardingStrategyConfiguration in project sharding-jdbc by shardingjdbc.
the class ShardingRuleTest method assertShardingRuleWithoutBindingTableRule.
@Test
public void assertShardingRuleWithoutBindingTableRule() {
ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration();
TableRuleConfiguration tableRuleConfig = createTableRuleConfig();
shardingRuleConfig.getTableRuleConfigs().add(tableRuleConfig);
shardingRuleConfig.setDefaultDatabaseShardingStrategyConfig(new NoneShardingStrategyConfiguration());
shardingRuleConfig.setDefaultTableShardingStrategyConfig(new NoneShardingStrategyConfiguration());
ShardingRule actual = new ShardingRule(shardingRuleConfig, createDataSourceNames());
assertTrue(actual.getDefaultDatabaseShardingStrategy().getShardingColumns().isEmpty());
assertTrue(actual.getDefaultDatabaseShardingStrategy().getShardingColumns().isEmpty());
}
Aggregations