From 09b2961251f26c052e9e0cca9155d68e08b1f290 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Fri, 7 Nov 2014 10:25:15 +0100 Subject: [PATCH] SONAR-5844 Profile inheritance is always displaying '0 rules' whatever the content of Profiles --- .../qualityprofile/index/ActiveRuleIndex.java | 2 +- .../ActiveRuleBackendMediumTest.java | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleIndex.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleIndex.java index e96cafcecba..dfffc90eb3a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleIndex.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleIndex.java @@ -180,7 +180,7 @@ public class ActiveRuleIndex extends BaseIndex profileKeys = newArrayList(); + for (int i = 0; i<30; i++) { + QualityProfileDto profileDto = QProfileTesting.newDto(QProfileName.createFor("xoo", "profile-" + i), "profile-" + i); + profileKeys.add(profileDto.getKey()); + db.qualityProfileDao().insert(dbSession, profileDto); + + db.activeRuleDao().insert(dbSession, + ActiveRuleDto.createFor(profileDto, ruleDto1) + .setSeverity(Severity.BLOCKER), + ActiveRuleDto.createFor(profileDto, ruleDto2) + .setSeverity(Severity.MAJOR) + ); + } + dbSession.commit(); + dbSession.clearCache(); + + Map> stats = index.get(ActiveRuleIndex.class).getStatsByProfileKeys(profileKeys); + assertThat(stats).hasSize(30); + } + private RuleDto newRuleDto(RuleKey ruleKey) { return new RuleDto() .setRuleKey(ruleKey.rule()) -- 2.39.5