use of org.sonar.wsclient.qualitygate.QualityGate in project sonarqube by SonarSource.
the class QualityGateTest method use_server_settings_instead_of_default_gate.
@Test
public void use_server_settings_instead_of_default_gate() throws IOException {
QualityGate alert = qgClient().create("AlertWithLowThreshold");
qgClient().createCondition(NewCondition.create(alert.id()).metricKey("ncloc").operator("GT").warningThreshold("10"));
QualityGate error = qgClient().create("ErrorWithLowThreshold");
qgClient().createCondition(NewCondition.create(error.id()).metricKey("ncloc").operator("GT").errorThreshold("10"));
qgClient().setDefault(alert.id());
associateQualityGateToProject(error.id(), PROJECT_KEY);
try {
SonarScanner build = SonarScanner.create(projectDir("qualitygate/xoo-sample"));
BuildResult buildResult = orchestrator.executeBuild(build);
verifyQGStatusInPostTask(buildResult, TASK_STATUS_SUCCESS, QG_STATUS_ERROR);
assertThat(getGateStatusMeasure().getValue()).isEqualTo("ERROR");
} finally {
qgClient().unsetDefault();
qgClient().destroy(alert.id());
qgClient().destroy(error.id());
}
}
use of org.sonar.wsclient.qualitygate.QualityGate in project sonarqube by SonarSource.
the class ProjectQualityGatePageTest method should_display_custom.
@Test
public void should_display_custom() {
QualityGate customQualityGate = createCustomQualityGate("should_display_custom");
associateWithQualityGate(customQualityGate);
ProjectQualityGatePage page = openPage();
SelenideElement selectedQualityGate = page.getSelectedQualityGate();
selectedQualityGate.shouldNot(Condition.hasText("Default"));
selectedQualityGate.should(Condition.hasText(customQualityGate.name()));
}
use of org.sonar.wsclient.qualitygate.QualityGate in project sonarqube by SonarSource.
the class ProjectQualityGatePageTest method should_set_none.
@Test
@Ignore("find a way to select None")
public void should_set_none() {
qualityGateClient().unsetDefault();
QualityGate customQualityGate = createCustomQualityGate("should_set_none");
associateWithQualityGate(customQualityGate);
ProjectQualityGatePage page = openPage();
page.setQualityGate("");
page.assertNotSelected();
}
use of org.sonar.wsclient.qualitygate.QualityGate in project sonarqube by SonarSource.
the class ProjectQualityGatePageTest method should_display_default.
@Test
public void should_display_default() {
QualityGate customQualityGate = createCustomQualityGate("should_display_default");
qualityGateClient().setDefault(customQualityGate.id());
ProjectQualityGatePage page = openPage();
SelenideElement selectedQualityGate = page.getSelectedQualityGate();
selectedQualityGate.should(Condition.hasText("Default"));
selectedQualityGate.should(Condition.hasText(customQualityGate.name()));
}
Aggregations