PMD 5.0 conversion of eclipse plugin

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@6608 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Xavier Le Vourch
2008-10-14 03:38:06 +00:00
parent e4f4eea21d
commit b4c3780441
9 changed files with 99 additions and 97 deletions

@ -1,12 +1,12 @@
#Tue Nov 13 14:44:42 PST 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.4
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
org.eclipse.jdt.core.compiler.source=1.4
org.eclipse.jdt.core.compiler.source=1.5

@ -7,7 +7,7 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
@ -20,7 +20,7 @@
* * Neither the name of "PMD for Eclipse Development Team" nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
@ -57,15 +57,15 @@ import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
/**
* This is a utility classe for Eclipse various operations
*
* This is a utility class for Eclipse various operations
*
* @author Philippe Herlin
*
*
*/
public class EclipseUtils {
/**
* Because this class is a utility class, it cannot be instanciated
* Because this class is a utility class, it cannot be instantiated
*/
private EclipseUtils() {
super();
@ -73,7 +73,7 @@ public class EclipseUtils {
/**
* Create a new java project
*
*
* @param projectName a project name
* @return newProject a new project resource handle
*/
@ -99,7 +99,7 @@ public class EclipseUtils {
/**
* Create a test source file
*
*
* @param project a project where to create that file; this project is
* expected to be empty
*/
@ -123,7 +123,7 @@ public class EclipseUtils {
/**
* Get the content of a project resource.
*
*
* @param project a project reference
* @param resourceName the name of the resource (@see IProject)
* @return the resource content as an InputStream or null
@ -131,12 +131,12 @@ public class EclipseUtils {
*/
public static InputStream getResourceStream(IProject project, String resourceName) throws CoreException {
IFile file = project.getFile(resourceName);
return (file != null) && file.exists() && file.isAccessible() ? file.getContents(true) : null;
return file != null && file.exists() && file.isAccessible() ? file.getContents(true) : null;
}
/**
* Remove the PMD Nature from a project
*
*
* @param project a project to remove the PMD Nature
* @param monitor a progress monitor
* @return success true if the nature has been removed; false means the
@ -170,24 +170,24 @@ public class EclipseUtils {
/**
* Test if 2 sets of rules are equals
*
*
* @param ruleSet1
* @param ruleSet2
* @return
*/
public static boolean assertRuleSetEquals(Collection ruleSet1, Collection ruleSet2) {
public static boolean assertRuleSetEquals(Collection<Rule> ruleSet1, Collection<Rule> ruleSet2) {
boolean equals = true;
for (Iterator i = ruleSet1.iterator(); i.hasNext() && equals;) {
Rule rule = (Rule) i.next();
for (Iterator<Rule> i = ruleSet1.iterator(); i.hasNext() && equals;) {
Rule rule = i.next();
if (!searchRule(rule, ruleSet2)) {
equals = false;
System.out.println("Rule " + rule.getName() + " is not in the second ruleset");
}
}
for (Iterator i = ruleSet2.iterator(); i.hasNext() && equals;) {
Rule rule = (Rule) i.next();
for (Iterator<Rule> i = ruleSet2.iterator(); i.hasNext() && equals;) {
Rule rule = i.next();
if (!searchRule(rule, ruleSet1)) {
equals = false;
System.out.println("Rule " + rule.getName() + " is not in the first ruleset");
@ -199,7 +199,7 @@ public class EclipseUtils {
/**
* Add a Java Nature to a project when creating
*
*
* @param project
* @throws CoreException
*/
@ -217,20 +217,20 @@ public class EclipseUtils {
/**
* Search a rule in a set of rules
*
*
* @param rule
* @param set
* @return
*/
private static boolean searchRule(Rule rule, Collection set) {
private static boolean searchRule(Rule rule, Collection<Rule> set) {
boolean found = false;
for (Iterator i = set.iterator(); i.hasNext() && !found;) {
Rule r = (Rule) i.next();
for (Iterator<Rule> i = set.iterator(); i.hasNext() && !found;) {
Rule r = i.next();
if (r.getClass().getName().equals(rule.getClass().getName())) {
found = r.getName().equals(rule.getName()) && r.getProperties().equals(rule.getProperties())
&& (r.getPriority() == rule.getPriority());
if ((!found) && (r.getName().equals(rule.getName()))) {
&& r.getPriority() == rule.getPriority();
if (!found && r.getName().equals(rule.getName())) {
System.out.println("Rules " + r.getName() + " are different because:");
System.out.println("Priorities are different: " + (r.getPriority() != rule.getPriority()));
System.out.println("Properties are different: " + !r.getProperties().equals(rule.getProperties()));
@ -250,16 +250,15 @@ public class EclipseUtils {
/**
* Print rule details
*
*
* @param rule
*/
private static void dumpRule(Rule rule) {
System.out.println("Rule: " + rule.getName());
System.out.println("Priority: " + rule.getPriority());
Properties p = rule.getProperties();
Set keys = p.keySet();
for (Iterator i = keys.iterator(); i.hasNext();) {
String key = (String) i.next();
Set<String> keys = p.keySet();
for (String key : keys) {
System.out.println(" " + key + " = " + p.getProperty(key));
}
}

@ -79,11 +79,11 @@ public class PMDCorePluginTest extends TestCase {
/**
* Test all the known PMD rulesets has been registered For this test to
* work, no fragement or only the test plugin fragment should be installed.
* work, no fragment or only the test plugin fragment should be installed.
*
*/
public void testStandardPMDRuleSetsRegistered() throws RuleSetNotFoundException {
Set registeredRuleSets = PMDPlugin.getDefault().getRuleSetManager().getRegisteredRuleSets();
Set<RuleSet> registeredRuleSets = PMDPlugin.getDefault().getRuleSetManager().getRegisteredRuleSets();
assertFalse("No registered rulesets!", registeredRuleSets.isEmpty());
RuleSetFactory factory = new RuleSetFactory();
@ -96,11 +96,11 @@ public class PMDCorePluginTest extends TestCase {
/**
* Test the default rulesets has been registered For this test to work, no
* fragement or only the test plugin fragment should be installed.
* Fragment or only the test plugin fragment should be installed.
*
*/
public void testDefaultPMDRuleSetsRegistered() throws RuleSetNotFoundException {
Set defaultRuleSets = PMDPlugin.getDefault().getRuleSetManager().getRegisteredRuleSets();
Set<RuleSet> defaultRuleSets = PMDPlugin.getDefault().getRuleSetManager().getRegisteredRuleSets();
assertFalse("No registered default rulesets!", defaultRuleSets.isEmpty());
RuleSetFactory factory = new RuleSetFactory();
@ -116,14 +116,14 @@ public class PMDCorePluginTest extends TestCase {
*
* @param ruleSet
* @param set
* @return true if ok
* @return true if OK
*/
private boolean ruleSetRegistered(RuleSet ruleSet, Set set) {
private boolean ruleSetRegistered(RuleSet ruleSet, Set<RuleSet> set) {
boolean registered = false;
Iterator i = set.iterator();
Iterator<RuleSet> i = set.iterator();
while (i.hasNext() && !registered) {
RuleSet registeredRuleSet = (RuleSet) i.next();
RuleSet registeredRuleSet = i.next();
registered = registeredRuleSet.getName().equals(ruleSet.getName());
}

@ -7,7 +7,7 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
@ -20,7 +20,7 @@
* * Neither the name of "PMD for Eclipse Development Team" nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
@ -46,19 +46,19 @@ import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
/**
* Test the ruleset extension
*
*
* @author Philippe Herlin
*
*
*/
public class RuleSetsExtensionProcessorTest extends TestCase {
/**
* Tests the additional rulesets has been registered. For this test to work,
* the test plugin fragment must be installed.
*
*
*/
public void testAdditionalRuleSetsRegistered() throws RuleSetNotFoundException {
Set registeredRuleSets = PMDPlugin.getDefault().getRuleSetManager().getRegisteredRuleSets();
Set<RuleSet> registeredRuleSets = PMDPlugin.getDefault().getRuleSetManager().getRegisteredRuleSets();
assertFalse("No registered rulesets!", registeredRuleSets.isEmpty());
RuleSetFactory factory = new RuleSetFactory();
@ -72,10 +72,10 @@ public class RuleSetsExtensionProcessorTest extends TestCase {
/**
* Tests the additional default rulesets has been registered. For this test
* to work, the test plugin fragment must be installed.
*
*
*/
public void testAdditionalDefaultRuleSetsRegistered() throws RuleSetNotFoundException {
Set registeredRuleSets = PMDPlugin.getDefault().getRuleSetManager().getDefaultRuleSets();
Set<RuleSet> registeredRuleSets = PMDPlugin.getDefault().getRuleSetManager().getDefaultRuleSets();
assertFalse("No registered default rulesets!", registeredRuleSets.isEmpty());
RuleSetFactory factory = new RuleSetFactory();
@ -88,17 +88,17 @@ public class RuleSetsExtensionProcessorTest extends TestCase {
/**
* test if a ruleset is registered
*
*
* @param ruleSet
* @param set
* @return true if ok
* @return true if OK
*/
private boolean ruleSetRegistered(RuleSet ruleSet, Set set) {
private boolean ruleSetRegistered(RuleSet ruleSet, Set<RuleSet> set) {
boolean registered = false;
Iterator i = set.iterator();
Iterator<RuleSet> i = set.iterator();
while (i.hasNext() && !registered) {
RuleSet registeredRuleSet = (RuleSet) i.next();
RuleSet registeredRuleSet = i.next();
registered = registeredRuleSet.getName().equals(ruleSet.getName());
}

@ -43,7 +43,6 @@ import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import junit.framework.TestCase;
@ -73,8 +72,8 @@ public class RuleSetsManagerImplTest extends TestCase {
IRuleSetsManager rsm = new RuleSetsManagerImpl();
RuleSet ruleSet = rsm.valueOf(new String[] { "rulesets/basic.xml" });
Collection pmdRules = ruleSet.getPmdRuleSet().getRules();
Collection basicRules = new RuleSetFactory().createSingleRuleSet("rulesets/basic.xml").getRules();
Collection<Rule> pmdRules = ruleSet.getPmdRuleSet().getRules();
Collection<Rule> basicRules = new RuleSetFactory().createSingleRuleSet("rulesets/basic.xml").getRules();
// dump("PMD Rules", pmdRules);
// dump("Basic Rules", basicRules);
@ -95,7 +94,7 @@ public class RuleSetsManagerImplTest extends TestCase {
RuleSet ruleSet = rsm.valueOf(null);
fail("Getting a rule set from a null array is not allowed");
} catch (IllegalArgumentException e) {
// Sucess
// Success
}
}
@ -141,7 +140,7 @@ public class RuleSetsManagerImplTest extends TestCase {
ruleSet.setName("basic");
ruleSet.setLanguage(RuleSet.LANGUAGE_JAVA);
List ruleSetsList = new ArrayList();
List<RuleSet> ruleSetsList = new ArrayList<RuleSet>();
ruleSetsList.add(ruleSet);
RuleSets ruleSets = new RuleSets();
@ -170,10 +169,9 @@ public class RuleSetsManagerImplTest extends TestCase {
* @param message
* @param rules
*/
private void dump(String message, Collection rules) {
private void dump(String message, Collection<Rule> rules) {
System.out.println("Dump " + message);
for (Iterator i = rules.iterator(); i.hasNext();) {
Rule rule = (Rule) i.next();
for (Rule rule : rules) {
System.out.println(rule.getName());
}
System.out.println();

@ -7,7 +7,7 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
@ -20,7 +20,7 @@
* * Neither the name of "PMD for Eclipse Development Team" nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
@ -44,7 +44,7 @@ import net.sourceforge.pmd.RuleSetFactory;
import net.sourceforge.pmd.RuleSetNotFoundException;
/**
*
*
* @author Herlin
*
*/
@ -52,25 +52,25 @@ import net.sourceforge.pmd.RuleSetNotFoundException;
public class TestManager {
private static RuleSet basicRuleSet;
private static Rule[] rules;
public static Rule getRule(int i) throws RuleSetNotFoundException {
if (rules == null) {
getRuleSet();
}
return rules[i];
}
public static RuleSet getRuleSet() throws RuleSetNotFoundException {
if (basicRuleSet == null) {
basicRuleSet = new RuleSetFactory().createSingleRuleSet("rulesets/basic.xml");
Iterator i = getRuleSet().getRules().iterator();
Iterator<Rule> i = getRuleSet().getRules().iterator();
rules = new Rule[4];
for (int j = 0; j < 4; j++) {
rules[j] = (Rule) i.next();
rules[j] = i.next();
}
}
return basicRuleSet;
}

@ -36,13 +36,14 @@
package net.sourceforge.pmd.eclipse.runtime.cmd;
import java.io.InputStream;
import java.util.Properties;
import junit.framework.TestCase;
import name.herlin.command.CommandException;
import name.herlin.command.UnsetInputPropertiesException;
import net.sourceforge.pmd.eclipse.EclipseUtils;
import net.sourceforge.pmd.renderers.HTMLRenderer;
import net.sourceforge.pmd.eclipse.runtime.PMDRuntimeConstants;
import net.sourceforge.pmd.renderers.HTMLRenderer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@ -50,7 +51,6 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
/**
* Test the report rendering
*
@ -80,7 +80,7 @@ public class RenderReportCmdTest extends TestCase {
RenderReportCmd cmd = new RenderReportCmd();
cmd.setProject(this.testProject);
cmd.registerRenderer(new HTMLRenderer(), PMDRuntimeConstants.HTML_REPORT_NAME);
cmd.registerRenderer(new HTMLRenderer(new Properties()), PMDRuntimeConstants.HTML_REPORT_NAME);
cmd.performExecute();
cmd.join();
@ -110,7 +110,7 @@ public class RenderReportCmdTest extends TestCase {
try {
RenderReportCmd cmd = new RenderReportCmd();
cmd.setProject(null);
cmd.registerRenderer(new HTMLRenderer(), PMDRuntimeConstants.HTML_REPORT_NAME);
cmd.registerRenderer(new HTMLRenderer(new Properties()), PMDRuntimeConstants.HTML_REPORT_NAME);
cmd.performExecute();
fail();
} catch (UnsetInputPropertiesException e) {
@ -144,7 +144,7 @@ public class RenderReportCmdTest extends TestCase {
try {
RenderReportCmd cmd = new RenderReportCmd();
cmd.setProject(this.testProject);
cmd.registerRenderer(new HTMLRenderer(), null);
cmd.registerRenderer(new HTMLRenderer(new Properties()), null);
cmd.performExecute();
fail();
} catch (UnsetInputPropertiesException e) {
@ -178,7 +178,7 @@ public class RenderReportCmdTest extends TestCase {
try {
RenderReportCmd cmd = new RenderReportCmd();
cmd.setProject(null);
cmd.registerRenderer(new HTMLRenderer(), null);
cmd.registerRenderer(new HTMLRenderer(new Properties()), null);
cmd.performExecute();
fail();
} catch (UnsetInputPropertiesException e) {
@ -223,6 +223,7 @@ public class RenderReportCmdTest extends TestCase {
/**
* @see junit.framework.TestCase#setUp()
*/
@Override
protected void setUp() throws Exception {
super.setUp();
@ -242,6 +243,7 @@ public class RenderReportCmdTest extends TestCase {
/**
* @see junit.framework.TestCase#tearDown()
*/
@Override
protected void tearDown() throws Exception {
if (this.testProject != null) {
if (this.testProject.exists() && this.testProject.isAccessible()) {

@ -7,7 +7,7 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
@ -20,7 +20,7 @@
* * Neither the name of "PMD for Eclipse Development Team" nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
@ -37,12 +37,12 @@ package net.sourceforge.pmd.eclipse.runtime.cmd;
import java.io.InputStream;
import java.util.Map;
import java.util.Set;
import junit.framework.TestCase;
import name.herlin.command.CommandException;
import name.herlin.command.UnsetInputPropertiesException;
import net.sourceforge.pmd.eclipse.EclipseUtils;
import net.sourceforge.pmd.eclipse.runtime.cmd.ReviewCodeCmd;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@ -51,16 +51,16 @@ import org.eclipse.core.runtime.CoreException;
/**
* This tests the PMD Processor command
*
*
* @author Philippe Herlin
*
*
*/
public class ReviewCmdTest extends TestCase {
private IProject testProject;
/**
* Test case constructor
*
*
* @param name
* of the test case
*/
@ -70,22 +70,22 @@ public class ReviewCmdTest extends TestCase {
/**
* Test the basic usage of the processor command
*
*
*/
public void testReviewCmdBasic() throws CommandException, CoreException {
ReviewCodeCmd cmd = new ReviewCodeCmd();
cmd.addResource(this.testProject);
cmd.performExecute();
cmd.join();
Map markers = cmd.getMarkers();
Map<IFile, Set<MarkerInfo>> markers = cmd.getMarkers();
// We do not test PMD, only a non-empty report is enough
assertNotNull(markers);
assertTrue("Report size = " + markers.size(), markers.size() > 0);
}
/**
* The ReviewCodeCmd must also work on a ResourceDelta
* The ReviewCodeCmd must also work on a ResourceDelta
* @throws CommandException
*/
public void testReviewCmdDelta() throws CommandException {
@ -93,7 +93,7 @@ public class ReviewCmdTest extends TestCase {
// How to instantiate a ResourceDelta ?
// Let's comment for now
}
/**
* Normally a null resource and a null resource delta is not acceptable.
* @throws CommandException
@ -111,16 +111,17 @@ public class ReviewCmdTest extends TestCase {
; // cool, success
}
}
/**
* @see junit.framework.TestCase#setUp()
*/
@Override
protected void setUp() throws Exception {
super.setUp();
// 1. Create a Java project
this.testProject = EclipseUtils.createJavaProject("PMDTestProject");
assertTrue("A test project cannot be created; the tests cannot be performed.", (this.testProject != null)
assertTrue("A test project cannot be created; the tests cannot be performed.", this.testProject != null
&& this.testProject.exists() && this.testProject.isAccessible());
// 2. Create a test source file inside that project
@ -134,6 +135,7 @@ public class ReviewCmdTest extends TestCase {
/**
* @see junit.framework.TestCase#tearDown()
*/
@Override
protected void tearDown() throws Exception {
try {
if (this.testProject != null) {

@ -39,7 +39,6 @@ import java.util.Iterator;
import java.util.Set;
import junit.framework.TestCase;
import net.sourceforge.pmd.AbstractJavaRule;
import net.sourceforge.pmd.Rule;
import net.sourceforge.pmd.RuleSet;
import net.sourceforge.pmd.RuleSetFactory;
@ -48,6 +47,7 @@ import net.sourceforge.pmd.eclipse.EclipseUtils;
import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
import net.sourceforge.pmd.eclipse.runtime.builder.PMDNature;
import net.sourceforge.pmd.eclipse.runtime.preferences.IPreferencesManager;
import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@ -194,6 +194,7 @@ public class ProjectPropertiesModelTest extends TestCase {
// 2. add a rule to the plugin rule set
Rule myRule = new AbstractJavaRule() {
@Override
public String getName() {
return "MyRule";
}
@ -230,8 +231,8 @@ public class ProjectPropertiesModelTest extends TestCase {
// 2. remove the first rule (keep its name for assertion)
RuleSet newRuleSet = new RuleSet();
newRuleSet.addRuleSet(projectRuleSet);
Iterator i = newRuleSet.getRules().iterator();
Rule removedRule = (Rule) i.next();
Iterator<Rule> i = newRuleSet.getRules().iterator();
Rule removedRule = i.next();
i.remove();
model.setProjectRuleSet(newRuleSet);
@ -378,6 +379,7 @@ public class ProjectPropertiesModelTest extends TestCase {
/**
* @see junit.framework.TestCase#setUp()
*/
@Override
protected void setUp() throws Exception {
super.setUp();
@ -389,15 +391,16 @@ public class ProjectPropertiesModelTest extends TestCase {
// 2. Keep the plugin ruleset
this.initialPluginRuleSet = PMDPlugin.getDefault().getPreferencesManager().getRuleSet();
this.initialPluginRuleSet.getRules().clear();
Set defaultRuleSets = PMDPlugin.getDefault().getRuleSetManager().getDefaultRuleSets();
for (Iterator i = defaultRuleSets.iterator(); i.hasNext();) {
this.initialPluginRuleSet.addRuleSet((RuleSet) i.next());
Set<RuleSet> defaultRuleSets = PMDPlugin.getDefault().getRuleSetManager().getDefaultRuleSets();
for (RuleSet ruleSet : defaultRuleSets) {
this.initialPluginRuleSet.addRuleSet(ruleSet);
}
}
/**
* @see junit.framework.TestCase#tearDown()
*/
@Override
protected void tearDown() throws Exception {
// 1. Delete the test project
if (this.testProject != null) {
@ -415,9 +418,7 @@ public class ProjectPropertiesModelTest extends TestCase {
private void dumpRuleSet(RuleSet ruleSet) {
System.out.println("Dumping rule set:" + ruleSet.getName());
Iterator i = ruleSet.getRules().iterator();
while (i.hasNext()) {
Rule rule = (Rule) i.next();
for (Rule rule: ruleSet.getRules()) {
System.out.println(rule.getName());
}
System.out.println();