@Test public void shouldUpdateStatusWithUknownErrorAndIncrementMetricOnPrepare() { RedbeamsFailureEvent event = new RedbeamsFailureEvent(RESOURCE_ID, null); Optional<DBStack> dbStackOptional = Optional.of(dbStack); when(dbStackStatusUpdater.updateStatus(RESOURCE_ID, DetailedDBStackStatus.STOP_FAILED, "Unknown error")).thenReturn(Optional.of(dbStack)); victim.prepareExecution(event, null); verify(metricService).incrementMetricCounter(MetricType.DB_STOP_FAILED, dbStackOptional); }
@Override protected void prepareExecution(RedbeamsFailureEvent payload, Map<Object, Object> variables) { Exception failureException = payload.getException(); LOGGER.info("Error during database server stop flow:", failureException); String errorReason = failureException == null ? "Unknown error" : failureException.getMessage(); Optional<DBStack> dbStack = dbStackStatusUpdater.updateStatus(payload.getResourceId(), DetailedDBStackStatus.STOP_FAILED, errorReason); metricService.incrementMetricCounter(MetricType.DB_STOP_FAILED, dbStack); }
StopDatabaseServerFailedAction extends AbstractRedbeamsStopAction<RedbeamsFailureEvent> { @Override protected void prepareExecution(RedbeamsFailureEvent payload, Map<Object, Object> variables) { Exception failureException = payload.getException(); LOGGER.info("Error during database server stop flow:", failureException); String errorReason = failureException == null ? "Unknown error" : failureException.getMessage(); Optional<DBStack> dbStack = dbStackStatusUpdater.updateStatus(payload.getResourceId(), DetailedDBStackStatus.STOP_FAILED, errorReason); metricService.incrementMetricCounter(MetricType.DB_STOP_FAILED, dbStack); } }
StopDatabaseServerFailedAction extends AbstractRedbeamsStopAction<RedbeamsFailureEvent> { @Override protected void prepareExecution(RedbeamsFailureEvent payload, Map<Object, Object> variables) { Exception failureException = payload.getException(); LOGGER.info("Error during database server stop flow:", failureException); String errorReason = failureException == null ? "Unknown error" : failureException.getMessage(); Optional<DBStack> dbStack = dbStackStatusUpdater.updateStatus(payload.getResourceId(), DetailedDBStackStatus.STOP_FAILED, errorReason); metricService.incrementMetricCounter(MetricType.DB_STOP_FAILED, dbStack); } StopDatabaseServerFailedAction(); }
StopDatabaseServerFailedAction extends AbstractRedbeamsStopAction<RedbeamsFailureEvent> { @Override protected void prepareExecution(RedbeamsFailureEvent payload, Map<Object, Object> variables) { Exception failureException = payload.getException(); LOGGER.info("Error during database server stop flow:", failureException); String errorReason = failureException == null ? "Unknown error" : failureException.getMessage(); Optional<DBStack> dbStack = dbStackStatusUpdater.updateStatus(payload.getResourceId(), DetailedDBStackStatus.STOP_FAILED, errorReason); metricService.incrementMetricCounter(MetricType.DB_STOP_FAILED, dbStack); } StopDatabaseServerFailedAction();  }
StopDatabaseServerFailedAction extends AbstractRedbeamsStopAction<RedbeamsFailureEvent> { @Override protected void prepareExecution(RedbeamsFailureEvent payload, Map<Object, Object> variables) { Exception failureException = payload.getException(); LOGGER.info("Error during database server stop flow:", failureException); String errorReason = failureException == null ? "Unknown error" : failureException.getMessage(); Optional<DBStack> dbStack = dbStackStatusUpdater.updateStatus(payload.getResourceId(), DetailedDBStackStatus.STOP_FAILED, errorReason); metricService.incrementMetricCounter(MetricType.DB_STOP_FAILED, dbStack); } StopDatabaseServerFailedAction();   }