use of org.sonarqube.ws.Qualityprofiles.ShowResponse.QualityProfile in project sonarqube by SonarSource.
the class ShowActionTest method statistics.
@Test
public void statistics() {
QProfileDto profile = db.qualityProfiles().insert(p -> p.setLanguage(XOO1.getKey()));
// Active rules
range(0, 10).mapToObj(i -> db.rules().insertRule(r -> r.setLanguage(XOO1.getKey())).getDefinition()).forEach(r -> db.qualityProfiles().activateRule(profile, r));
// Deprecated rules
range(0, 3).mapToObj(i -> db.rules().insertRule(r -> r.setLanguage(XOO1.getKey()).setStatus(DEPRECATED)).getDefinition()).forEach(r -> db.qualityProfiles().activateRule(profile, r));
// Projects
range(0, 7).mapToObj(i -> db.components().insertPrivateProjectDto()).forEach(project -> db.qualityProfiles().associateWithProject(project, profile));
ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()));
assertThat(result.getProfile()).extracting(QualityProfile::getActiveRuleCount, QualityProfile::getActiveDeprecatedRuleCount, QualityProfile::getProjectCount).containsExactly(13L, 3L, 7L);
}
Aggregations