From a4a31362bfff7446142fae65581631f2a2931d79 Mon Sep 17 00:00:00 2001 From: wenshao Date: Sat, 15 Jun 2013 12:18:00 +0800 Subject: [PATCH] add testcase --- .../bvt/spring/SqlMapSessionWrapperTest.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/test/java/com/alibaba/druid/bvt/spring/SqlMapSessionWrapperTest.java diff --git a/src/test/java/com/alibaba/druid/bvt/spring/SqlMapSessionWrapperTest.java b/src/test/java/com/alibaba/druid/bvt/spring/SqlMapSessionWrapperTest.java new file mode 100644 index 0000000000..29e440b234 --- /dev/null +++ b/src/test/java/com/alibaba/druid/bvt/spring/SqlMapSessionWrapperTest.java @@ -0,0 +1,39 @@ +package com.alibaba.druid.bvt.spring; + +import junit.framework.TestCase; + +import org.junit.Assert; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +import com.alibaba.druid.support.ibatis.SqlMapSessionWrapper; +import com.ibatis.sqlmap.engine.impl.SqlMapClientImpl; +import com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl; + +public class SqlMapSessionWrapperTest extends TestCase { + + private ClassPathXmlApplicationContext context = null; + + protected void setUp() throws Exception { + context = new ClassPathXmlApplicationContext("com/alibaba/druid/pool/ibatis/spring-config-ibatis.xml"); + } + + protected void tearDown() throws Exception { + context.close(); + } + + @SuppressWarnings("deprecation") + public void test_wrap() throws Exception { + SqlMapClientImpl client = (SqlMapClientImpl) context.getBean("master-sqlMapClient"); + Assert.assertNotNull(client); + + SqlMapSessionImpl session = new SqlMapSessionImpl(client); + SqlMapSessionWrapper wrapper = new SqlMapSessionWrapper(client, session); + + wrapper.startTransaction(); + wrapper.commitTransaction(); + wrapper.getDataSource(); + wrapper.getCurrentConnection(); + wrapper.getUserConnection(); + wrapper.close(); + } +}