aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-09-14 13:00:25 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-09-14 13:00:25 +0000
commitddcc6272a62c245618d7797712062c96ff7ad3d4 (patch)
tree2465df13f82cbc664a51b4b7439c570b50e2146e
parent2f54216f77f9580f56891d662e56a5d151ce1a2a (diff)
downloadsonarqube-ddcc6272a62c245618d7797712062c96ff7ad3d4.tar.gz
sonarqube-ddcc6272a62c245618d7797712062c96ff7ad3d4.zip
move deprecated rule API to sonar-deprecated
-rw-r--r--plugins/sonar-findbugs-plugin/pom.xml5
-rw-r--r--plugins/sonar-pmd-plugin/pmd-result.xml2
-rw-r--r--plugins/sonar-pmd-plugin/pom.xml5
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/batch/AbstractViolationsStaxParser.java (renamed from sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractViolationsStaxParser.java)2
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/rules/AbstractImportableRulesRepository.java (renamed from sonar-plugin-api/src/main/java/org/sonar/api/rules/AbstractImportableRulesRepository.java)0
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/rules/AbstractRulesRepository.java (renamed from sonar-plugin-api/src/main/java/org/sonar/api/rules/AbstractRulesRepository.java)0
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/rules/ConfigurationExportable.java (renamed from sonar-plugin-api/src/main/java/org/sonar/api/rules/ConfigurationExportable.java)0
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/rules/ConfigurationImportable.java (renamed from sonar-plugin-api/src/main/java/org/sonar/api/rules/ConfigurationImportable.java)1
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/rules/RulePriorityMapper.java (renamed from sonar-plugin-api/src/main/java/org/sonar/api/rules/RulePriorityMapper.java)0
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/rules/RulesManager.java (renamed from sonar-plugin-api/src/main/java/org/sonar/api/rules/RulesManager.java)4
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/rules/RulesRepository.java (renamed from sonar-plugin-api/src/main/java/org/sonar/api/rules/RulesRepository.java)4
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/rules/StandardProfileXmlParser.java (renamed from sonar-plugin-api/src/main/java/org/sonar/api/rules/StandardProfileXmlParser.java)0
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/rules/StandardRulesXmlParser.java (renamed from sonar-plugin-api/src/main/java/org/sonar/api/rules/StandardRulesXmlParser.java)0
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/rules/xml/Profile.java (renamed from sonar-plugin-api/src/main/java/org/sonar/api/rules/xml/Profile.java)0
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/rules/xml/Property.java (renamed from sonar-plugin-api/src/main/java/org/sonar/api/rules/xml/Property.java)0
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/rules/xml/Rule.java (renamed from sonar-plugin-api/src/main/java/org/sonar/api/rules/xml/Rule.java)0
-rw-r--r--sonar-deprecated/src/test/java/org/sonar/api/batch/AbstractViolationsStaxParserTest.java (renamed from sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractViolationsStaxParserTest.java)0
-rw-r--r--sonar-deprecated/src/test/java/org/sonar/api/rules/AnnotatedCheck.java (renamed from sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotatedCheck.java)0
-rw-r--r--sonar-deprecated/src/test/java/org/sonar/api/rules/AnnotatedCheckWithParameters.java (renamed from sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotatedCheckWithParameters.java)0
-rw-r--r--sonar-deprecated/src/test/java/org/sonar/api/rules/RuleAnnotationUtilsTest.java (renamed from sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleAnnotationUtilsTest.java)5
-rw-r--r--sonar-deprecated/src/test/java/org/sonar/api/rules/RulePriorityTest.java (renamed from sonar-plugin-api/src/test/java/org/sonar/api/rules/RulePriorityTest.java)14
-rw-r--r--sonar-deprecated/src/test/java/org/sonar/api/rules/RuleTest.java (renamed from sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleTest.java)15
-rw-r--r--sonar-deprecated/src/test/java/org/sonar/api/rules/RuleUtilsTest.java (renamed from sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleUtilsTest.java)6
-rw-r--r--sonar-deprecated/src/test/java/org/sonar/api/rules/StandardProfileXmlParserTest.java (renamed from sonar-plugin-api/src/test/java/org/sonar/api/rules/StandardProfileXmlParserTest.java)7
-rw-r--r--sonar-deprecated/src/test/java/org/sonar/api/rules/StandardRuleXmlFormatTest.java (renamed from sonar-plugin-api/src/test/java/org/sonar/api/rules/StandardRuleXmlFormatTest.java)7
-rw-r--r--sonar-deprecated/src/test/java/org/sonar/api/rules/StandardRulesXmlParserTest.java (renamed from sonar-plugin-api/src/test/java/org/sonar/api/rules/StandardRulesXmlParserTest.java)36
-rw-r--r--sonar-deprecated/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/deprecated.xml (renamed from sonar-plugin-api/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/deprecated.xml)0
-rw-r--r--sonar-deprecated/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/rules.xml (renamed from sonar-plugin-api/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/rules.xml)0
-rw-r--r--sonar-deprecated/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/utf8.xml (renamed from sonar-plugin-api/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/utf8.xml)0
-rw-r--r--sonar-deprecated/src/test/resources/org/sonar/api/rules/test_profile.xml (renamed from sonar-plugin-api/src/test/resources/org/sonar/api/rules/test_profile.xml)0
-rw-r--r--sonar-deprecated/src/test/resources/org/sonar/api/rules/test_profile_name_null.xml (renamed from sonar-plugin-api/src/test/resources/org/sonar/api/rules/test_profile_name_null.xml)0
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/FakePlugin.java90
32 files changed, 68 insertions, 135 deletions
diff --git a/plugins/sonar-findbugs-plugin/pom.xml b/plugins/sonar-findbugs-plugin/pom.xml
index fa7c322c306..a5ad7731d5f 100644
--- a/plugins/sonar-findbugs-plugin/pom.xml
+++ b/plugins/sonar-findbugs-plugin/pom.xml
@@ -24,6 +24,11 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.codehaus.sonar</groupId>
+ <artifactId>sonar-deprecated</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<scope>provided</scope>
diff --git a/plugins/sonar-pmd-plugin/pmd-result.xml b/plugins/sonar-pmd-plugin/pmd-result.xml
index bffb2ec7aec..6381f36b54e 100644
--- a/plugins/sonar-pmd-plugin/pmd-result.xml
+++ b/plugins/sonar-pmd-plugin/pmd-result.xml
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
-<pmd version="4.2.5" timestamp="2010-09-12T21:47:59.064">
+<pmd version="4.2.5" timestamp="2010-09-14T13:20:30.108">
</pmd> \ No newline at end of file
diff --git a/plugins/sonar-pmd-plugin/pom.xml b/plugins/sonar-pmd-plugin/pom.xml
index 96b219cb10d..fe66fe29934 100644
--- a/plugins/sonar-pmd-plugin/pom.xml
+++ b/plugins/sonar-pmd-plugin/pom.xml
@@ -20,6 +20,11 @@
<dependencies>
<dependency>
<groupId>org.codehaus.sonar</groupId>
+ <artifactId>sonar-deprecated</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-plugin-api</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractViolationsStaxParser.java b/sonar-deprecated/src/main/java/org/sonar/api/batch/AbstractViolationsStaxParser.java
index d944d156a32..9a7432f16b1 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractViolationsStaxParser.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/batch/AbstractViolationsStaxParser.java
@@ -43,7 +43,9 @@ import org.sonar.api.utils.StaxParser;
/**
* @since 1.10
+ * @deprecated since 2.3. Too much "black-box".
*/
+@Deprecated
public abstract class AbstractViolationsStaxParser {
protected RulesManager rulesManager;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/AbstractImportableRulesRepository.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/AbstractImportableRulesRepository.java
index 9926a33081e..9926a33081e 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/AbstractImportableRulesRepository.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/rules/AbstractImportableRulesRepository.java
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/AbstractRulesRepository.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/AbstractRulesRepository.java
index ec69f047174..ec69f047174 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/AbstractRulesRepository.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/rules/AbstractRulesRepository.java
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ConfigurationExportable.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/ConfigurationExportable.java
index 3a853a6ab3f..3a853a6ab3f 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ConfigurationExportable.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/rules/ConfigurationExportable.java
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ConfigurationImportable.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/ConfigurationImportable.java
index 20e68fe3eed..c16337875e3 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ConfigurationImportable.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/rules/ConfigurationImportable.java
@@ -20,6 +20,7 @@
package org.sonar.api.rules;
import java.util.List;
+import org.sonar.api.rules.Rule;
@Deprecated
public interface ConfigurationImportable {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RulePriorityMapper.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/RulePriorityMapper.java
index c8a382ecd89..c8a382ecd89 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RulePriorityMapper.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/rules/RulePriorityMapper.java
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RulesManager.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/RulesManager.java
index 976fa2f6f35..374f2241cf3 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RulesManager.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/rules/RulesManager.java
@@ -28,9 +28,7 @@ import java.util.Map;
import java.util.Set;
/**
- * Manage and access rules defined in Sonar.
- *
- * @deprecated UGLY COMPONENT - WILL BE COMPLETELY REFACTORED IN SONAR 2.3
+ * @deprecated since 2.3
*/
@Deprecated
public abstract class RulesManager {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RulesRepository.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/RulesRepository.java
index 32d035b042e..8156cac9723 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RulesRepository.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/rules/RulesRepository.java
@@ -27,9 +27,7 @@ import org.sonar.api.resources.Language;
import java.util.List;
/**
- * The interface to implement to create a repository of rules
- *
- * @param <LANG>
+ * @deprecated since 2.3
*/
@Deprecated
public interface RulesRepository<LANG extends Language> extends BatchExtension, ServerExtension {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/StandardProfileXmlParser.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/StandardProfileXmlParser.java
index 272b9642889..272b9642889 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/StandardProfileXmlParser.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/rules/StandardProfileXmlParser.java
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/StandardRulesXmlParser.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/StandardRulesXmlParser.java
index e532df1d040..e532df1d040 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/StandardRulesXmlParser.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/rules/StandardRulesXmlParser.java
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/xml/Profile.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/xml/Profile.java
index cd40e8a1f0e..cd40e8a1f0e 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/xml/Profile.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/rules/xml/Profile.java
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/xml/Property.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/xml/Property.java
index 8e6dbec7670..8e6dbec7670 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/xml/Property.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/rules/xml/Property.java
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/xml/Rule.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/xml/Rule.java
index e424d1466a6..e424d1466a6 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/xml/Rule.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/rules/xml/Rule.java
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractViolationsStaxParserTest.java b/sonar-deprecated/src/test/java/org/sonar/api/batch/AbstractViolationsStaxParserTest.java
index d1f91f1b4d3..d1f91f1b4d3 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractViolationsStaxParserTest.java
+++ b/sonar-deprecated/src/test/java/org/sonar/api/batch/AbstractViolationsStaxParserTest.java
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotatedCheck.java b/sonar-deprecated/src/test/java/org/sonar/api/rules/AnnotatedCheck.java
index da01fb10904..da01fb10904 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotatedCheck.java
+++ b/sonar-deprecated/src/test/java/org/sonar/api/rules/AnnotatedCheck.java
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotatedCheckWithParameters.java b/sonar-deprecated/src/test/java/org/sonar/api/rules/AnnotatedCheckWithParameters.java
index cd487c3d0a0..cd487c3d0a0 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotatedCheckWithParameters.java
+++ b/sonar-deprecated/src/test/java/org/sonar/api/rules/AnnotatedCheckWithParameters.java
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleAnnotationUtilsTest.java b/sonar-deprecated/src/test/java/org/sonar/api/rules/RuleAnnotationUtilsTest.java
index fb40a6e74b7..98d05bbd1f4 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleAnnotationUtilsTest.java
+++ b/sonar-deprecated/src/test/java/org/sonar/api/rules/RuleAnnotationUtilsTest.java
@@ -19,6 +19,7 @@
*/
package org.sonar.api.rules;
+import org.hamcrest.core.Is;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.nullValue;
@@ -38,8 +39,8 @@ public class RuleAnnotationUtilsTest {
assertThat(rule.getConfigKey(), nullValue());
assertThat(rule.getParams().size(), is(0));
assertThat(rule.getDescription(), is("Description"));
- assertThat(rule.getCardinality(), is(Rule.Cardinality.SINGLE));
- assertThat(rule.getRulesCategory().getName(), is(Iso9126RulesCategories.RELIABILITY.getName()));
+ assertThat(rule.getCardinality(), Is.is(Rule.Cardinality.SINGLE));
+ assertThat(rule.getRulesCategory().getName(), Is.is(Iso9126RulesCategories.RELIABILITY.getName()));
}
@Test
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rules/RulePriorityTest.java b/sonar-deprecated/src/test/java/org/sonar/api/rules/RulePriorityTest.java
index 5e167ac1113..a3ed40321b8 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/rules/RulePriorityTest.java
+++ b/sonar-deprecated/src/test/java/org/sonar/api/rules/RulePriorityTest.java
@@ -20,18 +20,20 @@
package org.sonar.api.rules;
import static junit.framework.Assert.assertEquals;
+
+import junit.framework.Assert;
import org.junit.Test;
public class RulePriorityTest {
@Test
public void testValueOfString() {
- assertEquals(RulePriority.INFO, RulePriority.valueOfString("info"));
- assertEquals(RulePriority.MAJOR, RulePriority.valueOfString("MAJOR"));
- assertEquals(RulePriority.MAJOR, RulePriority.valueOfString("ERROR"));
- assertEquals(RulePriority.INFO, RulePriority.valueOfString("WARNING"));
- assertEquals(RulePriority.MAJOR, RulePriority.valueOfString("ErRor"));
- assertEquals(RulePriority.INFO, RulePriority.valueOfString("WaRnInG"));
+ Assert.assertEquals(RulePriority.INFO, RulePriority.valueOfString("info"));
+ Assert.assertEquals(RulePriority.MAJOR, RulePriority.valueOfString("MAJOR"));
+ Assert.assertEquals(RulePriority.MAJOR, RulePriority.valueOfString("ERROR"));
+ Assert.assertEquals(RulePriority.INFO, RulePriority.valueOfString("WARNING"));
+ Assert.assertEquals(RulePriority.MAJOR, RulePriority.valueOfString("ErRor"));
+ Assert.assertEquals(RulePriority.INFO, RulePriority.valueOfString("WaRnInG"));
}
@Test(expected = IllegalArgumentException.class)
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleTest.java b/sonar-deprecated/src/test/java/org/sonar/api/rules/RuleTest.java
index 005b0e583d9..c0767fda0ad 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleTest.java
+++ b/sonar-deprecated/src/test/java/org/sonar/api/rules/RuleTest.java
@@ -21,6 +21,9 @@ package org.sonar.api.rules;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;
+
+import org.hamcrest.core.Is;
+import org.junit.Assert;
import org.junit.Test;
import java.util.Arrays;
@@ -32,7 +35,7 @@ public class RuleTest {
public void descriptionShouldBeCleaned() {
Rule rule = new Rule();
rule.setDescription(" my description ");
- assertEquals("my description", rule.getDescription());
+ Assert.assertEquals("my description", rule.getDescription());
rule.setDescription(null);
assertNull(rule.getDescription());
@@ -68,19 +71,19 @@ public class RuleTest {
@Test
public void defaultPriorityIsMajor() {
Rule rule = new Rule();
- assertThat(rule.getPriority(), is(RulePriority.MAJOR));
+ assertThat(rule.getPriority(), Is.is(RulePriority.MAJOR));
rule = new Rule("name", "key");
- assertThat(rule.getPriority(), is(RulePriority.MAJOR));
+ assertThat(rule.getPriority(), Is.is(RulePriority.MAJOR));
rule = new Rule("pkey", "key", "name", Iso9126RulesCategories.EFFICIENCY, null, null);
- assertThat(rule.getPriority(), is(RulePriority.MAJOR));
+ assertThat(rule.getPriority(), Is.is(RulePriority.MAJOR));
rule.setPriority(RulePriority.BLOCKER);
- assertThat(rule.getPriority(), is(RulePriority.BLOCKER));
+ assertThat(rule.getPriority(), Is.is(RulePriority.BLOCKER));
rule.setPriority(null);
- assertThat(rule.getPriority(), is(RulePriority.MAJOR));
+ assertThat(rule.getPriority(), Is.is(RulePriority.MAJOR));
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleUtilsTest.java b/sonar-deprecated/src/test/java/org/sonar/api/rules/RuleUtilsTest.java
index 7626327bed3..c60a5fdf604 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleUtilsTest.java
+++ b/sonar-deprecated/src/test/java/org/sonar/api/rules/RuleUtilsTest.java
@@ -27,6 +27,8 @@ import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+
+import org.mockito.Matchers;
import org.sonar.api.CoreProperties;
import java.util.Map;
@@ -36,7 +38,7 @@ public class RuleUtilsTest {
@Test
public void getPriorityWeights() {
Configuration conf = mock(Configuration.class);
- when(conf.getString(eq(CoreProperties.CORE_RULE_WEIGHTS_PROPERTY), anyString())).thenReturn("info=0;minor=1;major=2;critical=5;blocker=10");
+ when(conf.getString(Matchers.eq(CoreProperties.CORE_RULE_WEIGHTS_PROPERTY), anyString())).thenReturn("info=0;minor=1;major=2;critical=5;blocker=10");
final Map<RulePriority, Integer> map = RuleUtils.getPriorityWeights(conf);
@@ -50,7 +52,7 @@ public class RuleUtilsTest {
@Test
public void loadMissingWeights() {
Configuration conf = mock(Configuration.class);
- when(conf.getString(eq(CoreProperties.CORE_RULE_WEIGHTS_PROPERTY), anyString())).thenReturn("foo=0;bar=1;CRITICAL=5");
+ when(conf.getString(Matchers.eq(CoreProperties.CORE_RULE_WEIGHTS_PROPERTY), anyString())).thenReturn("foo=0;bar=1;CRITICAL=5");
final Map<RulePriority, Integer> map = RuleUtils.getPriorityWeights(conf);
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rules/StandardProfileXmlParserTest.java b/sonar-deprecated/src/test/java/org/sonar/api/rules/StandardProfileXmlParserTest.java
index 9b83cffd0ba..2f20bd096ca 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/rules/StandardProfileXmlParserTest.java
+++ b/sonar-deprecated/src/test/java/org/sonar/api/rules/StandardProfileXmlParserTest.java
@@ -22,6 +22,9 @@ package org.sonar.api.rules;
import org.apache.commons.io.IOUtils;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;
+
+import org.hamcrest.CoreMatchers;
+import org.junit.Assert;
import org.junit.Test;
import org.sonar.api.profiles.RulesProfile;
import org.sonar.api.rules.xml.Profile;
@@ -107,7 +110,7 @@ public class StandardProfileXmlParserTest {
RulesProfile profile = standardProfileXmlParser.importConfiguration(IOUtils.toString(input));
List<ActiveRule> results = profile.getActiveRules();
- assertThat("Sonar way", is(profile.getName()));
+ assertThat("Sonar way", CoreMatchers.is(profile.getName()));
assertThat(results.size(), is(activeRulesExpected.size()));
assertActiveRulesAreEquals(results, activeRulesExpected);
}
@@ -156,7 +159,7 @@ public class StandardProfileXmlParserTest {
ActiveRule activeRule2 = activeRules2.get(i);
assertTrue(activeRule1.getRule().equals(activeRule2.getRule()) && activeRule1.getPriority().equals(activeRule2.getPriority()));
- assertEquals(activeRule1.getActiveRuleParams().size(), (activeRule2.getActiveRuleParams().size()));
+ Assert.assertEquals(activeRule1.getActiveRuleParams().size(), (activeRule2.getActiveRuleParams().size()));
for (int j = 0; j < activeRule1.getActiveRuleParams().size(); j++) {
ActiveRuleParam activeRuleParam1 = activeRule1.getActiveRuleParams().get(j);
ActiveRuleParam activeRuleParam2 = activeRule2.getActiveRuleParams().get(j);
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rules/StandardRuleXmlFormatTest.java b/sonar-deprecated/src/test/java/org/sonar/api/rules/StandardRuleXmlFormatTest.java
index e4ff582b6af..a1cfb59336c 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/rules/StandardRuleXmlFormatTest.java
+++ b/sonar-deprecated/src/test/java/org/sonar/api/rules/StandardRuleXmlFormatTest.java
@@ -19,6 +19,7 @@
*/
package org.sonar.api.rules;
+import org.hamcrest.core.Is;
import org.junit.Test;
import org.sonar.api.utils.SonarException;
@@ -40,8 +41,8 @@ public class StandardRuleXmlFormatTest {
Rule rule = rules.get(0);
assertThat(rule.getName(), is("Local Variable Name"));
assertThat(rule.getDescription(), is("Checks that local, non-final variable names conform to a format specified by the format property."));
- assertThat(rule.getPriority(), is(RulePriority.BLOCKER));
- assertThat(rule.getCardinality(), is(Rule.Cardinality.MULTIPLE));
+ assertThat(rule.getPriority(), Is.is(RulePriority.BLOCKER));
+ assertThat(rule.getCardinality(), Is.is(Rule.Cardinality.MULTIPLE));
assertThat(rule.getConfigKey(), is("Checker/TreeWalker/LocalVariableName"));
assertThat(rule.getParams().size(), is(2));
@@ -83,7 +84,7 @@ public class StandardRuleXmlFormatTest {
List<Rule> rules = StandardRuleXmlFormat.parseXml(getClass().getResourceAsStream("/org/sonar/api/rules/StandardRuleXmlFormatTest/deprecated.xml"));
assertThat(rules.size(), is(1));
Rule rule = rules.get(0);
- assertThat(rule.getPriority(), is(RulePriority.CRITICAL));
+ assertThat(rule.getPriority(), Is.is(RulePriority.CRITICAL));
assertThat(rule.getKey(), is("org.sonar.it.checkstyle.MethodsCountCheck"));
assertThat(rule.getParam("minMethodsCount"), not(nullValue()));
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rules/StandardRulesXmlParserTest.java b/sonar-deprecated/src/test/java/org/sonar/api/rules/StandardRulesXmlParserTest.java
index 8dac3375919..30bc75f9f89 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/rules/StandardRulesXmlParserTest.java
+++ b/sonar-deprecated/src/test/java/org/sonar/api/rules/StandardRulesXmlParserTest.java
@@ -23,6 +23,8 @@ import org.apache.commons.io.IOUtils;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.*;
+
+import org.junit.Assert;
import org.junit.Test;
import java.util.List;
@@ -36,14 +38,14 @@ public class StandardRulesXmlParserTest {
assertEquals(1, rules.size());
Rule rule = rules.get(0);
- assertEquals("key1", rule.getKey());
- assertEquals("my name", rule.getName());
- assertEquals("my_config_key", rule.getConfigKey());
- assertEquals("my description", rule.getDescription());
- assertEquals(2, rule.getParams().size());
- assertEquals("param1", rule.getParams().get(0).getKey());
- assertEquals("s", rule.getParams().get(0).getType());
- assertEquals("param description", rule.getParams().get(0).getDescription());
+ Assert.assertEquals("key1", rule.getKey());
+ Assert.assertEquals("my name", rule.getName());
+ Assert.assertEquals("my_config_key", rule.getConfigKey());
+ Assert.assertEquals("my description", rule.getDescription());
+ Assert.assertEquals(2, rule.getParams().size());
+ Assert.assertEquals("param1", rule.getParams().get(0).getKey());
+ Assert.assertEquals("s", rule.getParams().get(0).getType());
+ Assert.assertEquals("param description", rule.getParams().get(0).getDescription());
}
@Test
@@ -52,7 +54,7 @@ public class StandardRulesXmlParserTest {
String xml = "<rules><rule><category name='cat1' /></rule></rules>";
List<Rule> rules = parser.parse(xml);
assertNotNull(rules.get(0).getRulesCategory());
- assertEquals("cat1", rules.get(0).getRulesCategory().getName());
+ Assert.assertEquals("cat1", rules.get(0).getRulesCategory().getName());
assertNull(rules.get(0).getRulesCategory().getId());
assertNull(rules.get(0).getRulesCategory().getDescription());
}
@@ -63,7 +65,7 @@ public class StandardRulesXmlParserTest {
String xml = "<rules><rule key='1' priority='CRITICAL'><category name='cat1'/></rule></rules>";
List<Rule> rules = parser.parse(xml);
assertNotNull(rules.get(0).getRulesCategory());
- assertEquals(RulePriority.CRITICAL, rules.get(0).getPriority());
+ Assert.assertEquals(RulePriority.CRITICAL, rules.get(0).getPriority());
assertNull(rules.get(0).getRulesCategory().getId());
assertNull(rules.get(0).getRulesCategory().getDescription());
}
@@ -73,7 +75,7 @@ public class StandardRulesXmlParserTest {
StandardRulesXmlParser parser = new StandardRulesXmlParser();
String xml = "<rules><rule key='1'><category name='cat1'/></rule></rules>";
List<Rule> rules = parser.parse(xml);
- assertEquals(RulePriority.MAJOR, rules.get(0).getPriority());
+ Assert.assertEquals(RulePriority.MAJOR, rules.get(0).getPriority());
}
@Test
@@ -82,8 +84,8 @@ public class StandardRulesXmlParserTest {
String xml = "<rules><rule key='key1' category='cat1' /><rule key='key2' category='cat1' /></rules>";
List<Rule> rules = parser.parse(xml);
assertEquals(2, rules.size());
- assertEquals("key1", rules.get(0).getKey());
- assertEquals("key2", rules.get(1).getKey());
+ Assert.assertEquals("key1", rules.get(0).getKey());
+ Assert.assertEquals("key2", rules.get(1).getKey());
}
@Test
@@ -102,7 +104,7 @@ public class StandardRulesXmlParserTest {
String xml = "<rules><rule key='key1' category='cat1'><description> <![CDATA[<xml> </nodes> and accents Žˆ˜ ]]> </description></rule></rules>";
List<Rule> rules = parser.parse(xml);
assertEquals(1, rules.size());
- assertEquals("<xml> </nodes> and accents Žˆ˜", rules.get(0).getDescription());
+ Assert.assertEquals("<xml> </nodes> and accents Žˆ˜", rules.get(0).getDescription());
}
@Test
@@ -113,9 +115,9 @@ public class StandardRulesXmlParserTest {
assertEquals(1, rules.size());
Rule rule = rules.get(0);
- assertEquals("key1", rule.getKey());
- assertEquals(1, rule.getParams().size());
- assertEquals("param1", rule.getParams().get(0).getKey());
+ Assert.assertEquals("key1", rule.getKey());
+ Assert.assertEquals(1, rule.getParams().size());
+ Assert.assertEquals("param1", rule.getParams().get(0).getKey());
}
@Test
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/deprecated.xml b/sonar-deprecated/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/deprecated.xml
index 44cf56d228a..44cf56d228a 100644
--- a/sonar-plugin-api/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/deprecated.xml
+++ b/sonar-deprecated/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/deprecated.xml
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/rules.xml b/sonar-deprecated/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/rules.xml
index c4038bdf96c..c4038bdf96c 100644
--- a/sonar-plugin-api/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/rules.xml
+++ b/sonar-deprecated/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/rules.xml
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/utf8.xml b/sonar-deprecated/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/utf8.xml
index 6197e030057..6197e030057 100644
--- a/sonar-plugin-api/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/utf8.xml
+++ b/sonar-deprecated/src/test/resources/org/sonar/api/rules/StandardRuleXmlFormatTest/utf8.xml
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/rules/test_profile.xml b/sonar-deprecated/src/test/resources/org/sonar/api/rules/test_profile.xml
index 29e2024bf51..29e2024bf51 100644
--- a/sonar-plugin-api/src/test/resources/org/sonar/api/rules/test_profile.xml
+++ b/sonar-deprecated/src/test/resources/org/sonar/api/rules/test_profile.xml
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/rules/test_profile_name_null.xml b/sonar-deprecated/src/test/resources/org/sonar/api/rules/test_profile_name_null.xml
index 65d39e70403..65d39e70403 100644
--- a/sonar-plugin-api/src/test/resources/org/sonar/api/rules/test_profile_name_null.xml
+++ b/sonar-deprecated/src/test/resources/org/sonar/api/rules/test_profile_name_null.xml
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/FakePlugin.java b/sonar-plugin-api/src/test/java/org/sonar/api/FakePlugin.java
deleted file mode 100644
index 8bd20b265ba..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/FakePlugin.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2009 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.api;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.sonar.api.batch.Sensor;
-import org.sonar.api.resources.AbstractLanguage;
-import org.sonar.api.resources.Language;
-import org.sonar.api.rules.RulesRepository;
-
-public class FakePlugin implements Plugin {
- private Language lang;
- private String key;
- private Class<? extends RulesRepository> rulesClass;
- private Class<? extends Sensor> sensor = null;
-
- public FakePlugin(String key, Language lang) {
- this.lang = lang;
- this.key = key;
- }
-
- public FakePlugin(String key, Language lang, Class<? extends RulesRepository> rulesClass) {
- this.lang = lang;
- this.key = key;
- this.rulesClass = rulesClass;
- }
-
- public FakePlugin(String key, Language lang, Class<? extends RulesRepository> rulesClass, Class<? extends Sensor> sensor) {
- this.lang = lang;
- this.key = key;
- this.rulesClass = rulesClass;
- this.sensor = sensor;
- }
-
- FakePlugin() {
- this("fake", new AbstractLanguage("fake", "Fake") {
- public String[] getFileSuffixes() {
- return new String[0];
- }
- });
- }
-
- public String getKey() {
- return key;
- }
-
- public String getName() {
- return null;
- }
-
- public String getDescription() {
- return null;
- }
-
- public Language getLanguage() {
- return lang;
- }
-
- public List<Class<? extends Extension>> getExtensions() {
- List<Class<? extends Extension>> list = new ArrayList<Class<? extends Extension>>();
- if (sensor != null) {
- list.add(sensor);
- }
- if (rulesClass != null) {
- list.add(rulesClass);
- }
- return list;
- }
-
-
-}