diff options
3 files changed, 6 insertions, 2 deletions
diff --git a/it/it-tests/src/test/java/it/analysis/ReportDumpTest.java b/it/it-tests/src/test/java/it/analysis/ReportDumpTest.java index 91129f299a7..74d58aebaa4 100644 --- a/it/it-tests/src/test/java/it/analysis/ReportDumpTest.java +++ b/it/it-tests/src/test/java/it/analysis/ReportDumpTest.java @@ -44,9 +44,10 @@ public class ReportDumpTest { // verify properties Properties props = new Properties(); props.load(new StringReader(FileUtils.readFileToString(metadata, StandardCharsets.UTF_8))); - assertThat(props).hasSize(4); + assertThat(props).hasSize(5); assertThat(props.getProperty("projectKey")).isEqualTo("dump_metadata_of_uploaded_report"); assertThat(props.getProperty("ceTaskId")).isNotEmpty(); + verifyUrl(props.getProperty("serverUrl")); verifyUrl(props.getProperty("dashboardUrl")); verifyUrl(props.getProperty("ceTaskUrl")); } 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" |