aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-11-02 00:54:55 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-11-02 00:54:55 +0400
commite8886ef578f813bd720256ef04bd0086b51b508f (patch)
treed0cb551ce761e03d6440b1a7e92ef3fc6cea0e35 /sonar-core
parentb425105dd544757bddf88eb7a17968e69e3ae5ea (diff)
downloadsonarqube-e8886ef578f813bd720256ef04bd0086b51b508f.tar.gz
sonarqube-e8886ef578f813bd720256ef04bd0086b51b508f.zip
Fix DuplicationDaoTest
Other tests can stuck if connection not closed.
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/test/java/org/sonar/persistence/dao/DuplicationDaoTest.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/sonar-core/src/test/java/org/sonar/persistence/dao/DuplicationDaoTest.java b/sonar-core/src/test/java/org/sonar/persistence/dao/DuplicationDaoTest.java
index 0c2126f72bb..1622570ad3f 100644
--- a/sonar-core/src/test/java/org/sonar/persistence/dao/DuplicationDaoTest.java
+++ b/sonar-core/src/test/java/org/sonar/persistence/dao/DuplicationDaoTest.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import java.io.InputStream;
+import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;
@@ -166,9 +167,10 @@ public class DuplicationDaoTest {
}
private final void checkTables(String testName, String[] excludedColumnNames, String... tables) {
- // getSession().commit();
+ IDatabaseConnection connection = null;
try {
- IDataSet dataSet = getCurrentDataSet();
+ connection = databaseTester.getConnection();
+ IDataSet dataSet = connection.createDataSet();
IDataSet expectedDataSet = getExpectedData(testName);
for (String table : tables) {
ITable filteredTable = DefaultColumnFilter.excludedColumnsTable(dataSet.getTable(table), excludedColumnNames);
@@ -178,6 +180,16 @@ public class DuplicationDaoTest {
throw translateException("Error while checking results", e);
} catch (DatabaseUnitException e) {
fail(e.getMessage());
+ } catch (Exception e) {
+ throw translateException("Error while checking results", e);
+ } finally {
+ if (connection != null) {
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ throw translateException("Error while checking results", e);
+ }
+ }
}
}