]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8883 Reenable assertion
authorJulien HENRY <julien.henry@sonarsource.com>
Fri, 3 Mar 2017 09:38:06 +0000 (10:38 +0100)
committerJulien HENRY <julien.henry@sonarsource.com>
Fri, 3 Mar 2017 09:38:58 +0000 (10:38 +0100)
it/it-tests/src/test/java/it/analysis/ReportDumpTest.java
it/it-tests/src/test/java/it/analysis/ScannerTest.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java

index b5abec877c83888fbefeae3d3e4276863b30e626..9f9a8ee97764d80b8f577404968315066c408041 100644 (file)
@@ -57,7 +57,7 @@ public class ReportDumpTest {
     assertThat(props).hasSize(6);
     assertThat(props.getProperty("projectKey")).isEqualTo("dump_metadata_of_uploaded_report");
     assertThat(props.getProperty("ceTaskId")).isNotEmpty();
-    // FIXME assertThat(props.getProperty("serverVersion")).isEqualTo(orchestrator.getServer().version().toString());
+    assertThat(props.getProperty("serverVersion")).isEqualTo(orchestrator.getServer().version().toString());
     verifyUrl(props.getProperty("serverUrl"));
     verifyUrl(props.getProperty("dashboardUrl"));
     verifyUrl(props.getProperty("ceTaskUrl"));
index be7ac934dd8f79914b476b01efdd7090db4f669e..348a5fb3ab3f313d42b47cb987fb435b3382dbbb 100644 (file)
@@ -31,7 +31,6 @@ import org.apache.commons.io.FileUtils;
 import org.junit.Assume;
 import org.junit.Before;
 import org.junit.ClassRule;
-import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
@@ -378,47 +377,6 @@ public class ScannerTest {
     assertThat(getComponent(orchestrator, "com.sonarsource.it.samples:moduleB")).isNotNull();
   }
 
-  /**
-   * SONAR-4692
-   */
-  @Test
-  @Ignore("This test should be moved to a Medium test of the Compute Engine")
-  public void prevent_same_module_key_in_two_projects() {
-    orchestrator.getServer().provisionProject("projectAB", "project AB");
-    orchestrator.getServer().associateProjectToQualityProfile("projectAB", "xoo", "one-issue-per-line");
-    scan("analysis/prevent-common-module/projectAB");
-    assertThat(getComponent(orchestrator, "com.sonarsource.it.samples:moduleA")).isNotNull();
-    assertThat(getComponent(orchestrator, "com.sonarsource.it.samples:moduleB")).isNotNull();
-
-    orchestrator.getServer().provisionProject("projectAC", "project AC");
-    orchestrator.getServer().associateProjectToQualityProfile("projectAC", "xoo", "one-issue-per-line");
-
-    BuildResult result = scanQuietly("analysis/prevent-common-module/projectAC");
-    assertThat(result.getLastStatus()).isNotEqualTo(0);
-    assertThat(result.getLogs()).contains("Module \"com.sonarsource.it.samples:moduleA\" is already part of project \"projectAB\"");
-  }
-
-  /**
-   * SONAR-4334
-   */
-  @Test
-  @Ignore("Should be move to CE IT/MT")
-  public void fail_if_project_date_is_older_than_latest_snapshot() {
-    orchestrator.getServer().provisionProject("sample", "xoo-sample");
-    orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
-    SonarScanner analysis = SonarScanner.create(ItUtils.projectDir("shared/xoo-sample"));
-    analysis.setProperty("sonar.projectDate", "2014-01-01");
-    orchestrator.executeBuild(analysis);
-
-    analysis.setProperty("sonar.projectDate", "2000-10-19");
-    BuildResult result = orchestrator.executeBuildQuietly(analysis);
-
-    assertThat(result.getLastStatus()).isNotEqualTo(0);
-    assertThat(result.getLogs()).contains("'sonar.projectDate' property cannot be older than the date of the last known quality snapshot on this project. Value: '2000-10-19'. " +
-      "Latest quality snapshot: ");
-    assertThat(result.getLogs()).contains("This property may only be used to rebuild the past in a chronological order.");
-  }
-
   private BuildResult scan(String projectPath, String... props) {
     SonarScanner scanner = configureScanner(projectPath, props);
     return orchestrator.executeBuild(scanner);
index 7255cd82f623bf4c02b66df285f8f538e475e364..bb38c3ea6e0bd3d49eea01227927d7faef63f18c 100644 (file)
@@ -21,7 +21,6 @@ package org.sonar.scanner.report;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Throwables;
-
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -200,7 +199,6 @@ public class ReportPublisher implements Startable {
     } else {
       String publicUrl = server.getPublicRootUrl();
       HttpUrl httpUrl = HttpUrl.parse(publicUrl);
-      String serverVersion = (server.getVersion() != null) ? server.getVersion() : "";
 
       Map<String, String> metadata = new LinkedHashMap<>();
       String effectiveKey = projectReactor.getRoot().getKeyWithBranch();
@@ -209,7 +207,7 @@ public class ReportPublisher implements Startable {
       }
       metadata.put("projectKey", effectiveKey);
       metadata.put("serverUrl", publicUrl);
-      metadata.put("serverVersion", serverVersion);
+      metadata.put("serverVersion", server.getVersion());
 
       URL dashboardUrl = httpUrl.newBuilder()
         .addPathSegment("dashboard").addPathSegment("index").addPathSegment(effectiveKey)