aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-09-10 13:04:24 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-09-10 13:04:24 +0000
commit23830d07ed51853724dc660fff187c9e5aa4b36a (patch)
tree6873e45ea9642bf45d91c4058dc1a5e54b8416c9 /sonar-core
parent5cd839bbecd061d9463694d025788754bfca0f08 (diff)
downloadsonarqube-23830d07ed51853724dc660fff187c9e5aa4b36a.tar.gz
sonarqube-23830d07ed51853724dc660fff187c9e5aa4b36a.zip
* rename RuleProvider to RuleFinder
* deprecate some classes in the rule API * add the parameter ValidationMessages to ProfileDefinition.createPrototype()
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/rule/DefaultRuleFinder.java (renamed from sonar-core/src/main/java/org/sonar/core/rule/DefaultRuleProvider.java)6
-rw-r--r--sonar-core/src/test/java/org/sonar/core/rule/DefaultRuleFinderTest.java (renamed from sonar-core/src/test/java/org/sonar/core/rule/DefaultRuleProviderTest.java)14
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/rule/DefaultRuleFinderTest/shared.xml (renamed from sonar-core/src/test/resources/org/sonar/core/rule/DefaultRuleProviderTest/shared.xml)0
3 files changed, 10 insertions, 10 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/rule/DefaultRuleProvider.java b/sonar-core/src/main/java/org/sonar/core/rule/DefaultRuleFinder.java
index 0512cff60e9..6a167b180f7 100644
--- a/sonar-core/src/main/java/org/sonar/core/rule/DefaultRuleProvider.java
+++ b/sonar-core/src/main/java/org/sonar/core/rule/DefaultRuleFinder.java
@@ -22,7 +22,7 @@ package org.sonar.core.rule;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.database.DatabaseSession;
import org.sonar.api.rules.Rule;
-import org.sonar.api.rules.RuleProvider;
+import org.sonar.api.rules.RuleFinder;
import org.sonar.api.rules.RuleQuery;
import org.sonar.jpa.session.DatabaseSessionFactory;
@@ -31,11 +31,11 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-public class DefaultRuleProvider implements RuleProvider {
+public class DefaultRuleFinder implements RuleFinder {
private DatabaseSessionFactory sessionFactory;
- public DefaultRuleProvider(DatabaseSessionFactory sessionFactory) {
+ public DefaultRuleFinder(DatabaseSessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
diff --git a/sonar-core/src/test/java/org/sonar/core/rule/DefaultRuleProviderTest.java b/sonar-core/src/test/java/org/sonar/core/rule/DefaultRuleFinderTest.java
index 69287804e8c..c80573be1c0 100644
--- a/sonar-core/src/test/java/org/sonar/core/rule/DefaultRuleProviderTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/rule/DefaultRuleFinderTest.java
@@ -32,12 +32,12 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
-public class DefaultRuleProviderTest extends AbstractDbUnitTestCase {
+public class DefaultRuleFinderTest extends AbstractDbUnitTestCase {
@Test
public void findByKey() {
setupData("shared");
- DefaultRuleProvider provider = new DefaultRuleProvider(getSessionFactory());
+ DefaultRuleFinder provider = new DefaultRuleFinder(getSessionFactory());
Rule rule = provider.findByKey("checkstyle", "com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck");
assertNotNull(rule);
assertThat(rule.getKey(), is("com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck"));
@@ -47,7 +47,7 @@ public class DefaultRuleProviderTest extends AbstractDbUnitTestCase {
@Test
public void findReturnsNullIfNoResults() {
setupData("shared");
- DefaultRuleProvider provider = new DefaultRuleProvider(getSessionFactory());
+ DefaultRuleFinder provider = new DefaultRuleFinder(getSessionFactory());
assertNull(provider.findByKey("checkstyle", "unknown"));
assertNull(provider.find(RuleQuery.create().withRepositoryKey("checkstyle").withConfigKey("unknown")));
}
@@ -55,7 +55,7 @@ public class DefaultRuleProviderTest extends AbstractDbUnitTestCase {
@Test
public void findRepositoryRules() {
setupData("shared");
- DefaultRuleProvider provider = new DefaultRuleProvider(getSessionFactory());
+ DefaultRuleFinder provider = new DefaultRuleFinder(getSessionFactory());
Collection<Rule> rules = provider.findAll(RuleQuery.create().withRepositoryKey("checkstyle"));
assertNotNull(rules);
assertThat(rules.size(), is(2)); // only enabled checkstyle rules
@@ -64,7 +64,7 @@ public class DefaultRuleProviderTest extends AbstractDbUnitTestCase {
@Test
public void findAllEnabled() {
setupData("shared");
- DefaultRuleProvider provider = new DefaultRuleProvider(getSessionFactory());
+ DefaultRuleFinder provider = new DefaultRuleFinder(getSessionFactory());
Collection<Rule> rules = provider.findAll(RuleQuery.create());
assertNotNull(rules);
assertThat(rules.size(), is(3)); // only enabled checkstyle+pmd rules
@@ -76,7 +76,7 @@ public class DefaultRuleProviderTest extends AbstractDbUnitTestCase {
@Test
public void doNotFindDisabledRules() {
setupData("shared");
- DefaultRuleProvider provider = new DefaultRuleProvider(getSessionFactory());
+ DefaultRuleFinder provider = new DefaultRuleFinder(getSessionFactory());
Rule rule = provider.findByKey("checkstyle", "DisabledCheck");
assertNull(rule);
}
@@ -84,7 +84,7 @@ public class DefaultRuleProviderTest extends AbstractDbUnitTestCase {
@Test
public void doNotFindUnknownRules() {
setupData("shared");
- DefaultRuleProvider provider = new DefaultRuleProvider(getSessionFactory());
+ DefaultRuleFinder provider = new DefaultRuleFinder(getSessionFactory());
Collection<Rule> rules = provider.findAll(RuleQuery.create().withRepositoryKey("unknown_repository"));
assertThat(rules.size(), is(0));
}
diff --git a/sonar-core/src/test/resources/org/sonar/core/rule/DefaultRuleProviderTest/shared.xml b/sonar-core/src/test/resources/org/sonar/core/rule/DefaultRuleFinderTest/shared.xml
index f6adafee0da..f6adafee0da 100644
--- a/sonar-core/src/test/resources/org/sonar/core/rule/DefaultRuleProviderTest/shared.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/rule/DefaultRuleFinderTest/shared.xml