Search in sources :

Example 16 with ShardColModShardStrategy

use of com.ctrip.platform.dal.dao.strategy.ShardColModShardStrategy in project dal by ctripcorp.

the class ShardColModShardStrategyTest method testIsShardingEnableForTable.

@Test
public void testIsShardingEnableForTable() {
    ShardColModShardStrategy strategy = new ShardColModShardStrategy();
    Map<String, String> settings = new HashMap<String, String>();
    settings.put(ShardColModShardStrategy.TABLE_COLUMNS, "index,index1");
    settings.put(ShardColModShardStrategy.TABLE_MOD, "4");
    settings.put(ShardColModShardStrategy.SHARDED_TABLES, "table1,   table");
    strategy.initialize(settings);
    assertTrue(strategy.isShardingByTable());
    assertTrue(strategy.isShardingEnable("table"));
    assertTrue(strategy.isShardingEnable("table1"));
    assertTrue(strategy.isShardingEnable("tablE"));
    assertTrue(strategy.isShardingEnable("tabLe1"));
    assertTrue(strategy.isShardingEnable("TABLE"));
    assertTrue(strategy.isShardingEnable("tabLE1"));
}
Also used : HashMap(java.util.HashMap) ShardColModShardStrategy(com.ctrip.platform.dal.dao.strategy.ShardColModShardStrategy) Test(org.junit.Test)

Aggregations

ShardColModShardStrategy (com.ctrip.platform.dal.dao.strategy.ShardColModShardStrategy)16 HashMap (java.util.HashMap)16 Test (org.junit.Test)16 DalHints (com.ctrip.platform.dal.dao.DalHints)11 DalConfigure (com.ctrip.platform.dal.dao.configure.DalConfigure)11 StatementParameters (com.ctrip.platform.dal.dao.StatementParameters)2