use of org.sonar.server.qualitygate.EvaluatedQualityGate in project sonarqube by SonarSource.
the class QualityGateHolderImplTest method getEvaluation_returns_QualityGate_set_by_setQualityGate.
@Test
public void getEvaluation_returns_QualityGate_set_by_setQualityGate() {
QualityGateHolderImpl holder = new QualityGateHolderImpl();
EvaluatedQualityGate evaluation = mock(EvaluatedQualityGate.class);
holder.setEvaluation(evaluation);
assertThat(holder.getEvaluation().get()).isSameAs(evaluation);
}
use of org.sonar.server.qualitygate.EvaluatedQualityGate in project sonarqube by SonarSource.
the class QGToEvaluatedQG method apply.
@Override
public EvaluatedQualityGate apply(QualityGate qg) {
EvaluatedQualityGate.Builder builder = EvaluatedQualityGate.newBuilder();
Set<Condition> conditions = qg.getConditions().stream().map(q -> {
Condition condition = new Condition(q.getMetricKey(), Condition.Operator.valueOf(q.getOperator().name()), q.getErrorThreshold());
builder.addEvaluatedCondition(condition, EvaluatedCondition.EvaluationStatus.valueOf(q.getStatus().name()), q.getStatus() == EvaluationStatus.NO_VALUE ? null : q.getValue());
return condition;
}).collect(MoreCollectors.toSet());
return builder.setQualityGate(new org.sonar.server.qualitygate.QualityGate(qg.getId(), qg.getName(), conditions)).setStatus(Metric.Level.valueOf(qg.getStatus().name())).build();
}
Aggregations