org.springframework.batch.core.ExitStatus Java Examples

The following examples show how to use org.springframework.batch.core.ExitStatus. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpringBatchFlowRunner.java    From spring-cloud-release-tools with Apache License 2.0 7 votes vote down vote up
private ExecutionResult runJob(Job job) {
	try {
		JobExecution execution = this.jobLauncher.run(job, new JobParameters());
		if (!ExitStatus.COMPLETED.equals(execution.getExitStatus())) {
			return ExecutionResult.failure(new IllegalStateException(
					"Job failed to get executed successfully. Failed with exit code ["
							+ execution.getExitStatus().getExitCode()
							+ "] and description ["
							+ execution.getExitStatus().getExitDescription() + "]"));
		}
		List<Exception> thrownExceptions = exceptionsThrownBySteps(execution);
		return new ExecutionResult(thrownExceptions);
	}
	catch (JobExecutionException ex) {
		return ExecutionResult.failure(ex);
	}
}
 
Example #2
Source File: LdifReaderTest.java    From spring-ldap with Apache License 2.0 6 votes vote down vote up
@Test
public void testValidRun() {
	try {
		JobExecution jobExecution = this.launchStep("step1");

		//Ensure job completed successfully.
		Assert.isTrue(jobExecution.getExitStatus().equals(ExitStatus.COMPLETED), "Step Execution did not complete normally: " + jobExecution.getExitStatus());

		//Check output.
		Assert.isTrue(actual.exists(), "Actual does not exist.");
		AssertFile.assertFileEquals(expected.getFile(), actual.getFile());

	} catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
Example #3
Source File: TaxCalculationStepITest.java    From batchers with Apache License 2.0 6 votes vote down vote up
@Test
public void taxCalculationStep_generatesCorrectCalculation() throws Exception {
    Employee employee = haveOneEmployee();

    JobParameters jobParameters = new JobParametersBuilder()
            .addLong("year", 2014L, true)
            .addLong("month", 5L, true)
            .toJobParameters();

    JobExecution jobExecution = jobLauncherTestUtils.launchStep(EmployeeJobConfigSingleJvm.TAX_CALCULATION_STEP, jobParameters);

    assertThat(jobExecution.getExitStatus()).isEqualTo(ExitStatus.COMPLETED);

    List<TaxCalculation> byEmployee = taxCalculationRepository.findByEmployee(employee);

    assertThat(byEmployee).hasSize(1);
    TaxCalculation taxCalculation = byEmployee.get(0);
    assertThat(taxCalculation.getEmployee().getId()).isEqualTo(employee.getId());
    assertThat(taxCalculation.getYear()).isEqualTo(2014);
    assertThat(taxCalculation.getMonth()).isEqualTo(5);

    List<TaxCalculation> byYearAndMonth = taxCalculationRepository.find(2014, 5, 1L);
    assertThat(byYearAndMonth).hasSize(1);
}
 
Example #4
Source File: BaseStepExecutionListener.java    From spring-boot-doma2-sample with Apache License 2.0 6 votes vote down vote up
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
    val context = BatchContextHolder.getContext();

    // 機能別の終了処理を呼び出す
    try {
        after(context, stepExecution);
    } catch (Exception e) {
        log.error("exception occurred. ", e);
        throw new IllegalStateException(e);
    }

    // ログ出力
    logAfterStep(context, stepExecution);
    ExitStatus exitStatus = stepExecution.getExitStatus();
    return exitStatus;
}
 
Example #5
Source File: CampusInterceptor.java    From olat with Apache License 2.0 6 votes vote down vote up
/**
 * Generates an appropriate statistic of the processed, <br>
 * delegates the cleanup and the metric notification.
 * 
 * @param se
 *            the StepExecution
 */
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public ExitStatus afterStep(StepExecution se) {
    LOG.info(se);

    statisticDao.save(createImportStatistic(se));

    if (CampusProcessStep.IMPORT_CONTROLFILE.name().equalsIgnoreCase(se.getStepName())) {
        if (se.getWriteCount() != getFixedNumberOfFilesToBeExported()) {
            // if (se.getReadCount() != getFixedNumberOfFilesToBeExported() || se.getWriteCount() != getFixedNumberOfFilesToBeExported()) {
            notifyMetrics(se);
            return ExitStatus.FAILED;
        }
    }

    removeOldDataIfExist(se);
    notifyMetrics(se);

    return null;
}
 
Example #6
Source File: ProtocolListenerTest.java    From spring-boot-starter-batch-web with Apache License 2.0 6 votes vote down vote up
@Test
public void createProtocol() throws Exception {
	// Given
	JobExecution jobExecution = new JobExecution(1L,
			new JobParametersBuilder().addString("test", "value").toJobParameters());
	jobExecution.setJobInstance(new JobInstance(1L, "test-job"));
	jobExecution.setCreateTime(new Date());
	jobExecution.setStartTime(new Date());
	jobExecution.setEndTime(new Date());
	jobExecution.setExitStatus(new ExitStatus("COMPLETED_WITH_ERRORS", "This is a default exit message"));
	jobExecution.getExecutionContext().put("jobCounter", 1);
	StepExecution stepExecution = jobExecution.createStepExecution("test-step-1");
	stepExecution.getExecutionContext().put("stepCounter", 1);
	ProtocolListener protocolListener = new ProtocolListener();
	// When
	protocolListener.afterJob(jobExecution);
	// Then
	String output = this.outputCapture.toString();
	assertThat(output, containsString("Protocol for test-job"));
	assertThat(output, containsString("COMPLETED_WITH_ERRORS"));
}
 
Example #7
Source File: JdbcSearchableStepExecutionDao.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
public StepExecution mapRow(ResultSet rs, int rowNum) throws SQLException {
	StepExecution stepExecution = new StepExecution(rs.getString(2), null);
	stepExecution.setId(rs.getLong(1));
	stepExecution.setStartTime(rs.getTimestamp(3));
	stepExecution.setEndTime(rs.getTimestamp(4));
	stepExecution.setStatus(BatchStatus.valueOf(rs.getString(5)));
	stepExecution.setCommitCount(rs.getInt(6));
	stepExecution.setReadCount(rs.getInt(7));
	stepExecution.setFilterCount(rs.getInt(8));
	stepExecution.setWriteCount(rs.getInt(9));
	stepExecution.setExitStatus(new ExitStatus(rs.getString(10), rs.getString(11)));
	stepExecution.setReadSkipCount(rs.getInt(12));
	stepExecution.setWriteSkipCount(rs.getInt(13));
	stepExecution.setProcessSkipCount(rs.getInt(14));
	stepExecution.setRollbackCount(rs.getInt(15));
	stepExecution.setLastUpdated(rs.getTimestamp(16));
	stepExecution.setVersion(rs.getInt(17));
	return stepExecution;
}
 
Example #8
Source File: MapLightminJobExecutionDaoTest.java    From spring-batch-lightmin with Apache License 2.0 6 votes vote down vote up
@Test
public void testFindJobExecutionsAllQueryParameters() {
    this.createJobExecutionsForQuery();
    final String jobName = "queryJob";
    final Integer size = 4;
    final Date startDate = new Date(System.currentTimeMillis() - 100000);
    final Date endDate = new Date(System.currentTimeMillis() + 100000);
    final String exitStatus = ExitStatus.COMPLETED.getExitCode();
    final Map<String, Object> queryParameters = new HashMap<>();
    queryParameters.put(QueryParameterKey.EXIT_STATUS, exitStatus);
    queryParameters.put(QueryParameterKey.START_DATE, startDate);
    queryParameters.put(QueryParameterKey.END_DATE, endDate);
    final List<JobExecution> result = this.mapLightminJobExecutionDao.findJobExecutions(jobName, queryParameters, size);
    assertThat(result).isNotNull();
    assertThat(result).isNotEmpty();
    assertThat(result).hasSize(size);
}
 
Example #9
Source File: DeciderJobIntegrationTest.java    From tutorials with MIT License 6 votes vote down vote up
@Test
public void givenNumberGeneratorDecider_whenDeciderRuns_thenStatusIsNotify() throws Exception {
    JobExecution jobExecution = jobLauncherTestUtils.launchJob();
    Collection<StepExecution> actualStepExecutions = jobExecution.getStepExecutions();
    ExitStatus actualJobExitStatus = jobExecution.getExitStatus();

    assertEquals("COMPLETED", actualJobExitStatus.getExitCode()
        .toString());
    assertEquals(2, actualStepExecutions.size());
    boolean notifyStepDidRun = false;
    Iterator<StepExecution> iterator = actualStepExecutions.iterator();
    while (iterator.hasNext() && !notifyStepDidRun) {
        if (iterator.next()
            .getStepName()
            .equals("Notify step")) {
            notifyStepDidRun = true;
        }
    }
    assertTrue(notifyStepDidRun);
}
 
Example #10
Source File: MapLightminJobExecutionDaoTest.java    From spring-batch-lightmin with Apache License 2.0 6 votes vote down vote up
@Test
public void testFindJobExecutionsAllQueryParametersWithOutJobName() {
    this.createJobExecutionsForQuery();
    final Integer size = 4;
    final Date startDate = new Date(System.currentTimeMillis() - 100000);
    final Date endDate = new Date(System.currentTimeMillis() + 100000);
    final String exitStatus = ExitStatus.COMPLETED.getExitCode();
    final Map<String, Object> queryParameters = new HashMap<>();
    queryParameters.put(QueryParameterKey.EXIT_STATUS, exitStatus);
    queryParameters.put(QueryParameterKey.START_DATE, startDate);
    queryParameters.put(QueryParameterKey.END_DATE, endDate);
    final List<JobExecution> result = this.mapLightminJobExecutionDao.findJobExecutions(null, queryParameters, size);
    assertThat(result).isNotNull();
    assertThat(result).isNotEmpty();
    assertThat(result).hasSize(size);
}
 
Example #11
Source File: SpringBatchRetryIntegrationTest.java    From tutorials with MIT License 6 votes vote down vote up
@Test
public void whenEndpointFailsTwicePasses3rdTime_thenSuccess() throws Exception {
    FileSystemResource expectedResult = new FileSystemResource(EXPECTED_OUTPUT);
    FileSystemResource actualResult = new FileSystemResource(TEST_OUTPUT);

    //fails for first two calls and passes third time onwards
    when(httpResponse.getEntity())
      .thenReturn(new StringEntity("{ \"age\":10, \"postCode\":\"430222\" }"));
    when(closeableHttpClient.execute(any()))
      .thenThrow(new ConnectTimeoutException("Timeout count 1"))
      .thenThrow(new ConnectTimeoutException("Timeout count 2"))
      .thenReturn(httpResponse);

    JobExecution jobExecution = jobLauncherTestUtils.launchJob(defaultJobParameters());
    JobInstance actualJobInstance = jobExecution.getJobInstance();
    ExitStatus actualJobExitStatus = jobExecution.getExitStatus();

    assertThat(actualJobInstance.getJobName(), is("retryBatchJob"));
    assertThat(actualJobExitStatus.getExitCode(), is("COMPLETED"));
    AssertFile.assertFileEquals(expectedResult, actualResult);
}
 
Example #12
Source File: SpringBatchIntegrationTest.java    From tutorials with MIT License 6 votes vote down vote up
@Test
public void givenReferenceOutput_whenJobExecuted_thenSuccess() throws Exception {
    // given
    FileSystemResource expectedResult = new FileSystemResource(EXPECTED_OUTPUT);
    FileSystemResource actualResult = new FileSystemResource(TEST_OUTPUT);

    // when
    JobExecution jobExecution = jobLauncherTestUtils.launchJob(defaultJobParameters());
    JobInstance actualJobInstance = jobExecution.getJobInstance();
    ExitStatus actualJobExitStatus = jobExecution.getExitStatus();

    // then
    assertThat(actualJobInstance.getJobName(), is("transformBooksRecords"));
    assertThat(actualJobExitStatus.getExitCode(), is("COMPLETED"));
    AssertFile.assertFileEquals(expectedResult, actualResult);
}
 
Example #13
Source File: SpringBatchIntegrationTest.java    From tutorials with MIT License 6 votes vote down vote up
@Test
public void givenReferenceOutput_whenStep1Executed_thenSuccess() throws Exception {

    // given
    FileSystemResource expectedResult = new FileSystemResource(EXPECTED_OUTPUT);
    FileSystemResource actualResult = new FileSystemResource(TEST_OUTPUT);

    // when
    JobExecution jobExecution = jobLauncherTestUtils.launchStep("step1", defaultJobParameters());
    Collection<StepExecution> actualStepExecutions = jobExecution.getStepExecutions();
    ExitStatus actualJobExitStatus = jobExecution.getExitStatus();

    // then
    assertThat(actualStepExecutions.size(), is(1));
    assertThat(actualJobExitStatus.getExitCode(), is("COMPLETED"));
    AssertFile.assertFileEquals(expectedResult, actualResult);
}
 
Example #14
Source File: MappingLdifReaderTest.java    From spring-ldap with Apache License 2.0 6 votes vote down vote up
@Test
public void testValidRun() {
	try {
		JobExecution jobExecution = this.launchStep("step1");

		//Ensure job completed successfully.
		Assert.isTrue(jobExecution.getExitStatus().equals(ExitStatus.COMPLETED), "Step Execution did not complete normally: " + jobExecution.getExitStatus());

		//Check output.
		Assert.isTrue(actual.exists(), "Actual does not exist.");
		AssertFile.assertFileEquals(expected.getFile(), actual.getFile());

	} catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
Example #15
Source File: JobFailListener.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
@Override
public void afterJob(JobExecution jobExecution) {
    if (!jobExecution.getExitStatus().equals(ExitStatus.COMPLETED)) {
        jobFailMessageSender.sendSMS(jobExecution);
        jobFailMessageSender.sendEmail(jobExecution);
    }
}
 
Example #16
Source File: FailedStepStepExecutionListenerTest.java    From batchers with Apache License 2.0 5 votes vote down vote up
@Test
public void testAfterStep_returns_CompletedExitStatus_whenRead_And_Write_Match() throws Exception {
    stepExecution.setReadCount(2);
    stepExecution.setWriteCount(2);

    ExitStatus exitStatus = failedStepStepExecutionListener.afterStep(stepExecution);

    assertThat(exitStatus).isEqualTo(ExitStatus.COMPLETED);
}
 
Example #17
Source File: FlatFileJobIntegrationTest.java    From spring-boot-starter-batch-web with Apache License 2.0 5 votes vote down vote up
@Test
public void testLaunchJob() throws Exception {
	// Given
	String jobParameters = "pathToFile=classpath:partner-import.csv";
	// When
	ExitStatus exitStatus = runJobAndWaitForCompletion("localhost", "8090", "flatfileJob", jobParameters);
	// Then
	assertEquals(ExitStatus.COMPLETED.getExitCode(), exitStatus.getExitCode());
}
 
Example #18
Source File: NumberInfoClassifier.java    From tutorials with MIT License 5 votes vote down vote up
@Override
public void afterProcess(NumberInfo item, Integer result) {
    super.afterProcess(item, result);
    if (item.isPositive()) {
        stepExecution.setExitStatus(new ExitStatus(NOTIFY));
    }
}
 
Example #19
Source File: JobRestControllerDocumentation.java    From spring-batch-lightmin with Apache License 2.0 5 votes vote down vote up
@Test
public void testQueryJobExecutions() {
    final Date startDate = new Date(System.currentTimeMillis() - 100000);
    final Date endDate = new Date(System.currentTimeMillis() + 100000);
    final String exitStatus = ExitStatus.COMPLETED.getExitCode();
    final Map<String, Object> queryParameters = new HashMap<>();
    queryParameters.put(QueryParameterKey.EXIT_STATUS, exitStatus);
    queryParameters.put(QueryParameterKey.START_DATE, startDate);
    queryParameters.put(QueryParameterKey.END_DATE, endDate);
    given(this.documentationSpec)
            .accept(ContentType.JSON)
            .contentType(ContentType.JSON)
            .filter(document("jobcontroller/{method-name}",
                    preprocessRequest(modifyUris()
                                    .scheme("http")
                                    .host("localhost")
                                    .removePort(),
                            prettyPrint()),
                    preprocessResponse(prettyPrint()),
                    requestParameters(
                            parameterWithName("jobname").description("The name of the Spring Batch Job"),
                            parameterWithName("resultsize").description("The maximum size of the result"))))
            .when()
            .port(this.getServerPort())
            .body(queryParameters)
            .post(AbstractRestController.JobRestControllerAPI.QUERY_JOB_EXECUTIONS +
                    "?jobname=simpleJob&resultsize=4")
            .then()
            .assertThat().statusCode(is(200));
}
 
Example #20
Source File: LinesReader.java    From tutorials with MIT License 5 votes vote down vote up
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
    fu.closeReader();
    stepExecution
      .getJobExecution()
      .getExecutionContext()
      .put("lines", this.lines);
    logger.debug("Lines Reader ended.");
    return ExitStatus.COMPLETED;
}
 
Example #21
Source File: FailedStepStepExecutionListenerTest.java    From batchers with Apache License 2.0 5 votes vote down vote up
@Test
public void testAfterStep_returns_FailedExitStatus_whenRead_And_Write_Count_Dont_Match() throws Exception {
    stepExecution.setReadCount(2);
    stepExecution.setWriteCount(1);

    ExitStatus exitStatus = failedStepStepExecutionListener.afterStep(stepExecution);

    assertThat(exitStatus).isEqualTo(ExitStatus.FAILED);
}
 
Example #22
Source File: SpringBatchRetryIntegrationTest.java    From tutorials with MIT License 5 votes vote down vote up
@Test
public void whenEndpointAlwaysFail_thenJobFails() throws Exception {
    when(closeableHttpClient.execute(any()))
      .thenThrow(new ConnectTimeoutException("Endpoint is down"));

    JobExecution jobExecution = jobLauncherTestUtils.launchJob(defaultJobParameters());
    JobInstance actualJobInstance = jobExecution.getJobInstance();
    ExitStatus actualJobExitStatus = jobExecution.getExitStatus();

    assertThat(actualJobInstance.getJobName(), is("retryBatchJob"));
    assertThat(actualJobExitStatus.getExitCode(), is("FAILED"));
    assertThat(actualJobExitStatus.getExitDescription(), containsString("org.apache.http.conn.ConnectTimeoutException"));
}
 
Example #23
Source File: SpringBatchIntegrationTest.java    From tutorials with MIT License 5 votes vote down vote up
@Test
public void whenStep2Executed_thenSuccess() {

    // when
    JobExecution jobExecution = jobLauncherTestUtils.launchStep("step2", defaultJobParameters());
    Collection<StepExecution> actualStepExecutions = jobExecution.getStepExecutions();
    ExitStatus actualExitStatus = jobExecution.getExitStatus();

    // then
    assertThat(actualStepExecutions.size(), is(1));
    assertThat(actualExitStatus.getExitCode(), is("COMPLETED"));
    actualStepExecutions.forEach(stepExecution -> {
        assertThat(stepExecution.getWriteCount(), is(8));
    });
}
 
Example #24
Source File: MetricsListener.java    From spring-boot-starter-batch-web with Apache License 2.0 5 votes vote down vote up
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
	// Calculate step execution time
	// Why is stepExecution.getEndTime().getTime() not available here? (see AbstractStep)
	long stepDuration = System.currentTimeMillis() - stepExecution.getStartTime().getTime();
	meterRegistry.gauge(METRIC_NAME, Arrays.asList(//
			new ImmutableTag("context", getStepExecutionIdentifier(stepExecution)), //
			new ImmutableTag("name", "duration")//
	), stepDuration);
	long itemCount = stepExecution.getWriteCount() + stepExecution.getSkipCount();
	meterRegistry.gauge(METRIC_NAME, Arrays.asList(//
			new ImmutableTag("context", getStepExecutionIdentifier(stepExecution)), //
			new ImmutableTag("name", "item.count")//
	), itemCount);
	// Calculate execution time per item
	long durationPerItem = 0;
	if (itemCount > 0) {
		durationPerItem = stepDuration / itemCount;
	}
	meterRegistry.gauge(METRIC_NAME, Arrays.asList(//
			new ImmutableTag("context", getStepExecutionIdentifier(stepExecution)), //
			new ImmutableTag("name", "item.duration")//
	), durationPerItem);
	// Export metrics from StepExecution to MetricRepositories
	Set<Entry<String, Object>> metrics = stepExecution.getExecutionContext().entrySet();
	for (Entry<String, Object> metric : metrics) {
		if (metric.getValue() instanceof Number) {
			meterRegistry.gauge(METRIC_NAME, Arrays.asList(//
					new ImmutableTag("context", getStepExecutionIdentifier(stepExecution)), //
					new ImmutableTag("name", metric.getKey())//
			), (Number) metric.getValue());
		}
	}
	return null;
}
 
Example #25
Source File: TaxCalculationStepITest.java    From batchers with Apache License 2.0 5 votes vote down vote up
@Test
public void taxCalculationStep_noWork() throws Exception {
    JobParameters jobParameters = new JobParametersBuilder()
            .addLong("year", 2014L, true)
            .addLong("month", 5L, true)
            .toJobParameters();

    JobExecution jobExecution = jobLauncherTestUtils.launchStep(EmployeeJobConfigSingleJvm.TAX_CALCULATION_STEP, jobParameters);

    assertThat(jobExecution.getExitStatus()).isEqualTo(ExitStatus.COMPLETED);
    assertThat(taxCalculationRepository.find(2014, 5, 1L)).isEmpty();
}
 
Example #26
Source File: FailedStepStepExecutionListener.java    From batchers with Apache License 2.0 5 votes vote down vote up
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
    if (someItemsGotSkippedDueToTaxWebServiceExceptions(stepExecution)) {
        //stepExecution.setStatus(BatchStatus.FAILED);
        return ExitStatus.FAILED;
    }
    return ExitStatus.COMPLETED;
}
 
Example #27
Source File: JobExecutionController.java    From spring-batch-rest with Apache License 2.0 5 votes vote down vote up
@Operation(summary = "Start a Spring Batch job execution")
@PostMapping
public ResponseEntity<JobExecutionResource> put(@RequestBody JobConfig jobConfig) {
    JobExecutionResource resource = new JobExecutionResource(jobExecutionService.launch(jobConfig));
    boolean failed = resource.getJobExecution().getExitCode().equals(ExitStatus.FAILED.getExitCode());
    return new ResponseEntity<>(resource, failed ? HttpStatus.INTERNAL_SERVER_ERROR : HttpStatus.OK);
}
 
Example #28
Source File: ProductItemListener.java    From website with GNU Affero General Public License v3.0 5 votes vote down vote up
@Transactional
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
	ImportExecution importExecution = ImportExecution.findByFilename(getInputFilename());
	if (importExecution != null) {
		if (importExecution.hasErrors()) {
			importExecution.setStatus(ImportStatus.COMPLETE_WITH_ERRORS);
		} else {
			importExecution.setStatus(ImportStatus.COMPLETE);
		}
		importExecution.merge();
	}
	return null;
}
 
Example #29
Source File: OnJobExecutionFinishedEventListenerTest.java    From spring-batch-lightmin with Apache License 2.0 5 votes vote down vote up
@Test
public void testOnApplicationEventJobExecution() {
    final JobInstance instance = new JobInstance(1L, "testJob");
    final JobExecution jobExecution = new JobExecution(1L);
    jobExecution.setJobInstance(instance);
    jobExecution.setExitStatus(ExitStatus.COMPLETED);
    final JobExecutionEvent jobExecutionEvent = new JobExecutionEvent(jobExecution, "testApplication");

    this.onJobExecutionFinishedEventListener.onApplicationEvent(jobExecutionEvent);
    Mockito.verify(this.jobExecutionEventPublisher, Mockito.times(1))
            .publishEvent(any(JobExecutionEventInfo.class));
}
 
Example #30
Source File: ChangeStatusOnFailedStepsJobExecListener.java    From batchers with Apache License 2.0 5 votes vote down vote up
@Override
public void afterJob(JobExecution jobExecution) {
    List<StepExecution> failedStepExecutions = jobExecution.getStepExecutions()
            .stream()
            .filter(stepExecution -> stepExecution.getExitStatus().getExitCode().equals(ExitStatus.FAILED.getExitCode()))
            .collect(Collectors.toList());

    if (failedStepExecutions.size() > 0) {
        jobExecution.setStatus(BatchStatus.FAILED);
        jobExecution.setExitStatus(new ExitStatus("FAILED-BECAUSE-OF-SKIPS"));
    }
}