]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6886 Stop support of deprecated property sonar.jdbc.user
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 30 Sep 2015 10:17:19 +0000 (12:17 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 30 Sep 2015 10:17:19 +0000 (12:17 +0200)
sonar-db/src/main/java/org/sonar/db/DefaultDatabase.java
sonar-db/src/test/java/org/sonar/db/DefaultDatabaseTest.java
sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseProperties.java

index cf71253f7f5e9c7310460a46bd441adf7120b998..7bb864230f2016445705c3b059797e3ca36a6963 100644 (file)
@@ -75,7 +75,7 @@ public class DefaultDatabase implements Database {
   void initSettings() {
     properties = new Properties();
     completeProperties(settings, properties, SONAR_JDBC);
-    completeDefaultProperties(properties);
+    completeDefaultProperty(properties, DatabaseProperties.PROP_URL, DEFAULT_URL);
     doCompleteProperties(properties);
 
     dialect = DialectUtils.find(properties.getProperty(SONAR_JDBC_DIALECT), properties.getProperty(SONAR_JDBC_URL));
@@ -160,14 +160,6 @@ public class DefaultDatabase implements Database {
     return result;
   }
 
-  private static void completeDefaultProperties(Properties props) {
-    completeDefaultProperty(props, DatabaseProperties.PROP_URL, DEFAULT_URL);
-
-    if (props.getProperty(DatabaseProperties.PROP_USER_DEPRECATED) != null) {
-      completeDefaultProperty(props, DatabaseProperties.PROP_USER, props.getProperty(DatabaseProperties.PROP_USER_DEPRECATED));
-    }
-  }
-
   private static void completeDefaultProperty(Properties props, String key, String defaultValue) {
     if (props.getProperty(key) == null) {
       props.setProperty(key, defaultValue);
index 0d0c4ee1ad67e62ede9eb083100c521d9d677076..7eb9ad8e8a8b8629874df0c5f4a3553778241624 100644 (file)
@@ -40,18 +40,6 @@ public class DefaultDatabaseTest {
     assertThat(db.toString()).isEqualTo("Database[jdbc:h2:tcp://localhost/sonar]");
   }
 
-  @Test
-  public void shouldSupportDeprecatedUserProperty() {
-    Settings settings = new Settings();
-    settings.setProperty("sonar.jdbc.user", "me");
-
-    DefaultDatabase db = new DefaultDatabase(settings);
-    db.initSettings();
-    Properties props = db.getProperties();
-
-    assertThat(props.getProperty("sonar.jdbc.username")).isEqualTo("me");
-  }
-
   @Test
   public void shouldExtractCommonsDbcpProperties() {
     Properties props = new Properties();
index 7b427b3faf1e75e3e09f69c803b9d0e444dbea63..2bbea33ce7b85594d2fe8921eb9255ce8c4b3552 100644 (file)
@@ -26,6 +26,11 @@ public interface DatabaseProperties {
   String PROP_URL = "sonar.jdbc.url";
   String PROP_DRIVER = "sonar.jdbc.driverClassName";
   String PROP_USER = "sonar.jdbc.username";
+
+  /**
+   * @deprecated not documented for a while (before version 3.6) and not supported since version 5.2.
+   */
+  @Deprecated
   String PROP_USER_DEPRECATED = "sonar.jdbc.user";
   String PROP_USER_DEFAULT_VALUE = "";
   String PROP_PASSWORD = "sonar.jdbc.password";