@Test public void canceling_a_running_job_calls_execution_service_cancel_operation() { job.state = PDSJobStatusState.RUNNING; serviceToTest.cancelJob(jobUUID); verify(executionService).cancel(jobUUID); }
@UseCaseUserCancelsJob(@PDSStep(name="service call",description = "trigger change to execution service and marks job status as cancel requested",number=2)) public void cancelJob(UUID jobUUID) { notNull(jobUUID, "job uuid may not be null!"); PDSJob job = assertJobFound(jobUUID, repository); if (PDSJobStatusState.CANCEL_REQUESTED.equals(job.getState()) || PDSJobStatusState.CANCELED.equals(job.getState())) { LOG.info("Cancel ignored because in state:{}", job.getState()); return; } assertJobIsInState(job, PDSJobStatusState.RUNNING); executionService.cancel(jobUUID); job.setState(PDSJobStatusState.CANCEL_REQUESTED); repository.save(job); }
PDSCancelJobService { @UseCaseUserCancelsJob(@PDSStep(name="service call",description = "trigger change to execution service and marks job status as cancel requested",number=2)) public void cancelJob(UUID jobUUID) { notNull(jobUUID, "job uuid may not be null!"); PDSJob job = assertJobFound(jobUUID, repository); if (PDSJobStatusState.CANCEL_REQUESTED.equals(job.getState()) || PDSJobStatusState.CANCELED.equals(job.getState())) { LOG.info("Cancel ignored because in state:{}", job.getState()); return; } assertJobIsInState(job, PDSJobStatusState.RUNNING); executionService.cancel(jobUUID); job.setState(PDSJobStatusState.CANCEL_REQUESTED); repository.save(job); } }
PDSCancelJobService { @UseCaseUserCancelsJob(@PDSStep(name="service call",description = "trigger change to execution service and marks job status as cancel requested",number=2)) public void cancelJob(UUID jobUUID) { notNull(jobUUID, "job uuid may not be null!"); PDSJob job = assertJobFound(jobUUID, repository); if (PDSJobStatusState.CANCEL_REQUESTED.equals(job.getState()) || PDSJobStatusState.CANCELED.equals(job.getState())) { LOG.info("Cancel ignored because in state:{}", job.getState()); return; } assertJobIsInState(job, PDSJobStatusState.RUNNING); executionService.cancel(jobUUID); job.setState(PDSJobStatusState.CANCEL_REQUESTED); repository.save(job); }  }
PDSCancelJobService { @UseCaseUserCancelsJob(@PDSStep(name="service call",description = "trigger change to execution service and marks job status as cancel requested",number=2)) public void cancelJob(UUID jobUUID) { notNull(jobUUID, "job uuid may not be null!"); PDSJob job = assertJobFound(jobUUID, repository); if (PDSJobStatusState.CANCEL_REQUESTED.equals(job.getState()) || PDSJobStatusState.CANCELED.equals(job.getState())) { LOG.info("Cancel ignored because in state:{}", job.getState()); return; } assertJobIsInState(job, PDSJobStatusState.RUNNING); executionService.cancel(jobUUID); job.setState(PDSJobStatusState.CANCEL_REQUESTED); repository.save(job); }  @UseCaseUserCancelsJob(@PDSStep(name="service call",description = "trigger change to execution service and marks job status as cancel requested",number=2)) void cancelJob(UUID jobUUID); }
PDSCancelJobService { @UseCaseUserCancelsJob(@PDSStep(name="service call",description = "trigger change to execution service and marks job status as cancel requested",number=2)) public void cancelJob(UUID jobUUID) { notNull(jobUUID, "job uuid may not be null!"); PDSJob job = assertJobFound(jobUUID, repository); if (PDSJobStatusState.CANCEL_REQUESTED.equals(job.getState()) || PDSJobStatusState.CANCELED.equals(job.getState())) { LOG.info("Cancel ignored because in state:{}", job.getState()); return; } assertJobIsInState(job, PDSJobStatusState.RUNNING); executionService.cancel(jobUUID); job.setState(PDSJobStatusState.CANCEL_REQUESTED); repository.save(job); }  @UseCaseUserCancelsJob(@PDSStep(name="service call",description = "trigger change to execution service and marks job status as cancel requested",number=2)) void cancelJob(UUID jobUUID);  }