aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2014-05-24 09:17:37 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2014-05-24 09:17:37 +0200
commit64829cd6db50b5b396c59e9c242aeaefe47a1f24 (patch)
tree3e70b7d004e7ae27b8ce8746c200f0bf2132bee2 /sonar-core
parent3b2ce2d2525d1ae8f766969a01925ee8fdd26e65 (diff)
downloadsonarqube-64829cd6db50b5b396c59e9c242aeaefe47a1f24.tar.gz
sonarqube-64829cd6db50b5b396c59e9c242aeaefe47a1f24.zip
SONAR-5007 fix test on postgres
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/test/java/org/sonar/core/qualityprofile/db/QualityProfileDaoTest.java44
1 files changed, 25 insertions, 19 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/QualityProfileDaoTest.java b/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/QualityProfileDaoTest.java
index 304d31346c8..e62ce0abdce 100644
--- a/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/QualityProfileDaoTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/QualityProfileDaoTest.java
@@ -23,6 +23,7 @@ package org.sonar.core.qualityprofile.db;
import org.junit.Before;
import org.junit.Test;
import org.sonar.core.persistence.AbstractDaoTestCase;
+import org.sonar.core.persistence.DbSession;
import java.util.List;
@@ -84,25 +85,30 @@ public class QualityProfileDaoTest extends AbstractDaoTestCase {
public void select_all() {
setupData("shared");
- List<QualityProfileDto> dtos = dao.findAll(getMyBatis().openSession(false));
-
- assertThat(dtos).hasSize(2);
-
- QualityProfileDto dto1 = dtos.get(0);
- assertThat(dto1.getId()).isEqualTo(1);
- assertThat(dto1.getName()).isEqualTo("Sonar Way");
- assertThat(dto1.getLanguage()).isEqualTo("java");
- assertThat(dto1.getParent()).isNull();
- assertThat(dto1.getVersion()).isEqualTo(1);
- assertThat(dto1.isUsed()).isFalse();
-
- QualityProfileDto dto2 = dtos.get(1);
- assertThat(dto2.getId()).isEqualTo(2);
- assertThat(dto2.getName()).isEqualTo("Sonar Way");
- assertThat(dto2.getLanguage()).isEqualTo("js");
- assertThat(dto2.getParent()).isNull();
- assertThat(dto2.getVersion()).isEqualTo(1);
- assertThat(dto2.isUsed()).isFalse();
+ DbSession session = getMyBatis().openSession(false);
+ try {
+ List<QualityProfileDto> dtos = dao.findAll(session);
+
+ assertThat(dtos).hasSize(2);
+
+ QualityProfileDto dto1 = dtos.get(0);
+ assertThat(dto1.getId()).isEqualTo(1);
+ assertThat(dto1.getName()).isEqualTo("Sonar Way");
+ assertThat(dto1.getLanguage()).isEqualTo("java");
+ assertThat(dto1.getParent()).isNull();
+ assertThat(dto1.getVersion()).isEqualTo(1);
+ assertThat(dto1.isUsed()).isFalse();
+
+ QualityProfileDto dto2 = dtos.get(1);
+ assertThat(dto2.getId()).isEqualTo(2);
+ assertThat(dto2.getName()).isEqualTo("Sonar Way");
+ assertThat(dto2.getLanguage()).isEqualTo("js");
+ assertThat(dto2.getParent()).isNull();
+ assertThat(dto2.getVersion()).isEqualTo(1);
+ assertThat(dto2.isUsed()).isFalse();
+ } finally {
+ session.close();
+ }
}
@Test