summaryrefslogtreecommitdiffstats
path: root/sonar-batch/src
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2015-12-10 17:32:36 +0100
committerDuarte Meneses <duarte.meneses@sonarsource.com>2015-12-10 17:55:45 +0100
commit1be1ef656f02315135f1197f8dfa0128de3ab763 (patch)
tree7acbc70d1d0d5084f86e9ce1ab9366b9fb80b731 /sonar-batch/src
parentda21079d404427b1195bf158acceb973fcdc5493 (diff)
downloadsonarqube-1be1ef656f02315135f1197f8dfa0128de3ab763.tar.gz
sonarqube-1be1ef656f02315135f1197f8dfa0128de3ab763.zip
SONAR-6905 Batch should dump analysis-related URL into a properties file
Diffstat (limited to 'sonar-batch/src')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java3
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java2
2 files changed, 4 insertions, 1 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java b/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java
index 2da734f8dde..1d9c4a81145 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java
@@ -173,7 +173,8 @@ public class ReportPublisher implements Startable {
Map<String, String> metadata = new LinkedHashMap<>();
String effectiveKey = projectReactor.getRoot().getKeyWithBranch();
metadata.put("projectKey", effectiveKey);
-
+ metadata.put("serverUrl", publicUrl());
+
URL dashboardUrl = HttpUrl.parse(publicUrl()).newBuilder()
.addPathSegment("dashboard").addPathSegment("index").addPathSegment(effectiveKey)
.build()
diff --git a/sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java b/sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java
index 576a2dcdf8a..04c1b4ff161 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java
@@ -81,6 +81,7 @@ public class ReportPublisherTest {
File detailsFile = new File(temp.getRoot(), "report-task.txt");
assertThat(readFileToString(detailsFile)).isEqualTo(
"projectKey=struts\n" +
+ "serverUrl=https://localhost/\n" +
"dashboardUrl=https://localhost/dashboard/index/struts\n" +
"ceTaskId=TASK-123\n" +
"ceTaskUrl=https://localhost/api/ce/task?id=TASK-123\n"
@@ -101,6 +102,7 @@ public class ReportPublisherTest {
File detailsFile = new File(temp.getRoot(), "report-task.txt");
assertThat(readFileToString(detailsFile)).isEqualTo(
"projectKey=struts\n" +
+ "serverUrl=https://publicserver/sonarqube/\n" +
"dashboardUrl=https://publicserver/sonarqube/dashboard/index/struts\n" +
"ceTaskId=TASK-123\n" +
"ceTaskUrl=https://publicserver/sonarqube/api/ce/task?id=TASK-123\n"