aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorStephane Gamard <stephane.gamard@searchbox.com>2014-08-12 23:07:14 +0200
committerStephane Gamard <stephane.gamard@searchbox.com>2014-08-12 23:07:14 +0200
commit66642522a988c225a42a863fca137d8ad32f9945 (patch)
tree1057f435933b34a2584a3379f0095d4be400e1a0 /sonar-core
parent68431a3d6af152fc40ec623e43f7589f31894cd3 (diff)
downloadsonarqube-66642522a988c225a42a863fca137d8ad32f9945.tar.gz
sonarqube-66642522a988c225a42a863fca137d8ad32f9945.zip
improved test performances for sq (reuse iConnection in DBUnits)
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/test/java/org/sonar/core/persistence/AbstractDaoTestCase.java17
1 files changed, 4 insertions, 13 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/AbstractDaoTestCase.java b/sonar-core/src/test/java/org/sonar/core/persistence/AbstractDaoTestCase.java
index be78536a392..aac92fb380d 100644
--- a/sonar-core/src/test/java/org/sonar/core/persistence/AbstractDaoTestCase.java
+++ b/sonar-core/src/test/java/org/sonar/core/persistence/AbstractDaoTestCase.java
@@ -39,7 +39,6 @@ import org.dbunit.dataset.filter.DefaultColumnFilter;
import org.dbunit.dataset.xml.FlatXmlDataSet;
import org.dbunit.ext.mssql.InsertIdentityOperation;
import org.dbunit.operation.DatabaseOperation;
-import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.slf4j.Logger;
@@ -85,17 +84,6 @@ public abstract class AbstractDaoTestCase {
private static IDatabaseConnection connection;
private WorkQueue queue = new NullQueue();
- @AfterClass
- public static void cleanUp(){
- try {
- if (connection != null) {
- connection.close();
- }
- } catch (SQLException e) {
- // ignore
- }
- }
-
@Before
public void startDatabase() throws Exception {
if (database == null) {
@@ -117,12 +105,15 @@ public abstract class AbstractDaoTestCase {
databaseCommands = DatabaseCommands.forDialect(database.getDialect());
databaseTester = new MyDBTester(database.getDataSource());
- connection = createConnection();
myBatis = new MyBatis(database, new Logback(), queue);
myBatis.start();
}
+ if(connection == null){
+ connection = createConnection();
+ }
+
databaseCommands.truncateDatabase(database.getDataSource());
}