diff options
author | David Gageot <david@gageot.net> | 2012-10-08 10:50:39 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-10-08 10:50:49 +0200 |
commit | abf9afb8e5bb3fc70665e315ebd8a18548cdf07c (patch) | |
tree | 60a0450a9aabe9580acee22be0f1f3dad50177b0 /sonar-plugin-api | |
parent | 05b4be07a5fe257e1286663718267cddc7b02ff6 (diff) | |
download | sonarqube-abf9afb8e5bb3fc70665e315ebd8a18548cdf07c.tar.gz sonarqube-abf9afb8e5bb3fc70665e315ebd8a18548cdf07c.zip |
SONAR-3758 Add logs and SONAR-1078 Fix default test exclusions
Diffstat (limited to 'sonar-plugin-api')
3 files changed, 8 insertions, 1 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java b/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java index 8bceb171ba2..05e6c192ae8 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java @@ -116,6 +116,7 @@ public interface CoreProperties { String PROJECT_TEST_EXCLUSIONS_PROPERTY = "sonar.test.exclusions"; String GLOBAL_EXCLUSIONS_PROPERTY = "sonar.global.exclusions"; String GLOBAL_TEST_EXCLUSIONS_PROPERTY = "sonar.global.test.exclusions"; + String GLOBAL_TEST_EXCLUSIONS_DEFAULT = "**/package-info.java"; /** * @deprecated since 2.5. See discussion from http://jira.codehaus.org/browse/SONAR-1873 diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java index 46871a2aca2..a7e8c7bd326 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java @@ -374,9 +374,14 @@ public class Project extends Resource { * @since 3.3 */ public String[] getTestExclusionPatterns() { + String[] globalTestExclusions = configuration.getStringArray(CoreProperties.GLOBAL_TEST_EXCLUSIONS_PROPERTY); + if (globalTestExclusions.length == 0) { + globalTestExclusions = new String[] {CoreProperties.GLOBAL_TEST_EXCLUSIONS_DEFAULT}; + } + return trimExclusions(ImmutableList.<String> builder() .add(configuration.getStringArray(CoreProperties.PROJECT_TEST_EXCLUSIONS_PROPERTY)) - .add(configuration.getStringArray(CoreProperties.GLOBAL_TEST_EXCLUSIONS_PROPERTY)).build()); + .add(globalTestExclusions).build()); } // http://jira.codehaus.org/browse/SONAR-2261 - exclusion must be trimmed diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/ProjectTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/ProjectTest.java index ae2d5151be7..81c3f209886 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/ProjectTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/resources/ProjectTest.java @@ -72,6 +72,7 @@ public class ProjectTest { Project project = new Project("key").setConfiguration(conf); assertThat(project.getExclusionPatterns()).isEmpty(); + assertThat(project.getTestExclusionPatterns()).containsOnly("**/package-info.java"); } @Test |