Replace explicit type with diamond operator in core tests module
This commit is contained in:
committed by
Mahmoud Ben Hassine
parent
4192bfe01e
commit
5ebf09e356
@@ -77,7 +77,7 @@ public class ConcurrentMapExecutionContextDaoTests {
|
||||
public void testConcurrentTransactionalSaveUpdate() throws Exception {
|
||||
|
||||
ExecutorService executor = Executors.newFixedThreadPool(3);
|
||||
CompletionService<StepExecution> completionService = new ExecutorCompletionService<StepExecution>(executor);
|
||||
CompletionService<StepExecution> completionService = new ExecutorCompletionService<>(executor);
|
||||
|
||||
final int outerMax = 10;
|
||||
final int innerMax = 100;
|
||||
|
||||
@@ -52,11 +52,11 @@ public class JdbcJobRepositoryTests {
|
||||
|
||||
private JobSupport job;
|
||||
|
||||
private Set<Long> jobExecutionIds = new HashSet<Long>();
|
||||
private Set<Long> jobExecutionIds = new HashSet<>();
|
||||
|
||||
private Set<Long> jobIds = new HashSet<Long>();
|
||||
private Set<Long> jobIds = new HashSet<>();
|
||||
|
||||
private List<Serializable> list = new ArrayList<Serializable>();
|
||||
private List<Serializable> list = new ArrayList<>();
|
||||
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.springframework.util.ClassUtils;
|
||||
*/
|
||||
public class JobSupport implements BeanNameAware, Job {
|
||||
|
||||
private List<Step> steps = new ArrayList<Step>();
|
||||
private List<Step> steps = new ArrayList<>();
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ public class FaultTolerantStepFactoryBeanIntegrationTests {
|
||||
writer = new SkipWriterStub(dataSource);
|
||||
processor = new SkipProcessorStub(dataSource);
|
||||
|
||||
factory = new FaultTolerantStepFactoryBean<String, String>();
|
||||
factory = new FaultTolerantStepFactoryBean<>();
|
||||
|
||||
factory.setBeanName("stepName");
|
||||
factory.setTransactionManager(transactionManager);
|
||||
@@ -152,10 +152,10 @@ public class FaultTolerantStepFactoryBeanIntegrationTests {
|
||||
step.execute(stepExecution);
|
||||
assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus());
|
||||
|
||||
List<String> committed = new ArrayList<String>(writer.getCommitted());
|
||||
List<String> committed = new ArrayList<>(writer.getCommitted());
|
||||
Collections.sort(committed);
|
||||
assertEquals("[1, 2, 3, 4, 5]", committed.toString());
|
||||
List<String> processed = new ArrayList<String>(processor.getCommitted());
|
||||
List<String> processed = new ArrayList<>(processor.getCommitted());
|
||||
Collections.sort(processed);
|
||||
assertEquals("[1, 2, 3, 4, 5]", processed.toString());
|
||||
assertEquals(0, stepExecution.getSkipCount());
|
||||
@@ -202,7 +202,7 @@ public class FaultTolerantStepFactoryBeanIntegrationTests {
|
||||
|
||||
private static class SkipWriterStub implements ItemWriter<String> {
|
||||
|
||||
private List<String> written = new ArrayList<String>();
|
||||
private List<String> written = new ArrayList<>();
|
||||
|
||||
private Collection<String> failures = Collections.emptySet();
|
||||
|
||||
@@ -247,7 +247,7 @@ public class FaultTolerantStepFactoryBeanIntegrationTests {
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private List<String> processed = new ArrayList<String>();
|
||||
private List<String> processed = new ArrayList<>();
|
||||
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ public class FaultTolerantStepFactoryBeanRollbackIntegrationTests {
|
||||
writer = new SkipWriterStub(dataSource);
|
||||
processor = new SkipProcessorStub(dataSource);
|
||||
|
||||
factory = new FaultTolerantStepFactoryBean<String, String>();
|
||||
factory = new FaultTolerantStepFactoryBean<>();
|
||||
|
||||
factory.setBeanName("stepName");
|
||||
factory.setTransactionManager(transactionManager);
|
||||
@@ -167,7 +167,7 @@ public class FaultTolerantStepFactoryBeanRollbackIntegrationTests {
|
||||
|
||||
assertEquals("[]", writer.getCommitted().toString());
|
||||
assertEquals("[]", processor.getCommitted().toString());
|
||||
List<String> processed = new ArrayList<String>(processor.getProcessed());
|
||||
List<String> processed = new ArrayList<>(processor.getProcessed());
|
||||
Collections.sort(processed);
|
||||
assertEquals("[1, 1, 2, 2, 3, 3, 4, 4, 5, 5]", processed.toString());
|
||||
assertEquals(5, stepExecution.getSkipCount());
|
||||
@@ -184,7 +184,7 @@ public class FaultTolerantStepFactoryBeanRollbackIntegrationTests {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Map<Class<? extends Throwable>, Boolean> getExceptionMap(Class<? extends Throwable>... args) {
|
||||
Map<Class<? extends Throwable>, Boolean> map = new HashMap<Class<? extends Throwable>, Boolean>();
|
||||
Map<Class<? extends Throwable>, Boolean> map = new HashMap<>();
|
||||
for (Class<? extends Throwable> arg : args) {
|
||||
map.put(arg, true);
|
||||
}
|
||||
@@ -223,7 +223,7 @@ public class FaultTolerantStepFactoryBeanRollbackIntegrationTests {
|
||||
|
||||
private static class SkipWriterStub implements ItemWriter<String> {
|
||||
|
||||
private List<String> written = new CopyOnWriteArrayList<String>();
|
||||
private List<String> written = new CopyOnWriteArrayList<>();
|
||||
|
||||
private Collection<String> failures = Collections.emptySet();
|
||||
|
||||
@@ -272,7 +272,7 @@ public class FaultTolerantStepFactoryBeanRollbackIntegrationTests {
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private List<String> processed = new CopyOnWriteArrayList<String>();
|
||||
private List<String> processed = new CopyOnWriteArrayList<>();
|
||||
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ public class MapRepositoryFaultTolerantStepFactoryBeanRollbackTests {
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private List<String> written = new CopyOnWriteArrayList<String>();
|
||||
private List<String> written = new CopyOnWriteArrayList<>();
|
||||
|
||||
private Collection<String> failures = Collections.emptySet();
|
||||
|
||||
@@ -226,7 +226,7 @@ public class MapRepositoryFaultTolerantStepFactoryBeanRollbackTests {
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private List<String> processed = new CopyOnWriteArrayList<String>();
|
||||
private List<String> processed = new CopyOnWriteArrayList<>();
|
||||
|
||||
public List<String> getProcessed() {
|
||||
return processed;
|
||||
|
||||
@@ -78,7 +78,7 @@ public class MapRepositoryFaultTolerantStepFactoryBeanTests {
|
||||
writer = new SkipWriterStub();
|
||||
processor = new SkipProcessorStub();
|
||||
|
||||
factory = new FaultTolerantStepFactoryBean<String, String>();
|
||||
factory = new FaultTolerantStepFactoryBean<>();
|
||||
|
||||
factory.setBeanName("stepName");
|
||||
factory.setTransactionManager(transactionManager);
|
||||
@@ -135,10 +135,10 @@ public class MapRepositoryFaultTolerantStepFactoryBeanTests {
|
||||
step.execute(stepExecution);
|
||||
assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus());
|
||||
|
||||
List<String> committed = new ArrayList<String>(writer.getWritten());
|
||||
List<String> committed = new ArrayList<>(writer.getWritten());
|
||||
Collections.sort(committed);
|
||||
assertEquals("[1, 2, 3, 4, 5]", committed.toString());
|
||||
List<String> processed = new ArrayList<String>(processor.getProcessed());
|
||||
List<String> processed = new ArrayList<>(processor.getProcessed());
|
||||
Collections.sort(processed);
|
||||
assertEquals("[1, 2, 3, 4, 5]", processed.toString());
|
||||
assertEquals(0, stepExecution.getSkipCount());
|
||||
@@ -185,7 +185,7 @@ public class MapRepositoryFaultTolerantStepFactoryBeanTests {
|
||||
|
||||
private static class SkipWriterStub implements ItemWriter<String> {
|
||||
|
||||
private List<String> written = new CopyOnWriteArrayList<String>();
|
||||
private List<String> written = new CopyOnWriteArrayList<>();
|
||||
|
||||
private Collection<String> failures = Collections.emptySet();
|
||||
|
||||
@@ -216,7 +216,7 @@ public class MapRepositoryFaultTolerantStepFactoryBeanTests {
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private List<String> processed = new CopyOnWriteArrayList<String>();
|
||||
private List<String> processed = new CopyOnWriteArrayList<>();
|
||||
|
||||
public List<String> getProcessed() {
|
||||
return processed;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class StepExecutionSerializationUtilsTests {
|
||||
int threads = 10;
|
||||
|
||||
Executor executor = Executors.newFixedThreadPool(threads);
|
||||
CompletionService<StepExecution> completionService = new ExecutorCompletionService<StepExecution>(executor);
|
||||
CompletionService<StepExecution> completionService = new ExecutorCompletionService<>(executor);
|
||||
|
||||
for (int i = 0; i < repeats; i++) {
|
||||
final JobExecution jobExecution = new JobExecution(new JobInstance(123L, "job"), 321L, new JobParameters(), null);
|
||||
|
||||
Reference in New Issue
Block a user