diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-09-30 09:00:18 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-09-30 09:00:18 +0000 |
commit | 2c7c234cf1cf4c8b104b970a5cad30089cb6c043 (patch) | |
tree | 4d4fa070d9c38e438de5f7f45798cd86f1e11841 | |
parent | 40222de99b59be01a4640444a4d8caf8cc9284cf (diff) | |
download | sonarqube-2c7c234cf1cf4c8b104b970a5cad30089cb6c043.tar.gz sonarqube-2c7c234cf1cf4c8b104b970a5cad30089cb6c043.zip |
rename org.sonar.api.rules.StandardRuleXmlFormat to XMLRuleParser
8 files changed, 21 insertions, 21 deletions
diff --git a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleRuleRepository.java b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleRuleRepository.java index 5d7073f266e..ee533a1cffa 100644 --- a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleRuleRepository.java +++ b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleRuleRepository.java @@ -23,7 +23,7 @@ import org.sonar.api.platform.ServerFileSystem; import org.sonar.api.resources.Java; import org.sonar.api.rules.Rule; import org.sonar.api.rules.RuleRepository; -import org.sonar.api.rules.StandardRuleXmlFormat; +import org.sonar.api.rules.XMLRuleParser; import java.io.File; import java.util.ArrayList; @@ -43,9 +43,9 @@ public final class CheckstyleRuleRepository extends RuleRepository { @Override public List<Rule> createRules() { List<Rule> rules = new ArrayList<Rule>(); - rules.addAll(StandardRuleXmlFormat.parseXml(getClass().getResourceAsStream("/org/sonar/plugins/checkstyle/rules.xml"))); + rules.addAll(XMLRuleParser.parseXML(getClass().getResourceAsStream("/org/sonar/plugins/checkstyle/rules.xml"))); for (File userExtensionXml : fileSystem.getExtensions(CheckstyleConstants.REPOSITORY_KEY, "xml")) { - rules.addAll(StandardRuleXmlFormat.parseXml(userExtensionXml)); + rules.addAll(XMLRuleParser.parseXML(userExtensionXml)); } return rules; } diff --git a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsRuleRepository.java b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsRuleRepository.java index f690c82619b..bf4b11febb6 100644 --- a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsRuleRepository.java +++ b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsRuleRepository.java @@ -26,7 +26,7 @@ import org.sonar.api.platform.ServerFileSystem; import org.sonar.api.resources.Java; import org.sonar.api.rules.Rule; import org.sonar.api.rules.RuleRepository; -import org.sonar.api.rules.StandardRuleXmlFormat; +import org.sonar.api.rules.XMLRuleParser; public final class FindbugsRuleRepository extends RuleRepository { @@ -38,7 +38,7 @@ public final class FindbugsRuleRepository extends RuleRepository { @Override public List<Rule> createRules() { List<Rule> rules = new ArrayList<Rule>(); - rules.addAll(StandardRuleXmlFormat.parseXml(getClass().getResourceAsStream("/org/sonar/plugins/findbugs/rules.xml"))); + rules.addAll(XMLRuleParser.parseXML(getClass().getResourceAsStream("/org/sonar/plugins/findbugs/rules.xml"))); return rules; } } diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdRuleRepository.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdRuleRepository.java index 308a93b90fe..19214409b08 100644 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdRuleRepository.java +++ b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdRuleRepository.java @@ -23,7 +23,7 @@ import org.sonar.api.platform.ServerFileSystem; import org.sonar.api.resources.Java; import org.sonar.api.rules.Rule; import org.sonar.api.rules.RuleRepository; -import org.sonar.api.rules.StandardRuleXmlFormat; +import org.sonar.api.rules.XMLRuleParser; import java.io.File; import java.util.ArrayList; @@ -43,9 +43,9 @@ public final class PmdRuleRepository extends RuleRepository { @Override public List<Rule> createRules() { List<Rule> rules = new ArrayList<Rule>(); - rules.addAll(StandardRuleXmlFormat.parseXml(getClass().getResourceAsStream("/org/sonar/plugins/pmd/rules.xml"))); + rules.addAll(XMLRuleParser.parseXML(getClass().getResourceAsStream("/org/sonar/plugins/pmd/rules.xml"))); for (File userExtensionXml : fileSystem.getExtensions(PmdConstants.REPOSITORY_KEY, "xml")) { - rules.addAll(StandardRuleXmlFormat.parseXml(userExtensionXml)); + rules.addAll(XMLRuleParser.parseXML(userExtensionXml)); } return rules; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/StandardRuleXmlFormat.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/XMLRuleParser.java index 9e56a4e1276..4537da54b27 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/StandardRuleXmlFormat.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/XMLRuleParser.java @@ -38,17 +38,17 @@ import java.util.List; /** * @since 2.3 */ -public final class StandardRuleXmlFormat { +public final class XMLRuleParser { - private StandardRuleXmlFormat() { + private XMLRuleParser() { // only static methods } - public static List<Rule> parseXml(File file) { + public static List<Rule> parseXML(File file) { Reader reader = null; try { reader = new InputStreamReader(FileUtils.openInputStream(file), CharEncoding.UTF_8); - return parseXml(reader); + return parseXML(reader); } catch (IOException e) { throw new SonarException("Fail to load the file: " + file, e); @@ -61,11 +61,11 @@ public final class StandardRuleXmlFormat { /** * Warning : the input stream is closed in this method */ - public static List<Rule> parseXml(InputStream input) { + public static List<Rule> parseXML(InputStream input) { Reader reader = null; try { reader = new InputStreamReader(input, CharEncoding.UTF_8); - return parseXml(reader); + return parseXML(reader); } catch (IOException e) { throw new SonarException("Fail to load the xml stream", e); @@ -75,7 +75,7 @@ public final class StandardRuleXmlFormat { } } - public static List<Rule> parseXml(Reader reader) { + public static List<Rule> parseXML(Reader reader) { XMLInputFactory xmlFactory = XMLInputFactory2.newInstance(); xmlFactory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE); xmlFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.FALSE); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rules/StandardRuleXmlFormatTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/rules/XMLRuleParserTest.java index cfcc6267603..73f41a460e3 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/rules/StandardRuleXmlFormatTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/rules/XMLRuleParserTest.java @@ -31,11 +31,11 @@ import static org.hamcrest.core.IsNot.not; import static org.hamcrest.core.IsNull.nullValue; import static org.junit.Assert.assertThat; -public class StandardRuleXmlFormatTest { +public class XMLRuleParserTest { @Test public void parseXml() { - List<Rule> rules = StandardRuleXmlFormat.parseXml(getClass().getResourceAsStream("/org/sonar/api/rules/StandardRuleXmlFormatTest/rules.xml")); + List<Rule> rules = XMLRuleParser.parseXML(getClass().getResourceAsStream("/org/sonar/api/rules/XMLRuleParserTest/rules.xml")); assertThat(rules.size(), is(2)); Rule rule = rules.get(0); @@ -59,17 +59,17 @@ public class StandardRuleXmlFormatTest { @Test(expected = SonarException.class) public void failIfMissingRuleKey() { - StandardRuleXmlFormat.parseXml(new StringReader("<rules><rule><name>Foo</name></rule></rules>")); + XMLRuleParser.parseXML(new StringReader("<rules><rule><name>Foo</name></rule></rules>")); } @Test(expected = SonarException.class) public void failIfMissingPropertyKey() { - StandardRuleXmlFormat.parseXml(new StringReader("<rules><rule><key>foo</key><name>Foo</name><param></param></rule></rules>")); + XMLRuleParser.parseXML(new StringReader("<rules><rule><key>foo</key><name>Foo</name><param></param></rule></rules>")); } @Test public void utf8Encoding() { - List<Rule> rules = StandardRuleXmlFormat.parseXml(getClass().getResourceAsStream("/org/sonar/api/rules/StandardRuleXmlFormatTest/utf8.xml")); + List<Rule> rules = XMLRuleParser.parseXML(getClass().getResourceAsStream("/org/sonar/api/rules/XMLRuleParserTest/utf8.xml")); assertThat(rules.size(), is(1)); Rule rule = rules.get(0); assertThat(rule.getKey(), is("com.puppycrawl.tools.checkstyle.checks.naming.LocalVariableNameCheck")); @@ -82,7 +82,7 @@ public class StandardRuleXmlFormatTest { @Test public void supportDeprecatedFormat() { // the deprecated format uses some attributes instead of nodes - List<Rule> rules = StandardRuleXmlFormat.parseXml(getClass().getResourceAsStream("/org/sonar/api/rules/StandardRuleXmlFormatTest/deprecated.xml")); + List<Rule> rules = XMLRuleParser.parseXML(getClass().getResourceAsStream("/org/sonar/api/rules/XMLRuleParserTest/deprecated.xml")); assertThat(rules.size(), is(1)); Rule rule = rules.get(0); assertThat(rule.getPriority(), Is.is(RulePriority.CRITICAL)); diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/deprecated.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/rules/XMLRuleParserTest/deprecated.xml index 44cf56d228a..44cf56d228a 100644 --- a/sonar-plugin-api/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/deprecated.xml +++ b/sonar-plugin-api/src/test/resources/org/sonar/api/rules/XMLRuleParserTest/deprecated.xml diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/rules.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/rules/XMLRuleParserTest/rules.xml index 4d807407097..4d807407097 100644 --- a/sonar-plugin-api/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/rules.xml +++ b/sonar-plugin-api/src/test/resources/org/sonar/api/rules/XMLRuleParserTest/rules.xml diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/utf8.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/rules/XMLRuleParserTest/utf8.xml index 6197e030057..6197e030057 100644 --- a/sonar-plugin-api/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/utf8.xml +++ b/sonar-plugin-api/src/test/resources/org/sonar/api/rules/XMLRuleParserTest/utf8.xml |