Author: michaelo
Date: Sun Nov 30 10:14:35 2014
New Revision: 1642534
URL: http://svn.apache.org/r1642534
Log:
[MPMD-171] Rule properties are ignored when run under MPMD
Already fixed implicitly by a PMD upgrade. Unit test for this issue.
Contributed-by: Andreas Dangel
Modified:
maven/plugins/trunk/maven-pmd-plugin/src/test/java/org/apache/maven/plugin/pmd/PmdReportTest.java
maven/plugins/trunk/maven-pmd-plugin/src/test/resources/unit/custom-configuration/custom/configuration/App.java
maven/plugins/trunk/maven-pmd-plugin/src/test/resources/unit/custom-configuration/resources/rulesets/custom.xml
Modified:
maven/plugins/trunk/maven-pmd-plugin/src/test/java/org/apache/maven/plugin/pmd/PmdReportTest.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/test/java/org/apache/maven/plugin/pmd/PmdReportTest.java?rev=1642534&r1=1642533&r2=1642534&view=diff
==============================================================================
---
maven/plugins/trunk/maven-pmd-plugin/src/test/java/org/apache/maven/plugin/pmd/PmdReportTest.java
(original)
+++
maven/plugins/trunk/maven-pmd-plugin/src/test/java/org/apache/maven/plugin/pmd/PmdReportTest.java
Sun Nov 30 10:14:35 2014
@@ -198,6 +198,10 @@ public class PmdReportTest
assertTrue( "unnecessary constructor should not be triggered because
of low priority",
!str.toLowerCase().contains("Avoid unnecessary constructors -
the compiler will generate these for you".toLowerCase()));
+ // veryLongVariableNameWithViolation is really too long
+ assertTrue( str.toLowerCase().contains(
"veryLongVariableNameWithViolation".toLowerCase() ) );
+ // notSoLongVariableName should not be reported
+ assertFalse( str.toLowerCase().contains(
"notSoLongVariableName".toLowerCase() ) );
}
/**
Modified:
maven/plugins/trunk/maven-pmd-plugin/src/test/resources/unit/custom-configuration/custom/configuration/App.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/test/resources/unit/custom-configuration/custom/configuration/App.java?rev=1642534&r1=1642533&r2=1642534&view=diff
==============================================================================
---
maven/plugins/trunk/maven-pmd-plugin/src/test/resources/unit/custom-configuration/custom/configuration/App.java
(original)
+++
maven/plugins/trunk/maven-pmd-plugin/src/test/resources/unit/custom-configuration/custom/configuration/App.java
Sun Nov 30 10:14:35 2014
@@ -65,6 +65,10 @@ public class App
public void testMethod( String unusedParam1, String unusedParam2 )
{
System.out.println( "Test method" );
+ String notSoLongVariableName = "a"; // just 21 characters, but
threshold is 25 characters
+ String veryLongVariableNameWithViolation = "a"; // more than 25
characters
+ // so that the two variables are not reported as unused
+ System.out.println( notSoLongVariableName +
veryLongVariableNameWithViolation );
}
}
Modified:
maven/plugins/trunk/maven-pmd-plugin/src/test/resources/unit/custom-configuration/resources/rulesets/custom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/test/resources/unit/custom-configuration/resources/rulesets/custom.xml?rev=1642534&r1=1642533&r2=1642534&view=diff
==============================================================================
---
maven/plugins/trunk/maven-pmd-plugin/src/test/resources/unit/custom-configuration/resources/rulesets/custom.xml
(original)
+++
maven/plugins/trunk/maven-pmd-plugin/src/test/resources/unit/custom-configuration/resources/rulesets/custom.xml
Sun Nov 30 10:14:35 2014
@@ -31,5 +31,11 @@ under the License.
<rule ref="rulesets/java/controversial.xml/UnnecessaryConstructor" >
<priority>5</priority>
</rule>
+
+ <rule ref="rulesets/java/naming.xml/LongVariable">
+ <properties>
+ <property name="minimum" value="25"/>
+ </properties>
+ </rule>
</ruleset>