]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6905 Batch should dump analysis-related URL into a properties file
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Thu, 10 Dec 2015 16:32:36 +0000 (17:32 +0100)
committerDuarte Meneses <duarte.meneses@sonarsource.com>
Thu, 10 Dec 2015 16:55:45 +0000 (17:55 +0100)
it/it-tests/src/test/java/it/analysis/ReportDumpTest.java
sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java
sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java

index 91129f299a7473ce279e16075c3d68b4f9f3845c..74d58aebaa494ad45b3778f1bed361ebc6b4f1f0 100644 (file)
@@ -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"));
   }
index 2da734f8ddecff8db002a7a0933b6c3741d9adb5..1d9c4a811459381231acbabfd3bd126431f49620 100644 (file)
@@ -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()
index 576a2dcdf8afe6a9a1cdbc82405596fd633cb354..04c1b4ff161339044f022ecea36d73e0b575d545 100644 (file)
@@ -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"