use of org.sonar.ce.task.projectanalysis.qualitygate.ConditionStatus in project sonarqube by SonarSource.
the class ConditionToCondition method apply.
@Override
@Nonnull
public QualityGate.Condition apply(Condition input) {
String metricKey = input.getMetric().getKey();
ConditionStatus conditionStatus = statusPerConditions.get(input);
checkState(conditionStatus != null, "Missing ConditionStatus for condition on metric key %s", metricKey);
return builder.setStatus(convert(conditionStatus.getStatus())).setMetricKey(metricKey).setOperator(convert(input.getOperator())).setErrorThreshold(input.getErrorThreshold()).setValue(conditionStatus.getValue()).build();
}
use of org.sonar.ce.task.projectanalysis.qualitygate.ConditionStatus in project sonarqube by SonarSource.
the class QualityGateMeasuresStep method createStatusPerCondition.
private static Map<Condition, ConditionStatus> createStatusPerCondition(Iterable<Condition> conditions, Iterable<EvaluatedCondition> evaluatedConditions) {
Map<Condition, EvaluatedCondition> evaluatedConditionPerCondition = from(evaluatedConditions).uniqueIndex(EvaluatedConditionToCondition.INSTANCE);
ImmutableMap.Builder<Condition, ConditionStatus> builder = ImmutableMap.builder();
for (Condition condition : conditions) {
EvaluatedCondition evaluatedCondition = evaluatedConditionPerCondition.get(condition);
if (evaluatedCondition == null) {
builder.put(condition, NO_VALUE_STATUS);
} else {
builder.put(condition, create(toEvaluationStatus(evaluatedCondition.getLevel()), evaluatedCondition.getActualValue()));
}
}
return builder.build();
}
Aggregations