@Test
public void testUpdateExecutableRamp() throws ExecutorManagerException {

  Map<String, Object> data = ImmutableMap.<String, Object>builder()
      .put("rampId", "dali")
      .put("isActive", 1)
      .put("rampPolicy", "SimpleAutoRampPolicy")
      .put("startTime", 0L)
      .put("maxFailureToPause", 5)
      .put("maxFailureToRampDown", 10)
      .build();
  this.executionRampDao.insertAction("ramp", data);
  final ExecutableRampMap record =
      this.executionRampDao.fetchExecutableRampMap();
  assertThat(record.get("dali").isActive()).isTrue();
  assertThat(record.get("dali").getPolicy()).isEqualTo("SimpleAutoRampPolicy");
  assertThat(record.get("dali").getMaxFailureToRampDown()).isEqualTo(10);
  assertThat(record.get("dali").getMaxFailureToPause()).isEqualTo(5);
  assertThat(record.get("dali").isPercentageScaleForMaxFailure()).isFalse();
  assertThat(record.get("dali").getStage()).isEqualTo(0);
  assertThat(record.get("dali").getStartTime()).isEqualTo(0);
  assertThat(record.get("dali").getEndTime()).isEqualTo(0);
  assertThat(record.get("dali").getLastUpdatedTime()).isEqualTo(0);
  assertThat(record.get("dali").getCount(ExecutableRamp.CountType.FAILURE)).isEqualTo(0);
  assertThat(record.get("dali").getCount(ExecutableRamp.CountType.SUCCESS)).isEqualTo(0);
  assertThat(record.get("dali").getCount(ExecutableRamp.CountType.TRAIL)).isEqualTo(0);
  assertThat(record.get("dali").isPaused()).isFalse();
  record.get("dali").cacheResult(ExecutableRamp.Action.FAILED);
  record.get("dali").cacheResult(ExecutableRamp.Action.SUCCEEDED);
  record.get("dali").cacheResult(ExecutableRamp.Action.SUCCEEDED);
  record.get("dali").cacheResult(ExecutableRamp.Action.SUCCEEDED);
  record.get("dali").cacheResult(ExecutableRamp.Action.IGNORED);
  this.executionRampDao.updateExecutableRamp(record.get("dali"));
  final ExecutableRampMap updatedRecord =
      this.executionRampDao.fetchExecutableRampMap();
  assertThat(updatedRecord.get("dali").getCount(ExecutableRamp.CountType.FAILURE)).isEqualTo(1);
  assertThat(updatedRecord.get("dali").getCount(ExecutableRamp.CountType.SUCCESS)).isEqualTo(3);
  assertThat(updatedRecord.get("dali").getCount(ExecutableRamp.CountType.TRAIL)).isEqualTo(5);
  assertThat(updatedRecord.get("dali").getCount(ExecutableRamp.CountType.IGNORED)).isEqualTo(1);
  assertThat(updatedRecord.get("dali").getLastUpdatedTime()).isGreaterThan(0);
}