QualityGateConditionDto getCondition(DbSession dbSession, long id) { return checkFound(dbClient.gateConditionDao().selectById(id, dbSession), "No quality gate condition with id '%d'", id); }
@Test public void testSelectById() { dbTester.prepareDbUnit(getClass(), "selectForQualityGate.xml"); QualityGateConditionDto selectById = underTest.selectById(1L, dbSession); assertThat(selectById).isNotNull(); assertThat(selectById.getId()).isNotNull().isNotEqualTo(0L); assertThat(selectById.getMetricId()).isEqualTo(2L); assertThat(selectById.getOperator()).isEqualTo("<"); assertThat(selectById.getQualityGateId()).isEqualTo(1L); assertThat(selectById.getErrorThreshold()).isEqualTo("20"); assertThat(underTest.selectById(42L, dbSession)).isNull(); }
private void verifyCondition(QualityGateConditionDto dto, QualityGateDto qualityGate, MetricDto metric, String operator, String error) { QualityGateConditionDto reloaded = db.getDbClient().gateConditionDao().selectById(dto.getId(), db.getSession()); assertThat(reloaded.getQualityGateId()).isEqualTo(qualityGate.getId()); assertThat(reloaded.getMetricId()).isEqualTo(metric.getId().longValue()); assertThat(reloaded.getOperator()).isEqualTo(operator); assertThat(reloaded.getErrorThreshold()).isEqualTo(error); assertThat(dto.getQualityGateId()).isEqualTo(qualityGate.getId()); assertThat(dto.getMetricId()).isEqualTo(metric.getId().longValue()); assertThat(dto.getOperator()).isEqualTo(operator); assertThat(dto.getErrorThreshold()).isEqualTo(error); }
public QualityGateConditionDto selectById(long id) { SqlSession session = myBatis.openSession(false); try { return selectById(id, session); } finally { MyBatis.closeQuietly(session); } }
QualityGateConditionDto getCondition(DbSession dbSession, long id) { return checkFound(dbClient.gateConditionDao().selectById(id, dbSession), "No quality gate condition with id '%d'", id); }