use of org.sonarqube.ws.Qualityprofiles.SearchWsResponse in project sonarqube by SonarSource.
the class SearchActionTest method map_dates.
@Test
public void map_dates() {
long time = DateUtils.parseDateTime("2016-12-22T19:10:03+0100").getTime();
qualityProfileDb.insert(newQualityProfileDto().setLanguage(XOO1.getKey()).setRulesUpdatedAt("2016-12-21T19:10:03+0100").setLastUsed(time).setUserUpdatedAt(time));
SearchWsResponse result = call(ws.newRequest());
assertThat(result.getProfilesCount()).isOne();
assertThat(result.getProfiles(0).getRulesUpdatedAt()).isEqualTo("2016-12-21T19:10:03+0100");
assertThat(parseDateTime(result.getProfiles(0).getLastUsed()).getTime()).isEqualTo(time);
assertThat(parseDateTime(result.getProfiles(0).getUserUpdatedAt()).getTime()).isEqualTo(time);
}
use of org.sonarqube.ws.Qualityprofiles.SearchWsResponse 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());
}
use of org.sonarqube.ws.Qualityprofiles.SearchWsResponse 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());
}
use of org.sonarqube.ws.Qualityprofiles.SearchWsResponse in project sonarqube by SonarSource.
the class SearchActionTest method does_not_filter_when_defaults_is_false.
@Test
public void does_not_filter_when_defaults_is_false() {
QProfileDto defaultProfile1 = db.qualityProfiles().insert(p -> p.setLanguage(XOO1.getKey()));
QProfileDto defaultProfile2 = db.qualityProfiles().insert(p -> p.setLanguage(XOO2.getKey()));
QProfileDto nonDefaultProfile = db.qualityProfiles().insert(p -> p.setLanguage(XOO1.getKey()));
db.qualityProfiles().setAsDefault(defaultProfile1, defaultProfile2);
SearchWsResponse result = call(ws.newRequest().setParam(PARAM_DEFAULTS, "false"));
assertThat(result.getProfilesList()).extracting(QualityProfile::getKey).containsExactlyInAnyOrder(defaultProfile1.getKee(), defaultProfile2.getKee(), nonDefaultProfile.getKee());
}
use of org.sonarqube.ws.Qualityprofiles.SearchWsResponse 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());
}
Aggregations