diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2017-03-01 17:10:28 +0100 |
---|---|---|
committer | dbmeneses <duarte.meneses@sonarsource.com> | 2017-03-01 17:20:44 +0100 |
commit | c723b844bed1ef2afdc3f5e5779f99fe598b6ac0 (patch) | |
tree | 985aff3d0e0ab7973060b5d3805d6b0a29742c3b /sonar-scanner-engine/src | |
parent | 3779ba44dbae7290bb91cc79692ebcbe5304f5b7 (diff) | |
download | sonarqube-c723b844bed1ef2afdc3f5e5779f99fe598b6ac0.tar.gz sonarqube-c723b844bed1ef2afdc3f5e5779f99fe598b6ac0.zip |
SONAR-8826 Add SonarQube server version to the task report
Diffstat (limited to 'sonar-scanner-engine/src')
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java | 1 | ||||
-rw-r--r-- | sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java index 7be514996f1..0f4e2ecf1e6 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java @@ -200,6 +200,7 @@ public class ReportPublisher implements Startable { } metadata.put("projectKey", effectiveKey); metadata.put("serverUrl", publicUrl); + metadata.put("serverVersion", server.getVersion()); URL dashboardUrl = httpUrl.newBuilder() .addPathSegment("dashboard").addPathSegment("index").addPathSegment(effectiveKey) diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java index ca5b55a43a4..118b460b740 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java @@ -82,6 +82,7 @@ public class ReportPublisherTest { root = ProjectDefinition.create().setKey("struts").setWorkDir(temp.getRoot()); when(reactor.getRoot()).thenReturn(root); when(server.getPublicRootUrl()).thenReturn("https://localhost"); + when(server.getVersion()).thenReturn("6.4"); } @Test @@ -101,6 +102,7 @@ public class ReportPublisherTest { "organization=MyOrg\n" + "projectKey=struts\n" + "serverUrl=https://localhost\n" + + "serverVersion=6.4\n" + "dashboardUrl=https://localhost/dashboard/index/struts\n" + "ceTaskId=TASK-123\n" + "ceTaskUrl=https://localhost/api/ce/task?id=TASK-123\n"); @@ -121,6 +123,7 @@ public class ReportPublisherTest { assertThat(readFileToString(detailsFile)).isEqualTo( "projectKey=struts\n" + "serverUrl=https://publicserver/sonarqube\n" + + "serverVersion=6.4\n" + "dashboardUrl=https://publicserver/sonarqube/dashboard/index/struts\n" + "ceTaskId=TASK-123\n" + "ceTaskUrl=https://publicserver/sonarqube/api/ce/task?id=TASK-123\n"); |