aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Rekveld <mark.rekveld@sonarsource.com>2020-11-10 13:41:56 +0100
committerGitHub <noreply@github.com>2020-11-10 13:41:56 +0100
commit4841a9b71ba70f29e185af9bbce555be1fc27a25 (patch)
tree387cc3e1b0947d485b0f3e862a5eb47ebccfc0ac
parent770d823a9758e7bf6c9db2f0a6d7a1eb4dd1404a (diff)
downloadsonar-scanner-cli-4841a9b71ba70f29e185af9bbce555be1fc27a25.tar.gz
sonar-scanner-cli-4841a9b71ba70f29e185af9bbce555be1fc27a25.zip
Upgrade Orchestrator to 3.33.0.2677
-rw-r--r--it/pom.xml2
-rw-r--r--it/src/test/java/com/sonarsource/scanner/it/DistributionTest.java6
-rw-r--r--it/src/test/java/com/sonarsource/scanner/it/MultimoduleTest.java6
-rw-r--r--it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java6
-rw-r--r--it/src/test/java/com/sonarsource/scanner/it/ScannerTestCase.java24
5 files changed, 25 insertions, 19 deletions
diff --git a/it/pom.xml b/it/pom.xml
index e6be08f..9266d6a 100644
--- a/it/pom.xml
+++ b/it/pom.xml
@@ -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>
diff --git a/it/src/test/java/com/sonarsource/scanner/it/DistributionTest.java b/it/src/test/java/com/sonarsource/scanner/it/DistributionTest.java
index 09c3b91..d3afab8 100644
--- a/it/src/test/java/com/sonarsource/scanner/it/DistributionTest.java
+++ b/it/src/test/java/com/sonarsource/scanner/it/DistributionTest.java
@@ -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 {
diff --git a/it/src/test/java/com/sonarsource/scanner/it/MultimoduleTest.java b/it/src/test/java/com/sonarsource/scanner/it/MultimoduleTest.java
index 282a96b..d74dfeb 100644
--- a/it/src/test/java/com/sonarsource/scanner/it/MultimoduleTest.java
+++ b/it/src/test/java/com/sonarsource/scanner/it/MultimoduleTest.java
@@ -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
*/
diff --git a/it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java b/it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java
index 89e0d82..96130cb 100644
--- a/it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java
+++ b/it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java
@@ -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"));
diff --git a/it/src/test/java/com/sonarsource/scanner/it/ScannerTestCase.java b/it/src/test/java/com/sonarsource/scanner/it/ScannerTestCase.java
index 4c1c4f6..f1e3153 100644
--- a/it/src/test/java/com/sonarsource/scanner/it/ScannerTestCase.java
+++ b/it/src/test/java/com/sonarsource/scanner/it/ScannerTestCase.java
@@ -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());