@Test public void shouldReturnWithoutAnyActionWhenStopInProgress() { when(dbStack.getStatus()).thenReturn(Status.STOP_IN_PROGRESS); victim.stopDatabaseServer(CRN_STRING); verifyZeroInteractions(dbStackStatusUpdater, flowManager); }
public void stopDatabaseServer(String crn) { DBStack dbStack = dbStackService.getByCrn(crn); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Stop called for: {}", dbStack); } if (dbStack.getStatus().isStopInProgressOrCompleted()) { LOGGER.debug("DatabaseServer with crn {} is already being stopped", dbStack.getResourceCrn()); return; } dbStackStatusUpdater.updateStatus(dbStack.getId(), DetailedDBStackStatus.STOP_REQUESTED); flowManager.notify(RedbeamsStopEvent.REDBEAMS_STOP_EVENT.selector(), new RedbeamsEvent(RedbeamsStopEvent.REDBEAMS_STOP_EVENT.selector(), dbStack.getId())); }
RedbeamsStopService { public void stopDatabaseServer(String crn) { DBStack dbStack = dbStackService.getByCrn(crn); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Stop called for: {}", dbStack); } if (dbStack.getStatus().isStopInProgressOrCompleted()) { LOGGER.debug("DatabaseServer with crn {} is already being stopped", dbStack.getResourceCrn()); return; } dbStackStatusUpdater.updateStatus(dbStack.getId(), DetailedDBStackStatus.STOP_REQUESTED); flowManager.notify(RedbeamsStopEvent.REDBEAMS_STOP_EVENT.selector(), new RedbeamsEvent(RedbeamsStopEvent.REDBEAMS_STOP_EVENT.selector(), dbStack.getId())); } }
RedbeamsStopService { public void stopDatabaseServer(String crn) { DBStack dbStack = dbStackService.getByCrn(crn); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Stop called for: {}", dbStack); } if (dbStack.getStatus().isStopInProgressOrCompleted()) { LOGGER.debug("DatabaseServer with crn {} is already being stopped", dbStack.getResourceCrn()); return; } dbStackStatusUpdater.updateStatus(dbStack.getId(), DetailedDBStackStatus.STOP_REQUESTED); flowManager.notify(RedbeamsStopEvent.REDBEAMS_STOP_EVENT.selector(), new RedbeamsEvent(RedbeamsStopEvent.REDBEAMS_STOP_EVENT.selector(), dbStack.getId())); }  }
RedbeamsStopService { public void stopDatabaseServer(String crn) { DBStack dbStack = dbStackService.getByCrn(crn); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Stop called for: {}", dbStack); } if (dbStack.getStatus().isStopInProgressOrCompleted()) { LOGGER.debug("DatabaseServer with crn {} is already being stopped", dbStack.getResourceCrn()); return; } dbStackStatusUpdater.updateStatus(dbStack.getId(), DetailedDBStackStatus.STOP_REQUESTED); flowManager.notify(RedbeamsStopEvent.REDBEAMS_STOP_EVENT.selector(), new RedbeamsEvent(RedbeamsStopEvent.REDBEAMS_STOP_EVENT.selector(), dbStack.getId())); }  void stopDatabaseServer(String crn); }
RedbeamsStopService { public void stopDatabaseServer(String crn) { DBStack dbStack = dbStackService.getByCrn(crn); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Stop called for: {}", dbStack); } if (dbStack.getStatus().isStopInProgressOrCompleted()) { LOGGER.debug("DatabaseServer with crn {} is already being stopped", dbStack.getResourceCrn()); return; } dbStackStatusUpdater.updateStatus(dbStack.getId(), DetailedDBStackStatus.STOP_REQUESTED); flowManager.notify(RedbeamsStopEvent.REDBEAMS_STOP_EVENT.selector(), new RedbeamsEvent(RedbeamsStopEvent.REDBEAMS_STOP_EVENT.selector(), dbStack.getId())); }  void stopDatabaseServer(String crn);  }