use of org.sonar.ce.task.projectanalysis.issue.DumbRule in project sonarqube by SonarSource.
the class NotificationFactoryTest method newMyNewIssuesNotification_DetailsSupplier_getRuleDefinitionByRuleKey_returns_name_and_language_from_RuleRepository.
@Test
public void newMyNewIssuesNotification_DetailsSupplier_getRuleDefinitionByRuleKey_returns_name_and_language_from_RuleRepository() {
RuleKey rulekey1 = RuleKey.of("foo", "bar");
RuleKey rulekey2 = RuleKey.of("foo", "donut");
RuleKey rulekey3 = RuleKey.of("no", "language");
DumbRule rule1 = ruleRepository.add(rulekey1).setName("rule1").setLanguage("lang1");
DumbRule rule2 = ruleRepository.add(rulekey2).setName("rule2").setLanguage("lang2");
DumbRule rule3 = ruleRepository.add(rulekey3).setName("rule3");
MyNewIssuesNotification underTest = this.underTest.newMyNewIssuesNotification(emptyMap());
DetailsSupplier detailsSupplier = readDetailsSupplier(underTest);
assertThat(detailsSupplier.getRuleDefinitionByRuleKey(rulekey1)).contains(new RuleDefinition(rule1.getName(), rule1.getLanguage()));
assertThat(detailsSupplier.getRuleDefinitionByRuleKey(rulekey2)).contains(new RuleDefinition(rule2.getName(), rule2.getLanguage()));
assertThat(detailsSupplier.getRuleDefinitionByRuleKey(rulekey3)).contains(new RuleDefinition(rule3.getName(), null));
assertThat(detailsSupplier.getRuleDefinitionByRuleKey(RuleKey.of("donut", "foo"))).isEmpty();
}
use of org.sonar.ce.task.projectanalysis.issue.DumbRule in project sonarqube by SonarSource.
the class LoadQualityProfilesStepTest method ignore_rules_with_status_REMOVED.
@Test
public void ignore_rules_with_status_REMOVED() {
ruleRepository.add(new DumbRule(XOO_X1).setStatus(RuleStatus.REMOVED));
ScannerReport.ActiveRule.Builder batch1 = ScannerReport.ActiveRule.newBuilder().setRuleRepository(XOO_X1.repository()).setRuleKey(XOO_X1.rule()).setSeverity(Constants.Severity.BLOCKER);
batchReportReader.putActiveRules(asList(batch1.build()));
underTest.execute(new TestComputationStepContext());
assertThat(activeRulesHolder.getAll()).isEmpty();
}
use of org.sonar.ce.task.projectanalysis.issue.DumbRule in project sonarqube by SonarSource.
the class NotificationFactoryTest method newNewIssuesNotification_DetailsSupplier_getRuleDefinitionByRuleKey_returns_name_and_language_from_RuleRepository.
@Test
public void newNewIssuesNotification_DetailsSupplier_getRuleDefinitionByRuleKey_returns_name_and_language_from_RuleRepository() {
RuleKey rulekey1 = RuleKey.of("foo", "bar");
RuleKey rulekey2 = RuleKey.of("foo", "donut");
RuleKey rulekey3 = RuleKey.of("no", "language");
DumbRule rule1 = ruleRepository.add(rulekey1).setName("rule1").setLanguage("lang1");
DumbRule rule2 = ruleRepository.add(rulekey2).setName("rule2").setLanguage("lang2");
DumbRule rule3 = ruleRepository.add(rulekey3).setName("rule3");
NewIssuesNotification underTest = this.underTest.newNewIssuesNotification(emptyMap());
DetailsSupplier detailsSupplier = readDetailsSupplier(underTest);
assertThat(detailsSupplier.getRuleDefinitionByRuleKey(rulekey1)).contains(new RuleDefinition(rule1.getName(), rule1.getLanguage()));
assertThat(detailsSupplier.getRuleDefinitionByRuleKey(rulekey2)).contains(new RuleDefinition(rule2.getName(), rule2.getLanguage()));
assertThat(detailsSupplier.getRuleDefinitionByRuleKey(rulekey3)).contains(new RuleDefinition(rule3.getName(), null));
assertThat(detailsSupplier.getRuleDefinitionByRuleKey(RuleKey.of("donut", "foo"))).isEmpty();
}
Aggregations