@Test public void shouldReturnWithoutAnyActionWhenStartInProgress() { when(dbStack.getStatus()).thenReturn(Status.START_IN_PROGRESS); victim.startDatabaseServer(CRN_STRING); verifyZeroInteractions(dbStackStatusUpdater, flowManager); }
public void startDatabaseServer(String crn) { DBStack dbStack = dbStackService.getByCrn(crn); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Start called for: {}", dbStack); } if (dbStack.getStatus().isStartInProgressOrCompleted()) { LOGGER.debug("DatabaseServer with crn {} is already being started", dbStack.getResourceCrn()); return; } dbStackStatusUpdater.updateStatus(dbStack.getId(), DetailedDBStackStatus.START_REQUESTED); flowManager.notify(RedbeamsStartEvent.REDBEAMS_START_EVENT.selector(), new RedbeamsEvent(RedbeamsStartEvent.REDBEAMS_START_EVENT.selector(), dbStack.getId())); }
RedbeamsStartService { public void startDatabaseServer(String crn) { DBStack dbStack = dbStackService.getByCrn(crn); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Start called for: {}", dbStack); } if (dbStack.getStatus().isStartInProgressOrCompleted()) { LOGGER.debug("DatabaseServer with crn {} is already being started", dbStack.getResourceCrn()); return; } dbStackStatusUpdater.updateStatus(dbStack.getId(), DetailedDBStackStatus.START_REQUESTED); flowManager.notify(RedbeamsStartEvent.REDBEAMS_START_EVENT.selector(), new RedbeamsEvent(RedbeamsStartEvent.REDBEAMS_START_EVENT.selector(), dbStack.getId())); } }
RedbeamsStartService { public void startDatabaseServer(String crn) { DBStack dbStack = dbStackService.getByCrn(crn); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Start called for: {}", dbStack); } if (dbStack.getStatus().isStartInProgressOrCompleted()) { LOGGER.debug("DatabaseServer with crn {} is already being started", dbStack.getResourceCrn()); return; } dbStackStatusUpdater.updateStatus(dbStack.getId(), DetailedDBStackStatus.START_REQUESTED); flowManager.notify(RedbeamsStartEvent.REDBEAMS_START_EVENT.selector(), new RedbeamsEvent(RedbeamsStartEvent.REDBEAMS_START_EVENT.selector(), dbStack.getId())); }  }
RedbeamsStartService { public void startDatabaseServer(String crn) { DBStack dbStack = dbStackService.getByCrn(crn); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Start called for: {}", dbStack); } if (dbStack.getStatus().isStartInProgressOrCompleted()) { LOGGER.debug("DatabaseServer with crn {} is already being started", dbStack.getResourceCrn()); return; } dbStackStatusUpdater.updateStatus(dbStack.getId(), DetailedDBStackStatus.START_REQUESTED); flowManager.notify(RedbeamsStartEvent.REDBEAMS_START_EVENT.selector(), new RedbeamsEvent(RedbeamsStartEvent.REDBEAMS_START_EVENT.selector(), dbStack.getId())); }  void startDatabaseServer(String crn); }
RedbeamsStartService { public void startDatabaseServer(String crn) { DBStack dbStack = dbStackService.getByCrn(crn); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Start called for: {}", dbStack); } if (dbStack.getStatus().isStartInProgressOrCompleted()) { LOGGER.debug("DatabaseServer with crn {} is already being started", dbStack.getResourceCrn()); return; } dbStackStatusUpdater.updateStatus(dbStack.getId(), DetailedDBStackStatus.START_REQUESTED); flowManager.notify(RedbeamsStartEvent.REDBEAMS_START_EVENT.selector(), new RedbeamsEvent(RedbeamsStartEvent.REDBEAMS_START_EVENT.selector(), dbStack.getId())); }  void startDatabaseServer(String crn);  }