Package com.alibaba.druid.support.ibatis

Examples of com.alibaba.druid.support.ibatis.SqlMapClientWrapper


    public void test_wrap() throws Exception {
        SqlMapClientImpl client = (SqlMapClientImpl) context.getBean("master-sqlMapClient");
        Assert.assertNotNull(client);

        SqlMapClientWrapper wrapper = new SqlMapClientWrapper(client);

        wrapper.insert("User.insert", new User(12345678, "aaa"));
        {
            Exception error = null;
            try {
                wrapper.insert("User.insert");
            } catch (Exception ex) {
                error = ex;
            }
            Assert.assertNotNull(error);
        }
        wrapper.update("User.update", new User(12345678, "bbb"));
        {
            Exception error = null;
            try {
                wrapper.update("User.update");
            } catch (Exception ex) {
                error = ex;
            }
            Assert.assertNotNull(error);
        }

        Assert.assertNotNull((User) wrapper.queryForObject("User.select"));
        Assert.assertNotNull((User) wrapper.queryForObject("User.select", Collections.emptyMap()));
        Assert.assertNotNull((User) wrapper.queryForObject("User.select", Collections.emptyMap(), new User()));

        Assert.assertEquals(1, wrapper.queryForList("User.select").size());
        Assert.assertEquals(1, wrapper.queryForList("User.select", Collections.emptyMap()).size());
        Assert.assertEquals(1, wrapper.queryForList("User.select", Collections.emptyMap(), 0, 2).size());

        wrapper.queryWithRowHandler("User.select", new RowHandler() {

            @Override
            public void handleRow(Object valueObject) {

            }
        });
        wrapper.queryWithRowHandler("User.select", Collections.emptyMap(), new RowHandler() {

            @Override
            public void handleRow(Object valueObject) {

            }
        });

        Assert.assertEquals(1, wrapper.queryForPaginatedList("User.select", 10).size());
        Assert.assertEquals(1, wrapper.queryForPaginatedList("User.select", Collections.emptyMap(), 10).size());

        Assert.assertNotNull(wrapper.queryForMap("User.select", Collections.emptyMap(), "id"));
        Assert.assertNotNull(wrapper.queryForMap("User.select", Collections.emptyMap(), "id", "name"));
       
        wrapper.delete("User.delete", 12345678L);
        {
            Exception error = null;
            try {
                wrapper.delete("User.delete");
            } catch (Exception ex) {
                error = ex;
            }
            Assert.assertNotNull(error);
        }
       
        wrapper.startBatch();
        wrapper.executeBatch();
        wrapper.executeBatchDetailed();
    }
View Full Code Here


    public void test_wrap() throws Exception {
        SqlMapClientImpl client = (SqlMapClientImpl) context.getBean("master-sqlMapClient");
        Assert.assertNotNull(client);

        SqlMapClientWrapper wrapper = new SqlMapClientWrapper(client);
        wrapper.getClient();
        wrapper.startTransaction();
        wrapper.endTransaction();
        wrapper.startTransaction(Connection.TRANSACTION_NONE);
        wrapper.endTransaction();
        wrapper.setUserConnection(wrapper.getUserConnection());
        wrapper.getCurrentConnection();
        wrapper.getDataSource();
        wrapper.openSession().close();
        wrapper.openSession(wrapper.getCurrentConnection()).close();
        wrapper.getSession();
        wrapper.flushDataCache();
        Exception error = null;
        try {
            wrapper.flushDataCache(null);
        } catch (Exception ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
        wrapper.startTransaction();
        wrapper.commitTransaction();
       
        wrapper.getMappedStatement("Sequence.getValue");
       
        wrapper.isEnhancementEnabled();
        wrapper.isLazyLoadingEnabled();
       
        wrapper.getSqlExecutor();
       
        wrapper.getDelegate();
       
        wrapper.getResultObjectFactory();
    }
View Full Code Here

TOP

Related Classes of com.alibaba.druid.support.ibatis.SqlMapClientWrapper

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.