diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-11-02 00:54:55 +0400 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-11-02 00:54:55 +0400 |
commit | e8886ef578f813bd720256ef04bd0086b51b508f (patch) | |
tree | d0cb551ce761e03d6440b1a7e92ef3fc6cea0e35 /sonar-core | |
parent | b425105dd544757bddf88eb7a17968e69e3ae5ea (diff) | |
download | sonarqube-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.java | 16 |
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); + } + } } } |