]> source.dussan.org Git - sonar-scanner-cli.git/commitdiff
Upgrade sonar-ws in ITs to v7.9.1
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Mon, 21 Oct 2019 20:39:20 +0000 (15:39 -0500)
committerDuarte Meneses <duarte.meneses@sonarsource.com>
Mon, 21 Oct 2019 21:43:09 +0000 (16:43 -0500)
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 a560dc2f723c715071faf3ef6073189326a3f0f4..46d3f3f149ff7ac93b11bd3f413c1cd09a5d7760 100644 (file)
@@ -22,7 +22,7 @@
   </organization>
 
   <properties>
-    <sonar.buildVersion>6.7</sonar.buildVersion>
+    <sonar.buildVersion>7.9.1</sonar.buildVersion>
     <!-- following properties must be set in command-line : sonar.runtimeVersion and sonarRunner.version -->
   </properties>
 
@@ -53,7 +53,7 @@
     <dependency>
       <groupId>org.sonarsource.sonarqube</groupId>
       <artifactId>sonar-ws</artifactId>
-      <version>6.7</version>
+      <version>${sonar.buildVersion}</version>
     </dependency>
     <dependency>
       <groupId>org.assertj</groupId>
index 69f3bbb3050829c219f7d9fef09289ca1d286e5f..1ebf353dad31cbbec059c9eb0cb4eca0248ee821 100644 (file)
@@ -26,7 +26,7 @@ import java.io.IOException;
 import java.util.Map;
 import org.junit.After;
 import org.junit.Test;
-import org.sonarqube.ws.WsMeasures.Measure;
+import org.sonarqube.ws.Measures.Measure;
 
 import static java.lang.Integer.parseInt;
 import static org.assertj.core.api.Assertions.assertThat;
@@ -39,7 +39,8 @@ public class DistributionTest extends ScannerTestCase {
   }
 
   @Test
-  public void should_succeed_with_self_contained_jre_despite_rubbish_java_home() throws IOException, InterruptedException {
+  public void should_succeed_with_self_contained_jre_despite_rubbish_java_home()
+    throws IOException, InterruptedException {
     String projectKey = "basedir-with-source";
 
     File projectDir = new File("projects/basedir-with-source");
@@ -48,13 +49,16 @@ public class DistributionTest extends ScannerTestCase {
       .useNative();
     orchestrator.executeBuild(build, true);
 
-    Map<String, Measure> projectMeasures = getMeasures(projectKey, "files", "ncloc");
+    Map<String, Measure> projectMeasures = getMeasures(projectKey, "files",
+      "ncloc");
     assertThat(parseInt(projectMeasures.get("files").getValue())).isEqualTo(1);
-    assertThat(parseInt(projectMeasures.get("ncloc").getValue())).isGreaterThan(1);
+    assertThat(parseInt(projectMeasures.get("ncloc").getValue()))
+      .isGreaterThan(1);
   }
 
   @Test(expected = BuildFailureException.class)
-  public void should_fail_without_self_contained_jre_when_rubbish_java_home() throws IOException, InterruptedException {
+  public void should_fail_without_self_contained_jre_when_rubbish_java_home()
+    throws IOException, InterruptedException {
     String projectKey = "basedir-with-source";
 
     File projectDir = new File("projects/basedir-with-source");
index 3346c712b8adb0d4202441d15544826091a4d52a..43c3db8252588a0e00380d12e66d09a46212ab59 100644 (file)
@@ -24,7 +24,7 @@ import com.sonar.orchestrator.build.SonarScanner;
 import java.io.File;
 import org.junit.After;
 import org.junit.Test;
-import org.sonarqube.ws.WsComponents.Component;
+import org.sonarqube.ws.Components.Component;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
@@ -40,29 +40,44 @@ public class MultimoduleTest extends ScannerTestCase {
    */
   @Test
   public void test_simplest_with_props_on_root() {
-    SonarScanner build = newScanner(new File("projects/multi-module/simplest/simplest-with-props-on-root"));
+    SonarScanner build = newScanner(
+      new File("projects/multi-module/simplest/simplest-with-props-on-root"));
 
     orchestrator.executeBuild(build);
 
-    assertThat(getComponent("simplest-with-props-on-root").getName()).isEqualTo("Simplest multi-module project with all properties set on the root project");
+    assertThat(getComponent("simplest-with-props-on-root").getName()).isEqualTo(
+      "Simplest multi-module project with all properties set on the root project");
 
     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");
+      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");
+      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");
+    File workDir = new File(
+      "projects/multi-module/simplest/simplest-with-props-on-root/.scannerwork");
     assertThat(workDir).exists();
-    assertThat(new File(workDir, "simplest-with-props-on-root_module1")).exists();
-    assertThat(new File(workDir, "simplest-with-props-on-root_module2")).exists();
-    assertThat(new File("projects/multi-module/simplest/simplest-with-props-on-root/module1/.scannerwork")).doesNotExist();
-    assertThat(new File("projects/multi-module/simplest/simplest-with-props-on-root/module2/.scannerwork")).doesNotExist();
+    assertThat(new File(workDir, "simplest-with-props-on-root_module1"))
+      .exists();
+    assertThat(new File(workDir, "simplest-with-props-on-root_module2"))
+      .exists();
+    assertThat(new File(
+      "projects/multi-module/simplest/simplest-with-props-on-root/module1/.scannerwork"))
+      .doesNotExist();
+    assertThat(new File(
+      "projects/multi-module/simplest/simplest-with-props-on-root/module2/.scannerwork"))
+      .doesNotExist();
   }
 
   /**
@@ -70,19 +85,30 @@ public class MultimoduleTest extends ScannerTestCase {
    */
   @Test
   public void test_simplest_with_props_on_each_module() {
-    SonarScanner build = newScanner(new File("projects/multi-module/simplest/simplest-with-props-on-each-module"));
+    SonarScanner build = newScanner(new File(
+      "projects/multi-module/simplest/simplest-with-props-on-each-module"));
 
     orchestrator.executeBuild(build);
 
-    assertThat(getComponent("simplest-with-props-each-module").getName()).isEqualTo("Simplest multi-module project with properties set on each module");
+    assertThat(getComponent("simplest-with-props-each-module").getName())
+      .isEqualTo(
+        "Simplest multi-module project with properties set on each module");
 
     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");
+      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");
+      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");
     }
   }
 
@@ -91,19 +117,27 @@ public class MultimoduleTest extends ScannerTestCase {
    */
   @Test
   public void test_deep_path_for_modules() {
-    SonarScanner build = newScanner(new File("projects/multi-module/customization/deep-path-for-modules"));
+    SonarScanner build = newScanner(
+      new File("projects/multi-module/customization/deep-path-for-modules"));
 
     orchestrator.executeBuild(build);
 
-    assertThat(getComponent("deep-path-for-modules").getName()).isEqualTo("Project with deep path for modules");
+    assertThat(getComponent("deep-path-for-modules").getName())
+      .isEqualTo("Project with deep path for modules");
 
     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");
+      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");
+      assertThat(getComponent("deep-path-for-modules:mod1").getName())
+        .isEqualTo("Module 1");
+      assertThat(getComponent("deep-path-for-modules:mod2").getName())
+        .isEqualTo("Module 2");
     }
   }
 
@@ -112,19 +146,27 @@ public class MultimoduleTest extends ScannerTestCase {
    */
   @Test
   public void test_module_path_with_space() {
-    SonarScanner build = newScanner(new File("projects/multi-module/customization/module-path-with-space"));
+    SonarScanner build = newScanner(
+      new File("projects/multi-module/customization/module-path-with-space"));
 
     orchestrator.executeBuild(build);
 
-    assertThat(getComponent("module-path-with-space").getName()).isEqualTo("Project with module path that contain spaces");
+    assertThat(getComponent("module-path-with-space").getName())
+      .isEqualTo("Project with module path that contain spaces");
 
     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");
+      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");
+      assertThat(getComponent("module-path-with-space:module1").getName())
+        .isEqualTo("Module 1");
+      assertThat(getComponent("module-path-with-space:module2").getName())
+        .isEqualTo("Module 2");
     }
   }
 
@@ -133,24 +175,33 @@ public class MultimoduleTest extends ScannerTestCase {
    */
   @Test
   public void test_overwriting_parent_properties() {
-    SonarScanner build = newScanner(new File("projects/multi-module/customization/overwriting-parent-properties"));
+    SonarScanner build = newScanner(new File(
+      "projects/multi-module/customization/overwriting-parent-properties"));
 
     orchestrator.executeBuild(build);
 
     Component rootProject = getComponent("overwriting-parent-properties");
-    assertThat(rootProject.getName()).isEqualTo("Project with modules that overwrite properties");
-    assertThat(rootProject.getDescription()).isEqualTo("Description of root project");
+    assertThat(rootProject.getName())
+      .isEqualTo("Project with modules that overwrite properties");
+    assertThat(rootProject.getDescription())
+      .isEqualTo("Description of root project");
 
     if (noMoreModules()) {
-      assertThat(getComponent("overwriting-parent-properties:module1/src1").getName()).isEqualTo("module1/src1");
-      assertThat(getComponent("overwriting-parent-properties:module2/src2").getName()).isEqualTo("module2/src2");
+      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");
+      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");
+      Component module2 = getComponent(
+        "overwriting-parent-properties:module2-new-key");
       assertThat(module2.getName()).isEqualTo("Module 2");
       assertThat(module2.getDescription()).isEqualTo("Description of module 2");
     }
@@ -161,19 +212,25 @@ public class MultimoduleTest extends ScannerTestCase {
    */
   @Test
   public void test_using_config_file_property() {
-    SonarScanner build = newScanner(new File("projects/multi-module/advanced/using-config-file-prop"));
+    SonarScanner build = newScanner(
+      new File("projects/multi-module/advanced/using-config-file-prop"));
 
     orchestrator.executeBuild(build);
 
-    assertThat(getComponent("using-config-file-prop").getName()).isEqualTo("Advanced use case - mostly used by the Ant task");
+    assertThat(getComponent("using-config-file-prop").getName())
+      .isEqualTo("Advanced use case - mostly used by the Ant task");
 
     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");
+      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:module1").getName())
+        .isEqualTo("Module 1");
+      assertThat(getComponent("using-config-file-prop:module2").getName())
+        .isEqualTo("Module 2");
     }
   }
 
@@ -186,13 +243,15 @@ public class MultimoduleTest extends ScannerTestCase {
    */
   @Test
   public void should_fail_if_unexisting_base_dir() {
-    SonarScanner build = newScanner(new File("projects/multi-module/failures/unexisting-base-dir"));
+    SonarScanner build = newScanner(
+      new File("projects/multi-module/failures/unexisting-base-dir"));
 
     BuildResult result = orchestrator.executeBuildQuietly(build);
     // expect build failure
     assertThat(result.getStatus()).isNotEqualTo(0);
     // with the following message
-    assertThat(result.getLogs()).contains("The base directory of the module 'module3' does not exist");
+    assertThat(result.getLogs())
+      .contains("The base directory of the module 'module3' does not exist");
 
   }
 
@@ -201,13 +260,15 @@ public class MultimoduleTest extends ScannerTestCase {
    */
   @Test
   public void should_fail_if_unexisting_config_file() {
-    SonarScanner build = newScanner(new File("projects/multi-module/failures/unexisting-config-file"));
+    SonarScanner build = newScanner(
+      new File("projects/multi-module/failures/unexisting-config-file"));
 
     BuildResult result = orchestrator.executeBuildQuietly(build);
     // expect build failure
     assertThat(result.getStatus()).isNotEqualTo(0);
     // with the following message
-    assertThat(result.getLogs()).contains("The properties file of the module 'module1' does not exist");
+    assertThat(result.getLogs())
+      .contains("The properties file of the module 'module1' does not exist");
   }
 
 }
index d444a98dba7cbf124ccd190ed5a86d06ddd7c65b..c61a3e4715cdef41d6db1784e36c2d9976dda703 100644 (file)
@@ -31,7 +31,7 @@ import org.junit.After;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
-import org.sonarqube.ws.WsMeasures.Measure;
+import org.sonarqube.ws.Measures.Measure;
 
 import static java.lang.Integer.parseInt;
 import static org.assertj.core.api.Assertions.assertThat;
@@ -51,9 +51,11 @@ public class ScannerTest extends ScannerTestCase {
     SonarScanner build = newScanner(new File("projects/basedir-with-source"));
     orchestrator.executeBuild(build);
 
-    Map<String, Measure> projectMeasures = getMeasures("java:basedir-with-source", "files", "ncloc");
+    Map<String, Measure> projectMeasures = getMeasures(
+      "java:basedir-with-source", "files", "ncloc");
     assertThat(parseInt(projectMeasures.get("files").getValue())).isEqualTo(1);
-    assertThat(parseInt(projectMeasures.get("ncloc").getValue())).isGreaterThan(1);
+    assertThat(parseInt(projectMeasures.get("ncloc").getValue()))
+      .isGreaterThan(1);
   }
 
   /**
@@ -65,9 +67,11 @@ public class ScannerTest extends ScannerTestCase {
       .setProjectKey("SAMPLE");
     orchestrator.executeBuild(build);
 
-    Map<String, Measure> projectMeasures = getMeasures("SAMPLE", "files", "ncloc");
+    Map<String, Measure> projectMeasures = getMeasures("SAMPLE", "files",
+      "ncloc");
     assertThat(parseInt(projectMeasures.get("files").getValue())).isEqualTo(2);
-    assertThat(parseInt(projectMeasures.get("ncloc").getValue())).isGreaterThan(1);
+    assertThat(parseInt(projectMeasures.get("ncloc").getValue()))
+      .isGreaterThan(1);
   }
 
   /**
@@ -80,7 +84,9 @@ public class ScannerTest extends ScannerTestCase {
     orchestrator.executeBuild(build);
 
     assertThat(new File("projects/override-working-dir/.sonar")).doesNotExist();
-    assertThat(new File("projects/override-working-dir/.overridden-relative-sonar")).exists().isDirectory();
+    assertThat(
+      new File("projects/override-working-dir/.overridden-relative-sonar"))
+      .exists().isDirectory();
   }
 
   /**
@@ -90,11 +96,14 @@ public class ScannerTest extends ScannerTestCase {
   public void should_override_working_dir_with_absolute_path() {
     File projectHome = new File("projects/override-working-dir");
     SonarScanner build = newScanner(projectHome)
-      .setProperty("sonar.working.directory", new File(projectHome, ".overridden-absolute-sonar").getAbsolutePath());
+      .setProperty("sonar.working.directory",
+        new File(projectHome, ".overridden-absolute-sonar").getAbsolutePath());
     orchestrator.executeBuild(build);
 
     assertThat(new File("projects/override-working-dir/.sonar")).doesNotExist();
-    assertThat(new File("projects/override-working-dir/.overridden-absolute-sonar")).exists().isDirectory();
+    assertThat(
+      new File("projects/override-working-dir/.overridden-absolute-sonar"))
+      .exists().isDirectory();
   }
 
   /**
@@ -107,7 +116,8 @@ public class ScannerTest extends ScannerTestCase {
     BuildResult result = orchestrator.executeBuildQuietly(build);
     assertThat(result.getStatus()).isNotEqualTo(0);
     // with the following message
-    assertThat(result.getLogs()).contains("Invalid value of sonar.sources for bad-source-dirs");
+    assertThat(result.getLogs())
+      .contains("Invalid value of sonar.sources for bad-source-dirs");
   }
 
   /**
@@ -142,7 +152,8 @@ public class ScannerTest extends ScannerTestCase {
 
   @Test
   public void should_use_json_environment_props() {
-    SonarScanner build = newScanner(new File("projects/simple-sample-no-properties"))
+    SonarScanner build = newScanner(
+      new File("projects/simple-sample-no-properties"))
       .setEnvironmentVariable("SONARQUBE_SCANNER_PARAMS", "{"
         + "\"sonar.projectKey\" : \"sample\"," +
         "\"sonar.projectName\" : \"Sample, with comma\"," +
@@ -161,14 +172,16 @@ public class ScannerTest extends ScannerTestCase {
     BuildResult buildResult = runner.runQuietly(null, build);
 
     assertThat(buildResult.isSuccess()).isFalse();
-    assertThat(buildResult.getLogs()).contains("SonarQube server [http://from-env.org] can not be reached");
+    assertThat(buildResult.getLogs())
+      .contains("SonarQube server [http://from-env.org] can not be reached");
   }
 
   @Test
   public void should_skip_analysis() {
     SonarScanner build = newScanner(new File("projects/simple-sample"))
       .setProperty("sonar.host.url", "http://foo")
-      .setEnvironmentVariable("SONARQUBE_SCANNER_PARAMS", "{ \"sonar.scanner.skip\":\"true\" }");
+      .setEnvironmentVariable("SONARQUBE_SCANNER_PARAMS",
+        "{ \"sonar.scanner.skip\":\"true\" }");
 
     BuildResult result = orchestrator.executeBuild(build);
     assertThat(result.getLogs()).contains("SonarQube Scanner analysis skipped");
@@ -185,7 +198,8 @@ public class ScannerTest extends ScannerTestCase {
     // expect build failure
     assertThat(result.isSuccess()).isFalse();
     // with the following message
-    assertThat(result.getLogs()).contains("SonarQube server [http://foo] can not be reached");
+    assertThat(result.getLogs())
+      .contains("SonarQube server [http://foo] can not be reached");
   }
 
   // SONARPLUGINS-3574
@@ -193,13 +207,18 @@ public class ScannerTest extends ScannerTestCase {
   public void run_from_external_location() throws IOException {
     File tempDir = temp.newFolder();
     SonarScanner build = newScanner(tempDir)
-      .setProperty("sonar.projectBaseDir", new File("projects/simple-sample").getAbsolutePath())
+      .setProperty("sonar.projectBaseDir",
+        new File("projects/simple-sample").getAbsolutePath())
       .addArguments("-e");
     orchestrator.executeBuild(build);
 
-    assertThat(getComponent("sample").getDescription()).isEqualTo("This is a sample");
-    Map<String, Measure> projectMeasures = getMeasures("sample", "files", "ncloc", "classes", "violations");
-    assertThat(projectMeasures.values().stream().filter(measure -> measure.getValue() != null).collect(Collectors.toList())).hasSize(4);
+    assertThat(getComponent("sample").getDescription())
+      .isEqualTo("This is a sample");
+    Map<String, Measure> projectMeasures = getMeasures("sample", "files",
+      "ncloc", "classes", "violations");
+    assertThat(projectMeasures.values().stream()
+      .filter(measure -> measure.getValue() != null)
+      .collect(Collectors.toList())).hasSize(4);
   }
 
   @Test
@@ -219,10 +238,12 @@ public class ScannerTest extends ScannerTestCase {
   public void should_override_project_settings_path() {
     File projectHome = new File("projects/override-project-settings-path");
     SonarScanner build = newScanner(projectHome)
-      .setProperty("project.settings", new File(projectHome, "conf/sq-project.properties").getAbsolutePath());
+      .setProperty("project.settings",
+        new File(projectHome, "conf/sq-project.properties").getAbsolutePath());
     orchestrator.executeBuild(build);
 
-    assertThat(getComponent("sample-with-custom-settings-path").getName()).isEqualTo("Test with custom settings location");
+    assertThat(getComponent("sample-with-custom-settings-path").getName())
+      .isEqualTo("Test with custom settings location");
   }
 
   // SQSCANNER-61
@@ -231,10 +252,13 @@ public class ScannerTest extends ScannerTestCase {
     File projectHome = new File("projects/override-project-settings-path");
     SonarScanner build = newScanner(projectHome)
       .setEnvironmentVariable("SONARQUBE_SCANNER_PARAMS", "{"
-        + "\"project.settings\" : \"" + StringEscapeUtils.escapeJavaScript(new File(projectHome, "conf/sq-project.properties").getAbsolutePath()) + "\"}");
+        + "\"project.settings\" : \"" + StringEscapeUtils.escapeJavaScript(
+        new File(projectHome, "conf/sq-project.properties").getAbsolutePath())
+        + "\"}");
     orchestrator.executeBuild(build);
 
-    assertThat(getComponent("sample-with-custom-settings-path").getName()).isEqualTo("Test with custom settings location");
+    assertThat(getComponent("sample-with-custom-settings-path").getName())
+      .isEqualTo("Test with custom settings location");
   }
 
 }
index 0c8c8a1a2ab81c0972c7608a6c4d1e2d52c04e5b..0731ed653ff9353ca0cb39db1e3c6e4b24149caf 100644 (file)
@@ -37,22 +37,22 @@ import org.junit.Rule;
 import org.junit.rules.ExpectedException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.sonarqube.ws.WsComponents;
-import org.sonarqube.ws.WsComponents.Component;
-import org.sonarqube.ws.WsMeasures;
-import org.sonarqube.ws.WsMeasures.Measure;
+import org.sonarqube.ws.Components.Component;
+import org.sonarqube.ws.Measures;
+import org.sonarqube.ws.Measures.Measure;
 import org.sonarqube.ws.client.HttpConnector;
 import org.sonarqube.ws.client.WsClient;
 import org.sonarqube.ws.client.WsClientFactories;
-import org.sonarqube.ws.client.component.ShowWsRequest;
-import org.sonarqube.ws.client.measure.ComponentWsRequest;
+import org.sonarqube.ws.client.components.ShowRequest;
+import org.sonarqube.ws.client.measures.ComponentRequest;
 
 import static java.util.Arrays.asList;
 import static java.util.Collections.singletonList;
 
 public abstract class ScannerTestCase {
 
-  private static final Logger LOG = LoggerFactory.getLogger(ScannerTestCase.class);
+  private static final Logger LOG = LoggerFactory
+    .getLogger(ScannerTestCase.class);
 
   @Rule
   public ExpectedException thrown = ExpectedException.none();
@@ -69,7 +69,8 @@ public abstract class ScannerTestCase {
         LOG.info("Use provided Scanner version: " + scannerVersion);
         artifactVersion = Version.create(scannerVersion);
       } else {
-        try (FileInputStream fis = new FileInputStream(new File("../target/maven-archiver/pom.properties"))) {
+        try (FileInputStream fis = new FileInputStream(
+          new File("../target/maven-archiver/pom.properties"))) {
           Properties props = new Properties();
           props.load(fis);
           artifactVersion = Version.create(props.getProperty("version"));
@@ -89,9 +90,10 @@ public abstract class ScannerTestCase {
   }
 
   @CheckForNull
-  static Map<String, Measure> getMeasures(String componentKey, String... metricKeys) {
-    return newWsClient().measures().component(new ComponentWsRequest()
-      .setComponentKey(componentKey)
+  static Map<String, Measure> getMeasures(String componentKey,
+    String... metricKeys) {
+    return newWsClient().measures().component(new ComponentRequest()
+      .setComponent(componentKey)
       .setMetricKeys(asList(metricKeys)))
       .getComponent().getMeasuresList()
       .stream()
@@ -100,9 +102,10 @@ public abstract class ScannerTestCase {
 
   @CheckForNull
   static Measure getMeasure(String componentKey, String metricKey) {
-    WsMeasures.ComponentWsResponse response = newWsClient().measures().component(new ComponentWsRequest()
-      .setComponentKey(componentKey)
-      .setMetricKeys(singletonList(metricKey)));
+    Measures.ComponentWsResponse response = newWsClient().measures()
+      .component(new ComponentRequest()
+        .setComponent(componentKey)
+        .setMetricKeys(singletonList(metricKey)));
     List<Measure> measures = response.getComponent().getMeasuresList();
     return measures.size() == 1 ? measures.get(0) : null;
   }
@@ -121,7 +124,8 @@ public abstract class ScannerTestCase {
 
   @CheckForNull
   static Component getComponent(String componentKey) {
-    return newWsClient().components().show(new ShowWsRequest().setKey(componentKey)).getComponent();
+    return newWsClient().components()
+      .show(new ShowRequest().setComponent(componentKey)).getComponent();
   }
 
   static WsClient newWsClient() {