use of org.sonarqube.ws.Qualityprofiles.ShowResponse in project sonarqube by SonarSource.
the class ShowActionTest method profile_info.
@Test
public void profile_info() {
QProfileDto profile = db.qualityProfiles().insert(p -> p.setLanguage(XOO1.getKey()));
ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()));
assertThat(result.getProfile()).extracting(QualityProfile::getKey, QualityProfile::getName, QualityProfile::getIsBuiltIn, QualityProfile::getLanguage, QualityProfile::getLanguageName, QualityProfile::getIsInherited).containsExactly(profile.getKee(), profile.getName(), profile.isBuiltIn(), profile.getLanguage(), XOO1.getName(), false);
}
use of org.sonarqube.ws.Qualityprofiles.ShowResponse in project sonarqube by SonarSource.
the class ShowActionTest method default_profile.
@Test
public void default_profile() {
QProfileDto profile = db.qualityProfiles().insert(p -> p.setLanguage(XOO1.getKey()));
db.qualityProfiles().setAsDefault(profile);
ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()));
assertThat(result.getProfile().getIsDefault()).isTrue();
}
use of org.sonarqube.ws.Qualityprofiles.ShowResponse in project sonarqube by SonarSource.
the class ShowActionTest method show.
@Test
public void show() {
QProfileDto qualityProfile = db.qualityProfiles().insert(p -> p.setLanguage(XOO1.getKey()));
UserDto user = db.users().insertUser();
userSession.logIn(user);
ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, qualityProfile.getKee()));
assertThat(result.getProfile()).extracting(QualityProfile::getKey).isEqualTo(qualityProfile.getKee());
}
use of org.sonarqube.ws.Qualityprofiles.ShowResponse in project sonarqube by SonarSource.
the class ShowActionTest method map_dates.
@Test
public void map_dates() {
long time = DateUtils.parseDateTime("2016-12-22T19:10:03+0100").getTime();
QProfileDto profile = db.qualityProfiles().insert(p -> p.setLanguage(XOO1.getKey()).setRulesUpdatedAt("2016-12-21T19:10:03+0100").setLastUsed(time).setUserUpdatedAt(time));
ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()));
assertThat(result.getProfile().getRulesUpdatedAt()).isEqualTo("2016-12-21T19:10:03+0100");
assertThat(parseDateTime(result.getProfile().getLastUsed()).getTime()).isEqualTo(time);
assertThat(parseDateTime(result.getProfile().getUserUpdatedAt()).getTime()).isEqualTo(time);
}
use of org.sonarqube.ws.Qualityprofiles.ShowResponse in project sonarqube by SonarSource.
the class ShowActionTest method no_comparison_when_sonar_way_does_not_exist.
@Test
public void no_comparison_when_sonar_way_does_not_exist() {
QProfileDto anotherSonarWayProfile = db.qualityProfiles().insert(p -> p.setIsBuiltIn(true).setName("Another 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();
}
Aggregations