Search in sources :

Example 1 with CreateConditionWsResponse

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();
}
Also used : CreateConditionWsResponse(org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse) QualityGateConditionDto(org.sonar.db.qualitygate.QualityGateConditionDto)

Example 2 with CreateConditionWsResponse

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);
}
Also used : CreateConditionWsResponse(org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse) Test(org.junit.Test)

Example 3 with CreateConditionWsResponse

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);
}
Also used : CreateConditionWsResponse(org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse) Test(org.junit.Test)

Example 4 with CreateConditionWsResponse

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);
}
Also used : CreateConditionWsResponse(org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse) Test(org.junit.Test)

Example 5 with CreateConditionWsResponse

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);
}
Also used : CreateConditionWsResponse(org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse) Test(org.junit.Test)

Aggregations

CreateConditionWsResponse (org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse)7 Test (org.junit.Test)6 QualityGateConditionDto (org.sonar.db.qualitygate.QualityGateConditionDto)1