aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2015-09-30 12:17:19 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-09-30 12:17:19 +0200
commit7a9d22a005d1f0b80a161149c967f149576a46ac (patch)
tree3551536131c481b1905f7f22f62b66f59559e971
parentadcaa85706df94a86e4c0ab7d54c1a490368daca (diff)
downloadsonarqube-7a9d22a005d1f0b80a161149c967f149576a46ac.tar.gz
sonarqube-7a9d22a005d1f0b80a161149c967f149576a46ac.zip
SONAR-6886 Stop support of deprecated property sonar.jdbc.user
-rw-r--r--sonar-db/src/main/java/org/sonar/db/DefaultDatabase.java10
-rw-r--r--sonar-db/src/test/java/org/sonar/db/DefaultDatabaseTest.java12
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseProperties.java5
3 files changed, 6 insertions, 21 deletions
diff --git a/sonar-db/src/main/java/org/sonar/db/DefaultDatabase.java b/sonar-db/src/main/java/org/sonar/db/DefaultDatabase.java
index cf71253f7f5..7bb864230f2 100644
--- a/sonar-db/src/main/java/org/sonar/db/DefaultDatabase.java
+++ b/sonar-db/src/main/java/org/sonar/db/DefaultDatabase.java
@@ -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);
diff --git a/sonar-db/src/test/java/org/sonar/db/DefaultDatabaseTest.java b/sonar-db/src/test/java/org/sonar/db/DefaultDatabaseTest.java
index 0d0c4ee1ad6..7eb9ad8e8a8 100644
--- a/sonar-db/src/test/java/org/sonar/db/DefaultDatabaseTest.java
+++ b/sonar-db/src/test/java/org/sonar/db/DefaultDatabaseTest.java
@@ -41,18 +41,6 @@ public class DefaultDatabaseTest {
}
@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();
props.setProperty("sonar.jdbc.driverClassName", "my.Driver");
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseProperties.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseProperties.java
index 7b427b3faf1..2bbea33ce7b 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseProperties.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseProperties.java
@@ -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";