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