Boot updated bom to use batch 5.x

Updated code to remove new deprecations
Updated code to fix compilation errors.
Updated code to add new bits for tests
This commit is contained in:
Glenn Renfro
2022-01-18 12:46:31 -05:00
parent 930d21fae3
commit c353d68396
15 changed files with 89 additions and 77 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020-2020 the original author or authors.
* Copyright 2020-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,6 +34,7 @@ import org.springframework.batch.item.support.ListItemWriter;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -107,7 +108,8 @@ public class SingleStepJobAutoConfigurationTests {
.withConfiguration(
AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class))
SingleStepJobAutoConfiguration.class,
DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=job",
"spring.batch.job.stepName=step1",
"spring.batch.job.chunkSize=5");
@@ -122,7 +124,8 @@ public class SingleStepJobAutoConfigurationTests {
.withConfiguration(
AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class))
SingleStepJobAutoConfiguration.class,
DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.job-name=job",
"spring.batch.job.step-name=step1",
"spring.batch.job.chunk-size=5");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020-2021 the original author or authors.
* Copyright 2020-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,6 +39,7 @@ import org.springframework.batch.item.support.ListItemWriter;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.cloud.task.batch.autoconfigure.RangeConverter;
import org.springframework.cloud.task.batch.autoconfigure.SingleStepJobAutoConfiguration;
@@ -79,7 +80,8 @@ public class FlatFileItemReaderAutoConfigurationTests {
AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
FlatFileItemReaderAutoConfiguration.class))
FlatFileItemReaderAutoConfiguration.class,
DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=job",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
"spring.batch.job.flatfileitemreader.savestate=true",
@@ -136,7 +138,8 @@ public class FlatFileItemReaderAutoConfigurationTests {
PropertyPlaceholderAutoConfiguration.class,
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
FlatFileItemReaderAutoConfiguration.class, RangeConverter.class))
FlatFileItemReaderAutoConfiguration.class, RangeConverter.class,
DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=job",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
"spring.batch.job.flatfileitemreader.savestate=true",
@@ -196,7 +199,8 @@ public class FlatFileItemReaderAutoConfigurationTests {
AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
FlatFileItemReaderAutoConfiguration.class))
FlatFileItemReaderAutoConfiguration.class,
DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=job",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
"spring.batch.job.flatfileitemreader.name=fixedWidthConfiguration",
@@ -236,7 +240,8 @@ public class FlatFileItemReaderAutoConfigurationTests {
PropertyPlaceholderAutoConfiguration.class,
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
FlatFileItemReaderAutoConfiguration.class, RangeConverter.class))
FlatFileItemReaderAutoConfiguration.class, RangeConverter.class,
DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=job",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
"spring.batch.job.flatfileitemreader.name=fixedWidthConfiguration",
@@ -281,7 +286,8 @@ public class FlatFileItemReaderAutoConfigurationTests {
PropertyPlaceholderAutoConfiguration.class,
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
FlatFileItemReaderAutoConfiguration.class, RangeConverter.class))
FlatFileItemReaderAutoConfiguration.class, RangeConverter.class,
DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=job",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
"spring.batch.job.flatfileitemreader.name=fixedWidthConfiguration",

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020-2020 the original author or authors.
* Copyright 2020-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,6 +44,7 @@ import org.springframework.batch.test.AssertFile;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.cloud.task.batch.autoconfigure.SingleStepJobAutoConfiguration;
import org.springframework.context.annotation.Bean;
@@ -141,7 +142,7 @@ public class FlatFileItemWriterAutoConfigurationTests {
AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
FlatFileItemWriterAutoConfiguration.class))
FlatFileItemWriterAutoConfiguration.class, DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=job",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
"spring.batch.job.flatfileitemwriter.name=fooWriter",
@@ -197,7 +198,8 @@ public class FlatFileItemWriterAutoConfigurationTests {
AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
FlatFileItemWriterAutoConfiguration.class))
FlatFileItemWriterAutoConfiguration.class,
DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=job",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=2",
"spring.batch.job.flatfileitemwriter.name=fooWriter",
@@ -240,7 +242,8 @@ public class FlatFileItemWriterAutoConfigurationTests {
AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
FlatFileItemWriterAutoConfiguration.class))
FlatFileItemWriterAutoConfiguration.class,
DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=job",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
"spring.batch.job.flatfileitemwriter.name=fooWriter",
@@ -281,7 +284,8 @@ public class FlatFileItemWriterAutoConfigurationTests {
AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
FlatFileItemWriterAutoConfiguration.class))
FlatFileItemWriterAutoConfiguration.class,
DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=job",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
"spring.batch.job.flatfileitemwriter.name=fooWriter",
@@ -320,7 +324,8 @@ public class FlatFileItemWriterAutoConfigurationTests {
AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
FlatFileItemWriterAutoConfiguration.class))
FlatFileItemWriterAutoConfiguration.class,
DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=job",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
"spring.batch.job.flatfileitemwriter.name=fooWriter",
@@ -358,7 +363,8 @@ public class FlatFileItemWriterAutoConfigurationTests {
AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
FlatFileItemWriterAutoConfiguration.class))
FlatFileItemWriterAutoConfiguration.class,
DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=job",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
"spring.batch.job.flatfileitemwriter.name=fooWriter",

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020-2020 the original author or authors.
* Copyright 2020-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,6 +39,7 @@ import org.springframework.batch.item.support.ListItemWriter;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.cloud.task.batch.autoconfigure.SingleStepJobAutoConfiguration;
import org.springframework.context.annotation.Bean;
@@ -75,7 +76,8 @@ public class KafkaItemReaderAutoConfigurationTests {
AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
KafkaItemReaderAutoConfiguration.class))
KafkaItemReaderAutoConfiguration.class,
DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=job",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
"spring.kafka.consumer.bootstrap-servers="
@@ -122,7 +124,8 @@ public class KafkaItemReaderAutoConfigurationTests {
AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
KafkaItemReaderAutoConfiguration.class))
KafkaItemReaderAutoConfiguration.class,
DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=job",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
"spring.kafka.consumer.bootstrap-servers="
@@ -164,7 +167,8 @@ public class KafkaItemReaderAutoConfigurationTests {
AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
KafkaItemReaderAutoConfiguration.class))
KafkaItemReaderAutoConfiguration.class,
DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=job",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
"spring.kafka.consumer.bootstrap-servers="

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020-2020 the original author or authors.
* Copyright 2020-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,6 +37,7 @@ import org.springframework.batch.item.support.ListItemReader;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.cloud.task.batch.autoconfigure.SingleStepJobAutoConfiguration;
import org.springframework.context.ApplicationContext;
@@ -71,7 +72,8 @@ public class KafkaItemWriterTests {
AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
KafkaItemWriterAutoConfiguration.class))
KafkaItemWriterAutoConfiguration.class,
DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=job",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
"spring.kafka.producer.bootstrap-servers="

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020-2020 the original author or authors.
* Copyright 2020-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,6 +47,7 @@ import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration;
import org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.cloud.task.batch.autoconfigure.SingleStepJobAutoConfiguration;
@@ -110,7 +111,8 @@ public class AmqpItemReaderAutoConfigurationTests {
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
AmqpItemReaderAutoConfiguration.class,
RabbitAutoConfiguration.class))
RabbitAutoConfiguration.class,
DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=integrationJob",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
"spring.batch.job.amqpitemreader.enabled=true",
@@ -140,7 +142,8 @@ public class AmqpItemReaderAutoConfigurationTests {
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
AmqpItemReaderAutoConfiguration.class,
RabbitAutoConfiguration.class))
RabbitAutoConfiguration.class,
DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=integrationJob",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
"spring.batch.job.amqpitemreader.enabled=true",
@@ -168,7 +171,8 @@ public class AmqpItemReaderAutoConfigurationTests {
AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
AmqpItemReaderAutoConfiguration.class))
AmqpItemReaderAutoConfiguration.class,
DataSourceAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=integrationJob",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
"spring.batch.job.amqpitemreader.enabled=true",

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020-2020 the original author or authors.
* Copyright 2020-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,6 +51,7 @@ import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration;
import org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.cloud.task.batch.autoconfigure.SingleStepJobAutoConfiguration;
@@ -135,7 +136,8 @@ public class AmqpItemWriterAutoConfigurationTests {
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
AmqpItemWriterAutoConfiguration.class,
RabbitAutoConfiguration.class))
RabbitAutoConfiguration.class,
DataSourceAutoConfiguration.class))
.withPropertyValues(this.configurations);
applicationContextRunner.run((context) -> {
@@ -163,7 +165,8 @@ public class AmqpItemWriterAutoConfigurationTests {
AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
BatchAutoConfiguration.class,
SingleStepJobAutoConfiguration.class,
AmqpItemWriterAutoConfiguration.class))
AmqpItemWriterAutoConfiguration.class,
DataSourceAutoConfiguration.class))
.withPropertyValues(this.configurations);
applicationContextRunner.run((context) -> {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 the original author or authors.
* Copyright 2016-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.listener.JobExecutionListenerSupport;
import org.springframework.batch.core.JobExecutionListener;
import org.springframework.cloud.task.listener.annotation.BeforeTask;
import org.springframework.cloud.task.repository.TaskExecution;
import org.springframework.util.Assert;
@@ -31,7 +31,7 @@ import org.springframework.util.Assert;
*
* @author Michael Minella
*/
public class TaskBatchExecutionListener extends JobExecutionListenerSupport {
public class TaskBatchExecutionListener implements JobExecutionListener {
private static final Log logger = LogFactory.getLog(TaskBatchExecutionListener.class);

View File

@@ -83,7 +83,6 @@ public class TaskJobLauncherApplicationRunnerCoreTests {
@Autowired
private JobExplorer jobExplorer;
@Autowired
private PlatformTransactionManager transactionManager;
private TaskJobLauncherApplicationRunner runner;
@@ -98,6 +97,7 @@ public class TaskJobLauncherApplicationRunnerCoreTests {
@BeforeEach
public void init() {
this.transactionManager = new ResourcelessTransactionManager();
this.jobs = new JobBuilderFactory(this.jobRepository);
this.steps = new StepBuilderFactory(this.jobRepository, this.transactionManager);
Tasklet tasklet = (contribution, chunkContext) -> RepeatStatus.FINISHED;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019-2019 the original author or authors.
* Copyright 2019-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -116,8 +116,7 @@ public class TaskMetrics {
(this.exception == null) ? "none"
: this.exception.getClass().getSimpleName())
.tag(TASK_STATUS_TAG,
(this.exception == null) ? STATUS_SUCCESS : STATUS_FAILURE)
.register(Metrics.globalRegistry));
(this.exception == null) ? STATUS_SUCCESS : STATUS_FAILURE));
this.taskSample = null;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 the original author or authors.
* Copyright 2016-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -64,8 +64,6 @@ public class JobExecutionEvent extends Entity {
private List<Throwable> failureExceptions = new CopyOnWriteArrayList<>();
private String jobConfigurationName;
public JobExecutionEvent() {
super();
}
@@ -90,7 +88,6 @@ public class JobExecutionEvent extends Entity {
this.exitStatus = new ExitStatus(original.getExitStatus());
this.executionContext = original.getExecutionContext();
this.failureExceptions = original.getFailureExceptions();
this.jobConfigurationName = original.getJobConfigurationName();
this.setId(original.getId());
this.setVersion(original.getVersion());
}
@@ -213,10 +210,6 @@ public class JobExecutionEvent extends Entity {
this.createTime = createTime;
}
public String getJobConfigurationName() {
return this.jobConfigurationName;
}
/**
* Get the date representing the last time this JobExecution was updated in the
* JobRepository.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2019 the original author or authors.
* Copyright 2015-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,19 +41,19 @@ public class StepExecutionEvent extends Entity {
private BatchStatus status = BatchStatus.STARTING;
private int readCount = 0;
private long readCount = 0;
private int writeCount = 0;
private long writeCount = 0;
private int commitCount = 0;
private long commitCount = 0;
private int rollbackCount = 0;
private long rollbackCount = 0;
private int readSkipCount = 0;
private long readSkipCount = 0;
private int processSkipCount = 0;
private long processSkipCount = 0;
private int writeSkipCount = 0;
private long writeSkipCount = 0;
private Date startTime = new Date(System.currentTimeMillis());
@@ -68,7 +68,7 @@ public class StepExecutionEvent extends Entity {
private boolean terminateOnly;
private int filterCount;
private long filterCount;
private List<Throwable> failureExceptions = new CopyOnWriteArrayList<>();
@@ -133,7 +133,7 @@ public class StepExecutionEvent extends Entity {
* Returns the current number of commits for this execution.
* @return the current number of commits
*/
public int getCommitCount() {
public long getCommitCount() {
return this.commitCount;
}
@@ -165,7 +165,7 @@ public class StepExecutionEvent extends Entity {
* Returns the current number of items read for this execution.
* @return the current number of items read for this execution
*/
public int getReadCount() {
public long getReadCount() {
return this.readCount;
}
@@ -181,7 +181,7 @@ public class StepExecutionEvent extends Entity {
* Returns the current number of items written for this execution.
* @return the current number of items written for this execution
*/
public int getWriteCount() {
public long getWriteCount() {
return this.writeCount;
}
@@ -197,7 +197,7 @@ public class StepExecutionEvent extends Entity {
* Returns the current number of rollbacks for this execution.
* @return the current number of rollbacks for this execution
*/
public int getRollbackCount() {
public long getRollbackCount() {
return this.rollbackCount;
}
@@ -213,7 +213,7 @@ public class StepExecutionEvent extends Entity {
* Returns the current number of items filtered out of this execution.
* @return the current number of items filtered out of this execution
*/
public int getFilterCount() {
public long getFilterCount() {
return this.filterCount;
}
@@ -300,7 +300,7 @@ public class StepExecutionEvent extends Entity {
/**
* @return the total number of items skipped.
*/
public int getSkipCount() {
public long getSkipCount() {
return this.readSkipCount + this.processSkipCount + this.writeSkipCount;
}
@@ -314,7 +314,7 @@ public class StepExecutionEvent extends Entity {
/**
* @return the number of records skipped on read.
*/
public int getReadSkipCount() {
public long getReadSkipCount() {
return this.readSkipCount;
}
@@ -329,7 +329,7 @@ public class StepExecutionEvent extends Entity {
/**
* @return the number of records skipped on write
*/
public int getWriteSkipCount() {
public long getWriteSkipCount() {
return this.writeSkipCount;
}
@@ -344,7 +344,7 @@ public class StepExecutionEvent extends Entity {
/**
* @return the number of records skipped during processing
*/
public int getProcessSkipCount() {
public long getProcessSkipCount() {
return this.processSkipCount;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2021 the original author or authors.
* Copyright 2016-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -297,8 +297,7 @@ public class EventListenerTests {
private JobExecution getJobExecution() {
final String JOB_NAME = UUID.randomUUID().toString();
JobInstance jobInstance = new JobInstance(1L, JOB_NAME);
return new JobExecution(jobInstance, 1L, new JobParameters(),
UUID.randomUUID().toString());
return new JobExecution(jobInstance, 1L, new JobParameters());
}
private List<String> getSampleList() {

View File

@@ -60,8 +60,6 @@ public class JobExecutionEventTests {
private static final Long JOB_EXECUTION_ID = 2L;
private static final String JOB_CONFIGURATION_NAME = "FOO_JOB_CONFIG";
private static final String[] LISTENER_BEAN_NAMES = {
BatchEventAutoConfiguration.JOB_EXECUTION_EVENTS_LISTENER,
BatchEventAutoConfiguration.STEP_EXECUTION_EVENTS_LISTENER,
@@ -86,15 +84,12 @@ public class JobExecutionEventTests {
public void testBasic() {
JobExecution jobExecution;
jobExecution = new JobExecution(this.jobInstance, JOB_EXECUTION_ID,
this.jobParameters, JOB_CONFIGURATION_NAME);
this.jobParameters);
JobExecutionEvent jobExecutionEvent = new JobExecutionEvent(jobExecution);
assertThat(jobExecutionEvent.getJobInstance())
.as("jobInstance should not be null").isNotNull();
assertThat(jobExecutionEvent.getJobParameters())
.as("jobParameters should not be null").isNotNull();
assertThat(jobExecutionEvent.getJobConfigurationName())
.as("jobConfigurationName did not match expected")
.isEqualTo(JOB_CONFIGURATION_NAME);
assertThat(jobExecutionEvent.getJobParameters().getParameters().size())
.as("jobParameters size did not match").isEqualTo(0);
@@ -121,7 +116,7 @@ public class JobExecutionEventTests {
this.jobParameters = new JobParameters(jobParamMap);
JobExecution jobExecution;
jobExecution = new JobExecution(this.jobInstance, JOB_EXECUTION_ID,
this.jobParameters, JOB_CONFIGURATION_NAME);
this.jobParameters);
JobExecutionEvent jobExecutionEvent = new JobExecutionEvent(jobExecution);
assertThat(jobExecutionEvent.getJobParameters().getString("A"))
@@ -147,7 +142,7 @@ public class JobExecutionEventTests {
public void testStepExecutions() {
JobExecution jobExecution;
jobExecution = new JobExecution(this.jobInstance, JOB_EXECUTION_ID,
this.jobParameters, JOB_CONFIGURATION_NAME);
this.jobParameters);
List<StepExecution> stepsExecutions = new ArrayList<>();
stepsExecutions.add(new StepExecution("foo", jobExecution));
stepsExecutions.add(new StepExecution("bar", jobExecution));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 the original author or authors.
* Copyright 2016-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,8 +44,6 @@ public class StepExecutionEventTests {
private static final Long JOB_EXECUTION_ID = 2L;
private static final String JOB_CONFIGURATION_NAME = "FOO_JOB_CONFIG";
@Test
public void testBasic() {
StepExecution stepExecution = getBasicStepExecution();
@@ -238,7 +236,7 @@ public class StepExecutionEventTests {
JobInstance jobInstance = new JobInstance(JOB_INSTANCE_ID, JOB_NAME);
JobParameters jobParameters = new JobParameters();
JobExecution jobExecution = new JobExecution(jobInstance, JOB_EXECUTION_ID,
jobParameters, JOB_CONFIGURATION_NAME);
jobParameters);
return new StepExecution(STEP_NAME, jobExecution);
}