aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-09-09 22:20:01 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2012-09-09 22:20:01 +0200
commit6cdc77eab8e8aa04e87fca450a70a05c02f7a03d (patch)
tree9393e10ca199a0b43825634ed2a8c932114fffbe
parent7e44abab607e2e4ef509074a064261bd245b3dd3 (diff)
downloadsonarqube-6cdc77eab8e8aa04e87fca450a70a05c02f7a03d.tar.gz
sonarqube-6cdc77eab8e8aa04e87fca450a70a05c02f7a03d.zip
SONAR-3542 refactoring to remove custom activerecord adapters
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/dialect/AbstractDialect.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/dialect/Dialect.java5
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/dialect/H2.java2
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/dialect/MsSql.java2
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/dialect/MySql.java2
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/dialect/Oracle.java2
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/dialect/PostgreSql.java2
-rw-r--r--sonar-core/src/test/java/org/sonar/core/persistence/dialect/H2Test.java1
-rw-r--r--sonar-core/src/test/java/org/sonar/core/persistence/dialect/MsSqlTest.java1
-rw-r--r--sonar-core/src/test/java/org/sonar/core/persistence/dialect/MySqlTest.java1
-rw-r--r--sonar-core/src/test/java/org/sonar/core/persistence/dialect/OracleTest.java1
-rw-r--r--sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSqlTest.java1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/config/database.yml2
13 files changed, 7 insertions, 23 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/AbstractDialect.java b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/AbstractDialect.java
index dbf34ea54ad..0efe69d12b5 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/AbstractDialect.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/AbstractDialect.java
@@ -25,17 +25,15 @@ package org.sonar.core.persistence.dialect;
abstract class AbstractDialect implements Dialect {
private final String id;
private final String activeRecordDialectCode;
- private final String activeRecordJdbcAdapter;
private final String defaultDriverClassName;
private final String trueSqlValue;
private final String falseSqlValue;
private final String validationQuery;
- protected AbstractDialect(String id, String activeRecordDialectCode, String activeRecordJdbcAdapter, String defaultDriverClassName, String trueSqlValue, String falseSqlValue,
+ protected AbstractDialect(String id, String activeRecordDialectCode, String defaultDriverClassName, String trueSqlValue, String falseSqlValue,
String validationQuery) {
this.id = id;
this.activeRecordDialectCode = activeRecordDialectCode;
- this.activeRecordJdbcAdapter = activeRecordJdbcAdapter;
this.defaultDriverClassName = defaultDriverClassName;
this.trueSqlValue = trueSqlValue;
this.falseSqlValue = falseSqlValue;
@@ -50,10 +48,6 @@ abstract class AbstractDialect implements Dialect {
return activeRecordDialectCode;
}
- public String getActiveRecordJdbcAdapter() {
- return activeRecordJdbcAdapter;
- }
-
public String getDefaultDriverClassName() {
return defaultDriverClassName;
}
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/Dialect.java b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/Dialect.java
index bb699f82b7b..0994f3dcf4f 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/Dialect.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/Dialect.java
@@ -40,11 +40,6 @@ public interface Dialect {
String getActiveRecordDialectCode();
/**
- * @return the activerecord-jdbc adapter. See the property 'adapter' in database.yml
- */
- String getActiveRecordJdbcAdapter();
-
- /**
* Used to autodetect a dialect for a given driver URL
*
* @param jdbcConnectionURL a jdbc driver url such as jdbc:mysql://localhost:3306/sonar
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/H2.java b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/H2.java
index 1bbfbe13bd4..3e572aaae35 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/H2.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/H2.java
@@ -30,7 +30,7 @@ public class H2 extends AbstractDialect {
public static final String ID = "h2";
public H2() {
- super(ID, "h2", "jdbc", "org.h2.Driver", "true", "false", "SELECT 1");
+ super(ID, "h2", "org.h2.Driver", "true", "false", "SELECT 1");
}
public Class<? extends org.hibernate.dialect.Dialect> getHibernateDialectClass() {
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MsSql.java b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MsSql.java
index 2e35bc3b894..a7b30451e3f 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MsSql.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MsSql.java
@@ -30,7 +30,7 @@ public class MsSql extends AbstractDialect {
public static final String ID = "mssql";
public MsSql() {
- super(ID, "sqlserver", "jdbc", "net.sourceforge.jtds.jdbc.Driver", "1", "0", "SELECT 1");
+ super(ID, "sqlserver", "net.sourceforge.jtds.jdbc.Driver", "1", "0", "SELECT 1");
}
public Class<? extends org.hibernate.dialect.Dialect> getHibernateDialectClass() {
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MySql.java b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MySql.java
index 16f3b9117ba..1e0d86d73e2 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MySql.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MySql.java
@@ -33,7 +33,7 @@ public class MySql extends AbstractDialect {
public static final String ID = "mysql";
public MySql() {
- super(ID, "mysql", "jdbc", "com.mysql.jdbc.Driver", "true", "false", "SELECT 1");
+ super(ID, "mysql", "com.mysql.jdbc.Driver", "true", "false", "SELECT 1");
}
public Class<? extends org.hibernate.dialect.Dialect> getHibernateDialectClass() {
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/Oracle.java b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/Oracle.java
index c02ee4a4061..ce21be04c52 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/Oracle.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/Oracle.java
@@ -33,7 +33,7 @@ public class Oracle extends AbstractDialect {
public static final String ID = "oracle";
public Oracle() {
- super(ID, "oracle", "jdbc", "oracle.jdbc.OracleDriver", "1", "0", "SELECT 1 FROM DUAL");
+ super(ID, "oracle", "oracle.jdbc.OracleDriver", "1", "0", "SELECT 1 FROM DUAL");
}
public Class<? extends org.hibernate.dialect.Dialect> getHibernateDialectClass() {
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/PostgreSql.java b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/PostgreSql.java
index d14c29e0eda..0db4659e653 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/PostgreSql.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/PostgreSql.java
@@ -32,7 +32,7 @@ public class PostgreSql extends AbstractDialect {
public static final String ID = "postgresql";
public PostgreSql() {
- super(ID, "postgre", "jdbc", "org.postgresql.Driver", "true", "false", "SELECT 1");
+ super(ID, "postgre", "org.postgresql.Driver", "true", "false", "SELECT 1");
}
public Class<? extends org.hibernate.dialect.Dialect> getHibernateDialectClass() {
diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/H2Test.java b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/H2Test.java
index 54e1319a736..6c4737514d1 100644
--- a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/H2Test.java
+++ b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/H2Test.java
@@ -43,7 +43,6 @@ public class H2Test {
public void should_configure() {
assertThat(h2.getId()).isEqualTo("h2");
assertThat(h2.getActiveRecordDialectCode()).isEqualTo("h2");
- assertThat(h2.getActiveRecordJdbcAdapter()).isEqualTo("jdbc");
assertThat(h2.getDefaultDriverClassName()).isEqualTo("org.h2.Driver");
assertThat(h2.getValidationQuery()).isEqualTo("SELECT 1");
}
diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MsSqlTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MsSqlTest.java
index 4b1570c8570..bf4b5b4957c 100644
--- a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MsSqlTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MsSqlTest.java
@@ -46,7 +46,6 @@ public class MsSqlTest {
public void should_configure() {
assertThat(msSql.getId()).isEqualTo("mssql");
assertThat(msSql.getActiveRecordDialectCode()).isEqualTo("sqlserver");
- assertThat(msSql.getActiveRecordJdbcAdapter()).isEqualTo("jdbc");
assertThat(msSql.getDefaultDriverClassName()).isEqualTo("net.sourceforge.jtds.jdbc.Driver");
assertThat(msSql.getValidationQuery()).isEqualTo("SELECT 1");
}
diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MySqlTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MySqlTest.java
index dd1d9b47198..91f6e6e29e4 100644
--- a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MySqlTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MySqlTest.java
@@ -46,7 +46,6 @@ public class MySqlTest {
public void should_configure() {
assertThat(mySql.getId()).isEqualTo("mysql");
assertThat(mySql.getActiveRecordDialectCode()).isEqualTo("mysql");
- assertThat(mySql.getActiveRecordJdbcAdapter()).isEqualTo("jdbc");
assertThat(mySql.getDefaultDriverClassName()).isEqualTo("com.mysql.jdbc.Driver");
assertThat(mySql.getValidationQuery()).isEqualTo("SELECT 1");
}
diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/OracleTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/OracleTest.java
index 3030d7935fc..34d1594f2c5 100644
--- a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/OracleTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/OracleTest.java
@@ -58,7 +58,6 @@ public class OracleTest {
public void should_configure() {
assertThat(oracle.getId()).isEqualTo("oracle");
assertThat(oracle.getActiveRecordDialectCode()).isEqualTo("oracle");
- assertThat(oracle.getActiveRecordJdbcAdapter()).isEqualTo("jdbc");
assertThat(oracle.getDefaultDriverClassName()).isEqualTo("oracle.jdbc.OracleDriver");
assertThat(oracle.getValidationQuery()).isEqualTo("SELECT 1 FROM DUAL");
}
diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSqlTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSqlTest.java
index bde06f8579d..dfc35ac88c4 100644
--- a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSqlTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSqlTest.java
@@ -57,7 +57,6 @@ public class PostgreSqlTest {
public void should_configure() {
assertThat(postgreSql.getId()).isEqualTo("postgresql");
assertThat(postgreSql.getActiveRecordDialectCode()).isEqualTo("postgre");
- assertThat(postgreSql.getActiveRecordJdbcAdapter()).isEqualTo("jdbc");
assertThat(postgreSql.getDefaultDriverClassName()).isEqualTo("org.postgresql.Driver");
assertThat(postgreSql.getValidationQuery()).isEqualTo("SELECT 1");
}
diff --git a/sonar-server/src/main/webapp/WEB-INF/config/database.yml b/sonar-server/src/main/webapp/WEB-INF/config/database.yml
index d43273bc083..0677de89998 100644
--- a/sonar-server/src/main/webapp/WEB-INF/config/database.yml
+++ b/sonar-server/src/main/webapp/WEB-INF/config/database.yml
@@ -1,5 +1,5 @@
base: &base
- adapter: <%= ::Java::OrgSonarServerUi::JRubyFacade.getInstance().getDatabase().getDialect().getActiveRecordJdbcAdapter() %>
+ adapter: jdbc
url: <%= ::Java::OrgSonarServerUi::JRubyFacade.getInstance().getConfigurationValue('sonar.jdbc.url') %>
dialect: <%= ::Java::OrgSonarServerUi::JRubyFacade.getInstance().getDatabase().getDialect().getActiveRecordDialectCode() %>
driver: <%= ::Java::OrgSonarServerUi::JRubyFacade.getInstance().getConfigurationValue('sonar.jdbc.driverClassName') %>