Fix for scheduled Spring Batch jobs
This commit is contained in:
committed by
Arnold Gálovics
parent
5dab0127d8
commit
c46864c8c9
@@ -38,8 +38,13 @@ import org.mockito.Mockito;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.mockito.junit.jupiter.MockitoSettings;
|
||||
import org.mockito.quality.Strictness;
|
||||
import org.springframework.batch.core.configuration.ListableJobLocator;
|
||||
import org.springframework.batch.core.configuration.annotation.BatchConfigurer;
|
||||
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
|
||||
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
|
||||
import org.springframework.batch.core.explore.JobExplorer;
|
||||
import org.springframework.batch.core.launch.JobLauncher;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
@@ -93,6 +98,18 @@ public class TestConfiguration {
|
||||
return mock(JobBuilderFactory.class, RETURNS_MOCKS);
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public JobExplorer jobExplorer() {
|
||||
return mock(JobExplorer.class, RETURNS_MOCKS);
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public JobLauncher jobLauncher() {
|
||||
return mock(JobLauncher.class, RETURNS_MOCKS);
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public StepBuilderFactory stepBuilderFactory() {
|
||||
@@ -161,4 +178,22 @@ public class TestConfiguration {
|
||||
public JdbcTemplate jdbcTemplate() {
|
||||
return mock(JdbcTemplate.class);
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public BatchConfigurer batchConfigurer() {
|
||||
return mock(BatchConfigurer.class, RETURNS_MOCKS);
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public ListableJobLocator listableJobLocator() {
|
||||
return mock(ListableJobLocator.class, RETURNS_MOCKS);
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public JobRepository jobRepository() {
|
||||
return mock(JobRepository.class, RETURNS_MOCKS);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user