/** * Convenient accessor for current step name identifier. Usually this is the * same as the bean name of the step that is executing (but might not be * e.g. in a partition). * * @return the step name identifier of the current {@link StepExecution} */ public String getStepName() { return stepExecution.getStepName(); }
@Override public String getStepName() { return stepExecution.getStepName(); }
private void validateStepExecution(StepExecution stepExecution) { Assert.notNull(stepExecution, "StepExecution cannot be null."); Assert.notNull(stepExecution.getStepName(), "StepExecution's step name cannot be null."); Assert.notNull(stepExecution.getJobExecutionId(), "StepExecution must belong to persisted JobExecution"); }
/** * Validate StepExecution. At a minimum, JobId, StartTime, and Status cannot * be null. EndTime can be null for an unfinished job. * * @throws IllegalArgumentException */ private void validateStepExecution(StepExecution stepExecution) { Assert.notNull(stepExecution, "stepExecution is required"); Assert.notNull(stepExecution.getStepName(), "StepExecution step name cannot be null."); Assert.notNull(stepExecution.getStartTime(), "StepExecution start time cannot be null."); Assert.notNull(stepExecution.getStatus(), "StepExecution status cannot be null."); }
@Override public void execute(StepExecution stepExecution) throws JobInterruptedException { count++; stepExecutions.add(stepExecution.getStepName()); } });
private List<String> getStepNames(JobExecution jobExecution) { List<String> list = new ArrayList<>(); for (StepExecution stepExecution : jobExecution.getStepExecutions()) { list.add(stepExecution.getStepName()); } return list; }
private List<String> getStepNames(JobExecution jobExecution) { List<String> list = new ArrayList<>(); for (StepExecution stepExecution : jobExecution.getStepExecutions()) { list.add(stepExecution.getStepName()); } Collections.sort(list); return list; }
private List<String> getStepNames(JobExecution jobExecution) { List<String> list = new ArrayList<>(); for (StepExecution stepExecution : jobExecution.getStepExecutions()) { list.add(stepExecution.getStepName()); } return list; }
private List<String> getStepNames(JobExecution jobExecution) { List<String> list = new ArrayList<>(); for (StepExecution stepExecution : jobExecution.getStepExecutions()) { list.add(stepExecution.getStepName()); } Collections.sort(list); return list; }
private List<String> getStepNames(JobExecution jobExecution) { List<String> list = new ArrayList<>(); for (StepExecution stepExecution : jobExecution.getStepExecutions()) { list.add(stepExecution.getStepName()); } return list; }
@Override public boolean equals(Object obj) { Object jobExecutionId = getJobExecutionId(); if (jobExecutionId == null || !(obj instanceof StepExecution) || getId() == null) { return super.equals(obj); } StepExecution other = (StepExecution) obj; return stepName.equals(other.getStepName()) && (jobExecutionId.equals(other.getJobExecutionId())) && getId().equals(other.getId()); }
private List<String> getStepNames(JobExecution jobExecution) { List<String> list = new ArrayList<>(); for (StepExecution stepExecution : jobExecution.getStepExecutions()) { list.add(stepExecution.getStepName()); } Collections.sort(list); return list; }
@BeforeStep public void createOutputNameFromInput(StepExecution stepExecution) { ExecutionContext executionContext = stepExecution.getExecutionContext(); String inputName = stepExecution.getStepName().replace(":", "-"); if (executionContext.containsKey(inputKeyName)) { inputName = executionContext.getString(inputKeyName); } if (!executionContext.containsKey(outputKeyName)) { executionContext.putString(outputKeyName, path + FilenameUtils.getBaseName(inputName) + ".csv"); } }
protected boolean isFlowContinued(State state, FlowExecutionStatus status, StepExecution stepExecution) { boolean continued = true; continued = state != null && status!=FlowExecutionStatus.STOPPED; if(stepExecution != null) { Boolean reRun = (Boolean) stepExecution.getExecutionContext().get("batch.restart"); Boolean executed = (Boolean) stepExecution.getExecutionContext().get("batch.executed"); if((executed == null || !executed) && reRun != null && reRun && status == FlowExecutionStatus.STOPPED && !state.getName().endsWith(stepExecution.getStepName()) ) { continued = true; } } return continued; }
protected StepExecution getStepExecution(JobExecution jobExecution, String stepName) { for (StepExecution stepExecution : jobExecution.getStepExecutions()) { if (stepExecution.getStepName().equals(stepName)) { return stepExecution; } } fail("No stepExecution found with name: [" + stepName + "]"); return null; }
@Test public void testGetPartitionPlan() { Properties partitionPropertyValues = new Properties(); partitionPropertyValues.put("key1", "value1"); propertyContext.setStepProperties(stepExecution.getStepName(), partitionPropertyValues); context = new StepContext(stepExecution, propertyContext); Map<String, Object> plan = context.getPartitionPlan(); assertEquals("value1", plan.get("key1")); }
@BeforeStep public void saveStepName(StepExecution stepExecution) { stepExecution.getExecutionContext().put("stepName", stepExecution.getStepName()); } }
@Test public void testStepAlreadyComplete() throws Exception { stepExecution1.setStatus(BatchStatus.COMPLETED); jobRepository.add(stepExecution1); jobExecution.setEndTime(new Date()); jobRepository.update(jobExecution); jobExecution = jobRepository.createJobExecution(job.getName(), jobParameters); job.execute(jobExecution); assertEquals(0, jobExecution.getFailureExceptions().size()); assertEquals(1, jobExecution.getStepExecutions().size()); assertEquals(stepExecution2.getStepName(), jobExecution.getStepExecutions().iterator().next().getStepName()); }
@Test public void testExecutionContextIsSet() throws Exception { testRunNormally(); assertEquals(jobInstance, jobExecution.getJobInstance()); assertEquals(2, jobExecution.getStepExecutions().size()); assertEquals(step1.getName(), stepExecution1.getStepName()); assertEquals(step2.getName(), stepExecution2.getStepName()); }
@Test public void testEqualsWithNullStepId() throws Exception { Step step = new StepSupport("name"); execution = newStepExecution(step, new Long(31)); assertEquals("name", execution.getStepName()); StepExecution stepExecution = newStepExecution(step, new Long(31)); assertEquals(stepExecution.getJobExecutionId(), execution.getJobExecutionId()); assertTrue(execution.equals(stepExecution)); }