diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-02-21 12:31:23 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-02-21 12:31:23 +0100 |
commit | 47f803be07c81dac2396f364deca15a2bb1fa7e8 (patch) | |
tree | 95a94de509eeb0def2aa3d17e03f88becb002f7d /plugins | |
parent | b27c50696631e0b9d4183a576e7c9783d5084ad7 (diff) | |
download | sonarqube-47f803be07c81dac2396f364deca15a2bb1fa7e8.tar.gz sonarqube-47f803be07c81dac2396f364deca15a2bb1fa7e8.zip |
Add ResourceDefinition#hasSourceCode
Diffstat (limited to 'plugins')
2 files changed, 41 insertions, 4 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/resources/DefaultResources.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/resources/DefaultResources.java index ab954783c3e..e2ae90b40bd 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/resources/DefaultResources.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/resources/DefaultResources.java @@ -19,6 +19,7 @@ */ package org.sonar.plugins.core.resources; +import org.sonar.api.BatchExtension; import org.sonar.api.ExtensionProvider; import org.sonar.api.ServerExtension; import org.sonar.api.resources.Qualifiers; @@ -27,7 +28,7 @@ import org.sonar.api.resources.ResourceDefinition; import java.util.Arrays; import java.util.List; -public class DefaultResources extends ExtensionProvider implements ServerExtension { +public class DefaultResources extends ExtensionProvider implements BatchExtension, ServerExtension { @Override public List<ResourceDefinition> provide() { @@ -38,9 +39,9 @@ public class DefaultResources extends ExtensionProvider implements ServerExtensi ResourceDefinition.builder(Qualifiers.MODULE).build(), ResourceDefinition.builder(Qualifiers.DIRECTORY).build(), ResourceDefinition.builder(Qualifiers.PACKAGE).build(), - ResourceDefinition.builder(Qualifiers.FILE).build(), - ResourceDefinition.builder(Qualifiers.CLASS).build(), - ResourceDefinition.builder(Qualifiers.UNIT_TEST_FILE).build(), + ResourceDefinition.builder(Qualifiers.FILE).hasSourceCode().build(), + ResourceDefinition.builder(Qualifiers.CLASS).hasSourceCode().build(), + ResourceDefinition.builder(Qualifiers.UNIT_TEST_FILE).hasSourceCode().build(), ResourceDefinition.builder(Qualifiers.LIBRARY).build()); } diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/resources/DefaultResourcesTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/resources/DefaultResourcesTest.java new file mode 100644 index 00000000000..3120c17d488 --- /dev/null +++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/resources/DefaultResourcesTest.java @@ -0,0 +1,36 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2012 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar 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. + * + * Sonar 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 Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.core.resources; + +import org.junit.Test; +import org.sonar.api.resources.ResourceDefinition; + +import java.util.List; + +import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertThat; + +public class DefaultResourcesTest { + @Test + public void provide() { + List<ResourceDefinition> defs = new DefaultResources().provide(); + assertThat(defs.isEmpty(), is(false)); + } +} |