]> source.dussan.org Git - sonar-scanner-cli.git/commitdiff
Fix ITs after the drop of modules
authorJulien HENRY <julien.henry@sonarsource.com>
Mon, 14 Jan 2019 15:48:56 +0000 (16:48 +0100)
committerJulien HENRY <julien.henry@sonarsource.com>
Mon, 14 Jan 2019 16:16:18 +0000 (17:16 +0100)
it/pom.xml
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/SonarScannerTestSuite.java

index 663899cf6ae1cb507eae3feb7554f96391ba047a..dd5d84531ae5007dcba41f1f4466718f0d2b8d62 100644 (file)
@@ -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>
     <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>
 
index ecbfd7a456ab747afeb4f9e64a80dcfad1dd5b3d..3346c712b8adb0d4202441d15544826091a4d52a 100644 (file)
@@ -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);
   }
 
   /**
index 6569b1eda9a7cd6cd2c785b4df86bdab8d370d0c..fa147ac5a5d12237db29979fee510fdca2a1111e 100644 (file)
@@ -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")
index 682b4a127160c9b96a58c0b4c9a7516f08d638a7..6e903036616b5c6df87727b1b30d02567184e023 100644 (file)
@@ -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();
 
 }