@Test public void shouldSetStatusAndUnscheduleInCaseOfStopCompleted() throws Exception { when(resourceConnector.getDatabaseServerStatus(authenticatedContext, databaseStack)).thenReturn(ExternalDatabaseStatus.DELETED); when(dbStack.getId()).thenReturn(DB_STACK_ID); when(dbStack.getStatus()).thenReturn(Status.DELETE_IN_PROGRESS); when(dbStack.getOwnerCrn()).thenReturn(crn); victim.sync(dbStack); verify(dbStackStatusUpdater).updateStatus(DB_STACK_ID, DetailedDBStackStatus.DELETE_COMPLETED); verify(dbStackJobService).unschedule(dbStack); }
public void sync(DBStack dbStack) { DetailedDBStackStatus detailedDBStackStatus = getDetailedDBStackStatusFromProvider(dbStack); Status status = detailedDBStackStatus.getStatus(); if (dbStack.getStatus() != status) { if (status == null) { LOGGER.warn(":::Auto sync::: Can not update DBStack status because 'ExternalDatabaseStatus.{}' is mapped to 'null'", detailedDBStackStatus); } else { LOGGER.debug(":::Auto sync::: Update DB Stack Status from '{}' to '{}'", dbStack.getStatus(), status); dbStackStatusUpdater.updateStatus(dbStack.getId(), detailedDBStackStatus); } } if (status != null && Status.getUnscheduleAutoSyncStatuses().contains(status)) { LOGGER.debug(":::Auto sync::: Unschedule DB Stack Status sync as the status is '{}'", status); dbStackJobService.unschedule(dbStack); } }
DBStackStatusSyncService { public void sync(DBStack dbStack) { DetailedDBStackStatus detailedDBStackStatus = getDetailedDBStackStatusFromProvider(dbStack); Status status = detailedDBStackStatus.getStatus(); if (dbStack.getStatus() != status) { if (status == null) { LOGGER.warn(":::Auto sync::: Can not update DBStack status because 'ExternalDatabaseStatus.{}' is mapped to 'null'", detailedDBStackStatus); } else { LOGGER.debug(":::Auto sync::: Update DB Stack Status from '{}' to '{}'", dbStack.getStatus(), status); dbStackStatusUpdater.updateStatus(dbStack.getId(), detailedDBStackStatus); } } if (status != null && Status.getUnscheduleAutoSyncStatuses().contains(status)) { LOGGER.debug(":::Auto sync::: Unschedule DB Stack Status sync as the status is '{}'", status); dbStackJobService.unschedule(dbStack); } } }
DBStackStatusSyncService { public void sync(DBStack dbStack) { DetailedDBStackStatus detailedDBStackStatus = getDetailedDBStackStatusFromProvider(dbStack); Status status = detailedDBStackStatus.getStatus(); if (dbStack.getStatus() != status) { if (status == null) { LOGGER.warn(":::Auto sync::: Can not update DBStack status because 'ExternalDatabaseStatus.{}' is mapped to 'null'", detailedDBStackStatus); } else { LOGGER.debug(":::Auto sync::: Update DB Stack Status from '{}' to '{}'", dbStack.getStatus(), status); dbStackStatusUpdater.updateStatus(dbStack.getId(), detailedDBStackStatus); } } if (status != null && Status.getUnscheduleAutoSyncStatuses().contains(status)) { LOGGER.debug(":::Auto sync::: Unschedule DB Stack Status sync as the status is '{}'", status); dbStackJobService.unschedule(dbStack); } }  }
DBStackStatusSyncService { public void sync(DBStack dbStack) { DetailedDBStackStatus detailedDBStackStatus = getDetailedDBStackStatusFromProvider(dbStack); Status status = detailedDBStackStatus.getStatus(); if (dbStack.getStatus() != status) { if (status == null) { LOGGER.warn(":::Auto sync::: Can not update DBStack status because 'ExternalDatabaseStatus.{}' is mapped to 'null'", detailedDBStackStatus); } else { LOGGER.debug(":::Auto sync::: Update DB Stack Status from '{}' to '{}'", dbStack.getStatus(), status); dbStackStatusUpdater.updateStatus(dbStack.getId(), detailedDBStackStatus); } } if (status != null && Status.getUnscheduleAutoSyncStatuses().contains(status)) { LOGGER.debug(":::Auto sync::: Unschedule DB Stack Status sync as the status is '{}'", status); dbStackJobService.unschedule(dbStack); } }  void sync(DBStack dbStack); }
DBStackStatusSyncService { public void sync(DBStack dbStack) { DetailedDBStackStatus detailedDBStackStatus = getDetailedDBStackStatusFromProvider(dbStack); Status status = detailedDBStackStatus.getStatus(); if (dbStack.getStatus() != status) { if (status == null) { LOGGER.warn(":::Auto sync::: Can not update DBStack status because 'ExternalDatabaseStatus.{}' is mapped to 'null'", detailedDBStackStatus); } else { LOGGER.debug(":::Auto sync::: Update DB Stack Status from '{}' to '{}'", dbStack.getStatus(), status); dbStackStatusUpdater.updateStatus(dbStack.getId(), detailedDBStackStatus); } } if (status != null && Status.getUnscheduleAutoSyncStatuses().contains(status)) { LOGGER.debug(":::Auto sync::: Unschedule DB Stack Status sync as the status is '{}'", status); dbStackJobService.unschedule(dbStack); } }  void sync(DBStack dbStack);  }