diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2016-08-16 15:27:47 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2016-08-16 17:06:27 +0200 |
commit | d235acc3d3f20d44617effe1fda54467fa81a9dc (patch) | |
tree | 87c56b9bf1c95517e8d4b017de26b476abd77f9e /it | |
parent | 3b68b76704109654e105a393105aa41ced907890 (diff) | |
download | sonarqube-d235acc3d3f20d44617effe1fda54467fa81a9dc.tar.gz sonarqube-d235acc3d3f20d44617effe1fda54467fa81a9dc.zip |
SONAR-7953 Add IT
Diffstat (limited to 'it')
23 files changed, 581 insertions, 0 deletions
diff --git a/it/it-projects/duplications/new-duplications-v1/sonar-project.properties b/it/it-projects/duplications/new-duplications-v1/sonar-project.properties new file mode 100644 index 00000000000..6f0a3e53d33 --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v1/sonar-project.properties @@ -0,0 +1,6 @@ +sonar.projectKey=new-duplications +sonar.projectName=New duplications +sonar.projectVersion=1.0-SNAPSHOT +sonar.sources=src/main/xoo +sonar.language=xoo +sonar.scm.provider=xoo diff --git a/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_with_other_dir1/DuplicatedLinesWithOtherDirectory.xoo b/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_with_other_dir1/DuplicatedLinesWithOtherDirectory.xoo new file mode 100644 index 00000000000..366e85ec229 --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_with_other_dir1/DuplicatedLinesWithOtherDirectory.xoo @@ -0,0 +1,17 @@ +package duplicated_lines_with_other_dir1; + +public class DuplicatedLinesWithOtherDirectory { + + public DuplicatedLinesWithOtherDirectory() { + } + + public void duplicatedMethodWithOtherDirectory() { + char[] charList = new char[30]; + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + } +} diff --git a/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_with_other_dir1/DuplicatedLinesWithOtherDirectory.xoo.measures b/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_with_other_dir1/DuplicatedLinesWithOtherDirectory.xoo.measures new file mode 100644 index 00000000000..57948d5b8c6 --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_with_other_dir1/DuplicatedLinesWithOtherDirectory.xoo.measures @@ -0,0 +1 @@ +ncloc:18 diff --git a/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_with_other_dir1/DuplicatedLinesWithOtherDirectory.xoo.scm b/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_with_other_dir1/DuplicatedLinesWithOtherDirectory.xoo.scm new file mode 100644 index 00000000000..a4f7ca6c8b0 --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_with_other_dir1/DuplicatedLinesWithOtherDirectory.xoo.scm @@ -0,0 +1,18 @@ +1,user1,2015-01-04 +1,user1,2015-01-04 +1,user1,2015-01-04 +1,user1,2015-01-04 +2,user2,2015-01-05 +2,user2,2015-01-05 +3,user3,2015-01-06 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 diff --git a/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_with_other_dir2/DuplicatedLinesWithOtherDirectory.xoo b/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_with_other_dir2/DuplicatedLinesWithOtherDirectory.xoo new file mode 100644 index 00000000000..366e85ec229 --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_with_other_dir2/DuplicatedLinesWithOtherDirectory.xoo @@ -0,0 +1,17 @@ +package duplicated_lines_with_other_dir1; + +public class DuplicatedLinesWithOtherDirectory { + + public DuplicatedLinesWithOtherDirectory() { + } + + public void duplicatedMethodWithOtherDirectory() { + char[] charList = new char[30]; + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + } +} diff --git a/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_with_other_dir2/DuplicatedLinesWithOtherDirectory.xoo.measures b/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_with_other_dir2/DuplicatedLinesWithOtherDirectory.xoo.measures new file mode 100644 index 00000000000..57948d5b8c6 --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_with_other_dir2/DuplicatedLinesWithOtherDirectory.xoo.measures @@ -0,0 +1 @@ +ncloc:18 diff --git a/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_with_other_dir2/DuplicatedLinesWithOtherDirectory.xoo.scm b/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_with_other_dir2/DuplicatedLinesWithOtherDirectory.xoo.scm new file mode 100644 index 00000000000..a4f7ca6c8b0 --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_with_other_dir2/DuplicatedLinesWithOtherDirectory.xoo.scm @@ -0,0 +1,18 @@ +1,user1,2015-01-04 +1,user1,2015-01-04 +1,user1,2015-01-04 +1,user1,2015-01-04 +2,user2,2015-01-05 +2,user2,2015-01-05 +3,user3,2015-01-06 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 diff --git a/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo b/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo new file mode 100644 index 00000000000..89addba19cf --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo @@ -0,0 +1,39 @@ +package duplicated_lines_within_same_file; + +public class DuplicatedLinesInSameFile { + + public DuplicatedLinesInSameFile() { + } + + public void duplicatedMethodInSameFile1() { + String temp = ""; + for (int i=0; i<10; i++){ + temp += "say something"+i; + } + for (int i=0; i<20; i++){ + temp += "say nothing"+i; + } + for (int i=0; i<30; i++){ + temp += "always say nothing"+i; + } + for (int i=0; i<40; i++){ + temp += "really nothing to say "+i; + } + for (int i=0; i<50; i++){ + temp += "really really nothing to say "+i; + } + for (int i=0; i<60; i++){ + temp += ".. "+i; + } + for (int i=0; i<70; i++){ + temp += "you say something? "+i; + } + for (int i=0; i<80; i++){ + temp += "ah no..."+i; + } + for (int i=0; i<90; i++){ + temp += "bye"+i; + } + } + +} diff --git a/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo.measures b/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo.measures new file mode 100644 index 00000000000..9680b5f6c8a --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo.measures @@ -0,0 +1 @@ +ncloc:40 diff --git a/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo.scm b/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo.scm new file mode 100644 index 00000000000..50df6bcf039 --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v1/src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo.scm @@ -0,0 +1,40 @@ +1,user1,2015-01-04 +1,user1,2015-01-04 +1,user1,2015-01-04 +1,user1,2015-01-04 +2,user2,2015-01-05 +2,user2,2015-01-05 +3,user3,2015-01-06 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 diff --git a/it/it-projects/duplications/new-duplications-v2/sonar-project.properties b/it/it-projects/duplications/new-duplications-v2/sonar-project.properties new file mode 100644 index 00000000000..6f0a3e53d33 --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v2/sonar-project.properties @@ -0,0 +1,6 @@ +sonar.projectKey=new-duplications +sonar.projectName=New duplications +sonar.projectVersion=1.0-SNAPSHOT +sonar.sources=src/main/xoo +sonar.language=xoo +sonar.scm.provider=xoo diff --git a/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_with_other_dir1/DuplicatedLinesWithOtherDirectory.xoo b/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_with_other_dir1/DuplicatedLinesWithOtherDirectory.xoo new file mode 100644 index 00000000000..88e610b4a74 --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_with_other_dir1/DuplicatedLinesWithOtherDirectory.xoo @@ -0,0 +1,41 @@ +package duplicated_lines_with_other_dir1; + +public class DuplicatedLinesWithOtherDirectory { + + public DuplicatedLinesWithOtherDirectory() { + } + + public void duplicatedMethodWithOtherDirectory() { + char[] charList = new char[30]; + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + } +} diff --git a/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_with_other_dir1/DuplicatedLinesWithOtherDirectory.xoo.measures b/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_with_other_dir1/DuplicatedLinesWithOtherDirectory.xoo.measures new file mode 100644 index 00000000000..86639725ced --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_with_other_dir1/DuplicatedLinesWithOtherDirectory.xoo.measures @@ -0,0 +1,2 @@ +ncloc:42 +ncloc_data:1=0;2=0;3=0;4=0;5=1;6=1;7=0;8=1;9=1;10=1;11=1;12=1;13=1;14=1;15=1;16=1;17=1;18=1;19=1;20=1;21=1;22=1;23=1;24=1;25=1;26=1;27=1;28=1;29=1;30=1;31=1;32=1;33=1;34=1;35=1;36=1;37=1;38=1;39=1;40=1;41=0;42=0; diff --git a/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_with_other_dir1/DuplicatedLinesWithOtherDirectory.xoo.scm b/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_with_other_dir1/DuplicatedLinesWithOtherDirectory.xoo.scm new file mode 100644 index 00000000000..728006a3575 --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_with_other_dir1/DuplicatedLinesWithOtherDirectory.xoo.scm @@ -0,0 +1,42 @@ +1,user1,2015-01-04 +1,user1,2015-01-04 +1,user1,2015-01-04 +1,user1,2015-01-04 +2,user2,2015-01-05 +2,user2,2015-01-05 +3,user3,2015-01-06 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 diff --git a/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_with_other_dir2/DuplicatedLinesWithOtherDirectory.xoo b/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_with_other_dir2/DuplicatedLinesWithOtherDirectory.xoo new file mode 100644 index 00000000000..433514f17af --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_with_other_dir2/DuplicatedLinesWithOtherDirectory.xoo @@ -0,0 +1,35 @@ +package duplicated_lines_with_other_dir2; + +public class DuplicatedLinesWithOtherDirectory { + + public DuplicatedLinesWithOtherDirectory() { + } + + public void duplicatedMethodWithOtherDirectory() { + char[] charList = new char[30]; + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + for (int i = 0; i < 10; i++) { + charList[i] = 'a'; + } + } +} diff --git a/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_with_other_dir2/DuplicatedLinesWithOtherDirectory.xoo.measures b/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_with_other_dir2/DuplicatedLinesWithOtherDirectory.xoo.measures new file mode 100644 index 00000000000..24cb7ef5ab1 --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_with_other_dir2/DuplicatedLinesWithOtherDirectory.xoo.measures @@ -0,0 +1,3 @@ +ncloc:36 +ncloc_data:1=0;2=0;3=0;4=0;5=1;6=1;7=0;8=1;9=1;10=1;11=1;12=1;13=1;14=1;15=1;16=1;17=1;18=1;19=1;20=1;21=1;22=1;23=1;24=1;25=1;26=1;27=1;28=1;29=1;30=1;31=1;32=1;33=1;34=1;35=0;36=0; + diff --git a/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_with_other_dir2/DuplicatedLinesWithOtherDirectory.xoo.scm b/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_with_other_dir2/DuplicatedLinesWithOtherDirectory.xoo.scm new file mode 100644 index 00000000000..8320f408e7a --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_with_other_dir2/DuplicatedLinesWithOtherDirectory.xoo.scm @@ -0,0 +1,36 @@ +1,user1,2015-01-04 +1,user1,2015-01-04 +1,user1,2015-01-04 +1,user1,2015-01-04 +2,user2,2015-01-05 +2,user2,2015-01-05 +3,user3,2015-01-06 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 diff --git a/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo b/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo new file mode 100644 index 00000000000..a0d79b856c6 --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo @@ -0,0 +1,80 @@ +package duplicated_lines_within_same_file; + +public class DuplicatedLinesInSameFile { + + public DuplicatedLinesInSameFile() { + } + + public void duplicatedMethodInSameFile1() { + String temp = ""; + for (int i=0; i<10; i++){ + temp += "say something"+i; + } + for (int i=0; i<20; i++){ + temp += "say nothing"+i; + } + for (int i=0; i<30; i++){ + temp += "always say nothing"+i; + } + for (int i=0; i<40; i++){ + temp += "really nothing to say "+i; + } + for (int i=0; i<50; i++){ + temp += "really really nothing to say "+i; + } + for (int i=0; i<60; i++){ + temp += ".. "+i; + } + for (int i=0; i<70; i++){ + temp += "you say something? "+i; + } + for (int i=0; i<80; i++){ + temp += "ah no..."+i; + } + for (int i=0; i<90; i++){ + temp += "bye"+i; + } + } + + public void duplicatedMethodInSameFile2() { + String temp = ""; + for (int i=0; i<10; i++){ + temp += "say something"+i; + } + for (int i=0; i<20; i++){ + temp += "say nothing"+i; + } + for (int i=0; i<30; i++){ + temp += "always say nothing"+i; + } + for (int i=0; i<40; i++){ + temp += "really nothing to say "+i; + } + // Some comment + // Some comment + // Some comment + for (int i=0; i<50; i++){ + temp += "really really nothing to say "+i; + } + for (int i=0; i<60; i++){ + temp += ".. "+i; + } + for (int i=0; i<70; i++){ + temp += "you say something? "+i; + } + for (int i=0; i<80; i++){ + temp += "ah no..."+i; + } + for (int i=0; i<90; i++){ + temp += "bye"+i; + } + } + + public void notDuplicated(){ + int intergerToBeIncremented6 = 0; + while (intergerToBeIncremented6 < 100) { + intergerToBeIncremented6++; + } + } + +} diff --git a/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo.measures b/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo.measures new file mode 100644 index 00000000000..902659ea929 --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo.measures @@ -0,0 +1,3 @@ +ncloc:81 +ncloc_data:1=0;2=0;3=0;4=0;5=1;6=1;7=0;8=1;9=1;10=1;11=1;12=1;13=1;14=1;15=1;16=1;17=1;18=1;19=1;20=1;21=1;22=1;23=1;24=1;25=1;26=1;27=1;28=1;29=1;30=1;31=1;32=1;33=1;34=1;35=1;36=1;37=1;38=0;39=1;40=1;41=0;42=0;43=1;44=1;45=1;46=1;47=1;48=0;49=1;50=1;51=1;52=1;53=0;54=0;55=0;56=1;57=1;58=1;59=1;60=1;61=1;62=1;63=1;64=1;65=1;66=1;67=1;68=1;69=1;70=1;71=1;72=0;73=1;74=1;75=1;76=1;77=1;78=1;79=0;80=0;81=0; + diff --git a/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo.scm b/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo.scm new file mode 100644 index 00000000000..f3cf9706ffa --- /dev/null +++ b/it/it-projects/duplications/new-duplications-v2/src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo.scm @@ -0,0 +1,81 @@ +1,user1,2015-01-04 +1,user1,2015-01-04 +1,user1,2015-01-04 +1,user1,2015-01-04 +2,user2,2015-01-05 +2,user2,2015-01-05 +3,user3,2015-01-06 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +5,user4,2015-06-07 +4,user4,2015-01-07 +4,user4,2015-01-07 +4,user4,2015-01-07 diff --git a/it/it-tests/src/test/java/it/Category4Suite.java b/it/it-tests/src/test/java/it/Category4Suite.java index 915a1ed8395..d32ea11c17c 100644 --- a/it/it-tests/src/test/java/it/Category4Suite.java +++ b/it/it-tests/src/test/java/it/Category4Suite.java @@ -30,6 +30,7 @@ import it.dbCleaner.PurgeTest; import it.duplication.CrossProjectDuplicationsOnRemoveFileTest; import it.duplication.CrossProjectDuplicationsTest; import it.duplication.DuplicationsTest; +import it.duplication.NewDuplicationsTest; import it.http.HttpHeadersTest; import it.projectComparison.ProjectComparisonTest; import it.projectEvent.EventTest; @@ -77,6 +78,7 @@ import static util.ItUtils.xooPlugin; CrossProjectDuplicationsTest.class, CrossProjectDuplicationsOnRemoveFileTest.class, DuplicationsTest.class, + NewDuplicationsTest.class, // db cleaner PurgeTest.class, // project event @@ -122,5 +124,6 @@ public class Category4Suite { // Used by LogsTest .setServerProperty("sonar.web.accessLogs.pattern", LogsTest.ACCESS_LOGS_PATTERN) + .build(); } diff --git a/it/it-tests/src/test/java/it/duplication/DuplicationsTest.java b/it/it-tests/src/test/java/it/duplication/DuplicationsTest.java index 44d7c42ca96..c4c0f1acdc7 100644 --- a/it/it-tests/src/test/java/it/duplication/DuplicationsTest.java +++ b/it/it-tests/src/test/java/it/duplication/DuplicationsTest.java @@ -26,6 +26,7 @@ import com.sonar.orchestrator.selenium.Selenese; import it.Category4Suite; import java.util.List; import org.apache.commons.io.IOUtils; +import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; @@ -62,6 +63,11 @@ public class DuplicationsTest { analyzeProject(WITHOUT_ENOUGH_TOKENS); } + @AfterClass + public static void resetProperties() throws Exception { + setServerProperty(orchestrator, "sonar.cpd.xoo.minimumTokens", null); + } + @Test public void duplicated_lines_within_same_file() { verifyDuplicationMeasures(DUPLICATIONS + ":src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo", diff --git a/it/it-tests/src/test/java/it/duplication/NewDuplicationsTest.java b/it/it-tests/src/test/java/it/duplication/NewDuplicationsTest.java new file mode 100644 index 00000000000..65ea8831cc5 --- /dev/null +++ b/it/it-tests/src/test/java/it/duplication/NewDuplicationsTest.java @@ -0,0 +1,85 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program 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. + * + * This program 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.duplication; + +import com.sonar.orchestrator.Orchestrator; +import it.Category4Suite; +import org.assertj.core.data.Offset; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; +import org.sonar.wsclient.services.Resource; +import org.sonar.wsclient.services.ResourceQuery; + +import static org.assertj.core.api.Assertions.assertThat; +import static util.ItUtils.runProjectAnalysis; + +public class NewDuplicationsTest { + + static final Offset<Double> DEFAULT_OFFSET = Offset.offset(0.1d); + + @ClassRule + public static Orchestrator orchestrator = Category4Suite.ORCHESTRATOR; + + @BeforeClass + public static void analyzeProjects() { + orchestrator.resetData(); + + runProjectAnalysis(orchestrator, "duplications/new-duplications-v1", + "sonar.projectDate", "2015-02-01", + "sonar.scm.disabled", "false"); + runProjectAnalysis(orchestrator, "duplications/new-duplications-v2", + "sonar.scm.disabled", "false"); + } + + @Test + public void new_duplications_on_project() throws Exception { + Resource project = getComponent("new-duplications"); + assertThat(project.getMeasure("new_ncloc").getVariation1()).isEqualTo(75d, DEFAULT_OFFSET); + assertThat(project.getMeasure("new_duplicated_lines").getVariation1()).isEqualTo(71d, DEFAULT_OFFSET); + assertThat(project.getMeasure("new_duplicated_lines_density").getVariation1()).isEqualTo(94.7d, DEFAULT_OFFSET); + assertThat(project.getMeasure("new_duplicated_blocks").getVariation1()).isEqualTo(12d, DEFAULT_OFFSET); + } + + @Test + public void new_duplications_on_directory() throws Exception { + Resource project = getComponent("new-duplications:src/main/xoo/duplicated_lines_with_other_dir1"); + assertThat(project.getMeasure("new_ncloc").getVariation1()).isEqualTo(24d, DEFAULT_OFFSET); + assertThat(project.getMeasure("new_duplicated_lines").getVariation1()).isEqualTo(24d, DEFAULT_OFFSET); + assertThat(project.getMeasure("new_duplicated_lines_density").getVariation1()).isEqualTo(100d, DEFAULT_OFFSET); + assertThat(project.getMeasure("new_duplicated_blocks").getVariation1()).isEqualTo(7d, DEFAULT_OFFSET); + } + + @Test + public void new_duplications_on_file() throws Exception { + Resource project = getComponent("new-duplications:src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo"); + assertThat(project.getMeasure("new_ncloc").getVariation1()).isEqualTo(33d, DEFAULT_OFFSET); + assertThat(project.getMeasure("new_duplicated_lines").getVariation1()).isEqualTo(29d, DEFAULT_OFFSET); + assertThat(project.getMeasure("new_duplicated_lines_density").getVariation1()).isEqualTo(87.9d, DEFAULT_OFFSET); + assertThat(project.getMeasure("new_duplicated_blocks").getVariation1()).isEqualTo(2d, DEFAULT_OFFSET); + } + + private static Resource getComponent(String key) { + Resource component = orchestrator.getServer().getWsClient() + .find(ResourceQuery.createForMetrics(key, "new_ncloc", "new_duplicated_lines", "new_duplicated_lines_density", "new_duplicated_blocks").setIncludeTrends(true)); + assertThat(component).isNotNull(); + return component; + } +} |