diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2019-01-14 16:48:56 +0100 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2019-01-14 17:16:18 +0100 |
commit | 2e23725e0457ab7a44e7701472c4d7a730699e2a (patch) | |
tree | 955e43d0e07165176d05ae101504fb4a53f720de /it | |
parent | f7d62297e28ef917810337f96023f048fe46eb94 (diff) | |
download | sonar-scanner-cli-2e23725e0457ab7a44e7701472c4d7a730699e2a.tar.gz sonar-scanner-cli-2e23725e0457ab7a44e7701472c4d7a730699e2a.zip |
Fix ITs after the drop of modules
Diffstat (limited to 'it')
4 files changed, 68 insertions, 43 deletions
@@ -22,7 +22,7 @@ </organization> <properties> - <sonar.buildVersion>5.6</sonar.buildVersion> + <sonar.buildVersion>6.7</sonar.buildVersion> <!-- following properties must be set in command-line : sonar.runtimeVersion and sonarRunner.version --> </properties> @@ -36,7 +36,7 @@ <dependency> <groupId>org.sonarsource.orchestrator</groupId> <artifactId>sonar-orchestrator</artifactId> - <version>3.15.1.1274</version> + <version>3.22.0.1791</version> </dependency> <dependency> <groupId>junit</groupId> @@ -53,18 +53,12 @@ <dependency> <groupId>org.sonarsource.sonarqube</groupId> <artifactId>sonar-ws</artifactId> - <version>5.6</version> - </dependency> - <dependency> - <groupId>org.easytesting</groupId> - <artifactId>fest-assert</artifactId> - <version>1.4</version> - <scope>test</scope> + <version>6.7</version> </dependency> <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> - <version>2.1.0</version> + <version>3.11.1</version> </dependency> </dependencies> 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 ecbfd7a..3346c71 100644 --- a/it/src/test/java/com/sonarsource/scanner/it/MultimoduleTest.java +++ b/it/src/test/java/com/sonarsource/scanner/it/MultimoduleTest.java @@ -26,7 +26,7 @@ import org.junit.After; import org.junit.Test; import org.sonarqube.ws.WsComponents.Component; -import static org.fest.assertions.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; public class MultimoduleTest extends ScannerTestCase { @@ -46,10 +46,15 @@ public class MultimoduleTest extends ScannerTestCase { assertThat(getComponent("simplest-with-props-on-root").getName()).isEqualTo("Simplest multi-module project with all properties set on the root project"); - // Verify that we have the modules - assertThat(getComponent("simplest-with-props-on-root:module1").getName()).isEqualTo("module1"); - - assertThat(getComponent("simplest-with-props-on-root:module2").getName()).isEqualTo("module2"); + if (noMoreModules()) { + // Verify that we have the folders + assertThat(getComponent("simplest-with-props-on-root:module1/src").getName()).isEqualTo("module1/src"); + assertThat(getComponent("simplest-with-props-on-root:module2/src").getName()).isEqualTo("module2/src"); + } else { + // Verify that we have the modules + assertThat(getComponent("simplest-with-props-on-root:module1").getName()).isEqualTo("module1"); + assertThat(getComponent("simplest-with-props-on-root:module2").getName()).isEqualTo("module2"); + } // And verify that the working directories are all located in the root folder File workDir = new File("projects/multi-module/simplest/simplest-with-props-on-root/.scannerwork"); @@ -71,10 +76,14 @@ public class MultimoduleTest extends ScannerTestCase { assertThat(getComponent("simplest-with-props-each-module").getName()).isEqualTo("Simplest multi-module project with properties set on each module"); - // Verify that we have the modules - assertThat(getComponent("simplest-with-props-each-module:module1").getName()).isEqualTo("module1"); - - assertThat(getComponent("simplest-with-props-each-module:overridden-key-for-module2").getName()).isEqualTo("Module 2"); + if (noMoreModules()) { + assertThat(getComponent("simplest-with-props-each-module:module1/src").getName()).isEqualTo("module1/src"); + assertThat(getComponent("simplest-with-props-each-module:module2/src").getName()).isEqualTo("module2/src"); + } else { + // Verify that we have the modules + assertThat(getComponent("simplest-with-props-each-module:module1").getName()).isEqualTo("module1"); + assertThat(getComponent("simplest-with-props-each-module:overridden-key-for-module2").getName()).isEqualTo("Module 2"); + } } /** @@ -88,10 +97,14 @@ public class MultimoduleTest extends ScannerTestCase { assertThat(getComponent("deep-path-for-modules").getName()).isEqualTo("Project with deep path for modules"); - // Verify that we have the modules - assertThat(getComponent("deep-path-for-modules:mod1").getName()).isEqualTo("Module 1"); - - assertThat(getComponent("deep-path-for-modules:mod2").getName()).isEqualTo("Module 2"); + if (noMoreModules()) { + assertThat(getComponent("deep-path-for-modules:modules/module1/src").getName()).isEqualTo("module1/src"); + assertThat(getComponent("deep-path-for-modules:modules/module2/src").getName()).isEqualTo("module2/src"); + } else { + // Verify that we have the modules + assertThat(getComponent("deep-path-for-modules:mod1").getName()).isEqualTo("Module 1"); + assertThat(getComponent("deep-path-for-modules:mod2").getName()).isEqualTo("Module 2"); + } } /** @@ -105,10 +118,14 @@ public class MultimoduleTest extends ScannerTestCase { assertThat(getComponent("module-path-with-space").getName()).isEqualTo("Project with module path that contain spaces"); - // Verify that we have the modules - assertThat(getComponent("module-path-with-space:module1").getName()).isEqualTo("Module 1"); - - assertThat(getComponent("module-path-with-space:module2").getName()).isEqualTo("Module 2"); + if (noMoreModules()) { + assertThat(getComponent("module-path-with-space:my module 1/src").getName()).isEqualTo("my module 1/src"); + assertThat(getComponent("module-path-with-space:my module 2/src").getName()).isEqualTo("my module 2/src"); + } else { + // Verify that we have the modules + assertThat(getComponent("module-path-with-space:module1").getName()).isEqualTo("Module 1"); + assertThat(getComponent("module-path-with-space:module2").getName()).isEqualTo("Module 2"); + } } /** @@ -124,14 +141,19 @@ public class MultimoduleTest extends ScannerTestCase { assertThat(rootProject.getName()).isEqualTo("Project with modules that overwrite properties"); assertThat(rootProject.getDescription()).isEqualTo("Description of root project"); - // Verify that we have the modules - Component module1 = getComponent("overwriting-parent-properties:module1-new-key"); - assertThat(module1.getName()).isEqualTo("Module 1"); - assertThat(module1.getDescription()).isEqualTo("Description of module 1"); - - Component module2 = getComponent("overwriting-parent-properties:module2-new-key"); - assertThat(module2.getName()).isEqualTo("Module 2"); - assertThat(module2.getDescription()).isEqualTo("Description of module 2"); + if (noMoreModules()) { + assertThat(getComponent("overwriting-parent-properties:module1/src1").getName()).isEqualTo("module1/src1"); + assertThat(getComponent("overwriting-parent-properties:module2/src2").getName()).isEqualTo("module2/src2"); + } else { + // Verify that we have the modules + Component module1 = getComponent("overwriting-parent-properties:module1-new-key"); + assertThat(module1.getName()).isEqualTo("Module 1"); + assertThat(module1.getDescription()).isEqualTo("Description of module 1"); + + Component module2 = getComponent("overwriting-parent-properties:module2-new-key"); + assertThat(module2.getName()).isEqualTo("Module 2"); + assertThat(module2.getDescription()).isEqualTo("Description of module 2"); + } } /** @@ -145,10 +167,18 @@ public class MultimoduleTest extends ScannerTestCase { assertThat(getComponent("using-config-file-prop").getName()).isEqualTo("Advanced use case - mostly used by the Ant task"); - // Verify that we have the modules - assertThat(getComponent("using-config-file-prop:module1").getName()).isEqualTo("Module 1"); + if (noMoreModules()) { + assertThat(getComponent("using-config-file-prop:module1/src").getName()).isEqualTo("module1/src"); + assertThat(getComponent("using-config-file-prop:module2/src").getName()).isEqualTo("module2/src"); + } else { + // Verify that we have the modules + assertThat(getComponent("using-config-file-prop:module1").getName()).isEqualTo("Module 1"); + assertThat(getComponent("using-config-file-prop:module2").getName()).isEqualTo("Module 2"); + } + } - assertThat(getComponent("using-config-file-prop:module2").getName()).isEqualTo("Module 2"); + private boolean noMoreModules() { + return orchestrator.getServer().version().isGreaterThanOrEquals(7, 6); } /** 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 6569b1e..fa147ac 100644 --- a/it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java +++ b/it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java @@ -25,7 +25,7 @@ import java.io.File; import java.io.IOException; import java.util.Map; import java.util.stream.Collectors; -import org.fest.assertions.Condition; +import org.assertj.core.api.Condition; import org.junit.After; import org.junit.Rule; import org.junit.Test; @@ -33,7 +33,7 @@ import org.junit.rules.TemporaryFolder; import org.sonarqube.ws.WsMeasures.Measure; import static java.lang.Integer.parseInt; -import static org.fest.assertions.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; public class ScannerTest extends ScannerTestCase { @@ -194,7 +194,7 @@ public class ScannerTest extends ScannerTestCase { BuildResult executeBuild = orchestrator.executeBuildQuietly(build); assertThat(executeBuild.getStatus()).isNotEqualTo(0); String logs = executeBuild.getLogs(); - assertThat(logs).satisfies(new Condition<String>("Contain error message about OOM") { + assertThat(logs).is(new Condition<String>("Contain error message about OOM") { @Override public boolean matches(String value) { return value.contains("java.lang.OutOfMemoryError") diff --git a/it/src/test/java/com/sonarsource/scanner/it/SonarScannerTestSuite.java b/it/src/test/java/com/sonarsource/scanner/it/SonarScannerTestSuite.java index 682b4a1..6e90303 100644 --- a/it/src/test/java/com/sonarsource/scanner/it/SonarScannerTestSuite.java +++ b/it/src/test/java/com/sonarsource/scanner/it/SonarScannerTestSuite.java @@ -20,6 +20,7 @@ package com.sonarsource.scanner.it; import com.sonar.orchestrator.Orchestrator; +import com.sonar.orchestrator.locator.MavenLocation; import org.junit.ClassRule; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -31,8 +32,8 @@ public class SonarScannerTestSuite { @ClassRule public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv() - .setOrchestratorProperty("javascriptVersion", "LATEST_RELEASE") - .addPlugin("javascript") + .setSonarVersion(System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE[6.7]")) + .addPlugin(MavenLocation.of("org.sonarsource.javascript", "sonar-javascript-plugin", "LATEST_RELEASE")) .build(); } |