public QualityGateConditionDto updateCondition(DbSession dbSession, QualityGateConditionDto condition, String metricKey, String operator, String errorThreshold) { MetricDto metric = getNonNullMetric(dbSession, metricKey); validateCondition(metric, operator, errorThreshold); condition .setMetricId(metric.getId()) .setMetricKey(metric.getKey()) .setOperator(operator) .setErrorThreshold(errorThreshold); dbClient.gateConditionDao().update(condition, dbSession); return condition; }
@Test public void testUpdate() { dbTester.prepareDbUnit(getClass(), "selectForQualityGate.xml"); underTest.update(new QualityGateConditionDto().setId(1L).setMetricId(7L).setOperator(">").setErrorThreshold("80"), dbSession); dbSession.commit(); dbTester.assertDbUnitTable(getClass(), "update-result.xml", "quality_gate_conditions", COLUMNS_WITHOUT_TIMESTAMPS); }
public void update(QualityGateConditionDto qGate) { SqlSession session = myBatis.openSession(false); try { update(qGate, session); session.commit(); } finally { MyBatis.closeQuietly(session); } }
public QualityGateConditionDto updateCondition(DbSession dbSession, QualityGateConditionDto condition, String metricKey, String operator, @Nullable String warningThreshold, @Nullable String errorThreshold, @Nullable Integer period) { MetricDto metric = getNonNullMetric(dbSession, metricKey); validateCondition(metric, operator, warningThreshold, errorThreshold, period); checkConditionDoesNotAlreadyExistOnSameMetricAndPeriod(getConditions(dbSession, condition.getQualityGateId(), condition.getId()), metric, period); condition .setMetricId(metric.getId()) .setMetricKey(metric.getKey()) .setOperator(operator) .setWarningThreshold(warningThreshold) .setErrorThreshold(errorThreshold) .setPeriod(period); dbClient.gateConditionDao().update(condition, dbSession); return condition; }