diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2016-07-14 09:31:53 +0200 |
---|---|---|
committer | Duarte Meneses <duarte.meneses@sonarsource.com> | 2016-07-14 09:40:16 +0200 |
commit | 629a4eee4d0803169aa4d4beff62b585ca271700 (patch) | |
tree | bb4f55af4d45ac588fe3cdc9ea01aeea62da94c0 /sonar-scanner-engine/src/test/java/org/sonar/scanner/platform | |
parent | 2603cbdd54960fd453b90d37157320347f511b6a (diff) | |
download | sonarqube-629a4eee4d0803169aa4d4beff62b585ca271700.tar.gz sonarqube-629a4eee4d0803169aa4d4beff62b585ca271700.zip |
Improve quality
Diffstat (limited to 'sonar-scanner-engine/src/test/java/org/sonar/scanner/platform')
-rw-r--r-- | sonar-scanner-engine/src/test/java/org/sonar/scanner/platform/DefaultServerTest.java | 29 |
1 files changed, 29 insertions, 0 deletions
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 59fbb89ff8c..2bb86289c32 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 @@ -48,5 +48,34 @@ public class DefaultServerTest { assertThat(metadata.getStartedAt()).isNotNull(); assertThat(metadata.getURL()).isEqualTo("http://foo.com"); assertThat(metadata.getPermanentServerId()).isEqualTo("abcde"); + + assertThat(metadata.getRootDir()).isNull(); + assertThat(metadata.getDeployDir()).isNull(); + assertThat(metadata.getContextPath()).isNull(); + assertThat(metadata.isDev()).isFalse(); + assertThat(metadata.isSecured()).isFalse(); + } + + @Test + public void publicRootUrl() { + Settings settings = new Settings(); + BatchWsClient client = mock(BatchWsClient.class); + when(client.baseUrl()).thenReturn("http://foo.com/"); + DefaultServer metadata = new DefaultServer(settings, client); + + settings.setProperty(CoreProperties.SERVER_BASE_URL, "http://server.com/"); + assertThat(metadata.getPublicRootUrl()).isEqualTo("http://server.com"); + + settings.removeProperty(CoreProperties.SERVER_BASE_URL); + assertThat(metadata.getPublicRootUrl()).isEqualTo("http://foo.com"); + } + + @Test + public void invalidDate() { + Settings settings = new Settings(); + settings.setProperty(CoreProperties.SERVER_STARTTIME, "invalid"); + BatchWsClient client = mock(BatchWsClient.class); + DefaultServer metadata = new DefaultServer(settings, client); + assertThat(metadata.getStartedAt()).isNull(); } } |