Package com.alibaba.cobar.client.router.rules.ibatis

Examples of com.alibaba.cobar.client.router.rules.ibatis.IBatisSqlActionRule


            if (StringUtils.isNotEmpty(sqlAction)) {
                List<Set<IRoutingRule<IBatisRoutingFact, List<String>>>> ruleSequence = setUpRuleSequenceContainerIfNecessary(
                        router, StringUtils.substringBeforeLast(sqlAction, "."));

                if (StringUtils.isEmpty(shardingExpression)) {
                    ruleSequence.get(1).add(new IBatisSqlActionRule(sqlAction, destinations));
                } else {
                    IBatisSqlActionShardingRule issr = new IBatisSqlActionShardingRule(sqlAction,
                            destinations, shardingExpression);
                    if (MapUtils.isNotEmpty(functionsMap)) {
                        issr.setFunctionMap(functionsMap);
View Full Code Here


                    namespaceShardingRules.add(insr);
                }
            }
            if (StringUtils.isNotEmpty(sqlAction)) {
                if (StringUtils.isEmpty(shardingExpression)) {
                    sqlActionRules.add(new IBatisSqlActionRule(sqlAction, destinations));
                } else {
                    IBatisSqlActionShardingRule issr = new IBatisSqlActionShardingRule(sqlAction,
                            destinations, shardingExpression);
                    if (MapUtils.isNotEmpty(getFunctionsMap())) {
                        issr.setFunctionMap(getFunctionsMap());
View Full Code Here

    private IBatisSqlActionRule  rule;

    @BeforeMethod
    protected void setUp() throws Exception {
        rule = new IBatisSqlActionRule(SQL_MAP_ACTION_ID, "shard1, shard2, shard3");
    }
View Full Code Here

        }
    }

    public void testSqlActionRuleOnShardIdsAbnormally() {
        try {
            new IBatisSqlActionRule(SQL_MAP_ACTION_ID, "");
        } catch (IllegalArgumentException e) {
            // pass
        }

        try {
            new IBatisSqlActionRule(SQL_MAP_ACTION_ID, null);
        } catch (IllegalArgumentException e) {
            // pass
        }
    }
View Full Code Here

        List<String> shards = rule.action();
        assertTrue(CollectionUtils.isNotEmpty(shards));
        assertEquals(1, shards.size());
        assertEquals("shard1, shard2, shard3", shards.get(0));

        rule = new IBatisSqlActionRule(SQL_MAP_ACTION_ID, "shard1; shard2; shard3");
        rule.setActionPatternSeparator(";");
        shards = null;
        shards = rule.action();
        assertTrue(CollectionUtils.isNotEmpty(shards));
        assertEquals(3, shards.size());
View Full Code Here

TOP

Related Classes of com.alibaba.cobar.client.router.rules.ibatis.IBatisSqlActionRule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.