diff options
Diffstat (limited to 'sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java | 17 |
1 files changed, 14 insertions, 3 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 6cf1c15157d..1be6d3194aa 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 @@ -19,8 +19,9 @@ */ package org.sonar.batch.mediumtest; -import org.sonar.api.server.rule.RulesDefinition.Repository; +import org.sonar.batch.bootstrapper.IssueListener; +import org.sonar.api.server.rule.RulesDefinition.Repository; import org.sonar.api.server.rule.RulesDefinition; import org.sonar.batch.protocol.input.RulesSearchResult; import org.sonar.batch.rule.RulesLoader; @@ -144,7 +145,7 @@ public class BatchMediumTester { List<Repository> repositories = context.repositories(); for (Repository repo : repositories) { for (RulesDefinition.Rule rule : repo.rules()) { - this.addRule(new Rule(rule.repository().key() + ":" + rule.key(), rule.repository().key(), rule.internalKey(), rule.name(), rule.severity(), repo.language())); + this.addRule(new Rule(rule.repository().key() + ":" + rule.key(), rule.repository().key(), rule.internalKey(), rule.name())); } } return this; @@ -234,6 +235,7 @@ public class BatchMediumTester { public static class TaskBuilder { private final Map<String, String> taskProperties = new HashMap<>(); private BatchMediumTester tester; + private IssueListener issueListener = null; public TaskBuilder(BatchMediumTester tester) { this.tester = tester; @@ -243,7 +245,11 @@ public class BatchMediumTester { TaskResult result = new TaskResult(); Map<String, String> props = new HashMap<>(); props.putAll(taskProperties); - tester.batch.executeTask(props, result); + if (issueListener != null) { + tester.batch.executeTask(props, result, issueListener); + } else { + tester.batch.executeTask(props, result); + } return result; } @@ -256,6 +262,11 @@ public class BatchMediumTester { taskProperties.put(key, value); return this; } + + public TaskBuilder setIssueListener(IssueListener issueListener) { + this.issueListener = issueListener; + return this; + } } private static class FakeRulesLoader implements RulesLoader { |