diff options
author | Stephane Gamard <stephane.gamard@searchbox.com> | 2014-06-16 14:21:59 +0200 |
---|---|---|
committer | Stephane Gamard <stephane.gamard@searchbox.com> | 2014-06-16 14:22:07 +0200 |
commit | 5bff656f134e897db039c4d83c38a1773693faec (patch) | |
tree | e08939ae0ad5fc4ccc3f17c21677d149021e0d21 /sonar-server | |
parent | 0387123e68d203520e6313937fb98b3ada5c87ac (diff) | |
download | sonarqube-5bff656f134e897db039c4d83c38a1773693faec.tar.gz sonarqube-5bff656f134e897db039c4d83c38a1773693faec.zip |
SONAR-5329 - Updated getProfileStats
Diffstat (limited to 'sonar-server')
-rw-r--r-- | sonar-server/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleIndex.java | 6 | ||||
-rw-r--r-- | sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileServiceMediumTest.java | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleIndex.java b/sonar-server/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleIndex.java index 50b3788eaf7..07cedb501b0 100644 --- a/sonar-server/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleIndex.java +++ b/sonar-server/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleIndex.java @@ -200,9 +200,9 @@ public class ActiveRuleIndex extends BaseIndex<ActiveRule, ActiveRuleDto, Active .addAggregation(AggregationBuilders.terms(ActiveRuleNormalizer.ActiveRuleField.PROFILE_KEY.field()) .field(ActiveRuleNormalizer.ActiveRuleField.PROFILE_KEY.field()) .subAggregation(AggregationBuilders.terms(ActiveRuleNormalizer.ActiveRuleField.INHERITANCE.field()) - .field(ActiveRuleNormalizer.ActiveRuleField.INHERITANCE.field()) - .subAggregation(AggregationBuilders.terms(ActiveRuleNormalizer.ActiveRuleField.SEVERITY.field()) - .field(ActiveRuleNormalizer.ActiveRuleField.SEVERITY.field())))) + .field(ActiveRuleNormalizer.ActiveRuleField.INHERITANCE.field())) + .subAggregation(AggregationBuilders.terms(ActiveRuleNormalizer.ActiveRuleField.SEVERITY.field()) + .field(ActiveRuleNormalizer.ActiveRuleField.SEVERITY.field()))) .setSize(0) .setTypes(this.getIndexType()) .get(); diff --git a/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileServiceMediumTest.java b/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileServiceMediumTest.java index e4f51b4b6d8..5cfc763b574 100644 --- a/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileServiceMediumTest.java +++ b/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileServiceMediumTest.java @@ -33,6 +33,7 @@ import org.sonar.core.qualityprofile.db.QualityProfileKey; import org.sonar.core.rule.RuleDto; import org.sonar.server.db.DbClient; import org.sonar.server.qualityprofile.index.ActiveRuleIndex; +import org.sonar.server.qualityprofile.index.ActiveRuleNormalizer; import org.sonar.server.rule.RuleTesting; import org.sonar.server.search.FacetValue; import org.sonar.server.tester.ServerTester; @@ -117,9 +118,10 @@ public class QProfileServiceMediumTest { dbSession.commit(); Map<QualityProfileKey, Multimap<String, FacetValue>> stats = service.getAllProfileStats(); - System.out.println("stats = " + stats); assertThat(stats.size()).isEqualTo(2); - assertThat(stats.get(XOO_PROFILE_1).size()).isEqualTo(1); + assertThat(stats.get(XOO_PROFILE_1).size()).isEqualTo(2); + assertThat(stats.get(XOO_PROFILE_1).get(ActiveRuleNormalizer.ActiveRuleField.SEVERITY.field()).size()).isEqualTo(1); + assertThat(stats.get(XOO_PROFILE_1).get(ActiveRuleNormalizer.ActiveRuleField.INHERITANCE.field()).size()).isEqualTo(1); } } |