]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5329 - Updated getProfileStats
authorStephane Gamard <stephane.gamard@searchbox.com>
Mon, 16 Jun 2014 12:21:59 +0000 (14:21 +0200)
committerStephane Gamard <stephane.gamard@searchbox.com>
Mon, 16 Jun 2014 12:22:07 +0000 (14:22 +0200)
sonar-server/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleIndex.java
sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileServiceMediumTest.java

index 50b3788eaf77375486dcfe92f0d00570bb682a16..07cedb501b005ecafa38341b2da24493b00de723 100644 (file)
@@ -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();
index e4f51b4b6d81500b96fe8b21905a7796cb5113e9..5cfc763b574a340874d6d3da02f121dbb90a6477 100644 (file)
@@ -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);
   }
 }