Search in sources :

Example 6 with NoneTableShardingAlgorithm

use of com.dangdang.ddframe.rdb.sharding.api.strategy.table.NoneTableShardingAlgorithm in project sharding-jdbc by dangdangdotcom.

the class TableRuleTest method assertTableRuleForDynamicWithTableStrategy.

@Test
public void assertTableRuleForDynamicWithTableStrategy() {
    TableRule actual = TableRule.builder("logicTable").dynamic(true).dataSourceRule(createDataSourceRule()).tableShardingStrategy(new TableShardingStrategy("", new NoneTableShardingAlgorithm())).build();
    assertDynamicTable(actual);
    assertNull(actual.getDatabaseShardingStrategy());
    assertNotNull(actual.getTableShardingStrategy());
}
Also used : TableShardingStrategy(com.dangdang.ddframe.rdb.sharding.api.strategy.table.TableShardingStrategy) NoneTableShardingAlgorithm(com.dangdang.ddframe.rdb.sharding.api.strategy.table.NoneTableShardingAlgorithm) Test(org.junit.Test)

Example 7 with NoneTableShardingAlgorithm

use of com.dangdang.ddframe.rdb.sharding.api.strategy.table.NoneTableShardingAlgorithm in project sharding-jdbc by dangdangdotcom.

the class TableRuleTest method assertTableRuleForDynamicWithAllStrategies.

@Test
public void assertTableRuleForDynamicWithAllStrategies() {
    TableRule actual = TableRule.builder("logicTable").dynamic(true).dataSourceRule(createDataSourceRule()).databaseShardingStrategy(new DatabaseShardingStrategy("", new NoneDatabaseShardingAlgorithm())).tableShardingStrategy(new TableShardingStrategy("", new NoneTableShardingAlgorithm())).build();
    assertDynamicTable(actual);
    assertNotNull(actual.getDatabaseShardingStrategy());
    assertNotNull(actual.getTableShardingStrategy());
}
Also used : DatabaseShardingStrategy(com.dangdang.ddframe.rdb.sharding.api.strategy.database.DatabaseShardingStrategy) NoneDatabaseShardingAlgorithm(com.dangdang.ddframe.rdb.sharding.api.strategy.database.NoneDatabaseShardingAlgorithm) TableShardingStrategy(com.dangdang.ddframe.rdb.sharding.api.strategy.table.TableShardingStrategy) NoneTableShardingAlgorithm(com.dangdang.ddframe.rdb.sharding.api.strategy.table.NoneTableShardingAlgorithm) Test(org.junit.Test)

Aggregations

NoneTableShardingAlgorithm (com.dangdang.ddframe.rdb.sharding.api.strategy.table.NoneTableShardingAlgorithm)7 TableShardingStrategy (com.dangdang.ddframe.rdb.sharding.api.strategy.table.TableShardingStrategy)7 DatabaseShardingStrategy (com.dangdang.ddframe.rdb.sharding.api.strategy.database.DatabaseShardingStrategy)5 DataSourceRule (com.dangdang.ddframe.rdb.sharding.api.rule.DataSourceRule)4 MultipleKeysModuloDatabaseShardingAlgorithm (com.dangdang.ddframe.rdb.integrate.fixture.MultipleKeysModuloDatabaseShardingAlgorithm)3 BindingTableRule (com.dangdang.ddframe.rdb.sharding.api.rule.BindingTableRule)3 ShardingRule (com.dangdang.ddframe.rdb.sharding.api.rule.ShardingRule)3 TableRule (com.dangdang.ddframe.rdb.sharding.api.rule.TableRule)3 ShardingDataSource (com.dangdang.ddframe.rdb.sharding.jdbc.ShardingDataSource)3 Test (org.junit.Test)3 NoneDatabaseShardingAlgorithm (com.dangdang.ddframe.rdb.sharding.api.strategy.database.NoneDatabaseShardingAlgorithm)2 IncrementIdGenerator (com.dangdang.ddframe.rdb.sharding.id.generator.fixture.IncrementIdGenerator)1 HashMap (java.util.HashMap)1 DataSource (javax.sql.DataSource)1