@@ -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> |
@@ -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 { |
@@ -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 | |||
*/ |
@@ -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")); |
@@ -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()); |