]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7487 Fix ITs
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 22 Mar 2016 14:14:52 +0000 (15:14 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 22 Mar 2016 14:15:48 +0000 (15:15 +0100)
12 files changed:
it/it-projects/measureHistory/xoo-multi-files-sample/sonar-project.properties [new file with mode: 0644]
it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File1.xoo [new file with mode: 0644]
it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File1.xoo.measures [new file with mode: 0644]
it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File2.xoo [new file with mode: 0644]
it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File2.xoo.measures [new file with mode: 0644]
it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File3.xoo [new file with mode: 0644]
it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File3.xoo.measures [new file with mode: 0644]
it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File4.xoo [new file with mode: 0644]
it/it-projects/measureHistory/xoo-multi-files-sample/src/main/xoo/sample/File4.xoo.measures [new file with mode: 0644]
it/it-tests/src/test/java/it/measureHistory/SinceXDaysHistoryTest.java
it/it-tests/src/test/java/it/projectAdministration/ProjectAdministrationTest.java
it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-settings/override-global-settings.html

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 (file)
index 0000000..59af7df
--- /dev/null
@@ -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 (file)
index 0000000..74d29a4
--- /dev/null
@@ -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 (file)
index 0000000..7812e41
--- /dev/null
@@ -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 (file)
index 0000000..796d90c
--- /dev/null
@@ -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 (file)
index 0000000..63df5ad
--- /dev/null
@@ -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 (file)
index 0000000..b83c3af
--- /dev/null
@@ -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 (file)
index 0000000..3947d3b
--- /dev/null
@@ -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 (file)
index 0000000..20b8bb3
--- /dev/null
@@ -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 (file)
index 0000000..3947d3b
--- /dev/null
@@ -0,0 +1,2 @@
+ncloc:12
+classes:1
\ No newline at end of file
index 6141e1a3164d38b64116cc2f279aeb399acc1d1d..eedd98fe8a593d38081c58cb5b202cb7ea6a5f0d 100644 (file)
 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);
   }
index 71571b3fdd1c52e83f84da112281b7341ed69342..a5796f91824fd22cef21a07a1ab61b44c746ad65 100644 (file)
@@ -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");
   }
 
   /**
index 8d76ad511fb1070cc1593d2d26aacaf405f029ef..f9ab41f50b368efd1e2e457be6d027eda685966e 100644 (file)
 </tr>
 <tr>
        <td>type</td>
-       <td>id=input_sonar.skippedModules</td>
-       <td>my-excluded-module</td>
+       <td>id=input_sonar.exclusions</td>
+       <td>my-exclusions</td>
 </tr>
-               <tr>
-                       <td>click</td>
-                       <td>id=submit_settings</td>
+<tr>
+       <td>click</td>
+       <td>id=submit_settings</td>
        <td></td>
 </tr>
 <tr>
        <td>waitForValue</td>
-       <td>id=input_sonar.skippedModules</td>
-       <td>my-excluded-module</td>
+       <td>id=input_sonar.exclusions</td>
+       <td>my-exclusions</td>
 </tr>
 </tbody>
 </table>