]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3542 refactoring to remove custom activerecord adapters
authorSimon Brandhof <simon.brandhof@gmail.com>
Sun, 9 Sep 2012 20:20:01 +0000 (22:20 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Sun, 9 Sep 2012 20:20:01 +0000 (22:20 +0200)
13 files changed:
sonar-core/src/main/java/org/sonar/core/persistence/dialect/AbstractDialect.java
sonar-core/src/main/java/org/sonar/core/persistence/dialect/Dialect.java
sonar-core/src/main/java/org/sonar/core/persistence/dialect/H2.java
sonar-core/src/main/java/org/sonar/core/persistence/dialect/MsSql.java
sonar-core/src/main/java/org/sonar/core/persistence/dialect/MySql.java
sonar-core/src/main/java/org/sonar/core/persistence/dialect/Oracle.java
sonar-core/src/main/java/org/sonar/core/persistence/dialect/PostgreSql.java
sonar-core/src/test/java/org/sonar/core/persistence/dialect/H2Test.java
sonar-core/src/test/java/org/sonar/core/persistence/dialect/MsSqlTest.java
sonar-core/src/test/java/org/sonar/core/persistence/dialect/MySqlTest.java
sonar-core/src/test/java/org/sonar/core/persistence/dialect/OracleTest.java
sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSqlTest.java
sonar-server/src/main/webapp/WEB-INF/config/database.yml

index dbf34ea54ada1dd1818f321e8520967800b3c326..0efe69d12b5ff801253eed72c6d09c2464f8799e 100644 (file)
@@ -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;
   }
index bb699f82b7bef05608cc858f65100d85561c824a..0994f3dcf4fda6ed3cbe8492373ffa95d3067ba5 100644 (file)
@@ -39,11 +39,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
    *
index 1bbfbe13bd441b7f31880fadf2e8be3c67fbf499..3e572aaae352f250663a2ffab92559f7c956af3d 100644 (file)
@@ -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() {
index 2e35bc3b8940d9a8be8c4d1d134f2890a8f758e4..a7b30451e3f92523ebe96742588dd3396b09dc43 100644 (file)
@@ -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() {
index 16f3b9117bae2c55bcca86131d487b9c9f91d683..1e0d86d73e25a79503a57f85969dd5a2e578b26e 100644 (file)
@@ -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() {
index c02ee4a40617796b5db59faf24f6200baab5ccd4..ce21be04c52f4e8ffe8260c116072107bdd6ec27 100644 (file)
@@ -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() {
index d14c29e0eda2653e322871af0e21d7b32e307d87..0db4659e653df6c48b496ef309bac128a0afd2e1 100644 (file)
@@ -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() {
index 54e1319a736fe7b9759e2540673b136a95e39bcd..6c4737514d1eb9fa2605d3ea4dc7df01556063fd 100644 (file)
@@ -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");
   }
index 4b1570c8570c4b50d0cde404eccc90cc8009c98f..bf4b5b4957ceb622356e0da5af26c8c73b8223d1 100644 (file)
@@ -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");
   }
index dd1d9b47198bed91e6c20a4c5b4924445d1396e5..91f6e6e29e4cc534393c5ca9ec8677b9efeaaa44 100644 (file)
@@ -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");
   }
index 3030d7935fcc64ffc6151b4de4ff246747f0057e..34d1594f2c57828a5a5833a9b286840d0368fb63 100644 (file)
@@ -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");
   }
index bde06f8579dbf30f5d7db668a13dbcd0ad8117db..dfc35ac88c47213205ae052268b44479b17d787b 100644 (file)
@@ -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");
   }
index d43273bc08312e8bef9df10a71b0713ffdbf634e..0677de89998a3c41079f682d4dacba9ef028aadf 100644 (file)
@@ -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') %>