use of org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse in project sonarqube by SonarSource.
the class CreateConditionAction method doHandle.
private CreateConditionWsResponse doHandle(CreateConditionRequest request, DbSession dbSession) {
QualityGateConditionDto condition = qualityGateConditionsUpdater.createCondition(dbSession, request.getQualityGateId(), request.getMetricKey(), request.getOperator(), request.getWarning(), request.getError(), request.getPeriod());
CreateConditionWsResponse.Builder response = CreateConditionWsResponse.newBuilder().setId(condition.getId()).setMetric(condition.getMetricKey()).setOp(condition.getOperator());
setNullable(condition.getWarningThreshold(), response::setWarning);
setNullable(condition.getErrorThreshold(), response::setError);
setNullable(condition.getPeriod(), response::setPeriod);
return response.build();
}
use of org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse in project sonarqube by SonarSource.
the class UpdateConditionActionTest method update_error_condition.
@Test
public void update_error_condition() throws Exception {
logInAsQualityGateAdmin();
CreateConditionWsResponse response = executeRequest(conditionDto.getId(), coverageMetricDto.getKey(), "LT", null, "90", null);
assertCondition(response, "LT", null, "90", null);
}
use of org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse in project sonarqube by SonarSource.
the class UpdateConditionActionTest method update_condition_over_leak_period.
@Test
public void update_condition_over_leak_period() throws Exception {
logInAsQualityGateAdmin();
CreateConditionWsResponse response = executeRequest(conditionDto.getId(), coverageMetricDto.getKey(), "LT", null, "90", 1);
assertCondition(response, "LT", null, "90", 1);
}
use of org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse in project sonarqube by SonarSource.
the class UpdateConditionActionTest method update_warning_condition.
@Test
public void update_warning_condition() throws Exception {
logInAsQualityGateAdmin();
CreateConditionWsResponse response = executeRequest(conditionDto.getId(), coverageMetricDto.getKey(), "LT", "90", null, null);
assertCondition(response, "LT", "90", null, null);
}
use of org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse in project sonarqube by SonarSource.
the class CreateConditionActionTest method create_error_condition.
@Test
public void create_error_condition() throws Exception {
logInAsQualityGateAdmin();
CreateConditionWsResponse response = executeRequest(qualityGateDto.getId(), coverageMetricDto.getKey(), "LT", null, "90", null);
assertCondition(response, "LT", null, "90", null);
}
Aggregations