From: Julien Lancelot Date: Tue, 22 Mar 2016 14:14:52 +0000 (+0100) Subject: SONAR-7487 Fix ITs X-Git-Tag: 5.5-M11~47 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6104eabc38436443090b3fa63f942f453eecfdc9;p=sonarqube.git SONAR-7487 Fix ITs --- diff --git a/it/it-projects/measureHistory/xoo-multi-files-sample/sonar-project.properties b/it/it-projects/measureHistory/xoo-multi-files-sample/sonar-project.properties new file mode 100644 index 00000000000..59af7dfeaca --- /dev/null +++ b/it/it-projects/measureHistory/xoo-multi-files-sample/sonar-project.properties @@ -0,0 +1,9 @@ +# Root project information +sonar.projectKey=multi-files-sample +sonar.projectName=Sonar :: Integration Tests :: Multi-files Sample +sonar.projectVersion=1.0-SNAPSHOT + +sonar.language=xoo + +# Some properties that will be inherited by the modules +sonar.sources=src/main/xoo diff --git a/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File1.xoo b/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File1.xoo new file mode 100644 index 00000000000..74d29a4fa08 --- /dev/null +++ b/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File1.xoo @@ -0,0 +1,16 @@ +package com.sonar.it.samples.modules.a1; + +public class HelloA1 { + private int i; + private HelloA1() { + + } + + public void hello() { + System.out.println("hello" + " xoo"); + } + + protected String getHello() { + return "hello"; + } +} \ No newline at end of file diff --git a/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File1.xoo.measures b/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File1.xoo.measures new file mode 100644 index 00000000000..7812e4167fb --- /dev/null +++ b/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File1.xoo.measures @@ -0,0 +1,2 @@ +ncloc:12 +classes:1 diff --git a/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File2.xoo b/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File2.xoo new file mode 100644 index 00000000000..796d90cfad5 --- /dev/null +++ b/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File2.xoo @@ -0,0 +1,20 @@ +package com.sonar.it.samples.modules.a2; + +public class HelloA2 { + + public HelloA2(int i) { + int j = i++; + } + + public void hello() { + System.out.println("hello" + " xoo"); + } + + private String myMethod() { + if (foo == bar) { + return "hello"; + } else { + throw new IllegalStateException(); + } + } +} diff --git a/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File2.xoo.measures b/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File2.xoo.measures new file mode 100644 index 00000000000..63df5add6d4 --- /dev/null +++ b/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File2.xoo.measures @@ -0,0 +1,2 @@ +ncloc:15 +classes:1 diff --git a/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File3.xoo b/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File3.xoo new file mode 100644 index 00000000000..b83c3af128c --- /dev/null +++ b/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File3.xoo @@ -0,0 +1,12 @@ +package com.sonar.it.samples.modules.b1; + +public class HelloB1 { + private int i; + private HelloB1() { + + } + + public void hello() { + System.out.println("hello" + " world"); + } +} \ No newline at end of file diff --git a/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File3.xoo.measures b/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File3.xoo.measures new file mode 100644 index 00000000000..3947d3bdbff --- /dev/null +++ b/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File3.xoo.measures @@ -0,0 +1,2 @@ +ncloc:12 +classes:1 \ No newline at end of file diff --git a/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File4.xoo b/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File4.xoo new file mode 100644 index 00000000000..20b8bb3876a --- /dev/null +++ b/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File4.xoo @@ -0,0 +1,12 @@ +package com.sonar.it.samples.modules.b2; + +public class HelloB2 { + private int i; + private HelloB2() { + + } + + public void hello() { + System.out.println("hello" + " world"); + } +} \ No newline at end of file diff --git a/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File4.xoo.measures b/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File4.xoo.measures new file mode 100644 index 00000000000..3947d3bdbff --- /dev/null +++ b/it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File4.xoo.measures @@ -0,0 +1,2 @@ +ncloc:12 +classes:1 \ No newline at end of file diff --git a/it/it-tests/src/test/java/it/measureHistory/SinceXDaysHistoryTest.java b/it/it-tests/src/test/java/it/measureHistory/SinceXDaysHistoryTest.java index 6141e1a3164..eedd98fe8a5 100644 --- a/it/it-tests/src/test/java/it/measureHistory/SinceXDaysHistoryTest.java +++ b/it/it-tests/src/test/java/it/measureHistory/SinceXDaysHistoryTest.java @@ -20,11 +20,12 @@ package it.measureHistory; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category1Suite; import java.text.SimpleDateFormat; import java.util.Date; +import javax.annotation.Nullable; import org.apache.commons.lang.time.DateUtils; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -47,7 +48,7 @@ public class SinceXDaysHistoryTest { @ClassRule public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR; - private static final String PROJECT = "com.sonarsource.it.samples:multi-modules-sample"; + private static final String PROJECT = "multi-files-sample"; @BeforeClass public static void analyseProjectWithHistory() { @@ -59,13 +60,13 @@ public class SinceXDaysHistoryTest { orchestrator.getServer().associateProjectToQualityProfile(PROJECT, "xoo", "one-issue-per-line"); // Execute a analysis in the past before since 30 days period -> 0 issue, 0 file - analyzeProject("2013-01-01", "multi-modules-sample:module_b,multi-modules-sample:module_a"); + analyzeProject("2013-01-01", "**/File1*,**/File2*,**/File3*,**/File4*"); // Execute a analysis 20 days ago, after since 30 days period -> 16 issues, 1 file - analyzeProject(getPastDate(20), "multi-modules-sample:module_b,multi-modules-sample:module_a:module_a2"); + analyzeProject(getPastDate(20), "**/File2*,**/File3*,**/File4*"); // Execute a analysis 10 days ago, after since 30 days period -> 28 issues, 2 files - analyzeProject(getPastDate(10), "multi-modules-sample:module_b"); + analyzeProject(getPastDate(10), "**/File3*,**/File4*"); // Execute a analysis in the present with all modules -> 52 issues, 4 files analyzeProject(); @@ -123,13 +124,13 @@ public class SinceXDaysHistoryTest { analyzeProject(null, null); } - private static void analyzeProject(String date, String skippedModules) { - SonarRunner runner = SonarRunner.create(projectDir("shared/xoo-multi-modules-sample")); + private static void analyzeProject(@Nullable String date, @Nullable String exclusions) { + SonarScanner runner = SonarScanner.create(projectDir("measureHistory/xoo-multi-files-sample")); if (date != null) { runner.setProperty("sonar.projectDate", date); } - if (skippedModules != null) { - runner.setProperties("sonar.skippedModules", skippedModules); + if (exclusions != null) { + runner.setProperties("sonar.exclusions", exclusions); } orchestrator.executeBuild(runner); } diff --git a/it/it-tests/src/test/java/it/projectAdministration/ProjectAdministrationTest.java b/it/it-tests/src/test/java/it/projectAdministration/ProjectAdministrationTest.java index 71571b3fdd1..a5796f91824 100644 --- a/it/it-tests/src/test/java/it/projectAdministration/ProjectAdministrationTest.java +++ b/it/it-tests/src/test/java/it/projectAdministration/ProjectAdministrationTest.java @@ -174,8 +174,8 @@ public class ProjectAdministrationTest { ).build(); new SeleneseTest(selenese).runOn(orchestrator); - assertThat(orchestrator.getServer().getAdminWsClient().find(PropertyQuery.createForResource("sonar.skippedModules", "sample")).getValue()) - .isEqualTo("my-excluded-module"); + assertThat(orchestrator.getServer().getAdminWsClient().find(PropertyQuery.createForResource("sonar.exclusions", "sample")).getValue()) + .isEqualTo("my-exclusions"); } /** diff --git a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-settings/override-global-settings.html b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-settings/override-global-settings.html index 8d76ad511fb..f9ab41f50b3 100644 --- a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-settings/override-global-settings.html +++ b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-settings/override-global-settings.html @@ -40,18 +40,18 @@ type - id=input_sonar.skippedModules - my-excluded-module + id=input_sonar.exclusions + my-exclusions - - click - id=submit_settings + + click + id=submit_settings waitForValue - id=input_sonar.skippedModules - my-excluded-module + id=input_sonar.exclusions + my-exclusions