diff options
author | David Gageot <david@gageot.net> | 2012-07-06 13:39:45 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-07-06 13:39:45 +0200 |
commit | d4fe52e57da960412135997a10a875a009af4a75 (patch) | |
tree | d9e23b3bf0cae4410ead00bfbd9b1652a9a92eb6 /plugins/sonar-pmd-plugin | |
parent | 35ac8c8e18298c50898805e6610ddeddb9f3e173 (diff) | |
download | sonarqube-d4fe52e57da960412135997a10a875a009af4a75.tar.gz sonarqube-d4fe52e57da960412135997a10a875a009af4a75.zip |
SONAR-1995 Use TEXT input for xpath expression in XPath Rule
Diffstat (limited to 'plugins/sonar-pmd-plugin')
-rw-r--r-- | plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/rules.xml | 2 | ||||
-rw-r--r-- | plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdRuleRepositoryTest.java | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/rules.xml b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/rules.xml index 961239cadef..3bea66d4808 100644 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/rules.xml +++ b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/rules.xml @@ -1814,7 +1814,7 @@ <cardinality>MULTIPLE</cardinality> - <param key="xpath" type="s"> + <param key="xpath" type="TEXT"> </param> <param key="message" type="s"> diff --git a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdRuleRepositoryTest.java b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdRuleRepositoryTest.java index 036f5b48743..30113aa0764 100644 --- a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdRuleRepositoryTest.java +++ b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdRuleRepositoryTest.java @@ -19,8 +19,11 @@ */ package org.sonar.plugins.pmd; +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; import org.junit.Before; import org.junit.Test; +import org.sonar.api.PropertyType; import org.sonar.api.platform.ServerFileSystem; import org.sonar.api.rules.Rule; import org.sonar.api.rules.XMLRuleParser; @@ -77,6 +80,17 @@ public class PmdRuleRepositoryTest { } @Test + public void should_use_text_parameter_for_xpath_rule() { + Rule xpathRule = Iterables.find(repository.createRules(), new Predicate<Rule>() { + public boolean apply(Rule rule) { + return rule.getKey().equals("XPathRule"); + } + }); + + assertThat(xpathRule.getParam("xpath").getType()).isEqualTo(PropertyType.TEXT.name()); + } + + @Test public void should_provide_a_name_and_description_for_each_rule() { List<Rule> rules = RuleRepositoryTestHelper.createRulesWithNameAndDescription("pmd", repository); |