]> source.dussan.org Git - sonarqube.git/commitdiff
Rename org.sonar.server.platform.WebServerSettings to ServerSettingsImpl
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 26 Jul 2016 12:41:33 +0000 (14:41 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 29 Jul 2016 08:31:31 +0000 (10:31 +0200)
server/sonar-server/src/main/java/org/sonar/server/platform/ServerSettingsImpl.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/platform/WebServerSettings.java [deleted file]
server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/SetDefaultTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/platform/PersistentSettingsTest.java
server/sonar-server/src/test/java/org/sonar/server/platform/ServerSettingsTest.java

diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/ServerSettingsImpl.java b/server/sonar-server/src/main/java/org/sonar/server/platform/ServerSettingsImpl.java
new file mode 100644 (file)
index 0000000..b19d293
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.server.platform;
+
+import org.sonar.api.CoreProperties;
+import org.sonar.api.config.PropertyDefinitions;
+import org.sonar.api.config.Settings;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Load settings in the following order (the last override the first) :
+ * <ol>
+ * <li>general settings persisted in database</li>
+ * <li>file $SONAR_HOME/conf/sonar.properties</li>
+ * <li>environment variables</li>
+ * <li>system properties</li>
+ * </ol>
+ */
+public class ServerSettingsImpl extends Settings implements ServerSettings {
+
+  private final Properties properties;
+
+  public ServerSettingsImpl(PropertyDefinitions definitions, Properties properties) {
+    super(definitions);
+    this.properties = properties;
+    load(Collections.emptyMap());
+    // Secret key is loaded from conf/sonar.properties
+    getEncryption().setPathToSecretKey(getString(CoreProperties.ENCRYPTION_SECRET_KEY_PATH));
+  }
+
+  @Override
+  public ServerSettings activateDatabaseSettings(Map<String, String> databaseProperties) {
+    return load(databaseProperties);
+  }
+
+  @Override
+  public Settings getSettings() {
+    return this;
+  }
+
+  private ServerSettings load(Map<String, String> databaseSettings) {
+    clear();
+
+    // order is important : the last override the first
+    addProperties(databaseSettings);
+    addProperties(properties);
+
+    return this;
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/WebServerSettings.java b/server/sonar-server/src/main/java/org/sonar/server/platform/WebServerSettings.java
deleted file mode 100644 (file)
index 7a74f92..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.server.platform;
-
-import org.sonar.api.CoreProperties;
-import org.sonar.api.config.PropertyDefinitions;
-import org.sonar.api.config.Settings;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * Load settings in the following order (the last override the first) :
- * <ol>
- * <li>general settings persisted in database</li>
- * <li>file $SONAR_HOME/conf/sonar.properties</li>
- * <li>environment variables</li>
- * <li>system properties</li>
- * </ol>
- *
- * @since 2.12
- */
-public class WebServerSettings extends Settings implements ServerSettings {
-
-  private final Properties properties;
-
-  public WebServerSettings(PropertyDefinitions definitions, Properties properties) {
-    super(definitions);
-    this.properties = properties;
-    load(Collections.<String, String>emptyMap());
-    // Secret key is loaded from conf/sonar.properties
-    getEncryption().setPathToSecretKey(getString(CoreProperties.ENCRYPTION_SECRET_KEY_PATH));
-  }
-
-  @Override
-  public ServerSettings activateDatabaseSettings(Map<String, String> databaseProperties) {
-    return load(databaseProperties);
-  }
-
-  @Override
-  public Settings getSettings() {
-    return this;
-  }
-
-  private ServerSettings load(Map<String, String> databaseSettings) {
-    clear();
-
-    // order is important : the last override the first
-    addProperties(databaseSettings);
-    addProperties(properties);
-
-    return this;
-  }
-}
index 2d23b102dee136334d6b47008d53eda1f274927e..58053ce34985508cf5f8d902195052c80fe6db2d 100644 (file)
@@ -46,8 +46,8 @@ import org.sonar.server.platform.DatabaseServerCompatibility;
 import org.sonar.server.platform.DefaultServerFileSystem;
 import org.sonar.server.platform.Platform;
 import org.sonar.server.platform.ServerImpl;
+import org.sonar.server.platform.ServerSettingsImpl;
 import org.sonar.server.platform.TempFolderProvider;
-import org.sonar.server.platform.WebServerSettings;
 import org.sonar.server.qualityprofile.index.ActiveRuleIndex;
 import org.sonar.server.ruby.PlatformRackBridge;
 import org.sonar.server.rule.index.RuleIndex;
@@ -77,7 +77,7 @@ public class PlatformLevel1 extends PlatformLevel {
       SonarRuntimeImpl.forSonarQube(apiVersion, SonarQubeSide.SERVER),
       ProcessCommandWrapperImpl.class,
       RestartFlagHolderImpl.class,
-      WebServerSettings.class,
+      ServerSettingsImpl.class,
       ServerImpl.class,
       UuidFactoryImpl.INSTANCE,
       EmbeddedDatabaseFactory.class,
index a9c3918e28b07dd4d0c8afa1869f631e60e61c54..b4146f292386c20288548a1f7fa8231ca123ac97 100644 (file)
@@ -44,7 +44,7 @@ import org.sonar.server.exceptions.UnauthorizedException;
 import org.sonar.server.i18n.I18nRule;
 import org.sonar.server.permission.ws.PermissionDependenciesFinder;
 import org.sonar.server.platform.PersistentSettings;
-import org.sonar.server.platform.WebServerSettings;
+import org.sonar.server.platform.ServerSettingsImpl;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.usergroups.ws.UserGroupFinder;
 import org.sonar.server.ws.TestRequest;
@@ -82,7 +82,7 @@ public class SetDefaultTemplateActionTest {
   @Before
   public void setUp() {
     DbClient dbClient = db.getDbClient();
-    persistentSettings = new PersistentSettings(dbClient, new WebServerSettings(new PropertyDefinitions(), new Properties()));
+    persistentSettings = new PersistentSettings(dbClient, new ServerSettingsImpl(new PropertyDefinitions(), new Properties()));
     persistentSettings.saveProperty(DEFAULT_TEMPLATE_PROPERTY, "any-template-uuid");
     persistentSettings.saveProperty(defaultRootQualifierTemplateProperty(PROJECT), "any-template-uuid");
     persistentSettings.saveProperty(defaultRootQualifierTemplateProperty(VIEW), "any-view-template-uuid");
index 5a9bfaa154446f70aa1fa35fd16a931d1ecb3138..e80eaae4251fb2e60d8c3e198bed071b9ce50c4c 100644 (file)
@@ -42,7 +42,7 @@ public class PersistentSettingsTest {
   DbSession dbSession = db.getSession();
 
   private PropertiesDao dao = dbClient.propertiesDao();
-  private ServerSettings settings = new WebServerSettings(
+  private ServerSettings settings = new ServerSettingsImpl(
     new PropertyDefinitions(),
     new Properties());
 
index 7e2aef096798167ecbafb7a9281f6cf6842e085d..f06f5ede8e0e3b76c66844bc38c54fed9fe579d2 100644 (file)
@@ -33,7 +33,7 @@ public class ServerSettingsTest {
 
   Properties properties;
 
-  WebServerSettings settings;
+  ServerSettingsImpl settings;
 
   @Before
   public void before() {
@@ -41,7 +41,7 @@ public class ServerSettingsTest {
     properties.put("hello", "world");
     properties.put("in_file", "true");
     properties.put("ServerSettingsTestEnv", "in_file");
-    settings = new WebServerSettings(new PropertyDefinitions(), properties);
+    settings = new ServerSettingsImpl(new PropertyDefinitions(), properties);
   }
 
   @Test