Search in sources :

Example 21 with QualityProfile

use of org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile in project sonarqube by SonarSource.

the class SearchActionTest method filter_on_language.

@Test
public void filter_on_language() {
    QProfileDto profile1OnXoo1 = db.qualityProfiles().insert(p -> p.setLanguage(XOO1.getKey()));
    QProfileDto profile2OnXoo1 = db.qualityProfiles().insert(p -> p.setLanguage(XOO1.getKey()));
    QProfileDto profileOnXoo2 = db.qualityProfiles().insert(p -> p.setLanguage(XOO2.getKey()));
    SearchWsResponse result = call(ws.newRequest().setParam(PARAM_LANGUAGE, XOO1.getKey()));
    assertThat(result.getProfilesList()).extracting(QualityProfile::getKey).containsExactlyInAnyOrder(profile1OnXoo1.getKee(), profile2OnXoo1.getKee()).doesNotContain(profileOnXoo2.getKee());
}
Also used : QProfileDto(org.sonar.db.qualityprofile.QProfileDto) QualityProfile(org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile) SearchWsResponse(org.sonarqube.ws.Qualityprofiles.SearchWsResponse) Test(org.junit.Test)

Example 22 with QualityProfile

use of org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile in project sonarqube by SonarSource.

the class SearchActionTest method filter_on_profile_name.

@Test
public void filter_on_profile_name() {
    QProfileDto sonarWayOnXoo1 = db.qualityProfiles().insert(p -> p.setName("Sonar way").setLanguage(XOO1.getKey()));
    QProfileDto sonarWayOnXoo2 = db.qualityProfiles().insert(p -> p.setName("Sonar way").setLanguage(XOO1.getKey()));
    QProfileDto sonarWayInCamelCase = db.qualityProfiles().insert(p -> p.setName("Sonar Way").setLanguage(XOO2.getKey()));
    QProfileDto anotherProfile = db.qualityProfiles().insert(p -> p.setName("Another").setLanguage(XOO2.getKey()));
    SearchWsResponse result = call(ws.newRequest().setParam(PARAM_QUALITY_PROFILE, "Sonar way"));
    assertThat(result.getProfilesList()).extracting(QualityProfile::getKey).containsExactlyInAnyOrder(sonarWayOnXoo1.getKee(), sonarWayOnXoo2.getKee()).doesNotContain(anotherProfile.getKee(), sonarWayInCamelCase.getKee());
}
Also used : QProfileDto(org.sonar.db.qualityprofile.QProfileDto) QualityProfile(org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile) SearchWsResponse(org.sonarqube.ws.Qualityprofiles.SearchWsResponse) Test(org.junit.Test)

Example 23 with QualityProfile

use of org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile in project sonarqube by SonarSource.

the class SearchActionTest method filter_on_defaults_and_name.

@Test
public void filter_on_defaults_and_name() {
    QProfileDto sonarWayOnXoo1 = db.qualityProfiles().insert(p -> p.setName("Sonar way").setLanguage(XOO1.getKey()));
    QProfileDto sonarWayOnXoo2 = db.qualityProfiles().insert(p -> p.setName("Sonar way").setLanguage(XOO2.getKey()));
    QProfileDto anotherProfile = db.qualityProfiles().insert(p -> p.setName("Another").setLanguage(XOO2.getKey()));
    db.qualityProfiles().setAsDefault(sonarWayOnXoo1, anotherProfile);
    SearchWsResponse result = call(ws.newRequest().setParam(PARAM_DEFAULTS, "true").setParam(PARAM_QUALITY_PROFILE, "Sonar way"));
    assertThat(result.getProfilesList()).extracting(QualityProfile::getKey).containsExactlyInAnyOrder(sonarWayOnXoo1.getKee()).doesNotContain(sonarWayOnXoo2.getKee(), anotherProfile.getKee());
}
Also used : QProfileDto(org.sonar.db.qualityprofile.QProfileDto) QualityProfile(org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile) SearchWsResponse(org.sonarqube.ws.Qualityprofiles.SearchWsResponse) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)16 QualityProfile (org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile)16 SearchWsResponse (org.sonarqube.ws.Qualityprofiles.SearchWsResponse)13 QProfileDto (org.sonar.db.qualityprofile.QProfileDto)12 ProjectDto (org.sonar.db.project.ProjectDto)7 QualityProfile (org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile)7 QualityProfileTesting.newQualityProfileDto (org.sonar.db.qualityprofile.QualityProfileTesting.newQualityProfileDto)5 InputStream (java.io.InputStream)4 List (java.util.List)4 IntStream.range (java.util.stream.IntStream.range)4 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)4 Assertions.assertThatThrownBy (org.assertj.core.api.Assertions.assertThatThrownBy)4 Assertions.tuple (org.assertj.core.api.Assertions.tuple)4 Rule (org.junit.Rule)4 Language (org.sonar.api.resources.Language)4 Languages (org.sonar.api.resources.Languages)4 DEPRECATED (org.sonar.api.rule.RuleStatus.DEPRECATED)4 Change (org.sonar.api.server.ws.Change)4 WebService (org.sonar.api.server.ws.WebService)4 DateUtils (org.sonar.api.utils.DateUtils)4