You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by cb...@apache.org on 2010/05/08 15:41:11 UTC
svn commit: r942383 - in
/ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis: executor/
submitted/cglib_lazy_error/ submitted/complex_column/
submitted/enumtypehandler_on_map/ submitted/multiple_discriminator/
submitted/ognl_enum/
Author: cbegin
Date: Sat May 8 13:41:11 2010
New Revision: 942383
URL: http://svn.apache.org/viewvc?rev=942383&view=rev
Log:
called close on all unit test methods to verify that transactions are being closed properly.
Modified:
ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/executor/BaseExecutorTest.java
ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/cglib_lazy_error/CglibNPELazyTest.java
ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/cglib_lazy_error/CglibNPETest.java
ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/complex_column/ComplexColumnTest.java
ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/enumtypehandler_on_map/EnumTypeHandlerTest.java
ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/multiple_discriminator/MultipleDiscriminatorTest.java
ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/ognl_enum/EnumWithOgnlTest.java
Modified: ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/executor/BaseExecutorTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/executor/BaseExecutorTest.java?rev=942383&r1=942382&r2=942383&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/executor/BaseExecutorTest.java (original)
+++ ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/executor/BaseExecutorTest.java Sat May 8 13:41:11 2010
@@ -36,8 +36,8 @@ public class BaseExecutorTest extends Ba
public void shouldInsertNewAuthorWithBeforeAutoKey() throws Exception {
DataSource ds = createBlogDataSource();
Connection connection = ds.getConnection();
+ Executor executor = createExecutor(new JdbcTransaction(connection, false));
try {
- Executor executor = createExecutor(new JdbcTransaction(connection, false));
Author author = new Author(-1, "someone", "******", "someone@apache.org", null, Section.NEWS);
MappedStatement insertStatement = ExecutorTestHelper.prepareInsertAuthorMappedStatementWithBeforeAutoKey(config);
MappedStatement selectStatement = ExecutorTestHelper.prepareSelectOneAuthorMappedStatement(config);
@@ -55,8 +55,8 @@ public class BaseExecutorTest extends Ba
assertTrue(author.getId() >= 10000);
}
} finally {
- connection.rollback();
- connection.close();
+ executor.rollback(true);
+ executor.close(false);
}
}
@@ -64,8 +64,8 @@ public class BaseExecutorTest extends Ba
public void shouldInsertNewAuthor() throws Exception {
DataSource ds = createBlogDataSource();
Connection connection = ds.getConnection();
+ Executor executor = createExecutor(new JdbcTransaction(connection, false));
try {
- Executor executor = createExecutor(new JdbcTransaction(connection, false));
Author author = new Author(99, "someone", "******", "someone@apache.org", null, Section.NEWS);
MappedStatement insertStatement = ExecutorTestHelper.prepareInsertAuthorMappedStatement(config);
MappedStatement selectStatement = ExecutorTestHelper.prepareSelectOneAuthorMappedStatement(config);
@@ -77,7 +77,8 @@ public class BaseExecutorTest extends Ba
assertEquals(author.toString(), authors.get(0).toString());
assertTrue(1 == rows || BatchExecutor.BATCH_UPDATE_RETURN_VALUE == rows);
} finally {
- connection.close();
+ executor.rollback(true);
+ executor.close(false);
}
}
@@ -85,8 +86,8 @@ public class BaseExecutorTest extends Ba
public void shouldSelectAllAuthorsAutoMapped() throws Exception {
DataSource ds = createBlogDataSource();
Connection connection = ds.getConnection();
+ Executor executor = createExecutor(new JdbcTransaction(connection, false));
try {
- Executor executor = createExecutor(new JdbcTransaction(connection, false));
MappedStatement selectStatement = ExecutorTestHelper.prepareSelectAllAuthorsAutoMappedStatement(config);
List<Author> authors = executor.query(selectStatement, null, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
assertEquals(2, authors.size());
@@ -99,8 +100,8 @@ public class BaseExecutorTest extends Ba
assertEquals("", author.getBio());
assertEquals(Section.NEWS, author.getFavouriteSection());
} finally {
- connection.rollback();
- connection.close();
+ executor.rollback(true);
+ executor.close(false);
}
}
@@ -108,8 +109,8 @@ public class BaseExecutorTest extends Ba
public void shouldInsertNewAuthorWithAutoKey() throws Exception {
DataSource ds = createBlogDataSource();
Connection connection = ds.getConnection();
+ Executor executor = createExecutor(new JdbcTransaction(connection, false));
try {
- Executor executor = createExecutor(new JdbcTransaction(connection, false));
Author author = new Author(-1, "someone", "******", "someone@apache.org", null, Section.NEWS);
MappedStatement insertStatement = ExecutorTestHelper.prepareInsertAuthorMappedStatementWithAutoKey(config);
MappedStatement selectStatement = ExecutorTestHelper.prepareSelectOneAuthorMappedStatement(config);
@@ -127,8 +128,8 @@ public class BaseExecutorTest extends Ba
assertTrue(author.getId() >= 10000);
}
} finally {
- connection.rollback();
- connection.close();
+ executor.rollback(true);
+ executor.close(false);
}
}
@@ -136,8 +137,8 @@ public class BaseExecutorTest extends Ba
public void shouldInsertNewAuthorByProc() throws Exception {
DataSource ds = createBlogDataSource();
Connection connection = ds.getConnection();
+ Executor executor = createExecutor(new JdbcTransaction(connection, false));
try {
- Executor executor = createExecutor(new JdbcTransaction(connection, false));
Author author = new Author(97, "someone", "******", "someone@apache.org", null, null);
MappedStatement insertStatement = ExecutorTestHelper.prepareInsertAuthorProc(config);
MappedStatement selectStatement = ExecutorTestHelper.prepareSelectOneAuthorMappedStatement(config);
@@ -148,8 +149,8 @@ public class BaseExecutorTest extends Ba
assertEquals(1, authors.size());
assertEquals(author.toString(), authors.get(0).toString());
} finally {
- connection.rollback();
- connection.close();
+ executor.rollback(true);
+ executor.close(false);
}
}
@@ -157,8 +158,8 @@ public class BaseExecutorTest extends Ba
public void shouldInsertNewAuthorUsingSimpleNonPreparedStatements() throws Exception {
DataSource ds = createBlogDataSource();
Connection connection = ds.getConnection();
+ Executor executor = createExecutor(new JdbcTransaction(connection, false));
try {
- Executor executor = createExecutor(new JdbcTransaction(connection, false));
Author author = new Author(99, "someone", "******", "someone@apache.org", null, null);
MappedStatement insertStatement = ExecutorTestHelper.createInsertAuthorWithIDof99MappedStatement(config);
MappedStatement selectStatement = ExecutorTestHelper.createSelectAuthorWithIDof99MappedStatement(config);
@@ -170,8 +171,8 @@ public class BaseExecutorTest extends Ba
assertEquals(author.toString(), authors.get(0).toString());
assertTrue(1 == rows || BatchExecutor.BATCH_UPDATE_RETURN_VALUE == rows);
} finally {
- connection.rollback();
- connection.close();
+ executor.rollback(true);
+ executor.close(false);
}
}
@@ -179,8 +180,8 @@ public class BaseExecutorTest extends Ba
public void shouldUpdateAuthor() throws Exception {
DataSource ds = createBlogDataSource();
Connection connection = ds.getConnection();
+ Executor executor = createExecutor(new JdbcTransaction(connection, false));
try {
- Executor executor = createExecutor(new JdbcTransaction(connection, false));
Author author = new Author(101, "someone", "******", "someone@apache.org", null, Section.NEWS);
MappedStatement updateStatement = ExecutorTestHelper.prepareUpdateAuthorMappedStatement(config);
MappedStatement selectStatement = ExecutorTestHelper.prepareSelectOneAuthorMappedStatement(config);
@@ -192,8 +193,8 @@ public class BaseExecutorTest extends Ba
assertEquals(author.toString(), authors.get(0).toString());
assertTrue(1 == rows || BatchExecutor.BATCH_UPDATE_RETURN_VALUE == rows);
} finally {
- connection.rollback();
- connection.close();
+ executor.rollback(true);
+ executor.close(false);
}
}
@@ -201,8 +202,8 @@ public class BaseExecutorTest extends Ba
public void shouldDeleteAuthor() throws Exception {
DataSource ds = createBlogDataSource();
Connection connection = ds.getConnection();
+ Executor executor = createExecutor(new JdbcTransaction(connection, false));
try {
- Executor executor = createExecutor(new JdbcTransaction(connection, false));
Author author = new Author(101, null, null, null, null, null);
MappedStatement deleteStatement = ExecutorTestHelper.prepareDeleteAuthorMappedStatement(config);
MappedStatement selectStatement = ExecutorTestHelper.prepareSelectOneAuthorMappedStatement(config);
@@ -213,8 +214,8 @@ public class BaseExecutorTest extends Ba
assertEquals(0, authors.size());
assertTrue(1 == rows || BatchExecutor.BATCH_UPDATE_RETURN_VALUE == rows);
} finally {
- connection.rollback();
- connection.close();
+ executor.rollback(true);
+ executor.close(false);
}
}
@@ -222,8 +223,8 @@ public class BaseExecutorTest extends Ba
public void shouldSelectDiscriminatedProduct() throws Exception {
DataSource ds = createJPetstoreDataSource();
Connection connection = ds.getConnection();
+ Executor executor = createExecutor(new JdbcTransaction(connection, false));
try {
- Executor executor = createExecutor(new JdbcTransaction(connection, false));
MappedStatement selectStatement = ExecutorTestHelper.prepareSelectDiscriminatedProduct(config);
List<Map> products = executor.query(selectStatement, null, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
connection.rollback();
@@ -236,8 +237,8 @@ public class BaseExecutorTest extends Ba
}
}
} finally {
- connection.rollback();
- connection.close();
+ executor.rollback(true);
+ executor.close(false);
}
}
@@ -245,8 +246,8 @@ public class BaseExecutorTest extends Ba
public void shouldSelect10DiscriminatedProducts() throws Exception {
DataSource ds = createJPetstoreDataSource();
Connection connection = ds.getConnection();
+ Executor executor = createExecutor(new JdbcTransaction(connection, false));
try {
- Executor executor = createExecutor(new JdbcTransaction(connection, false));
MappedStatement selectStatement = ExecutorTestHelper.prepareSelectDiscriminatedProduct(config);
List<Map> products = executor.query(selectStatement, null, new RowBounds(4, 10), Executor.NO_RESULT_HANDLER);
connection.rollback();
@@ -259,8 +260,8 @@ public class BaseExecutorTest extends Ba
}
}
} finally {
- connection.rollback();
- connection.close();
+ executor.rollback(true);
+ executor.close(false);
}
}
@@ -269,9 +270,9 @@ public class BaseExecutorTest extends Ba
public void shouldSelectTwoSetsOfAuthorsViaProc() throws Exception {
DataSource ds = createBlogDataSource();
Connection connection = ds.getConnection();
+ connection.setAutoCommit(false);
+ Executor executor = createExecutor(new JdbcTransaction(connection, false));
try {
- connection.setAutoCommit(false);
- Executor executor = createExecutor(new JdbcTransaction(connection, false));
MappedStatement selectStatement = ExecutorTestHelper.prepareSelectTwoSetsOfAuthorsProc(config);
List<List> authorSets = executor.query(selectStatement, new HashMap() {
{
@@ -288,8 +289,8 @@ public class BaseExecutorTest extends Ba
}
}
} finally {
- connection.rollback();
- connection.close();
+ executor.rollback(true);
+ executor.close(false);
}
}
@@ -297,9 +298,9 @@ public class BaseExecutorTest extends Ba
public void shouldSelectAuthorViaOutParams() throws Exception {
DataSource ds = createBlogDataSource();
Connection connection = ds.getConnection();
+ connection.setAutoCommit(false);
+ Executor executor = createExecutor(new JdbcTransaction(connection, false));
try {
- connection.setAutoCommit(false);
- Executor executor = createExecutor(new JdbcTransaction(connection, false));
MappedStatement selectStatement = ExecutorTestHelper.prepareSelectAuthorViaOutParams(config);
Author author = new Author(102, null, null, null, null, null);
executor.query(selectStatement, author, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
@@ -310,8 +311,8 @@ public class BaseExecutorTest extends Ba
assertEquals("sally@ibatis.apache.org", author.getEmail());
assertEquals(null, author.getBio());
} finally {
- connection.rollback();
- connection.close();
+ executor.rollback(true);
+ executor.close(false);
}
}
@@ -320,8 +321,8 @@ public class BaseExecutorTest extends Ba
DataSource ds = createBlogDataSource();
Connection connection = ds.getConnection();
connection = ConnectionLogger.newInstance(connection);
+ Executor executor = createExecutor(new JdbcTransaction(connection, false));
try {
- Executor executor = createExecutor(new JdbcTransaction(connection, false));
MappedStatement selectBlog = ExecutorTestHelper.prepareComplexSelectBlogMappedStatement(config);
MappedStatement selectPosts = ExecutorTestHelper.prepareSelectPostsForBlogMappedStatement(config);
config.addMappedStatement(selectBlog);
@@ -333,8 +334,8 @@ public class BaseExecutorTest extends Ba
assertEquals(1, posts.get(1).getBlog().getId());
executor.rollback(true);
} finally {
- connection.rollback();
- connection.close();
+ executor.rollback(true);
+ executor.close(false);
}
}
@@ -342,8 +343,8 @@ public class BaseExecutorTest extends Ba
public void shouldFetchOneOrphanedPostWithNoBlog() throws Exception {
DataSource ds = createBlogDataSource();
Connection connection = ds.getConnection();
+ Executor executor = createExecutor(new JdbcTransaction(connection, false));
try {
- Executor executor = createExecutor(new JdbcTransaction(connection, false));
MappedStatement selectBlog = ExecutorTestHelper.prepareComplexSelectBlogMappedStatement(config);
MappedStatement selectPost = ExecutorTestHelper.prepareSelectPostMappedStatement(config);
config.addMappedStatement(selectBlog);
@@ -355,8 +356,8 @@ public class BaseExecutorTest extends Ba
Post post = posts.get(0);
assertNull(post.getBlog());
} finally {
- connection.rollback();
- connection.close();
+ executor.rollback(true);
+ executor.close(false);
}
}
@@ -364,8 +365,8 @@ public class BaseExecutorTest extends Ba
public void shouldFetchPostWithBlogWithCompositeKey() throws Exception {
DataSource ds = createBlogDataSource();
Connection connection = ds.getConnection();
+ Executor executor = createExecutor(new JdbcTransaction(connection, false));
try {
- Executor executor = createExecutor(new JdbcTransaction(connection, false));
MappedStatement selectBlog = ExecutorTestHelper.prepareSelectBlogByIdAndAuthor(config);
MappedStatement selectPost = ExecutorTestHelper.prepareSelectPostWithBlogByAuthorMappedStatement(config);
config.addMappedStatement(selectBlog);
@@ -378,8 +379,8 @@ public class BaseExecutorTest extends Ba
assertEquals(101, post.getBlog().getAuthor().getId());
executor.rollback(true);
} finally {
- connection.rollback();
- connection.close();
+ executor.rollback(true);
+ executor.close(false);
}
}
@@ -388,8 +389,8 @@ public class BaseExecutorTest extends Ba
public void shouldFetchComplexBlogs() throws Exception {
DataSource ds = createBlogDataSource();
Connection connection = ds.getConnection();
+ Executor executor = createExecutor(new JdbcTransaction(connection, false));
try {
- Executor executor = createExecutor(new JdbcTransaction(connection, false));
MappedStatement selectBlog = ExecutorTestHelper.prepareComplexSelectBlogMappedStatement(config);
MappedStatement selectPosts = ExecutorTestHelper.prepareSelectPostsForBlogMappedStatement(config);
config.addMappedStatement(selectBlog);
@@ -404,8 +405,8 @@ public class BaseExecutorTest extends Ba
executor.rollback(true);
} finally {
config.setLazyLoadingEnabled(true);
- connection.rollback();
- connection.close();
+ executor.rollback(true);
+ executor.close(false);
}
}
@@ -413,8 +414,8 @@ public class BaseExecutorTest extends Ba
public void shouldMapConstructorResults() throws Exception {
DataSource ds = createBlogDataSource();
Connection connection = ds.getConnection();
+ Executor executor = createExecutor(new JdbcTransaction(connection, false));
try {
- Executor executor = createExecutor(new JdbcTransaction(connection, false));
MappedStatement selectStatement = ExecutorTestHelper.prepareSelectOneAuthorMappedStatementWithConstructorResults(config);
List<Author> authors = executor.query(selectStatement, 102, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
executor.flushStatements();
@@ -424,8 +425,8 @@ public class BaseExecutorTest extends Ba
Author author = authors.get(0);
assertEquals(102, author.getId());
} finally {
- connection.rollback();
- connection.close();
+ executor.rollback(true);
+ executor.close(false);
}
}
Modified: ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/cglib_lazy_error/CglibNPELazyTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/cglib_lazy_error/CglibNPELazyTest.java?rev=942383&r1=942382&r2=942383&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/cglib_lazy_error/CglibNPELazyTest.java (original)
+++ ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/cglib_lazy_error/CglibNPELazyTest.java Sat May 8 13:41:11 2010
@@ -56,6 +56,7 @@ public class CglibNPELazyTest {
Assert.assertNotNull("Persons must not be null", person);
Person parent = person.getParent();
Assert.assertNull("Parent must be null", parent);
+ sqlSession.close();
}
@Test
@@ -66,6 +67,7 @@ public class CglibNPELazyTest {
Assert.assertNotNull("Persons must not be null", person);
Person ancestor = person.getAncestor();
Assert.assertEquals("Ancestor must be John Smith sr.", person, ancestor);
+ sqlSession.close();
}
@Test
@@ -79,6 +81,7 @@ public class CglibNPELazyTest {
Assert.assertNotNull("Parent must not be null", person.getParent());
Assert.assertNotNull("Grandparent must not be null", person.getParent().getParent());
Assert.assertEquals("Ancestor must be John Smith sr.", expectedAncestor, person.getAncestor());
+ sqlSession.close();
}
@Test
@@ -93,6 +96,7 @@ public class CglibNPELazyTest {
final Person actualGrandParent = person.getParent().getParent();
Assert.assertEquals(expectedParent, actualParent);
Assert.assertEquals(expectedGrandParent, actualGrandParent);
+ sqlSession.close();
}
@Test
@@ -104,6 +108,7 @@ public class CglibNPELazyTest {
Assert.assertNotNull("Persons must not be null", person);
final Person actualAncestor = person.getAncestor();
Assert.assertEquals(expectedAncestor, actualAncestor);
+ sqlSession.close();
}
}
Modified: ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/cglib_lazy_error/CglibNPETest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/cglib_lazy_error/CglibNPETest.java?rev=942383&r1=942382&r2=942383&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/cglib_lazy_error/CglibNPETest.java (original)
+++ ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/cglib_lazy_error/CglibNPETest.java Sat May 8 13:41:11 2010
@@ -54,6 +54,7 @@ public class CglibNPETest {
Assert.assertNotNull("Persons must not be null", person);
Person parent = person.getParent();
Assert.assertNull("Parent must be null", parent);
+ sqlSession.close();
}
@Test
@@ -64,6 +65,7 @@ public class CglibNPETest {
Assert.assertNotNull("Persons must not be null", person);
Person ancestor = person.getAncestor();
Assert.assertEquals("Ancestor must be John Smith sr.", person, ancestor);
+ sqlSession.close();
}
@Test
@@ -76,6 +78,7 @@ public class CglibNPETest {
Assert.assertNotNull("Persons must not be null", person);
Assert.assertEquals("Parent must be John Smith", expectedParent, person.getParent());
Assert.assertEquals("Parent must be John Smith sr.", expectedGrandParent, person.getParent().getParent());
+ sqlSession.close();
}
@Test
@@ -86,6 +89,7 @@ public class CglibNPETest {
Person person = personMapper.selectById(3);
Assert.assertNotNull("Persons must not be null", person);
Assert.assertEquals("Ancestor must be John Smith sr.", expectedAncestor, person.getAncestor());
+ sqlSession.close();
}
@Test
@@ -99,6 +103,7 @@ public class CglibNPETest {
Assert.assertNotNull("Parent must not be null", person.getParent());
Assert.assertNotNull("Grandparent must not be null", person.getParent().getParent());
Assert.assertEquals("Ancestor must be John Smith sr.", expectedAncestor, person.getAncestor());
+ sqlSession.close();
}
@Test
Modified: ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/complex_column/ComplexColumnTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/complex_column/ComplexColumnTest.java?rev=942383&r1=942382&r2=942383&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/complex_column/ComplexColumnTest.java (original)
+++ ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/complex_column/ComplexColumnTest.java Sat May 8 13:41:11 2010
@@ -59,6 +59,7 @@ public class ComplexColumnTest {
Assert.assertNotNull("parent must not be null", parent);
Assert.assertEquals("John", parent.getFirstName());
Assert.assertEquals("Smith", parent.getLastName());
+ sqlSession.close();
}
@Test
public void testWithComplex() {
@@ -72,5 +73,7 @@ public class ComplexColumnTest {
Assert.assertNotNull("parent must not be null", parent);
Assert.assertEquals("John", parent.getFirstName());
Assert.assertEquals("Smith", parent.getLastName());
+ sqlSession.close();
+
}
}
Modified: ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/enumtypehandler_on_map/EnumTypeHandlerTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/enumtypehandler_on_map/EnumTypeHandlerTest.java?rev=942383&r1=942382&r2=942383&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/enumtypehandler_on_map/EnumTypeHandlerTest.java (original)
+++ ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/enumtypehandler_on_map/EnumTypeHandlerTest.java Sat May 8 13:41:11 2010
@@ -56,6 +56,7 @@ public class EnumTypeHandlerTest {
List<Person> persons = personMapper.getByType(Person.Type.PERSON, "");
Assert.assertNotNull("Persons must not be null", persons);
Assert.assertEquals("Persons must contain exactly 1 person", 1, persons.size());
+ sqlSession.close();
}
@Test
public void testEnumWithoutParam() {
@@ -71,5 +72,6 @@ public class EnumTypeHandlerTest {
});
Assert.assertNotNull("Persons must not be null", persons);
Assert.assertEquals("Persons must contain exactly 1 person", 1, persons.size());
+ sqlSession.close();
}
}
Modified: ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/multiple_discriminator/MultipleDiscriminatorTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/multiple_discriminator/MultipleDiscriminatorTest.java?rev=942383&r1=942382&r2=942383&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/multiple_discriminator/MultipleDiscriminatorTest.java (original)
+++ ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/multiple_discriminator/MultipleDiscriminatorTest.java Sat May 8 13:41:11 2010
@@ -53,6 +53,7 @@ public class MultipleDiscriminatorTest {
Person person = personMapper.get(1L);
Assert.assertNotNull("Person must not be null", person);
Assert.assertEquals("Person must be a director", (Object)Director.class, (Object)person.getClass());
+ sqlSession.close();
}
@Test
public void testMultipleDiscriminator2() {
@@ -61,11 +62,14 @@ public class MultipleDiscriminatorTest {
Person person = personMapper.get2(1L);
Assert.assertNotNull("Person must not be null", person);
Assert.assertEquals("Person must be a director", (Object)Director.class, (Object)person.getClass());
+ sqlSession.close();
}
@Test(timeout=20000)
public void testMultipleDiscriminatorLoop() {
SqlSession sqlSession = sqlSessionFactory.openSession();
PersonMapper personMapper = sqlSession.getMapper(PersonMapper.class);
personMapper.getLoop();
+ sqlSession.close();
+
}
}
Modified: ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/ognl_enum/EnumWithOgnlTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/ognl_enum/EnumWithOgnlTest.java?rev=942383&r1=942382&r2=942383&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/ognl_enum/EnumWithOgnlTest.java (original)
+++ ibatis/java/ibatis-3/trunk/src/test/java/org/apache/ibatis/submitted/ognl_enum/EnumWithOgnlTest.java Sat May 8 13:41:11 2010
@@ -55,22 +55,28 @@ public class EnumWithOgnlTest {
PersonMapper personMapper = sqlSession.getMapper(PersonMapper.class);
List<Person> persons = personMapper.selectAllByType(null);
Assert.assertEquals("Persons must contain 3 persons", 3, persons.size());
+ sqlSession.close();
}
- @Test
+
+ @Test
public void testEnumWithOgnlDirector() {
SqlSession sqlSession = sqlSessionFactory.openSession();
PersonMapper personMapper = sqlSession.getMapper(PersonMapper.class);
List<Person> persons = personMapper.selectAllByType(Person.Type.DIRECTOR);
Assert.assertEquals("Persons must contain 1 persons", 1, persons.size());
+ sqlSession.close();
}
+
@Test
public void testEnumWithOgnlDirectorNameAttribute() {
SqlSession sqlSession = sqlSessionFactory.openSession();
PersonMapper personMapper = sqlSession.getMapper(PersonMapper.class);
List<Person> persons = personMapper.selectAllByTypeNameAttribute(Person.Type.DIRECTOR);
Assert.assertEquals("Persons must contain 1 persons", 1, persons.size());
+ sqlSession.close();
}
- @Test
+
+ @Test
public void testEnumWithOgnlDirectorWithInterface() {
SqlSession sqlSession = sqlSessionFactory.openSession();
PersonMapper personMapper = sqlSession.getMapper(PersonMapper.class);
@@ -80,6 +86,7 @@ public class EnumWithOgnlTest {
}
});
Assert.assertEquals("Persons must contain 1 persons", 1, persons.size());
+ sqlSession.close();
}
@Test
public void testEnumWithOgnlDirectorNameAttributeWithInterface() {
@@ -91,5 +98,6 @@ public class EnumWithOgnlTest {
}
});
Assert.assertEquals("Persons must contain 1 persons", 1, persons.size());
+ sqlSession.close();
}
}