]> source.dussan.org Git - sonarqube.git/commitdiff
Fix some JDBC connection pbs in unit tests
authorSimon Brandhof <simon.brandhof@gmail.com>
Wed, 5 Jun 2013 09:52:38 +0000 (11:52 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Wed, 5 Jun 2013 09:52:59 +0000 (11:52 +0200)
sonar-core/src/test/java/org/sonar/core/issue/db/ActionPlanDaoTest.java
sonar-core/src/test/java/org/sonar/core/issue/db/ActionPlanStatsDaoTest.java
sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDaoTest.java
sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeMapperTest.java
sonar-core/src/test/java/org/sonar/core/issue/db/IssueMapperTest.java

index 37fb16915ff818a648417c9d12cfcdfd7a32cab8..aba46152c5423b102e79c96886e9eb35f7ae6a84 100644 (file)
@@ -31,7 +31,7 @@ import static org.fest.assertions.Assertions.assertThat;
 
 public class ActionPlanDaoTest extends AbstractDaoTestCase {
 
-  private ActionPlanDao dao;
+  ActionPlanDao dao;
 
   @Before
   public void createDao() {
index 3be5466a397151c57ffcecf7685912a0fd83afc1..cb27fa0c5e3c3b53008b9cef9c259a366b7e529d 100644 (file)
@@ -30,7 +30,7 @@ import static org.fest.assertions.Assertions.assertThat;
 
 public class ActionPlanStatsDaoTest extends AbstractDaoTestCase {
 
-  private ActionPlanStatsDao dao;
+  ActionPlanStatsDao dao;
 
   @Before
   public void createDao() {
index 9c3bf875728c4dfe207449826881e325ed82b6f3..239168c3cc1c5381a9598495027e8d0dfbbae631 100644 (file)
@@ -26,6 +26,7 @@ import org.sonar.api.issue.internal.DefaultIssueComment;
 import org.sonar.api.issue.internal.FieldDiffs;
 import org.sonar.api.utils.DateUtils;
 import org.sonar.core.persistence.AbstractDaoTestCase;
+import org.sonar.core.persistence.MyBatis;
 
 import java.util.Arrays;
 import java.util.Collections;
@@ -49,7 +50,7 @@ public class IssueChangeDaoTest extends AbstractDaoTestCase {
 
     SqlSession session = getMyBatis().openSession();
     List<DefaultIssueComment> comments = dao.selectCommentsByIssues(session, Arrays.asList("1000"));
-    session.close();
+    MyBatis.closeQuietly(session);
     assertThat(comments).hasSize(2);
 
     // chronological order
index 363445e918f31c4dbec123ed870762e20c7fc47e..5a38ae372365019f8f121f9e95703ee1e904a4fb 100644 (file)
 package org.sonar.core.issue.db;
 
 import org.apache.ibatis.session.SqlSession;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.sonar.api.utils.DateUtils;
 import org.sonar.core.persistence.AbstractDaoTestCase;
+import org.sonar.core.persistence.MyBatis;
 
 import java.util.Date;
 
@@ -37,6 +39,11 @@ public class IssueChangeMapperTest extends AbstractDaoTestCase {
     mapper = session.getMapper(IssueChangeMapper.class);
   }
 
+  @After
+  public void tearDown() {
+    MyBatis.closeQuietly(session);
+  }
+
   @Test
   public void insert_diff() throws Exception {
     IssueChangeDto dto = new IssueChangeDto();
index 7476d5b98fceaf7d7383c70a693a7f590bdac4f7..199c198737b66e28e6aa7fb2dac3eb2911997c42 100644 (file)
 package org.sonar.core.issue.db;
 
 import org.apache.ibatis.session.SqlSession;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.sonar.api.utils.DateUtils;
 import org.sonar.core.persistence.AbstractDaoTestCase;
-
-import java.util.Date;
+import org.sonar.core.persistence.MyBatis;
 
 import static org.fest.assertions.Assertions.assertThat;
 
@@ -40,6 +40,11 @@ public class IssueMapperTest extends AbstractDaoTestCase {
     mapper = session.getMapper(IssueMapper.class);
   }
 
+  @After
+  public void tearDown() {
+    MyBatis.closeQuietly(session);
+  }
+
   @Test
   public void testInsert() throws Exception {
     IssueDto dto = new IssueDto();