diff options
author | fmallet <freddy.mallet@gmail.com> | 2010-09-21 09:56:29 +0000 |
---|---|---|
committer | fmallet <freddy.mallet@gmail.com> | 2010-09-21 09:56:29 +0000 |
commit | 157d76eb67fb4cf519fe45d9d2e194b2c15e831b (patch) | |
tree | e901764bf182deffa12a194ddc0c89e6526373f9 /tests | |
parent | 2f41ded2cee6bcb6438eeaeee3d3178e45e8e8b9 (diff) | |
download | sonarqube-157d76eb67fb4cf519fe45d9d2e194b2c15e831b.tar.gz sonarqube-157d76eb67fb4cf519fe45d9d2e194b2c15e831b.zip |
Add IT test on PMD XPath rule
Diffstat (limited to 'tests')
4 files changed, 81 insertions, 2 deletions
diff --git a/tests/integration/pmd-extensions/pmd-extensions.xml b/tests/integration/pmd-extensions/pmd-extensions.xml index abafbd45832..066df234898 100644 --- a/tests/integration/pmd-extensions/pmd-extensions.xml +++ b/tests/integration/pmd-extensions/pmd-extensions.xml @@ -12,6 +12,20 @@ <name>Avoid if without using brace</name>
<configKey>rulesets/extensions.xml/AvoidIfWithoutBrace</configKey>
<category name="Usability"/>
- <description>éviter les if sans crochet.</description>
- </rule>
+ <description></description>
+ </rule> + <rule key="PreventUseOfEmptyClass" priority="MAJOR"> + <name><![CDATA[Prevent use of EmptyClass]]></name> + <configKey><![CDATA[net.sourceforge.pmd.rules.XPathRule]]></configKey> + <category name="Maintainability"/> + <description></description> + <param key="xpath" type="s"> + <description><![CDATA[XPath expressions.]]></description> + <defaultValue>//VariableDeclarator[../Type/ReferenceType/ClassOrInterfaceType[@Image='EmptyClass']]</defaultValue> + </param> + <param key="message" type="s"> + <description><![CDATA[Message to display when a violation occurs.]]></description> + <defaultValue>Prevent use of EmptyClass class</defaultValue> + </param> + </rule>
</rules>
\ No newline at end of file diff --git a/tests/integration/tests/src/it/integration-tests-backup.xml b/tests/integration/tests/src/it/integration-tests-backup.xml index 4dff7f53226..81f1f8876da 100644 --- a/tests/integration/tests/src/it/integration-tests-backup.xml +++ b/tests/integration/tests/src/it/integration-tests-backup.xml @@ -1891,6 +1891,21 @@ <plugin><![CDATA[findbugs]]></plugin> <level><![CDATA[ERROR]]></level> </active-rule> + <active-rule> + <key><![CDATA[PreventUseOfEmptyClass]]></key> + <plugin><![CDATA[pmd]]></plugin> + <level><![CDATA[INFO]]></level> + <params> + <param> + <key><![CDATA[xpath]]></key> + <value><![CDATA[//VariableDeclarator[../Type/ReferenceType/ClassOrInterfaceType[@Image='EmptyClass']]]]></value> + </param> + <param> + <key><![CDATA[message]]></key> + <value><![CDATA[Prevent use of EmptyClass class]]></value> + </param> + </params> + </active-rule> </active-rules> <alerts> <alert> diff --git a/tests/integration/tests/src/it/selenium/all-tests.html b/tests/integration/tests/src/it/selenium/all-tests.html index 6b1622ad191..de37eb08bb0 100644 --- a/tests/integration/tests/src/it/selenium/all-tests.html +++ b/tests/integration/tests/src/it/selenium/all-tests.html @@ -441,6 +441,9 @@ <td><a href="rules/check_rules_extensions.html">rules/check_rules_extensions</a></td> </tr> <tr> + <td><a href="rules/pmd_xpath_rule_extension.html">rules/pmd_xpath_rule_extension</a></td> +</tr> +<tr> <td><a href="rules/copy_a_provided_profile_and_modify_a_rule_param.html">rules/copy_a_provided_profile_and_modify_a_rule_param</a> </td> </tr> diff --git a/tests/integration/tests/src/it/selenium/rules/pmd_xpath_rule_extension.html b/tests/integration/tests/src/it/selenium/rules/pmd_xpath_rule_extension.html new file mode 100644 index 00000000000..9bb23ff9f86 --- /dev/null +++ b/tests/integration/tests/src/it/selenium/rules/pmd_xpath_rule_extension.html @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="" /> +<title>pmd_xpath_rule_extension</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">pmd_xpath_rule_extension</td></tr> +</thead><tbody> +<tr> + <td>store</td> + <td>Methods Count Check</td> + <td>CHECKSTYLE_EXTENSION</td> +</tr> +<tr> + <td>store</td> + <td>org.sonar.tests:reference</td> + <td>PROJECT_ID</td> +</tr> +<tr> + <td>store</td> + <td>Prevent use of EmptyClass</td> + <td>RULE_TITLE</td> +</tr> +<tr> + <td>open</td> + <td>/drilldown/violations/${PROJECT_ID}</td> + <td></td> +</tr> +<tr> + <td>clickAndWait</td> + <td>link=${RULE_TITLE}</td> + <td></td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>InterfaceWithConstants</td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> |