aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2015-10-29 15:07:08 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2015-10-29 15:07:08 +0100
commitbed7d7f1897ab5f0e2bfa0e4e6ac61e3d413c5dc (patch)
treef7df6cda620f3d77b5ece96317cb15500822c831
parent9eaedc99f4f17277b58480a1a9368841b31c8a02 (diff)
downloadsonarqube-bed7d7f1897ab5f0e2bfa0e4e6ac61e3d413c5dc.tar.gz
sonarqube-bed7d7f1897ab5f0e2bfa0e4e6ac61e3d413c5dc.zip
Move PurgeTest IT
-rw-r--r--it/it-projects/dbCleaner/files/after/module_a/module_a1/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/files/after/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/NewHelloA1.xoo16
-rw-r--r--it/it-projects/dbCleaner/files/after/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/NewHelloA1.xoo.measures10
-rw-r--r--it/it-projects/dbCleaner/files/after/module_a/module_a2/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/files/after/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo12
-rw-r--r--it/it-projects/dbCleaner/files/after/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures2
-rw-r--r--it/it-projects/dbCleaner/files/after/module_a/sonar-project.properties4
-rw-r--r--it/it-projects/dbCleaner/files/after/module_b/module_b1/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/files/after/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo12
-rw-r--r--it/it-projects/dbCleaner/files/after/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures2
-rw-r--r--it/it-projects/dbCleaner/files/after/module_b/module_b2/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/files/after/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo12
-rw-r--r--it/it-projects/dbCleaner/files/after/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures2
-rw-r--r--it/it-projects/dbCleaner/files/after/module_b/sonar-project.properties4
-rw-r--r--it/it-projects/dbCleaner/files/after/sonar-project.properties12
-rw-r--r--it/it-projects/dbCleaner/files/before/module_a/module_a1/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/files/before/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo16
-rw-r--r--it/it-projects/dbCleaner/files/before/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo.measures10
-rw-r--r--it/it-projects/dbCleaner/files/before/module_a/module_a2/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/files/before/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo12
-rw-r--r--it/it-projects/dbCleaner/files/before/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures2
-rw-r--r--it/it-projects/dbCleaner/files/before/module_a/sonar-project.properties4
-rw-r--r--it/it-projects/dbCleaner/files/before/module_b/module_b1/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/files/before/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo12
-rw-r--r--it/it-projects/dbCleaner/files/before/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures2
-rw-r--r--it/it-projects/dbCleaner/files/before/module_b/module_b2/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/files/before/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo12
-rw-r--r--it/it-projects/dbCleaner/files/before/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures2
-rw-r--r--it/it-projects/dbCleaner/files/before/module_b/sonar-project.properties4
-rw-r--r--it/it-projects/dbCleaner/files/before/sonar-project.properties12
-rw-r--r--it/it-projects/dbCleaner/modules/after/module_a/module_a1/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/modules/after/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo16
-rw-r--r--it/it-projects/dbCleaner/modules/after/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo.measures10
-rw-r--r--it/it-projects/dbCleaner/modules/after/module_a/module_a2/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/modules/after/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo12
-rw-r--r--it/it-projects/dbCleaner/modules/after/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures2
-rw-r--r--it/it-projects/dbCleaner/modules/after/module_a/sonar-project.properties4
-rw-r--r--it/it-projects/dbCleaner/modules/after/module_c/module_c1/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/modules/after/module_c/module_c1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo12
-rw-r--r--it/it-projects/dbCleaner/modules/after/module_c/module_c1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures2
-rw-r--r--it/it-projects/dbCleaner/modules/after/module_c/module_c2/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/modules/after/module_c/module_c2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo12
-rw-r--r--it/it-projects/dbCleaner/modules/after/module_c/module_c2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures2
-rw-r--r--it/it-projects/dbCleaner/modules/after/module_c/sonar-project.properties4
-rw-r--r--it/it-projects/dbCleaner/modules/after/sonar-project.properties12
-rw-r--r--it/it-projects/dbCleaner/modules/before/module_a/module_a1/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/modules/before/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo16
-rw-r--r--it/it-projects/dbCleaner/modules/before/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo.measures10
-rw-r--r--it/it-projects/dbCleaner/modules/before/module_a/module_a2/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/modules/before/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo12
-rw-r--r--it/it-projects/dbCleaner/modules/before/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures2
-rw-r--r--it/it-projects/dbCleaner/modules/before/module_a/sonar-project.properties4
-rw-r--r--it/it-projects/dbCleaner/modules/before/module_b/module_b1/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/modules/before/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo12
-rw-r--r--it/it-projects/dbCleaner/modules/before/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures2
-rw-r--r--it/it-projects/dbCleaner/modules/before/module_b/module_b2/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/modules/before/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo12
-rw-r--r--it/it-projects/dbCleaner/modules/before/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures2
-rw-r--r--it/it-projects/dbCleaner/modules/before/module_b/sonar-project.properties4
-rw-r--r--it/it-projects/dbCleaner/modules/before/sonar-project.properties12
-rw-r--r--it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a1/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo16
-rw-r--r--it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo.measures10
-rw-r--r--it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a2/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo12
-rw-r--r--it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures2
-rw-r--r--it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/sonar-project.properties4
-rw-r--r--it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b1/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo12
-rw-r--r--it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures2
-rw-r--r--it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b2/sonar-project.properties1
-rw-r--r--it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo12
-rw-r--r--it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures2
-rw-r--r--it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/sonar-project.properties4
-rw-r--r--it/it-projects/dbCleaner/xoo-multi-modules-sample/sonar-project.properties12
-rw-r--r--it/it-tests/src/test/java/it/Category4Suite.java5
-rw-r--r--it/it-tests/src/test/java/it/dbCleaner/PurgeTest.java298
-rw-r--r--it/it-tests/src/test/java/it/dbCleaner/ToDoTest.java4
-rw-r--r--it/it-tests/src/test/resources/dbCleaner/one-issue-per-line-profile.xml12
79 files changed, 774 insertions, 5 deletions
diff --git a/it/it-projects/dbCleaner/files/after/module_a/module_a1/sonar-project.properties b/it/it-projects/dbCleaner/files/after/module_a/module_a1/sonar-project.properties
new file mode 100644
index 00000000000..a081a0e6342
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/after/module_a/module_a1/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module A1
diff --git a/it/it-projects/dbCleaner/files/after/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/NewHelloA1.xoo b/it/it-projects/dbCleaner/files/after/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/NewHelloA1.xoo
new file mode 100644
index 00000000000..f21f75685b5
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/after/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/NewHelloA1.xoo
@@ -0,0 +1,16 @@
+package com.sonar.it.samples.modules.a1;
+
+public class NewHelloA1 {
+ private int i;
+ private NewHelloA1() {
+
+ }
+
+ 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/dbCleaner/files/after/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/NewHelloA1.xoo.measures b/it/it-projects/dbCleaner/files/after/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/NewHelloA1.xoo.measures
new file mode 100644
index 00000000000..85460386130
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/after/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/NewHelloA1.xoo.measures
@@ -0,0 +1,10 @@
+ncloc:13
+complexity:3
+complexity_in_classes:3
+classes:1
+comment_lines:3
+public_api:5
+public_undocumented_api:2
+duplicated_files:1
+duplicated_blocks:2
+duplicated_lines:3
diff --git a/it/it-projects/dbCleaner/files/after/module_a/module_a2/sonar-project.properties b/it/it-projects/dbCleaner/files/after/module_a/module_a2/sonar-project.properties
new file mode 100644
index 00000000000..fcedab83843
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/after/module_a/module_a2/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module A2
diff --git a/it/it-projects/dbCleaner/files/after/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo b/it/it-projects/dbCleaner/files/after/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo
new file mode 100644
index 00000000000..42039538a92
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/after/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo
@@ -0,0 +1,12 @@
+package com.sonar.it.samples.modules.a2;
+
+public class HelloA2 {
+ private int i;
+ private HelloA2() {
+
+ }
+
+ public void hello() {
+ System.out.println("hello" + " xoo");
+ }
+} \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/files/after/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures b/it/it-projects/dbCleaner/files/after/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures
new file mode 100644
index 00000000000..3947d3bdbff
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/after/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures
@@ -0,0 +1,2 @@
+ncloc:12
+classes:1 \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/files/after/module_a/sonar-project.properties b/it/it-projects/dbCleaner/files/after/module_a/sonar-project.properties
new file mode 100644
index 00000000000..7e6ca9074a4
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/after/module_a/sonar-project.properties
@@ -0,0 +1,4 @@
+sonar.projectKey=module_a
+sonar.projectName=Module A
+
+sonar.modules=module_a1,module_a2
diff --git a/it/it-projects/dbCleaner/files/after/module_b/module_b1/sonar-project.properties b/it/it-projects/dbCleaner/files/after/module_b/module_b1/sonar-project.properties
new file mode 100644
index 00000000000..ca8404b7bd4
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/after/module_b/module_b1/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module B1
diff --git a/it/it-projects/dbCleaner/files/after/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo b/it/it-projects/dbCleaner/files/after/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo
new file mode 100644
index 00000000000..b83c3af128c
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/after/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.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/dbCleaner/files/after/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures b/it/it-projects/dbCleaner/files/after/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures
new file mode 100644
index 00000000000..3947d3bdbff
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/after/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures
@@ -0,0 +1,2 @@
+ncloc:12
+classes:1 \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/files/after/module_b/module_b2/sonar-project.properties b/it/it-projects/dbCleaner/files/after/module_b/module_b2/sonar-project.properties
new file mode 100644
index 00000000000..e597dab4f33
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/after/module_b/module_b2/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module B2
diff --git a/it/it-projects/dbCleaner/files/after/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo b/it/it-projects/dbCleaner/files/after/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo
new file mode 100644
index 00000000000..20b8bb3876a
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/after/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.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/dbCleaner/files/after/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures b/it/it-projects/dbCleaner/files/after/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures
new file mode 100644
index 00000000000..3947d3bdbff
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/after/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures
@@ -0,0 +1,2 @@
+ncloc:12
+classes:1 \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/files/after/module_b/sonar-project.properties b/it/it-projects/dbCleaner/files/after/module_b/sonar-project.properties
new file mode 100644
index 00000000000..21d69f769d3
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/after/module_b/sonar-project.properties
@@ -0,0 +1,4 @@
+sonar.projectKey=module_b
+sonar.projectName=Module B
+
+sonar.modules=module_b1,module_b2
diff --git a/it/it-projects/dbCleaner/files/after/sonar-project.properties b/it/it-projects/dbCleaner/files/after/sonar-project.properties
new file mode 100644
index 00000000000..7935cb5ffb0
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/after/sonar-project.properties
@@ -0,0 +1,12 @@
+# Root project information
+sonar.projectKey=com.sonarsource.it.samples:multi-modules-sample
+sonar.projectName=Sonar :: Integration Tests :: Multi-modules Sample
+sonar.projectVersion=1.0-SNAPSHOT
+
+sonar.language=xoo
+
+# Some properties that will be inherited by the modules
+sonar.sources=src/main/xoo
+
+# List of the module identifiers
+sonar.modules=module_a,module_b
diff --git a/it/it-projects/dbCleaner/files/before/module_a/module_a1/sonar-project.properties b/it/it-projects/dbCleaner/files/before/module_a/module_a1/sonar-project.properties
new file mode 100644
index 00000000000..a081a0e6342
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/before/module_a/module_a1/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module A1
diff --git a/it/it-projects/dbCleaner/files/before/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo b/it/it-projects/dbCleaner/files/before/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo
new file mode 100644
index 00000000000..74d29a4fa08
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/before/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.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/dbCleaner/files/before/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo.measures b/it/it-projects/dbCleaner/files/before/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo.measures
new file mode 100644
index 00000000000..85460386130
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/before/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo.measures
@@ -0,0 +1,10 @@
+ncloc:13
+complexity:3
+complexity_in_classes:3
+classes:1
+comment_lines:3
+public_api:5
+public_undocumented_api:2
+duplicated_files:1
+duplicated_blocks:2
+duplicated_lines:3
diff --git a/it/it-projects/dbCleaner/files/before/module_a/module_a2/sonar-project.properties b/it/it-projects/dbCleaner/files/before/module_a/module_a2/sonar-project.properties
new file mode 100644
index 00000000000..fcedab83843
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/before/module_a/module_a2/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module A2
diff --git a/it/it-projects/dbCleaner/files/before/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo b/it/it-projects/dbCleaner/files/before/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo
new file mode 100644
index 00000000000..42039538a92
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/before/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo
@@ -0,0 +1,12 @@
+package com.sonar.it.samples.modules.a2;
+
+public class HelloA2 {
+ private int i;
+ private HelloA2() {
+
+ }
+
+ public void hello() {
+ System.out.println("hello" + " xoo");
+ }
+} \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/files/before/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures b/it/it-projects/dbCleaner/files/before/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures
new file mode 100644
index 00000000000..3947d3bdbff
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/before/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures
@@ -0,0 +1,2 @@
+ncloc:12
+classes:1 \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/files/before/module_a/sonar-project.properties b/it/it-projects/dbCleaner/files/before/module_a/sonar-project.properties
new file mode 100644
index 00000000000..7e6ca9074a4
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/before/module_a/sonar-project.properties
@@ -0,0 +1,4 @@
+sonar.projectKey=module_a
+sonar.projectName=Module A
+
+sonar.modules=module_a1,module_a2
diff --git a/it/it-projects/dbCleaner/files/before/module_b/module_b1/sonar-project.properties b/it/it-projects/dbCleaner/files/before/module_b/module_b1/sonar-project.properties
new file mode 100644
index 00000000000..ca8404b7bd4
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/before/module_b/module_b1/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module B1
diff --git a/it/it-projects/dbCleaner/files/before/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo b/it/it-projects/dbCleaner/files/before/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo
new file mode 100644
index 00000000000..b83c3af128c
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/before/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.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/dbCleaner/files/before/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures b/it/it-projects/dbCleaner/files/before/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures
new file mode 100644
index 00000000000..3947d3bdbff
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/before/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures
@@ -0,0 +1,2 @@
+ncloc:12
+classes:1 \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/files/before/module_b/module_b2/sonar-project.properties b/it/it-projects/dbCleaner/files/before/module_b/module_b2/sonar-project.properties
new file mode 100644
index 00000000000..e597dab4f33
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/before/module_b/module_b2/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module B2
diff --git a/it/it-projects/dbCleaner/files/before/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo b/it/it-projects/dbCleaner/files/before/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo
new file mode 100644
index 00000000000..20b8bb3876a
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/before/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.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/dbCleaner/files/before/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures b/it/it-projects/dbCleaner/files/before/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures
new file mode 100644
index 00000000000..3947d3bdbff
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/before/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures
@@ -0,0 +1,2 @@
+ncloc:12
+classes:1 \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/files/before/module_b/sonar-project.properties b/it/it-projects/dbCleaner/files/before/module_b/sonar-project.properties
new file mode 100644
index 00000000000..21d69f769d3
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/before/module_b/sonar-project.properties
@@ -0,0 +1,4 @@
+sonar.projectKey=module_b
+sonar.projectName=Module B
+
+sonar.modules=module_b1,module_b2
diff --git a/it/it-projects/dbCleaner/files/before/sonar-project.properties b/it/it-projects/dbCleaner/files/before/sonar-project.properties
new file mode 100644
index 00000000000..7935cb5ffb0
--- /dev/null
+++ b/it/it-projects/dbCleaner/files/before/sonar-project.properties
@@ -0,0 +1,12 @@
+# Root project information
+sonar.projectKey=com.sonarsource.it.samples:multi-modules-sample
+sonar.projectName=Sonar :: Integration Tests :: Multi-modules Sample
+sonar.projectVersion=1.0-SNAPSHOT
+
+sonar.language=xoo
+
+# Some properties that will be inherited by the modules
+sonar.sources=src/main/xoo
+
+# List of the module identifiers
+sonar.modules=module_a,module_b
diff --git a/it/it-projects/dbCleaner/modules/after/module_a/module_a1/sonar-project.properties b/it/it-projects/dbCleaner/modules/after/module_a/module_a1/sonar-project.properties
new file mode 100644
index 00000000000..a081a0e6342
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/after/module_a/module_a1/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module A1
diff --git a/it/it-projects/dbCleaner/modules/after/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo b/it/it-projects/dbCleaner/modules/after/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo
new file mode 100644
index 00000000000..74d29a4fa08
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/after/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.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/dbCleaner/modules/after/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo.measures b/it/it-projects/dbCleaner/modules/after/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo.measures
new file mode 100644
index 00000000000..85460386130
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/after/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo.measures
@@ -0,0 +1,10 @@
+ncloc:13
+complexity:3
+complexity_in_classes:3
+classes:1
+comment_lines:3
+public_api:5
+public_undocumented_api:2
+duplicated_files:1
+duplicated_blocks:2
+duplicated_lines:3
diff --git a/it/it-projects/dbCleaner/modules/after/module_a/module_a2/sonar-project.properties b/it/it-projects/dbCleaner/modules/after/module_a/module_a2/sonar-project.properties
new file mode 100644
index 00000000000..fcedab83843
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/after/module_a/module_a2/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module A2
diff --git a/it/it-projects/dbCleaner/modules/after/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo b/it/it-projects/dbCleaner/modules/after/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo
new file mode 100644
index 00000000000..42039538a92
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/after/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo
@@ -0,0 +1,12 @@
+package com.sonar.it.samples.modules.a2;
+
+public class HelloA2 {
+ private int i;
+ private HelloA2() {
+
+ }
+
+ public void hello() {
+ System.out.println("hello" + " xoo");
+ }
+} \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/modules/after/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures b/it/it-projects/dbCleaner/modules/after/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures
new file mode 100644
index 00000000000..3947d3bdbff
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/after/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures
@@ -0,0 +1,2 @@
+ncloc:12
+classes:1 \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/modules/after/module_a/sonar-project.properties b/it/it-projects/dbCleaner/modules/after/module_a/sonar-project.properties
new file mode 100644
index 00000000000..7e6ca9074a4
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/after/module_a/sonar-project.properties
@@ -0,0 +1,4 @@
+sonar.projectKey=module_a
+sonar.projectName=Module A
+
+sonar.modules=module_a1,module_a2
diff --git a/it/it-projects/dbCleaner/modules/after/module_c/module_c1/sonar-project.properties b/it/it-projects/dbCleaner/modules/after/module_c/module_c1/sonar-project.properties
new file mode 100644
index 00000000000..ca8404b7bd4
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/after/module_c/module_c1/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module B1
diff --git a/it/it-projects/dbCleaner/modules/after/module_c/module_c1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo b/it/it-projects/dbCleaner/modules/after/module_c/module_c1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo
new file mode 100644
index 00000000000..b83c3af128c
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/after/module_c/module_c1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.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/dbCleaner/modules/after/module_c/module_c1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures b/it/it-projects/dbCleaner/modules/after/module_c/module_c1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures
new file mode 100644
index 00000000000..3947d3bdbff
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/after/module_c/module_c1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures
@@ -0,0 +1,2 @@
+ncloc:12
+classes:1 \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/modules/after/module_c/module_c2/sonar-project.properties b/it/it-projects/dbCleaner/modules/after/module_c/module_c2/sonar-project.properties
new file mode 100644
index 00000000000..e597dab4f33
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/after/module_c/module_c2/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module B2
diff --git a/it/it-projects/dbCleaner/modules/after/module_c/module_c2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo b/it/it-projects/dbCleaner/modules/after/module_c/module_c2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo
new file mode 100644
index 00000000000..20b8bb3876a
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/after/module_c/module_c2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.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/dbCleaner/modules/after/module_c/module_c2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures b/it/it-projects/dbCleaner/modules/after/module_c/module_c2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures
new file mode 100644
index 00000000000..3947d3bdbff
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/after/module_c/module_c2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures
@@ -0,0 +1,2 @@
+ncloc:12
+classes:1 \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/modules/after/module_c/sonar-project.properties b/it/it-projects/dbCleaner/modules/after/module_c/sonar-project.properties
new file mode 100644
index 00000000000..e379019d264
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/after/module_c/sonar-project.properties
@@ -0,0 +1,4 @@
+sonar.projectKey=module_c
+sonar.projectName=Module C
+
+sonar.modules=module_c1,module_c2
diff --git a/it/it-projects/dbCleaner/modules/after/sonar-project.properties b/it/it-projects/dbCleaner/modules/after/sonar-project.properties
new file mode 100644
index 00000000000..6a6d185f9df
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/after/sonar-project.properties
@@ -0,0 +1,12 @@
+# Root project information
+sonar.projectKey=com.sonarsource.it.samples:multi-modules-sample
+sonar.projectName=Sonar :: Integration Tests :: Multi-modules Sample
+sonar.projectVersion=1.0-SNAPSHOT
+
+sonar.language=xoo
+
+# Some properties that will be inherited by the modules
+sonar.sources=src/main/xoo
+
+# List of the module identifiers
+sonar.modules=module_a,module_c
diff --git a/it/it-projects/dbCleaner/modules/before/module_a/module_a1/sonar-project.properties b/it/it-projects/dbCleaner/modules/before/module_a/module_a1/sonar-project.properties
new file mode 100644
index 00000000000..a081a0e6342
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/before/module_a/module_a1/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module A1
diff --git a/it/it-projects/dbCleaner/modules/before/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo b/it/it-projects/dbCleaner/modules/before/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo
new file mode 100644
index 00000000000..74d29a4fa08
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/before/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.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/dbCleaner/modules/before/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo.measures b/it/it-projects/dbCleaner/modules/before/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo.measures
new file mode 100644
index 00000000000..85460386130
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/before/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo.measures
@@ -0,0 +1,10 @@
+ncloc:13
+complexity:3
+complexity_in_classes:3
+classes:1
+comment_lines:3
+public_api:5
+public_undocumented_api:2
+duplicated_files:1
+duplicated_blocks:2
+duplicated_lines:3
diff --git a/it/it-projects/dbCleaner/modules/before/module_a/module_a2/sonar-project.properties b/it/it-projects/dbCleaner/modules/before/module_a/module_a2/sonar-project.properties
new file mode 100644
index 00000000000..fcedab83843
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/before/module_a/module_a2/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module A2
diff --git a/it/it-projects/dbCleaner/modules/before/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo b/it/it-projects/dbCleaner/modules/before/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo
new file mode 100644
index 00000000000..42039538a92
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/before/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo
@@ -0,0 +1,12 @@
+package com.sonar.it.samples.modules.a2;
+
+public class HelloA2 {
+ private int i;
+ private HelloA2() {
+
+ }
+
+ public void hello() {
+ System.out.println("hello" + " xoo");
+ }
+} \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/modules/before/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures b/it/it-projects/dbCleaner/modules/before/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures
new file mode 100644
index 00000000000..3947d3bdbff
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/before/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures
@@ -0,0 +1,2 @@
+ncloc:12
+classes:1 \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/modules/before/module_a/sonar-project.properties b/it/it-projects/dbCleaner/modules/before/module_a/sonar-project.properties
new file mode 100644
index 00000000000..7e6ca9074a4
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/before/module_a/sonar-project.properties
@@ -0,0 +1,4 @@
+sonar.projectKey=module_a
+sonar.projectName=Module A
+
+sonar.modules=module_a1,module_a2
diff --git a/it/it-projects/dbCleaner/modules/before/module_b/module_b1/sonar-project.properties b/it/it-projects/dbCleaner/modules/before/module_b/module_b1/sonar-project.properties
new file mode 100644
index 00000000000..ca8404b7bd4
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/before/module_b/module_b1/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module B1
diff --git a/it/it-projects/dbCleaner/modules/before/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo b/it/it-projects/dbCleaner/modules/before/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo
new file mode 100644
index 00000000000..b83c3af128c
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/before/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.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/dbCleaner/modules/before/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures b/it/it-projects/dbCleaner/modules/before/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures
new file mode 100644
index 00000000000..3947d3bdbff
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/before/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures
@@ -0,0 +1,2 @@
+ncloc:12
+classes:1 \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/modules/before/module_b/module_b2/sonar-project.properties b/it/it-projects/dbCleaner/modules/before/module_b/module_b2/sonar-project.properties
new file mode 100644
index 00000000000..e597dab4f33
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/before/module_b/module_b2/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module B2
diff --git a/it/it-projects/dbCleaner/modules/before/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo b/it/it-projects/dbCleaner/modules/before/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo
new file mode 100644
index 00000000000..20b8bb3876a
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/before/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.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/dbCleaner/modules/before/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures b/it/it-projects/dbCleaner/modules/before/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures
new file mode 100644
index 00000000000..3947d3bdbff
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/before/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures
@@ -0,0 +1,2 @@
+ncloc:12
+classes:1 \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/modules/before/module_b/sonar-project.properties b/it/it-projects/dbCleaner/modules/before/module_b/sonar-project.properties
new file mode 100644
index 00000000000..21d69f769d3
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/before/module_b/sonar-project.properties
@@ -0,0 +1,4 @@
+sonar.projectKey=module_b
+sonar.projectName=Module B
+
+sonar.modules=module_b1,module_b2
diff --git a/it/it-projects/dbCleaner/modules/before/sonar-project.properties b/it/it-projects/dbCleaner/modules/before/sonar-project.properties
new file mode 100644
index 00000000000..7935cb5ffb0
--- /dev/null
+++ b/it/it-projects/dbCleaner/modules/before/sonar-project.properties
@@ -0,0 +1,12 @@
+# Root project information
+sonar.projectKey=com.sonarsource.it.samples:multi-modules-sample
+sonar.projectName=Sonar :: Integration Tests :: Multi-modules Sample
+sonar.projectVersion=1.0-SNAPSHOT
+
+sonar.language=xoo
+
+# Some properties that will be inherited by the modules
+sonar.sources=src/main/xoo
+
+# List of the module identifiers
+sonar.modules=module_a,module_b
diff --git a/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a1/sonar-project.properties b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a1/sonar-project.properties
new file mode 100644
index 00000000000..a081a0e6342
--- /dev/null
+++ b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a1/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module A1
diff --git a/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo
new file mode 100644
index 00000000000..74d29a4fa08
--- /dev/null
+++ b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.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/dbCleaner/xoo-multi-modules-sample/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo.measures b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo.measures
new file mode 100644
index 00000000000..85460386130
--- /dev/null
+++ b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a1/src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo.measures
@@ -0,0 +1,10 @@
+ncloc:13
+complexity:3
+complexity_in_classes:3
+classes:1
+comment_lines:3
+public_api:5
+public_undocumented_api:2
+duplicated_files:1
+duplicated_blocks:2
+duplicated_lines:3
diff --git a/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a2/sonar-project.properties b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a2/sonar-project.properties
new file mode 100644
index 00000000000..fcedab83843
--- /dev/null
+++ b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a2/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module A2
diff --git a/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo
new file mode 100644
index 00000000000..42039538a92
--- /dev/null
+++ b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo
@@ -0,0 +1,12 @@
+package com.sonar.it.samples.modules.a2;
+
+public class HelloA2 {
+ private int i;
+ private HelloA2() {
+
+ }
+
+ public void hello() {
+ System.out.println("hello" + " xoo");
+ }
+} \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures
new file mode 100644
index 00000000000..3947d3bdbff
--- /dev/null
+++ b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/module_a2/src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo.measures
@@ -0,0 +1,2 @@
+ncloc:12
+classes:1 \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/sonar-project.properties b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/sonar-project.properties
new file mode 100644
index 00000000000..7e6ca9074a4
--- /dev/null
+++ b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_a/sonar-project.properties
@@ -0,0 +1,4 @@
+sonar.projectKey=module_a
+sonar.projectName=Module A
+
+sonar.modules=module_a1,module_a2
diff --git a/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b1/sonar-project.properties b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b1/sonar-project.properties
new file mode 100644
index 00000000000..ca8404b7bd4
--- /dev/null
+++ b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b1/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module B1
diff --git a/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo
new file mode 100644
index 00000000000..b83c3af128c
--- /dev/null
+++ b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.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/dbCleaner/xoo-multi-modules-sample/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures
new file mode 100644
index 00000000000..3947d3bdbff
--- /dev/null
+++ b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b1/src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo.measures
@@ -0,0 +1,2 @@
+ncloc:12
+classes:1 \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b2/sonar-project.properties b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b2/sonar-project.properties
new file mode 100644
index 00000000000..e597dab4f33
--- /dev/null
+++ b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b2/sonar-project.properties
@@ -0,0 +1 @@
+sonar.projectName=Sub-module B2
diff --git a/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo
new file mode 100644
index 00000000000..20b8bb3876a
--- /dev/null
+++ b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.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/dbCleaner/xoo-multi-modules-sample/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures
new file mode 100644
index 00000000000..3947d3bdbff
--- /dev/null
+++ b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/module_b2/src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo.measures
@@ -0,0 +1,2 @@
+ncloc:12
+classes:1 \ No newline at end of file
diff --git a/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/sonar-project.properties b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/sonar-project.properties
new file mode 100644
index 00000000000..21d69f769d3
--- /dev/null
+++ b/it/it-projects/dbCleaner/xoo-multi-modules-sample/module_b/sonar-project.properties
@@ -0,0 +1,4 @@
+sonar.projectKey=module_b
+sonar.projectName=Module B
+
+sonar.modules=module_b1,module_b2
diff --git a/it/it-projects/dbCleaner/xoo-multi-modules-sample/sonar-project.properties b/it/it-projects/dbCleaner/xoo-multi-modules-sample/sonar-project.properties
new file mode 100644
index 00000000000..7935cb5ffb0
--- /dev/null
+++ b/it/it-projects/dbCleaner/xoo-multi-modules-sample/sonar-project.properties
@@ -0,0 +1,12 @@
+# Root project information
+sonar.projectKey=com.sonarsource.it.samples:multi-modules-sample
+sonar.projectName=Sonar :: Integration Tests :: Multi-modules Sample
+sonar.projectVersion=1.0-SNAPSHOT
+
+sonar.language=xoo
+
+# Some properties that will be inherited by the modules
+sonar.sources=src/main/xoo
+
+# List of the module identifiers
+sonar.modules=module_a,module_b
diff --git a/it/it-tests/src/test/java/it/Category4Suite.java b/it/it-tests/src/test/java/it/Category4Suite.java
index 7c08e8e7759..3c43fec6f8b 100644
--- a/it/it-tests/src/test/java/it/Category4Suite.java
+++ b/it/it-tests/src/test/java/it/Category4Suite.java
@@ -23,6 +23,7 @@ import com.sonar.orchestrator.Orchestrator;
import it.analysisExclusion.FileExclusionsTest;
import it.analysisExclusion.IssueExclusionsTest;
import it.componentSearch.ProjectSearchTest;
+import it.dbCleaner.PurgeTest;
import it.duplication.CrossProjectDuplicationsTest;
import it.duplication.DuplicationsTest;
import it.serverSystem.DevModeTest;
@@ -57,7 +58,9 @@ import static util.ItUtils.xooPlugin;
IssueExclusionsTest.class,
// duplication
CrossProjectDuplicationsTest.class,
- DuplicationsTest.class
+ DuplicationsTest.class,
+ // db cleaner
+ PurgeTest.class
})
public class Category4Suite {
diff --git a/it/it-tests/src/test/java/it/dbCleaner/PurgeTest.java b/it/it-tests/src/test/java/it/dbCleaner/PurgeTest.java
new file mode 100644
index 00000000000..ca20115e386
--- /dev/null
+++ b/it/it-tests/src/test/java/it/dbCleaner/PurgeTest.java
@@ -0,0 +1,298 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.dbCleaner;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.BuildResult;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.locator.FileLocation;
+import it.Category4Suite;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang.time.DateFormatUtils;
+import org.apache.commons.lang.time.DateUtils;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ErrorCollector;
+import org.sonar.wsclient.services.PropertyDeleteQuery;
+import org.sonar.wsclient.services.PropertyUpdateQuery;
+import util.ItUtils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+
+public class PurgeTest {
+
+ static final String PROJECT_KEY = "com.sonarsource.it.samples:multi-modules-sample";
+ static final String PROJECT_SAMPLE_PATH = "dbCleaner/xoo-multi-modules-sample";
+
+ @ClassRule
+ public static final Orchestrator orchestrator = Category4Suite.ORCHESTRATOR;
+
+ @Rule
+ public ErrorCollector collector = new ErrorCollector();
+
+ @Before
+ public void deleteProjectData() {
+ orchestrator.resetData();
+
+ orchestrator.getServer().provisionProject(PROJECT_KEY, PROJECT_KEY);
+
+ orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/dbCleaner/one-issue-per-line-profile.xml"));
+ orchestrator.getServer().getAdminWsClient().delete(new PropertyDeleteQuery("sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay"));
+ orchestrator.getServer().getAdminWsClient().delete(new PropertyDeleteQuery("sonar.dbcleaner.cleanDirectory"));
+ }
+
+ @Test
+ public void test_evolution_of_number_of_rows_when_scanning_two_times_the_same_project() {
+ Date today = new Date();
+ Date yesterday = DateUtils.addDays(today, -1);
+
+ scan(PROJECT_SAMPLE_PATH, DateFormatUtils.ISO_DATE_FORMAT.format(yesterday));
+
+ // count components
+ collector.checkThat("Wrong number of projects", count("projects where qualifier in ('TRK','BRC')"), equalTo(7));
+ collector.checkThat("Wrong number of directories", count("projects where qualifier in ('DIR')"), equalTo(4));
+ collector.checkThat("Wrong number of files", count("projects where qualifier in ('FIL')"), equalTo(4));
+ collector.checkThat("Wrong number of unit test files", count("projects where qualifier in ('UTS')"), equalTo(0));
+
+ int measuresOnTrk = 47;
+ int measuresOnBrc = 234;
+ int measuresOnDir = 117;
+ int measuresOnFil = 69;
+
+ // count measures 
+ logMeasures("First analysis - TRK measures", "TRK");
+ logMeasures("First analysis - BRC measures", "BRC");
+ assertMeasuresCountForQualifier("TRK", measuresOnTrk);
+ assertMeasuresCountForQualifier("BRC", measuresOnBrc);
+ assertMeasuresCountForQualifier("DIR", measuresOnDir);
+ assertMeasuresCountForQualifier("FIL", measuresOnFil);
+
+ // No new_* metrics measure should be recorded the first time
+ collector.checkThat(
+ "Wrong number of measure of new_ metrics",
+ count("project_measures, metrics where metrics.id = project_measures.metric_id and metrics.name like 'new_%'"),
+ equalTo(0));
+
+ int expectedMeasures = measuresOnTrk + measuresOnBrc + measuresOnDir + measuresOnFil;
+ collector.checkThat("Wrong number of measures", count("project_measures"), equalTo(expectedMeasures));
+ collector.checkThat("Wrong number of measure data", count("project_measures where measure_data is not null"), equalTo(0));
+
+ // count other tables that are constant between 2 scans
+ int expectedIssues = 52;
+
+ collector.checkThat("Wrong number of issues", count("issues"), equalTo(expectedIssues));
+
+ // must be a different date, else a single snapshot is kept per day
+ scan(PROJECT_SAMPLE_PATH, DateFormatUtils.ISO_DATE_FORMAT.format(today));
+
+ int newMeasuresOnTrk = 53;
+ int newMeasuresOnBrc = 274;
+ int newMeasuresOnDir = 32;
+ int newMeasuresOnFil = 0;
+
+ logMeasures("Second analysis - TRK measures", "TRK");
+ logMeasures("Second analysis - BRC measures", "BRC");
+ logMeasures("Second analysis – DIR measures", "DIR");
+ assertMeasuresCountForQualifier("TRK", measuresOnTrk + newMeasuresOnTrk);
+ assertMeasuresCountForQualifier("BRC", measuresOnBrc + newMeasuresOnBrc);
+ assertMeasuresCountForQualifier("DIR", measuresOnDir + newMeasuresOnDir);
+ assertMeasuresCountForQualifier("FIL", measuresOnFil + newMeasuresOnFil);
+
+ // Measures on new_* metrics should be recorded
+ collector.checkThat(
+ "Wrong number of measure of new_ metrics",
+ count("project_measures, metrics where metrics.id = project_measures.metric_id and metrics.name like 'new_%'"),
+ equalTo(88));
+
+ // added measures relate to project and new_* metrics
+ expectedMeasures += newMeasuresOnTrk + newMeasuresOnBrc + newMeasuresOnDir + newMeasuresOnFil;
+ collector.checkThat("Wrong number of measures after second analysis", count("project_measures"), equalTo(expectedMeasures));
+ collector.checkThat("Wrong number of measure data", count("project_measures where measure_data is not null"), equalTo(0));
+ collector.checkThat("Wrong number of issues", count("issues"), equalTo(expectedIssues));
+ }
+
+ /**
+ * SONAR-3378
+ */
+ @Test
+ public void should_keep_all_snapshots_the_first_day() {
+ // analyse once
+ scan(PROJECT_SAMPLE_PATH);
+ // analyse twice
+ scan(PROJECT_SAMPLE_PATH);
+ // and check we have 2 snapshots
+ assertThat(count("snapshots s where s.project_id=(select p.id from projects p where p.kee='com.sonarsource.it.samples:multi-modules-sample')")).isEqualTo(2);
+ }
+
+ /**
+ * SONAR-2807 & SONAR-3378 & SONAR-4710
+ */
+ @Test
+ public void should_keep_only_one_snapshot_per_day() {
+ scan(PROJECT_SAMPLE_PATH);
+
+ int snapshotsCount = count("snapshots where qualifier<>'LIB'");
+ int measuresCount = count("project_measures");
+ // Using the "sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay" property set to '0' is the way
+ // to keep only 1 snapshot per day
+ orchestrator.getServer().getAdminWsClient().update(new PropertyUpdateQuery("sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay", "0"));
+ scan(PROJECT_SAMPLE_PATH);
+ assertThat(count("snapshots where qualifier<>'LIB'")).as("Different number of snapshots").isEqualTo(snapshotsCount);
+
+ int measureOnNewMetrics = count("project_measures, metrics where metrics.id = project_measures.metric_id and metrics.name like 'new_%'");
+ // Number of measures should be the same as previous, with the measures on new metrics
+ assertThat(count("project_measures")).as("Different number of measures").isEqualTo(measuresCount + measureOnNewMetrics);
+ }
+
+ /**
+ * SONAR-3120
+ */
+ @Test
+ public void should_delete_removed_modules() {
+ scan("dbCleaner/modules/before");
+ assertSingleSnapshot("com.sonarsource.it.samples:multi-modules-sample:module_b");
+ assertSingleSnapshot("com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1");
+
+ // we want the previous snapshot to be purged
+ orchestrator.getServer().getAdminWsClient().update(new PropertyUpdateQuery("sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay", "0"));
+ scan("dbCleaner/modules/after");
+ assertDeleted("com.sonarsource.it.samples:multi-modules-sample:module_b");
+ assertDeleted("com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1");
+ assertSingleSnapshot("com.sonarsource.it.samples:multi-modules-sample:module_c:module_c1");
+ }
+
+ /**
+ * SONAR-3120
+ */
+ @Test
+ public void should_delete_removed_files() {
+ scan("dbCleaner/files/before");
+ assertSingleSnapshot("com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo");
+
+ scan("dbCleaner/files/after");
+ assertDeleted("src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo");
+ assertSingleSnapshot("com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/NewHelloA1.xoo");
+ }
+
+ /**
+ * SONAR-2754
+ */
+ @Test
+ public void should_delete_historical_data_of_directories_by_default() {
+ scan(PROJECT_SAMPLE_PATH, "2012-01-01");
+ String select = "snapshots where scope='DIR'";
+ int directorySnapshots = count(select);
+
+ scan(PROJECT_SAMPLE_PATH, "2012-02-02");
+ assertThat(count(select)).isEqualTo(directorySnapshots);
+ }
+
+ /**
+ * SONAR-2754
+ */
+ @Test
+ public void should_not_delete_historical_data_of_directories() {
+ scan(PROJECT_SAMPLE_PATH, "2012-01-01");
+
+ String select = "snapshots where scope='DIR'";
+ int directorySnapshots = count(select);
+
+ orchestrator.getServer().getAdminWsClient().update(new PropertyUpdateQuery("sonar.dbcleaner.cleanDirectory", "false"));
+ scan(PROJECT_SAMPLE_PATH, "2012-02-02");
+
+ assertThat(count(select)).isEqualTo(2 * directorySnapshots);
+ }
+
+ /**
+ * SONAR-2061
+ */
+ @Test
+ public void should_delete_historical_data_of_flagged_metrics() {
+ scan(PROJECT_SAMPLE_PATH, "2012-01-01");
+
+ // historical data of complexity_in_classes is supposed to be deleted (see CoreMetrics)
+ String selectNcloc = "project_measures where metric_id in (select id from metrics where name='ncloc')";
+ String selectComplexityInClasses = "project_measures where metric_id in (select id from metrics where name='complexity_in_classes')";
+ int nclocCount = count(selectNcloc);
+ int complexitInClassesCount = count(selectComplexityInClasses);
+
+ scan(PROJECT_SAMPLE_PATH, "2012-02-02");
+ assertThat(count(selectNcloc)).isGreaterThan(nclocCount);
+ assertThat(count(selectComplexityInClasses)).isEqualTo(complexitInClassesCount);
+ }
+
+ private void assertDeleted(String key) {
+ assertThat(count("snapshots s where s.project_id=(select p.id from projects p where p.kee='" + key + "')")).isZero();
+ assertThat(count("resource_index ri where ri.resource_id=(select p.id from projects p where p.kee='" + key + "')")).isZero();
+ }
+
+ private void assertSingleSnapshot(String key) {
+ assertThat(count("snapshots s where s.project_id=(select p.id from projects p where p.kee='" + key + "')")).isEqualTo(1);
+ assertThat(count("resource_index ri where ri.resource_id=(select p.id from projects p where p.kee='" + key + "')")).isGreaterThan(1);
+ }
+
+ private BuildResult scan(String path, String date) {
+ return scan(path, "sonar.projectDate", date);
+ }
+
+ private BuildResult scan(String path, String... extraProperties) {
+ SonarRunner runner = configureRunner(path, extraProperties);
+ return orchestrator.executeBuild(runner);
+ }
+
+ private SonarRunner configureRunner(String projectPath, String... props) {
+ orchestrator.getServer().associateProjectToQualityProfile(PROJECT_KEY, "xoo", "one-issue-per-line-profile");
+ return SonarRunner.create(ItUtils.projectDir(projectPath)).setProperties(props);
+ }
+
+ private int count(String condition) {
+ return orchestrator.getDatabase().countSql("select count(*) from " + condition);
+ }
+
+ private void assertMeasuresCountForQualifier(String qualifier, int count) {
+ int result = countMeasures(qualifier);
+ logMeasures("GOT", qualifier);
+ collector.checkThat("Wrong number of measures for qualifier " + qualifier, result, equalTo(count));
+ }
+
+ private int countMeasures(String qualifier) {
+ String sql = "SELECT count(pm.id) FROM project_measures pm, snapshots s, metrics m where pm.snapshot_id=s.id and pm.metric_id=m.id and s.qualifier='" + qualifier + "'";
+ return orchestrator.getDatabase().countSql(sql);
+ }
+
+ private void logMeasures(String title, String qualifier) {
+ String sql = "SELECT m.name as metricName, pm.value as value, pm.text_value as textValue, pm.variation_value_1, pm.variation_value_2, pm.variation_value_3, pm.rule_id, pm.characteristic_id "
+ +
+ "FROM project_measures pm, snapshots s, metrics m " +
+ "WHERE pm.snapshot_id=s.id and pm.metric_id=m.id and s.qualifier='"
+ + qualifier + "'";
+ List<Map<String, String>> rows = orchestrator.getDatabase().executeSql(sql);
+
+ System.out.println("---- " + title + " - measures on qualifier " + qualifier);
+ for (Map<String, String> row : rows) {
+ System.out.println(" " + row);
+ }
+ }
+}
diff --git a/it/it-tests/src/test/java/it/dbCleaner/ToDoTest.java b/it/it-tests/src/test/java/it/dbCleaner/ToDoTest.java
deleted file mode 100644
index 27efdae2eea..00000000000
--- a/it/it-tests/src/test/java/it/dbCleaner/ToDoTest.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package it.dbCleaner;
-
-public class ToDoTest {
-}
diff --git a/it/it-tests/src/test/resources/dbCleaner/one-issue-per-line-profile.xml b/it/it-tests/src/test/resources/dbCleaner/one-issue-per-line-profile.xml
new file mode 100644
index 00000000000..2006b6fb365
--- /dev/null
+++ b/it/it-tests/src/test/resources/dbCleaner/one-issue-per-line-profile.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0"?><!-- Generated by Sonar -->
+<profile>
+ <name>one-issue-per-line-profile</name>
+ <language>xoo</language>
+ <rules>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerLine</key>
+ <priority>MAJOR</priority>
+ </rule>
+ </rules>
+</profile>