Search in sources :

Example 6 with TestSingleKeyShardingAlgorithm

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

the class ShardingStrategyTest method assertDoDynamicShardingForEqualSingleKey.

@Test
public void assertDoDynamicShardingForEqualSingleKey() {
    ShardingStrategy strategy = new ShardingStrategy("column", new TestSingleKeyShardingAlgorithm());
    assertThat(strategy.doDynamicSharding(createShardingValues(new ShardingValue<>("logicTable", "column", "1"))), is((Collection<String>) Collections.singletonList("1")));
}
Also used : ShardingStrategy(com.dangdang.ddframe.rdb.sharding.router.strategy.ShardingStrategy) Collection(java.util.Collection) TestSingleKeyShardingAlgorithm(com.dangdang.ddframe.rdb.sharding.api.strategy.fixture.TestSingleKeyShardingAlgorithm) Test(org.junit.Test)

Aggregations

TestSingleKeyShardingAlgorithm (com.dangdang.ddframe.rdb.sharding.api.strategy.fixture.TestSingleKeyShardingAlgorithm)6 ShardingStrategy (com.dangdang.ddframe.rdb.sharding.router.strategy.ShardingStrategy)6 Collection (java.util.Collection)6 Test (org.junit.Test)6