Package com.alibaba.cobar.client.entities

Examples of com.alibaba.cobar.client.entities.Tweet


            // pass
        }
    }

    public void testRuleTypePatternMatchingNormally() {
        Tweet t = new Tweet();
        t.setId(15000L);
        t.setTweet("anything");
        IBatisRoutingFact fact = new IBatisRoutingFact(
                "com.alibaba.cobar.client.entity.Tweet.create", t);
        assertTrue(rule.isDefinedAt(fact));

        fact = new IBatisRoutingFact("com.alibaba.cobar.client.entity.Tweet.update", t);
View Full Code Here


            // pass
        }
    }

    public void testRuleShardingPatternMatchingNormally() {
        Tweet t = new Tweet();
        t.setId(15000L);
        t.setTweet("anything");
        IBatisRoutingFact fact = new IBatisRoutingFact(
                "com.alibaba.cobar.client.entity.Tweet.update", t);
        assertTrue(rule.isDefinedAt(fact));

        t.setId(20000001L);
        fact = new IBatisRoutingFact("com.alibaba.cobar.client.entity.Tweet.update", t);
        assertFalse(rule.isDefinedAt(fact));

        fact = new IBatisRoutingFact("com.alibaba.cobar.client.entity.Tweet.update", null);
        assertFalse(rule.isDefinedAt(fact));
View Full Code Here

                StringUtils.join(DEFAULT_SHARDS, ","), shardingExpression);
        Map<String, Object> functions = new HashMap<String, Object>();
        functions.put("mod", new ModFunction(18L));
        r.setFunctionMap(functions);

        Tweet t = new Tweet();
        t.setId(3L);
        t.setTweet("anything");
        IBatisRoutingFact fact = new IBatisRoutingFact(
                "com.alibaba.cobar.client.entity.Tweet.create", t);
        assertTrue(r.isDefinedAt(fact));
    }
View Full Code Here

            // pass
        }
    }

    public void testSqlActionShardingRulePatternMatchingNormally() {
        Tweet t = new Tweet();
        t.setId(15000L);
        t.setTweet("anything");

        IBatisRoutingFact fact = new IBatisRoutingFact(
                "com.alibaba.cobar.client.entity.Tweet.create", t);
        assertTrue(rule.isDefinedAt(fact));
        List<String> shards = rule.action();
        assertTrue(CollectionUtils.isNotEmpty(shards));
        assertEquals(2, shards.size());
        for (String shard : shards) {
            assertTrue(ArrayUtils.contains(DEFAULT_SHARDS, shard));
        }

        fact = new IBatisRoutingFact("com.alibaba.cobar.client.entity.Tweet.update", t);
        assertFalse(rule.isDefinedAt(fact));

        t.setId(20000L);
        fact = new IBatisRoutingFact("com.alibaba.cobar.client.entity.Tweet.create", t);
        assertFalse(rule.isDefinedAt(fact));

        fact = new IBatisRoutingFact("com.alibaba.cobar.client.entity.Tweet.create", null);
        assertFalse(rule.isDefinedAt(fact));
View Full Code Here

                "shard1,shard2", "mod.apply(id)==3");
        Map<String, Object> functions = new HashMap<String, Object>();
        functions.put("mod", new ModFunction(18L));
        r.setFunctionMap(functions);
       
        Tweet t = new Tweet();
        t.setId(21L);
        t.setTweet("anything");
        IBatisRoutingFact fact = new IBatisRoutingFact(
                "com.alibaba.cobar.client.entity.Tweet.create", t);
        assertTrue(r.isDefinedAt(fact));
    }
View Full Code Here

        verifyEntityNonExistenceOnSpecificDataSource(confirmSQL, jt2m);
        verifyEntityNonExistenceOnSpecificDataSource(confirmSQL, jt2s);
    }

    public void testInsertOnCobarSqlMapClientTemplate() {
        Tweet t = new Tweet("tcontent");
        getSqlMapClientTemplate().insert("com.alibaba.cobar.client.entities.Tweet.create", t);

        String confirmSQL = "select tweet from tweets where tweet='tcontent'";

        verifyEntityExistenceOnSpecificDataSource(confirmSQL, jt1m);
View Full Code Here

TOP

Related Classes of com.alibaba.cobar.client.entities.Tweet

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.