From f79030e299ce766ec510ce2019c7b5e77105a1cd Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Wed, 31 Aug 2016 16:05:43 +0200 Subject: SONAR-7678 server-side stateless settings * Settings class becomes abstract as multiple implementations are used. Can't become an interface for binary backward-compatibility of API * tests should use MapSettings, an in-memory implementation of Settings * web server uses a thread-specific cache of settings when processing HTTP requests * web server does not have a cache of settings during startup, except for the system settings loaded from sonar.properties * Compute Engine uses a thread-specific cache of settings when processing a task. Cache is clear at end of task. * some useless methods of PersistentSettings are removed --- .../test/java/org/sonar/scanner/platform/DefaultServerTest.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sonar-scanner-engine/src/test/java/org/sonar/scanner/platform') diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/platform/DefaultServerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/platform/DefaultServerTest.java index 70fe5399662..e743714e568 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/platform/DefaultServerTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/platform/DefaultServerTest.java @@ -22,6 +22,7 @@ package org.sonar.scanner.platform; import org.junit.Test; import org.sonar.api.CoreProperties; import org.sonar.api.config.Settings; +import org.sonar.api.config.MapSettings; import org.sonar.scanner.bootstrap.BatchWsClient; import static org.assertj.core.api.Assertions.assertThat; @@ -32,7 +33,7 @@ public class DefaultServerTest { @Test public void shouldLoadServerProperties() { - Settings settings = new Settings(); + Settings settings = new MapSettings(); settings.setProperty(CoreProperties.SERVER_ID, "123"); settings.setProperty(CoreProperties.SERVER_VERSION, "2.2"); settings.setProperty(CoreProperties.SERVER_STARTTIME, "2010-05-18T17:59:00+0000"); @@ -57,7 +58,7 @@ public class DefaultServerTest { @Test public void publicRootUrl() { - Settings settings = new Settings(); + Settings settings = new MapSettings(); BatchWsClient client = mock(BatchWsClient.class); when(client.baseUrl()).thenReturn("http://foo.com/"); DefaultServer metadata = new DefaultServer(settings, client); @@ -71,7 +72,7 @@ public class DefaultServerTest { @Test(expected = RuntimeException.class) public void invalid_startup_date_throws_exception() { - Settings settings = new Settings(); + Settings settings = new MapSettings(); settings.setProperty(CoreProperties.SERVER_STARTTIME, "invalid"); BatchWsClient client = mock(BatchWsClient.class); DefaultServer metadata = new DefaultServer(settings, client); -- cgit v1.2.3