]> source.dussan.org Git - sonar-scanner-cli.git/commitdiff
Upgrade Orchestrator to 3.33.0.2677
authorMark Rekveld <mark.rekveld@sonarsource.com>
Tue, 10 Nov 2020 12:41:56 +0000 (13:41 +0100)
committerGitHub <noreply@github.com>
Tue, 10 Nov 2020 12:41:56 +0000 (13:41 +0100)
it/pom.xml
it/src/test/java/com/sonarsource/scanner/it/DistributionTest.java
it/src/test/java/com/sonarsource/scanner/it/MultimoduleTest.java
it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java
it/src/test/java/com/sonarsource/scanner/it/ScannerTestCase.java

index e6be08fa8cd0dacadad8a703e57c33ce5c3534af..9266d6ac73beb6fa017701013fc73ef580929cbd 100644 (file)
@@ -36,7 +36,7 @@
     <dependency>
       <groupId>org.sonarsource.orchestrator</groupId>
       <artifactId>sonar-orchestrator</artifactId>
-      <version>3.30.0.2630</version>
+      <version>3.33.0.2677</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
index 09c3b9121334becf142c7903f48f467bd641e689..d3afab8f08317aa519dcf362b6efcbaf64b23bce 100644 (file)
@@ -24,7 +24,6 @@ import com.sonar.orchestrator.build.SonarScanner;
 import java.io.File;
 import java.io.IOException;
 import java.util.Map;
-import org.junit.After;
 import org.junit.Test;
 import org.sonarqube.ws.Measures.Measure;
 
@@ -33,11 +32,6 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 public class DistributionTest extends ScannerTestCase {
 
-  @After
-  public void cleanup() {
-    orchestrator.resetData();
-  }
-
   @Test
   public void should_succeed_with_self_contained_jre_despite_rubbish_java_home()
     throws IOException, InterruptedException {
index 282a96b48b893d15320b0bf50522698b70df0493..d74dfebe4641db29ff7c622da89ca50cd63bfe58 100644 (file)
@@ -22,7 +22,6 @@ package com.sonarsource.scanner.it;
 import com.sonar.orchestrator.build.BuildResult;
 import com.sonar.orchestrator.build.SonarScanner;
 import java.io.File;
-import org.junit.After;
 import org.junit.Test;
 import org.sonarqube.ws.Components.Component;
 
@@ -30,11 +29,6 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 public class MultimoduleTest extends ScannerTestCase {
 
-  @After
-  public void cleanup() {
-    orchestrator.resetData();
-  }
-
   /**
    * SONARPLUGINS-2202
    */
index 89e0d8206b22c096988b7c55a30c47b53bbd152e..96130cb35eacd9293f4525bfe95b22b88124037c 100644 (file)
@@ -27,7 +27,6 @@ import java.io.IOException;
 import java.util.Map;
 import java.util.stream.Collectors;
 import org.apache.commons.lang.StringEscapeUtils;
-import org.junit.After;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
@@ -41,11 +40,6 @@ public class ScannerTest extends ScannerTestCase {
   @Rule
   public TemporaryFolder temp = new TemporaryFolder();
 
-  @After
-  public void cleanup() {
-    orchestrator.resetData();
-  }
-
   @Test
   public void basedir_contains_sources() {
     SonarScanner build = newScanner(new File("projects/basedir-with-source"));
index 4c1c4f6f73f701aa553df48cd744fd4854abc6fb..f1e315348b9833957fd804939f75a3a2aef367aa 100644 (file)
@@ -21,10 +21,15 @@ package com.sonarsource.scanner.it;
 
 import com.sonar.orchestrator.Orchestrator;
 import com.sonar.orchestrator.build.SonarScanner;
+import com.sonar.orchestrator.http.HttpMethod;
 import com.sonar.orchestrator.version.Version;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -32,6 +37,7 @@ import java.util.function.Function;
 import java.util.stream.Collectors;
 import javax.annotation.CheckForNull;
 import org.apache.commons.lang.StringUtils;
+import org.junit.After;
 import org.junit.ClassRule;
 import org.junit.Rule;
 import org.junit.rules.ExpectedException;
@@ -86,6 +92,24 @@ public abstract class ScannerTestCase {
     return artifactVersion;
   }
 
+  @After
+  public void resetData() {
+    // We add one day to ensure that today's entries are deleted.
+    Instant instant = Instant.now().plus(1, ChronoUnit.DAYS);
+
+    // The expected format is yyyy-MM-dd.
+    String currentDateTime = DateTimeFormatter.ISO_LOCAL_DATE
+      .withZone(ZoneId.of("UTC"))
+      .format(instant);
+
+    orchestrator.getServer()
+      .newHttpCall("/api/projects/bulk_delete")
+      .setAdminCredentials()
+      .setMethod(HttpMethod.POST)
+      .setParams("analyzedBefore", currentDateTime)
+      .execute();
+  }
+
   SonarScanner newScanner(File baseDir, String... keyValueProperties) {
     SonarScanner scannerCli = SonarScanner.create(baseDir, keyValueProperties);
     scannerCli.setScannerVersion(artifactVersion().toString());