Package com.alibaba.cobar.client.entities

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


            verifyEntityNonExistenceOnSpecificDataSource(confirmSQL, jt2m);
            verifyEntityNonExistenceOnSpecificDataSource(confirmSQL, jt2s);
        }
        // since sql action below is routed to partition2, so no record will be found with it.
        for (String name : names) {
            Follower followerToFind = (Follower) getSqlMapClientTemplate().queryForObject(
                    "com.alibaba.cobar.client.entities.Follower.finaByName", name);
            assertNull(followerToFind);
        }
        // although records only reside on partition1, but we can get all of them with sql action below
        @SuppressWarnings("unchecked")
View Full Code Here


        // no record at beginning
        assertEquals(0, getSqlMapClientTemplate().delete(sqlAction, name));

        // insert 1 record and delete will affect this record which resides on partition1
        Follower follower = new Follower(name);
        getSqlMapClientTemplate().insert("com.alibaba.cobar.client.entities.Follower.create",
                follower);
        assertEquals(1, getSqlMapClientTemplate().delete(sqlAction, name));

        // insert 1 record to partition2, delete will NOT affect it because no rule is defined for it.
View Full Code Here

    public void testQueryForObjectOnCobarSqlMapClientTemplateWithDefaultPartition() {
        String[] names = { "Aaron", "Amily", "Aragon", "Darren", "Darwin" };
        batchInsertMultipleFollowersAsFixture(names);

        for (String name : names) {
            Follower f = (Follower) getSqlMapClientTemplate().queryForObject(
                    "com.alibaba.cobar.client.entities.Follower.finaByName", name);
            assertNull(f);
        }
    }
View Full Code Here

    public void testQueryForObjectOnCobarSqlMapClientTemplateWithFillingDataOntoPartition2() {
        String[] names = { "Aaron", "Amily", "Aragon", "Darren", "Darwin" };
        batchInsertMultipleFollowersAsFixtureWithJdbcTemplate(names, jt2m);

        for (String name : names) {
            Follower f = (Follower) getSqlMapClientTemplate().queryForObject(
                    "com.alibaba.cobar.client.entities.Follower.finaByName", name);
            assertNotNull(f);
            assertTrue(ArrayUtils.contains(names, f.getName()));
        }
    }
View Full Code Here

        String[] names = { "Aaron", "Amily", "Aragon", "Darren", "Darwin" };
        batchInsertMultipleFollowersAsFixture(names);
       
        for(String name:names)
        {
            Follower f = (Follower)jt1m.queryForObject("select * from followers where name=?",new Object[]{name}, new RowMapper(){
                public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
                    Follower fl =  new Follower();
                    fl.setId(rs.getLong(1));
                    fl.setName(rs.getString(2));
                    return fl;
                }});
            assertNotNull(f);
            int updatedCount = getSqlMapClientTemplate().update("com.alibaba.cobar.client.entities.Follower.update", f);
            assertEquals(1, updatedCount);
View Full Code Here

        String[] names = { "Aaron", "Amily", "Aragon", "Darren", "Darwin" };
        batchInsertMultipleFollowersAsFixtureWithJdbcTemplate(names, jt2m);
       
        for(String name:names)
        {
            Follower f = (Follower) getSqlMapClientTemplate().queryForObject(
                    "com.alibaba.cobar.client.entities.Follower.finaByName", name);
            assertNotNull(f); // this sql action is performed against partition2 as per routing rule
           
            // sql action below will be performed against default data source(partition1), so will not affect any records on partition2
            int updatedCount = getSqlMapClientTemplate().update("com.alibaba.cobar.client.entities.Follower.update", f);
View Full Code Here

TOP

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

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.