aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2015-07-31 10:25:31 +0200
committerDuarte Meneses <duarte.meneses@sonarsource.com>2015-07-31 12:04:26 +0200
commit2d39cc9078bf6ae36d86842829627a62f32d85ca (patch)
tree63e56a91059706ddb2a296000dd7661a3dcc09cc /sonar-batch
parent187b5f6f59454df662b29692fb86b0be552b6372 (diff)
downloadsonarqube-2d39cc9078bf6ae36d86842829627a62f32d85ca.tar.gz
sonarqube-2d39cc9078bf6ae36d86842829627a62f32d85ca.zip
use new rules WS
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java2
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/rule/DefaultRulesLoader.java2
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/rule/RulesProvider.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/ChecksMediumTest.java5
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/MultilineIssuesMediumTest.java3
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/mediumtest/preview/PreviewAndReportsMediumTest.java1
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/rule/RulesProviderTest.java4
7 files changed, 8 insertions, 11 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java
index 2d1a6128cf6..3f078b2b08f 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java
@@ -150,7 +150,7 @@ public class BatchMediumTester {
List<Repository> repositories = context.repositories();
for (Repository repo : repositories) {
for (RulesDefinition.Rule rule : repo.rules()) {
- this.addRule(rule.repository().key() + ":" + rule.key(), rule.repository().key(), rule.internalKey(), rule.name());
+ this.addRule(rule.key(), rule.repository().key(), rule.internalKey(), rule.name());
}
}
return this;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/DefaultRulesLoader.java b/sonar-batch/src/main/java/org/sonar/batch/rule/DefaultRulesLoader.java
index b456847765c..f9cb7c426fe 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/rule/DefaultRulesLoader.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/rule/DefaultRulesLoader.java
@@ -30,7 +30,7 @@ import java.util.List;
import org.sonar.batch.bootstrap.WSLoader;
public class DefaultRulesLoader implements RulesLoader {
- private static final String RULES_SEARCH_URL = "/api/rules/search?ps=500&f=repo,name,internalKey";
+ private static final String RULES_SEARCH_URL = "/api/rules/list";
private final WSLoader wsLoader;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/RulesProvider.java b/sonar-batch/src/main/java/org/sonar/batch/rule/RulesProvider.java
index 98c4d9f60f7..cafc1ebf65f 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/rule/RulesProvider.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/rule/RulesProvider.java
@@ -43,7 +43,7 @@ public class RulesProvider extends ProviderAdapter {
RulesBuilder builder = new RulesBuilder();
for (Rule r : loadedRules) {
- NewRule newRule = builder.add(RuleKey.parse(r.getKey()));
+ NewRule newRule = builder.add(RuleKey.of(r.getRepository(), r.getKey()));
newRule.setName(r.getName());
newRule.setInternalKey(r.getInternalKey());
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/ChecksMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/ChecksMediumTest.java
index 03b1ac8e8e8..2750688ddc1 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/ChecksMediumTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/ChecksMediumTest.java
@@ -31,7 +31,6 @@ import org.junit.rules.TemporaryFolder;
import org.sonar.batch.mediumtest.BatchMediumTester;
import org.sonar.batch.mediumtest.TaskResult;
import org.sonar.batch.protocol.input.ActiveRule;
-import org.sonar.batch.protocol.input.Rule;
import org.sonar.batch.protocol.output.BatchReport.Issue;
import org.sonar.xoo.XooPlugin;
import org.sonar.xoo.rule.XooRulesDefinition;
@@ -47,8 +46,8 @@ public class ChecksMediumTest {
.registerPlugin("xoo", new XooPlugin())
.addRules(new XooRulesDefinition())
.addDefaultQProfile("xoo", "Sonar Way")
- .addRule("xoo:TemplateRule_1234", "xoo", "TemplateRule_1234", "A template rule")
- .addRule("xoo:TemplateRule_1235", "xoo", "TemplateRule_1235", "Another template rule")
+ .addRule("TemplateRule_1234", "xoo", "TemplateRule_1234", "A template rule")
+ .addRule("TemplateRule_1235", "xoo", "TemplateRule_1235", "Another template rule")
.activateRule(new ActiveRule("xoo", "TemplateRule_1234", "TemplateRule", "A template rule", "MAJOR", null, "xoo").addParam("line", "1"))
.activateRule(new ActiveRule("xoo", "TemplateRule_1235", "TemplateRule", "Another template rule", "MAJOR", null, "xoo").addParam("line", "2"))
.build();
diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/MultilineIssuesMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/MultilineIssuesMediumTest.java
index 39bfc8b8206..6c81599b8ce 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/MultilineIssuesMediumTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/MultilineIssuesMediumTest.java
@@ -29,7 +29,6 @@ import org.junit.rules.TemporaryFolder;
import org.sonar.batch.mediumtest.BatchMediumTester;
import org.sonar.batch.mediumtest.TaskResult;
import org.sonar.batch.protocol.input.ActiveRule;
-import org.sonar.batch.protocol.input.Rule;
import org.sonar.batch.protocol.output.BatchReport.Issue;
import org.sonar.batch.protocol.output.BatchReport.IssueLocation;
import org.sonar.xoo.XooPlugin;
@@ -45,7 +44,7 @@ public class MultilineIssuesMediumTest {
public BatchMediumTester tester = BatchMediumTester.builder()
.registerPlugin("xoo", new XooPlugin())
.addRules(new XooRulesDefinition())
- .addRule("xoo:MultilineIssue", "xoo", null, "Multinile Issue")
+ .addRule("MultilineIssue", "xoo", null, "Multinile Issue")
.addDefaultQProfile("xoo", "Sonar Way")
.activateRule(new ActiveRule("xoo", "MultilineIssue", null, "Multinile Issue", "MAJOR", null, "xoo"))
.build();
diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/preview/PreviewAndReportsMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/preview/PreviewAndReportsMediumTest.java
index 5dc998463ae..8c05646a740 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/preview/PreviewAndReportsMediumTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/preview/PreviewAndReportsMediumTest.java
@@ -42,7 +42,6 @@ import org.sonar.batch.mediumtest.TaskResult;
import org.sonar.batch.mediumtest.issues.IssuesMediumTest;
import org.sonar.batch.protocol.Constants.Severity;
import org.sonar.batch.protocol.input.ActiveRule;
-import org.sonar.batch.protocol.input.Rule;
import org.sonar.batch.scan.report.ConsoleReport;
import org.sonar.xoo.XooPlugin;
import org.sonar.xoo.rule.XooRulesDefinition;
diff --git a/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProviderTest.java b/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProviderTest.java
index dbd44a3a816..3e43363d5f9 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProviderTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProviderTest.java
@@ -48,13 +48,13 @@ public class RulesProviderTest {
assertThat(r.name()).isEqualTo(testRule.getName());
assertThat(r.internalKey()).isEqualTo(testRule.getInternalKey());
- assertThat(r.key().toString()).isEqualTo(testRule.getKey());
+ assertThat(r.key().rule()).isEqualTo(testRule.getKey());
assertThat(r.key().repository()).isEqualTo(testRule.getRepository());
}
private static Rule getTestRule() {
Rule.Builder ruleBuilder = Rule.newBuilder();
- ruleBuilder.setKey("repo1:key1");
+ ruleBuilder.setKey("key1");
ruleBuilder.setRepository("repo1");
ruleBuilder.setName("name");
ruleBuilder.setInternalKey("key1");