summaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-09-30 09:00:18 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-09-30 09:00:18 +0000
commit2c7c234cf1cf4c8b104b970a5cad30089cb6c043 (patch)
tree4d4fa070d9c38e438de5f7f45798cd86f1e11841 /sonar-plugin-api
parent40222de99b59be01a4640444a4d8caf8cc9284cf (diff)
downloadsonarqube-2c7c234cf1cf4c8b104b970a5cad30089cb6c043.tar.gz
sonarqube-2c7c234cf1cf4c8b104b970a5cad30089cb6c043.zip
rename org.sonar.api.rules.StandardRuleXmlFormat to XMLRuleParser
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/rules/XMLRuleParser.java (renamed from sonar-plugin-api/src/main/java/org/sonar/api/rules/StandardRuleXmlFormat.java)14
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/rules/XMLRuleParserTest.java (renamed from sonar-plugin-api/src/test/java/org/sonar/api/rules/StandardRuleXmlFormatTest.java)12
-rw-r--r--sonar-plugin-api/src/test/resources/org/sonar/api/rules/XMLRuleParserTest/deprecated.xml (renamed from sonar-plugin-api/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/deprecated.xml)0
-rw-r--r--sonar-plugin-api/src/test/resources/org/sonar/api/rules/XMLRuleParserTest/rules.xml (renamed from sonar-plugin-api/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/rules.xml)0
-rw-r--r--sonar-plugin-api/src/test/resources/org/sonar/api/rules/XMLRuleParserTest/utf8.xml (renamed from sonar-plugin-api/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/utf8.xml)0
5 files changed, 13 insertions, 13 deletions
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