Update Batch tests
Related to: https://github.com/spring-projects/spring-batch/issues/4245 Closes gh-37348
This commit is contained in:
parent
9e37c6842a
commit
626d858d81
|
@ -39,7 +39,6 @@ import org.springframework.batch.core.configuration.JobFactory;
|
||||||
import org.springframework.batch.core.configuration.JobRegistry;
|
import org.springframework.batch.core.configuration.JobRegistry;
|
||||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||||
import org.springframework.batch.core.configuration.support.DefaultBatchConfiguration;
|
import org.springframework.batch.core.configuration.support.DefaultBatchConfiguration;
|
||||||
import org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor;
|
|
||||||
import org.springframework.batch.core.explore.JobExplorer;
|
import org.springframework.batch.core.explore.JobExplorer;
|
||||||
import org.springframework.batch.core.job.AbstractJob;
|
import org.springframework.batch.core.job.AbstractJob;
|
||||||
import org.springframework.batch.core.launch.JobLauncher;
|
import org.springframework.batch.core.launch.JobLauncher;
|
||||||
|
@ -96,6 +95,7 @@ import static org.mockito.Mockito.mock;
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
* @author Vedran Pavic
|
* @author Vedran Pavic
|
||||||
* @author Kazuki Shimizu
|
* @author Kazuki Shimizu
|
||||||
|
* @author Mahmoud Ben Hassine
|
||||||
*/
|
*/
|
||||||
@ExtendWith(OutputCaptureExtension.class)
|
@ExtendWith(OutputCaptureExtension.class)
|
||||||
class BatchAutoConfigurationTests {
|
class BatchAutoConfigurationTests {
|
||||||
|
@ -515,13 +515,6 @@ class BatchAutoConfigurationTests {
|
||||||
@Autowired
|
@Autowired
|
||||||
private JobRepository jobRepository;
|
private JobRepository jobRepository;
|
||||||
|
|
||||||
@Bean
|
|
||||||
static JobRegistryBeanPostProcessor registryProcessor(JobRegistry jobRegistry) {
|
|
||||||
JobRegistryBeanPostProcessor processor = new JobRegistryBeanPostProcessor();
|
|
||||||
processor.setJobRegistry(jobRegistry);
|
|
||||||
return processor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
Job discreteJob() {
|
Job discreteJob() {
|
||||||
AbstractJob job = new AbstractJob("discreteRegisteredJob") {
|
AbstractJob job = new AbstractJob("discreteRegisteredJob") {
|
||||||
|
@ -685,7 +678,17 @@ class BatchAutoConfigurationTests {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
Job job2() {
|
Job job2() {
|
||||||
return mock(Job.class);
|
return new Job() {
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "discreteLocalJob2";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(JobExecution execution) {
|
||||||
|
execution.setStatus(BatchStatus.COMPLETED);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue