diff options
author | David Gageot <david@gageot.net> | 2012-07-11 18:11:28 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-07-11 18:11:59 +0200 |
commit | e719e97c6ecaf17074491eee0c0578bf5c218b3f (patch) | |
tree | c9329c8cd937a4503d8c8e01402cb5a5512370b6 /sonar-core | |
parent | e9143e13398638eca1be4fa79d8176b94348b4d3 (diff) | |
download | sonarqube-e719e97c6ecaf17074491eee0c0578bf5c218b3f.tar.gz sonarqube-e719e97c6ecaf17074491eee0c0578bf5c218b3f.zip |
Cleaner code
Diffstat (limited to 'sonar-core')
-rw-r--r-- | sonar-core/src/test/java/org/sonar/core/persistence/H2Database.java | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/H2Database.java b/sonar-core/src/test/java/org/sonar/core/persistence/H2Database.java index 55db7c2ed94..3767121de0d 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/H2Database.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/H2Database.java @@ -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); } |