@Test public void testMissingStepExecution() throws Exception { when(this.environment.containsProperty(DeployerPartitionHandler.SPRING_CLOUD_TASK_JOB_EXECUTION_ID)).thenReturn(true); when(this.environment.containsProperty(DeployerPartitionHandler.SPRING_CLOUD_TASK_STEP_EXECUTION_ID)).thenReturn(true); when(this.environment.containsProperty(DeployerPartitionHandler.SPRING_CLOUD_TASK_STEP_NAME)).thenReturn(true); when(this.environment.getProperty(DeployerPartitionHandler.SPRING_CLOUD_TASK_STEP_NAME)).thenReturn("foo"); when(this.beanFactory.getBeanNamesForType(Step.class)).thenReturn(new String[] {"foo", "bar", "baz"}); when(this.environment.getProperty(DeployerPartitionHandler.SPRING_CLOUD_TASK_STEP_EXECUTION_ID)).thenReturn("2"); when(this.environment.getProperty(DeployerPartitionHandler.SPRING_CLOUD_TASK_JOB_EXECUTION_ID)).thenReturn("1"); try { this.handler.run(); } catch (NoSuchStepException nsse) { assertEquals("No StepExecution could be located for step execution id 2 within job execution 1", nsse.getMessage()); } }
@Override public Step getStep(String stepName) throws NoSuchStepException { final Step step = steps.get(stepName); if (step == null) { throw new NoSuchStepException("Step ["+stepName+"] does not exist for job with name ["+getName()+"]"); } return step; }
public Collection<StepExecution> listStepExecutionsForStep(String jobName, String stepName, int start, int count) throws NoSuchStepException { return simpleJobService.listStepExecutionsForStep(jobName, stepName, start, count); }
public int countStepExecutionsForStep(String jobName, String stepName) throws NoSuchStepException { return simpleJobService.countStepExecutionsForStep(jobName, stepName); }