use of org.sonarqube.ws.Qualityprofiles.ShowResponse 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);
}
use of org.sonarqube.ws.Qualityprofiles.ShowResponse in project sonarqube by SonarSource.
the class ShowActionTest method no_comparison_when_profile_is_built_in.
@Test
public void no_comparison_when_profile_is_built_in() {
QProfileDto sonarWayProfile = db.qualityProfiles().insert(p -> p.setIsBuiltIn(true).setName("Sonar way").setLanguage(XOO1.getKey()));
QProfileDto anotherBuiltInProfile = db.qualityProfiles().insert(p -> p.setIsBuiltIn(true).setLanguage(XOO1.getKey()));
ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, anotherBuiltInProfile.getKee()).setParam(PARAM_COMPARE_TO_SONAR_WAY, "true"));
assertThat(result.hasCompareToSonarWay()).isFalse();
}
use of org.sonarqube.ws.Qualityprofiles.ShowResponse in project sonarqube by SonarSource.
the class ShowActionTest method non_default_profile.
@Test
public void non_default_profile() {
QProfileDto profile = db.qualityProfiles().insert(p -> p.setLanguage(XOO1.getKey()));
QProfileDto defaultProfile = db.qualityProfiles().insert(p -> p.setLanguage(XOO1.getKey()));
db.qualityProfiles().setAsDefault(defaultProfile);
ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()));
assertThat(result.getProfile().getIsDefault()).isFalse();
}
use of org.sonarqube.ws.Qualityprofiles.ShowResponse in project sonarqube by SonarSource.
the class ShowActionTest method no_comparison_if_sonar_way_is_not_built_in.
@Test
public void no_comparison_if_sonar_way_is_not_built_in() {
QProfileDto sonarWayProfile = db.qualityProfiles().insert(p -> p.setIsBuiltIn(false).setName("Sonar way").setLanguage(XOO1.getKey()));
QProfileDto profile = db.qualityProfiles().insert(p -> p.setLanguage(XOO1.getKey()));
ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()).setParam(PARAM_COMPARE_TO_SONAR_WAY, "true"));
assertThat(result.hasCompareToSonarWay()).isFalse();
}
use of org.sonarqube.ws.Qualityprofiles.ShowResponse in project sonarqube by SonarSource.
the class ShowActionTest method no_comparison_when_param_is_false.
@Test
public void no_comparison_when_param_is_false() {
QProfileDto sonarWayProfile = db.qualityProfiles().insert(p -> p.setIsBuiltIn(true).setName("Sonar way").setLanguage(XOO1.getKey()));
QProfileDto profile = db.qualityProfiles().insert(p -> p.setLanguage(XOO1.getKey()));
ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()).setParam(PARAM_COMPARE_TO_SONAR_WAY, "false"));
assertThat(result.hasCompareToSonarWay()).isFalse();
}
Aggregations