From: Fabrice Bellingard Date: Thu, 6 Sep 2012 09:18:18 +0000 (+0200) Subject: SONARPLUGINS-2203 Improve tests X-Git-Tag: 2.5-rc1~276 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=84cf7f1fb4491a955dcd6b4e10a9510f06666db8;p=sonar-scanner-cli.git SONARPLUGINS-2203 Improve tests --- diff --git a/src/test/java/org/sonar/runner/model/SonarProjectBuilderTest.java b/src/test/java/org/sonar/runner/model/SonarProjectBuilderTest.java index fe22db6..d27e88c 100644 --- a/src/test/java/org/sonar/runner/model/SonarProjectBuilderTest.java +++ b/src/test/java/org/sonar/runner/model/SonarProjectBuilderTest.java @@ -56,6 +56,18 @@ public class SonarProjectBuilderTest { TestUtils.getResource(this.getClass(), "simple-project/libs/lib2.txt").getAbsolutePath()); } + @Test + public void shouldDefineSimpleProjectWithDeprecatedProperties() throws IOException { + ProjectDefinition projectDefinition = loadProjectDefinition("simple-project-with-deprecated-props"); + + assertThat(projectDefinition.getSourceDirs()).contains("sources"); + assertThat(projectDefinition.getTestDirs()).contains("tests"); + assertThat(projectDefinition.getBinaries()).contains("target/classes"); + assertThat(projectDefinition.getLibraries()).contains( + TestUtils.getResource(this.getClass(), "simple-project-with-deprecated-props/libs/lib2.txt").getAbsolutePath(), + TestUtils.getResource(this.getClass(), "simple-project-with-deprecated-props/libs/lib2.txt").getAbsolutePath()); + } + @Test public void shouldFailIfUnexistingSourceDirectory() throws IOException { thrown.expect(RunnerException.class); diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-file/sonar-project.properties b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-file/sonar-project.properties index 4c655a7..782fd4e 100644 --- a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-file/sonar-project.properties +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-file/sonar-project.properties @@ -3,9 +3,9 @@ sonar.projectName=Foo Project sonar.projectVersion=1.0-SNAPSHOT sonar.projectDescription=Description of Foo Project -sources=sources -tests=tests -binaries=target/classes +sonar.sources=sources +sonar.tests=tests +sonar.binaries=target/classes sonar.modules=module1 diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-path/sonar-project.properties b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-path/sonar-project.properties index 202de2e..ce5fa00 100644 --- a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-path/sonar-project.properties +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-path/sonar-project.properties @@ -3,9 +3,9 @@ sonar.projectName=Foo Project sonar.projectVersion=1.0-SNAPSHOT sonar.projectDescription=Description of Foo Project -sources=sources -tests=tests -binaries=target/classes +sonar.sources=sources +sonar.tests=tests +sonar.binaries=target/classes sonar.modules=module1 diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-unexisting-basedir/sonar-project.properties b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-unexisting-basedir/sonar-project.properties index 7249f0a..67fbf34 100644 --- a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-unexisting-basedir/sonar-project.properties +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-unexisting-basedir/sonar-project.properties @@ -3,9 +3,9 @@ sonar.projectName=Foo Project sonar.projectVersion=1.0-SNAPSHOT sonar.projectDescription=Description of Foo Project -sources=sources -tests=tests -binaries=target/classes +sonar.sources=sources +sonar.tests=tests +sonar.binaries=target/classes sonar.modules=module1 diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-unexisting-file/sonar-project.properties b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-unexisting-file/sonar-project.properties index 4c655a7..782fd4e 100644 --- a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-unexisting-file/sonar-project.properties +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-unexisting-file/sonar-project.properties @@ -3,9 +3,9 @@ sonar.projectName=Foo Project sonar.projectVersion=1.0-SNAPSHOT sonar.projectDescription=Description of Foo Project -sources=sources -tests=tests -binaries=target/classes +sonar.sources=sources +sonar.tests=tests +sonar.binaries=target/classes sonar.modules=module1 diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module/sonar-project.properties b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module/sonar-project.properties index 96eb03d..4e29926 100644 --- a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module/sonar-project.properties +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module/sonar-project.properties @@ -3,9 +3,9 @@ sonar.projectName=Foo Project sonar.projectVersion=1.0-SNAPSHOT sonar.projectDescription=Description of Foo Project -sources=sources -tests=tests -binaries=target/classes +sonar.sources=sources +sonar.tests=tests +sonar.binaries=target/classes sonar.modules=module1,\ module2 @@ -17,4 +17,4 @@ module2.sonar.projectKey=com.foo.project.module2 module2.sonar.projectName=Foo Module 2 # redefine some properties module2.sonar.projectDescription=Description of Module 2 -module2.sources=src +module2.sonar.sources=src diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/libs/lib1.txt b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/libs/lib1.txt new file mode 100644 index 0000000..81d4e95 --- /dev/null +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/libs/lib1.txt @@ -0,0 +1 @@ +lib1 \ No newline at end of file diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/libs/lib2.txt b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/libs/lib2.txt new file mode 100644 index 0000000..7dacac0 --- /dev/null +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/libs/lib2.txt @@ -0,0 +1 @@ +lib2 \ No newline at end of file diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/sonar-project.properties b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/sonar-project.properties new file mode 100644 index 0000000..acf3c83 --- /dev/null +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/sonar-project.properties @@ -0,0 +1,10 @@ +sonar.projectKey=com.foo.project +sonar.projectName=Foo Project +sonar.projectVersion=1.0-SNAPSHOT +sonar.projectDescription=Description of Foo Project + +# Those are the deprecated properties +sources=sources +tests=tests +binaries=target/classes +libraries=libs/*.txt diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/sources/Fake.java b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/sources/Fake.java new file mode 100644 index 0000000..5967658 --- /dev/null +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/sources/Fake.java @@ -0,0 +1 @@ +Fake \ No newline at end of file diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-unexisting-source-dir/sonar-project.properties b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-unexisting-source-dir/sonar-project.properties index 3ce2bb0..0b83b11 100644 --- a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-unexisting-source-dir/sonar-project.properties +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-unexisting-source-dir/sonar-project.properties @@ -3,4 +3,4 @@ sonar.projectName=Foo Project sonar.projectVersion=1.0-SNAPSHOT sonar.projectDescription=Description of Foo Project -sources=unexisting-source-dir +sonar.sources=unexisting-source-dir diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project/sonar-project.properties b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project/sonar-project.properties index 81bdf16..ea8a1b5 100644 --- a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project/sonar-project.properties +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project/sonar-project.properties @@ -3,7 +3,7 @@ sonar.projectName=Foo Project sonar.projectVersion=1.0-SNAPSHOT sonar.projectDescription=Description of Foo Project -sources=sources -tests=tests -binaries=target/classes -libraries=libs/*.txt +sonar.sources=sources +sonar.tests=tests +sonar.binaries=target/classes +sonar.libraries=libs/*.txt