]> source.dussan.org Git - sonarqube.git/commitdiff
Cleaner code
authorDavid Gageot <david@gageot.net>
Wed, 11 Jul 2012 16:11:28 +0000 (18:11 +0200)
committerDavid Gageot <david@gageot.net>
Wed, 11 Jul 2012 16:11:59 +0000 (18:11 +0200)
sonar-core/src/test/java/org/sonar/core/persistence/H2Database.java

index 55db7c2ed942928be05c59faa2cca5a26c069cd4..3767121de0dc42ab19a2937c7a23c11f3f2e128e 100644 (file)
@@ -20,7 +20,6 @@
 package org.sonar.core.persistence;
 
 import org.apache.commons.dbcp.BasicDataSource;
-import org.apache.commons.dbcp.BasicDataSourceFactory;
 import org.hibernate.cfg.Environment;
 import org.sonar.core.persistence.dialect.Dialect;
 import org.sonar.core.persistence.dialect.H2;
@@ -53,18 +52,13 @@ public class H2Database implements Database {
    */
   private void startDatabase() {
     try {
-      Properties properties = new Properties();
-      properties.put("driverClassName", "org.h2.Driver");
-      properties.put("username", "sonar");
-      properties.put("password", "sonar");
-      // properties.put("url", "jdbc:h2:mem:sonar2;TRACE_LEVEL_SYSTEM_OUT=2");
-      properties.put("url", "jdbc:h2:mem:sonar2");
-
-      // limit to 2 because of Hibernate and MyBatis
-      properties.put("maxActive", "2");
-      properties.put("maxIdle", "2");
-      datasource = (BasicDataSource) BasicDataSourceFactory.createDataSource(properties);
-
+      datasource = new BasicDataSource();
+      datasource.setDriverClassName("org.h2.Driver");
+      datasource.setUsername("sonar");
+      datasource.setPassword("sonar");
+      datasource.setUrl("jdbc:h2:mem:sonar2");
+      datasource.setMaxActive(2);
+      datasource.setMaxIdle(2);
     } catch (Exception e) {
       throw new IllegalStateException("Fail to start H2", e);
     }