--- /dev/null
+/*
+ * 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;
+ }
+}
+++ /dev/null
-/*
- * 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;
- }
-}
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;
SonarRuntimeImpl.forSonarQube(apiVersion, SonarQubeSide.SERVER),
ProcessCommandWrapperImpl.class,
RestartFlagHolderImpl.class,
- WebServerSettings.class,
+ ServerSettingsImpl.class,
ServerImpl.class,
UuidFactoryImpl.INSTANCE,
EmbeddedDatabaseFactory.class,
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;
@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");
DbSession dbSession = db.getSession();
private PropertiesDao dao = dbClient.propertiesDao();
- private ServerSettings settings = new WebServerSettings(
+ private ServerSettings settings = new ServerSettingsImpl(
new PropertyDefinitions(),
new Properties());
Properties properties;
- WebServerSettings settings;
+ ServerSettingsImpl settings;
@Before
public void before() {
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