diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/DefaultBatchConfigurer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/DefaultBatchConfigurer.java index f1c0ce722..80b01f0ff 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/DefaultBatchConfigurer.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/DefaultBatchConfigurer.java @@ -51,7 +51,7 @@ public class DefaultBatchConfigurer implements BatchConfigurer { * values are passed are ignored (to prevent {@code}@Autowired{@code} from overwriting * the value). * - * @param dataSource + * @param dataSource The data source to use */ @Autowired(required = false) public void setDataSource(DataSource dataSource) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/JobExplorerFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/JobExplorerFactoryBean.java index 4f24f8648..c0ebd8cf5 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/JobExplorerFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/JobExplorerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2018 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. @@ -30,7 +30,6 @@ import org.springframework.batch.core.repository.dao.JdbcStepExecutionDao; import org.springframework.batch.core.repository.dao.JobExecutionDao; import org.springframework.batch.core.repository.dao.JobInstanceDao; import org.springframework.batch.core.repository.dao.StepExecutionDao; -import org.springframework.batch.core.repository.dao.XStreamExecutionContextStringSerializer; import org.springframework.batch.item.ExecutionContext; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.InitializingBean; @@ -47,6 +46,7 @@ import org.springframework.util.Assert; * to describe what kind of database they are using. * * @author Dave Syer + * @author Mahmoud Ben Hassine * @since 2.0 */ public class JobExplorerFactoryBean extends AbstractJobExplorerFactoryBean @@ -71,7 +71,7 @@ implements InitializingBean { /** * A custom implementation of the {@link ExecutionContextSerializer}. - * The default, if not injected, is the {@link XStreamExecutionContextStringSerializer}. + * The default, if not injected, is the {@link Jackson2ExecutionContextStringSerializer}. * * @param serializer used to serialize/deserialize an {@link org.springframework.batch.item.ExecutionContext} * @see ExecutionContextSerializer @@ -124,7 +124,7 @@ implements InitializingBean { Assert.notNull(dataSource, "DataSource must not be null."); if (jdbcOperations == null) { - jdbcOperations = new JdbcTemplate(dataSource); + jdbcOperations = new JdbcTemplate(dataSource); } if(serializer == null) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/SpringAutowiredAnnotationBeanPostProcessor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/SpringAutowiredAnnotationBeanPostProcessor.java index 0fb59c240..8409eb625 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/SpringAutowiredAnnotationBeanPostProcessor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/SpringAutowiredAnnotationBeanPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 the original author or authors. + * Copyright 2013-2018 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. @@ -248,10 +248,10 @@ class SpringAutowiredAnnotationBeanPostProcessor extends InstantiationAwareBeanP if (requiredConstructor == null && defaultConstructor != null) { candidates.add(defaultConstructor); } - candidateConstructors = candidates.toArray(new Constructor[candidates.size()]); + candidateConstructors = candidates.toArray(new Constructor[candidates.size()]); } else { - candidateConstructors = new Constructor[0]; + candidateConstructors = new Constructor[0]; } this.candidateConstructorsCache.put(beanClass, candidateConstructors); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/RunIdIncrementer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/RunIdIncrementer.java index 36b5a2c69..36ccf6dd2 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/RunIdIncrementer.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/RunIdIncrementer.java @@ -47,7 +47,7 @@ public class RunIdIncrementer implements JobParametersIncrementer { JobParameters params = (parameters == null) ? new JobParameters() : parameters; - long id = params.getLong(key, 0L) + 1; + long id = params.getLong(key, new Long(0)) + 1; return new JobParametersBuilder(params).addLong(key, id).toJobParameters(); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/TaskExecutorPartitionHandler.java b/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/TaskExecutorPartitionHandler.java index b647d6b6f..32c4e624e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/TaskExecutorPartitionHandler.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/TaskExecutorPartitionHandler.java @@ -23,7 +23,6 @@ import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.partition.PartitionHandler; import org.springframework.batch.core.step.StepHolder; import org.springframework.beans.factory.InitializingBean; -import org.springframework.beans.factory.annotation.Required; import org.springframework.core.task.SyncTaskExecutor; import org.springframework.core.task.TaskExecutor; import org.springframework.core.task.TaskRejectedException; @@ -55,6 +54,7 @@ public class TaskExecutorPartitionHandler extends AbstractPartitionHandler imple @Override public void afterPropertiesSet() throws Exception { + Assert.state(step != null, "A Step must be provided."); } /** @@ -74,7 +74,6 @@ public class TaskExecutorPartitionHandler extends AbstractPartitionHandler imple * * @param step the {@link Step} instance to use to execute business logic */ - @Required public void setStep(Step step) { this.step = step; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/Jackson2ExecutionContextStringSerializer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/Jackson2ExecutionContextStringSerializer.java index 2b73a0126..bc3ab5c23 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/Jackson2ExecutionContextStringSerializer.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/Jackson2ExecutionContextStringSerializer.java @@ -85,6 +85,8 @@ public class Jackson2ExecutionContextStringSerializer implements ExecutionContex */ private class JobParametersModule extends SimpleModule { + private static final long serialVersionUID = 1L; + private JobParametersModule() { super("Job parameters module"); setMixInAnnotation(JobParameters.class, JobParametersMixIn.class); @@ -98,6 +100,7 @@ public class Jackson2ExecutionContextStringSerializer implements ExecutionContex private class JobParameterDeserializer extends StdDeserializer { + private static final long serialVersionUID = 1L; private static final String IDENTIFYING_KEY_NAME = "identifying"; private static final String TYPE_KEY_NAME = "type"; private static final String VALUE_KEY_NAME = "value"; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/TaskExecutorPartitionHandlerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/TaskExecutorPartitionHandlerTests.java index 5f3b06d6b..c67d8c3ab 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/TaskExecutorPartitionHandlerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/TaskExecutorPartitionHandlerTests.java @@ -76,6 +76,20 @@ public class TaskExecutorPartitionHandlerTests { handler.afterPropertiesSet(); } + @Test + public void testConfiguration() throws Exception { + handler = new TaskExecutorPartitionHandler(); + try { + handler.afterPropertiesSet(); + fail("Expected IllegalStateException when no step is set"); + } + catch (IllegalStateException e) { + // expected + String message = e.getMessage(); + assertEquals("Wrong message: " + message, "A Step must be provided.", message); + } + } + @Test public void testNullStep() throws Exception { handler = new TaskExecutorPartitionHandler(); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/XStreamExecutionContextStringSerializerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/XStreamExecutionContextStringSerializerTests.java index 1bd4d322e..115123e85 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/XStreamExecutionContextStringSerializerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/XStreamExecutionContextStringSerializerTests.java @@ -28,6 +28,7 @@ public class XStreamExecutionContextStringSerializerTests extends AbstractExecut @Before public void onSetUp() throws Exception { + @SuppressWarnings("deprecation") XStreamExecutionContextStringSerializer serializerDeserializer = new XStreamExecutionContextStringSerializer(); (serializerDeserializer).afterPropertiesSet(); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/StepBuilderTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/StepBuilderTests.java index 05db1b3a4..11b1673b4 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/StepBuilderTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/StepBuilderTests.java @@ -118,7 +118,7 @@ public class StepBuilderTests { StepExecution execution = jobRepository.createJobExecution("foo", new JobParameters()).createStepExecution("step"); jobRepository.add(execution); PlatformTransactionManager transactionManager = new ResourcelessTransactionManager(); - SimpleStepBuilder builder = new StepBuilder("step") + SimpleStepBuilder builder = new StepBuilder("step") .repository(jobRepository) .transactionManager(transactionManager) .chunk(5) @@ -137,7 +137,7 @@ public class StepBuilderTests { StepExecution execution = jobRepository.createJobExecution("foo", new JobParameters()).createStepExecution("step"); jobRepository.add(execution); PlatformTransactionManager transactionManager = new ResourcelessTransactionManager(); - SimpleStepBuilder builder = new StepBuilder("step") + SimpleStepBuilder builder = new StepBuilder("step") .repository(jobRepository) .transactionManager(transactionManager) .chunk(5) diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/CastorMarshallingTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/CastorMarshallingTests.java index 5350ba9cd..d1d2dd6fe 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/CastorMarshallingTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/CastorMarshallingTests.java @@ -17,14 +17,14 @@ package org.springframework.batch.item.xml; import org.springframework.core.io.ClassPathResource; import org.springframework.oxm.Marshaller; -import org.springframework.oxm.castor.CastorMarshaller; public class CastorMarshallingTests extends AbstractStaxEventWriterItemWriterTests { @Override protected Marshaller getMarshaller() throws Exception { - CastorMarshaller marshaller = new CastorMarshaller(); + @SuppressWarnings("deprecation") + org.springframework.oxm.castor.CastorMarshaller marshaller = new org.springframework.oxm.castor.CastorMarshaller(); // marshaller.setTargetClass(Trade.class); marshaller.setMappingLocation(new ClassPathResource("mapping-castor.xml", getClass())); // there is no way to call diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/CastorUnmarshallingTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/CastorUnmarshallingTests.java index 6c131599b..9c871891c 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/CastorUnmarshallingTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/CastorUnmarshallingTests.java @@ -17,13 +17,13 @@ package org.springframework.batch.item.xml; import org.springframework.core.io.ClassPathResource; import org.springframework.oxm.Unmarshaller; -import org.springframework.oxm.castor.CastorMarshaller; public class CastorUnmarshallingTests extends AbstractStaxEventReaderItemReaderTests { @Override protected Unmarshaller getUnmarshaller() throws Exception { - CastorMarshaller unmarshaller = new CastorMarshaller(); + @SuppressWarnings("deprecation") + org.springframework.oxm.castor.CastorMarshaller unmarshaller = new org.springframework.oxm.castor.CastorMarshaller(); unmarshaller.setMappingLocation(new ClassPathResource("mapping-castor.xml", getClass())); // alternatively target class can be set //unmarshaller.setTargetClass(Trade.class); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/RepositoryItemReaderBuilder.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/RepositoryItemReaderBuilder.java index d69942507..9d7820925 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/RepositoryItemReaderBuilder.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/RepositoryItemReaderBuilder.java @@ -53,7 +53,7 @@ public class RepositoryItemReaderBuilder { private String methodName; - private RepositoryMethodReference repositoryMethodReference; + private RepositoryMethodReference repositoryMethodReference; private boolean saveState = true; @@ -213,7 +213,7 @@ public class RepositoryItemReaderBuilder { * @see RepositoryItemReader#setRepository(PagingAndSortingRepository) * */ - public RepositoryItemReaderBuilder repository(RepositoryMethodReference repositoryMethodReference) { + public RepositoryItemReaderBuilder repository(RepositoryMethodReference repositoryMethodReference) { this.repositoryMethodReference = repositoryMethodReference; return this; @@ -275,6 +275,7 @@ public class RepositoryItemReaderBuilder { * information about the method. * @return T is a proxy of the object passed in in the constructor */ + @SuppressWarnings("unchecked") public T methodIs() { Enhancer enhancer = new Enhancer(); enhancer.setSuperclass(this.repository.getClass()); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/RepositoryItemWriterBuilder.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/RepositoryItemWriterBuilder.java index becba0df7..4d41a8ab0 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/RepositoryItemWriterBuilder.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/RepositoryItemWriterBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 the original author or authors. + * Copyright 2017-2018 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. @@ -18,9 +18,6 @@ package org.springframework.batch.item.data.builder; import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; import org.springframework.batch.item.data.RepositoryItemWriter; import org.springframework.cglib.proxy.Enhancer; @@ -33,6 +30,7 @@ import org.springframework.util.Assert; * A builder implementation for the {@link RepositoryItemWriter}. * * @author Glenn Renfro + * @author Mahmoud Ben Hassine * @since 4.0 * @see RepositoryItemWriter */ @@ -136,6 +134,7 @@ public class RepositoryItemWriterBuilder { * information about the method. * @return T is a proxy of the object passed in in the constructor */ + @SuppressWarnings("unchecked") public T methodIs() { Enhancer enhancer = new Enhancer(); enhancer.setSuperclass(this.repository.getClass()); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernateItemReaderHelper.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernateItemReaderHelper.java index 251b888af..f7a28bfc6 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernateItemReaderHelper.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernateItemReaderHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2013 the original author or authors. + * Copyright 2006-2018 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. @@ -38,9 +38,10 @@ import org.springframework.util.StringUtils; * queries. * * @author Dave Syer + * @author Mahmoud Ben Hassine * */ -@SuppressWarnings("rawtype") +@SuppressWarnings("rawtypes") public class HibernateItemReaderHelper implements InitializingBean { private SessionFactory sessionFactory; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/builder/HibernateCursorItemReaderBuilder.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/builder/HibernateCursorItemReaderBuilder.java index e53551589..2fc29c7a6 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/builder/HibernateCursorItemReaderBuilder.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/builder/HibernateCursorItemReaderBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 the original author or authors. + * Copyright 2017-2018 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.util.StringUtils; * * @author Michael Minella * @author Glenn Renfro + * @author Mahmoud Ben Hassine * @since 4.0 * @see HibernateCursorItemReader */ @@ -58,7 +59,7 @@ public class HibernateCursorItemReaderBuilder { private String nativeQuery; - private Class nativeClass; + private Class nativeClass; private boolean saveState = true; @@ -232,7 +233,7 @@ public class HibernateCursorItemReaderBuilder { return this; } - public HibernateCursorItemReaderBuilder entityClass(Class nativeClass) { + public HibernateCursorItemReaderBuilder entityClass(Class nativeClass) { this.nativeClass = nativeClass; return this; @@ -267,7 +268,7 @@ public class HibernateCursorItemReaderBuilder { reader.setQueryString(this.queryString); } else if(StringUtils.hasText(this.nativeQuery) && this.nativeClass != null) { - HibernateNativeQueryProvider provider = new HibernateNativeQueryProvider(); + HibernateNativeQueryProvider provider = new HibernateNativeQueryProvider<>(); provider.setSqlQuery(this.nativeQuery); provider.setEntityClass(this.nativeClass); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/builder/HibernatePagingItemReaderBuilder.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/builder/HibernatePagingItemReaderBuilder.java index b17bbb241..831c42991 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/builder/HibernatePagingItemReaderBuilder.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/builder/HibernatePagingItemReaderBuilder.java @@ -183,7 +183,7 @@ public class HibernatePagingItemReaderBuilder { * @return this instance for method chaining * @see HibernatePagingItemReader#setQueryProvider(HibernateQueryProvider) */ - public HibernatePagingItemReaderBuilder queryProvider(HibernateQueryProvider queryProvider) { + public HibernatePagingItemReaderBuilder queryProvider(HibernateQueryProvider queryProvider) { this.queryProvider = queryProvider; return this; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AbstractFileItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AbstractFileItemWriter.java index 27a517ed1..75689353a 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AbstractFileItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AbstractFileItemWriter.java @@ -412,6 +412,8 @@ public abstract class AbstractFileItemWriter extends AbstractItemStreamItemWr /** * Return the byte offset position of the cursor in the output file as a * long integer. + * @return the byte offset position of the cursor in the output file + * @throws IOException If unable to get the offset position */ public long position() throws IOException { long pos = 0; @@ -519,7 +521,7 @@ public abstract class AbstractFileItemWriter extends AbstractItemStreamItemWr /** * @param line String to be written to the file - * @throws IOException + * @throws IOException If unable to write the String to the file */ public void write(String line) throws IOException { if (!initialized) { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/MongoItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/MongoItemReaderTests.java index ec8038883..a6c0eff2a 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/MongoItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/MongoItemReaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2017 the original author or authors. + * Copyright 2013-2018 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. @@ -35,7 +35,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; public class MongoItemReaderTests { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/json/JsonFileItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/json/JsonFileItemWriterTests.java index d6016612d..150a4de50 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/json/JsonFileItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/json/JsonFileItemWriterTests.java @@ -22,7 +22,10 @@ import java.util.Arrays; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; import org.springframework.batch.item.ExecutionContext; import org.springframework.core.io.FileSystemResource; @@ -31,16 +34,17 @@ import org.springframework.core.io.Resource; /** * @author Mahmoud Ben Hassine */ +@RunWith(MockitoJUnitRunner.class) public class JsonFileItemWriterTests { private Resource resource; + @Mock private JsonObjectMarshaller jsonObjectMarshaller; @Before public void setUp() throws Exception { File file = Files.createTempFile("test", "json").toFile(); this.resource = new FileSystemResource(file); - this.jsonObjectMarshaller = Mockito.mock(JsonObjectMarshaller.class); } @Test(expected = IllegalArgumentException.class) diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxTestUtils.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxTestUtils.java index a85d6b1c1..3b7c8234d 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxTestUtils.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxTestUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 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. @@ -28,7 +28,7 @@ import javax.xml.transform.Source; public final class StaxTestUtils { public static XMLEventWriter getXmlEventWriter(Result r) throws Exception { - Method m = r.getClass().getDeclaredMethod("getXMLEventWriter", new Class[]{}); + Method m = r.getClass().getDeclaredMethod("getXMLEventWriter"); boolean accessible = m.isAccessible(); m.setAccessible(true); Object result = m.invoke(r); @@ -37,7 +37,7 @@ public final class StaxTestUtils { } public static XMLEventReader getXmlEventReader(Source s) throws Exception { - Method m = s.getClass().getDeclaredMethod("getXMLEventReader", new Class[]{}); + Method m = s.getClass().getDeclaredMethod("getXMLEventReader"); boolean accessible = m.isAccessible(); m.setAccessible(true); Object result = m.invoke(s); diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/async/StepExecutionInterceptor.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/async/StepExecutionInterceptor.java index 3a2d56337..231c5de6c 100644 --- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/async/StepExecutionInterceptor.java +++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/async/StepExecutionInterceptor.java @@ -22,7 +22,6 @@ import org.springframework.integration.support.MessageBuilder; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.support.ChannelInterceptor; -import org.springframework.messaging.support.ChannelInterceptorAdapter; /** * A {@link ChannelInterceptor} that adds the current {@link StepExecution} (if @@ -34,7 +33,7 @@ import org.springframework.messaging.support.ChannelInterceptorAdapter; * @author Dave Syer * */ -public class StepExecutionInterceptor extends ChannelInterceptorAdapter { +public class StepExecutionInterceptor implements ChannelInterceptor { /** * The name of the header diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/MessageSourcePollerInterceptor.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/MessageSourcePollerInterceptor.java index c258e027a..ecebd838a 100644 --- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/MessageSourcePollerInterceptor.java +++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/MessageSourcePollerInterceptor.java @@ -7,7 +7,6 @@ import org.springframework.integration.core.MessageSource; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.support.ChannelInterceptor; -import org.springframework.messaging.support.ChannelInterceptorAdapter; import org.springframework.util.Assert; @@ -20,7 +19,7 @@ import org.springframework.util.Assert; * @author Dave Syer * */ -public class MessageSourcePollerInterceptor extends ChannelInterceptorAdapter implements InitializingBean { +public class MessageSourcePollerInterceptor implements ChannelInterceptor, InitializingBean { private static Log logger = LogFactory.getLog(MessageSourcePollerInterceptor.class); @@ -70,7 +69,7 @@ public class MessageSourcePollerInterceptor extends ChannelInterceptorAdapter im * Receive from the {@link MessageSource} and send immediately to the input channel, so that the call that we are * intercepting always a message to receive. * - * @see ChannelInterceptorAdapter#preReceive(MessageChannel) + * @see ChannelInterceptor#preReceive(MessageChannel) */ @Override public boolean preReceive(MessageChannel channel) { diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkingMasterStepBuilder.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkingMasterStepBuilder.java index cfd5b373b..0fe413e9a 100644 --- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkingMasterStepBuilder.java +++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkingMasterStepBuilder.java @@ -139,6 +139,7 @@ public class RemoteChunkingMasterStepBuilder extends FaultTolerantStepBuil * slow workers time to finish, and responsiveness if there is a dead worker. Defaults to 40. * * @param maxWaitTimeouts the maximum number of wait timeouts + * @return this builder instance for fluent chaining * @see ChunkMessageChannelItemWriter#setMaxWaitTimeouts(int) */ public RemoteChunkingMasterStepBuilder maxWaitTimeouts(int maxWaitTimeouts) { @@ -152,6 +153,7 @@ public class RemoteChunkingMasterStepBuilder extends FaultTolerantStepBuil * overwhelming the receivers. * * @param throttleLimit the throttle limit to set + * @return this builder instance for fluent chaining * @see ChunkMessageChannelItemWriter#setThrottleLimit(long) */ public RemoteChunkingMasterStepBuilder throttleLimit(long throttleLimit) { diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkingMasterStepBuilderFactory.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkingMasterStepBuilderFactory.java index a8dca82b3..9511d099c 100644 --- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkingMasterStepBuilderFactory.java +++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkingMasterStepBuilderFactory.java @@ -50,6 +50,8 @@ public class RemoteChunkingMasterStepBuilderFactory { * repository and transaction manager. * * @param name the name of the step + * @param type of input items + * @param type of output items * @return a {@link RemoteChunkingMasterStepBuilder} */ public RemoteChunkingMasterStepBuilder get(String name) { diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkingWorkerBuilder.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkingWorkerBuilder.java index a30c4adad..40b1a99c5 100644 --- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkingWorkerBuilder.java +++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkingWorkerBuilder.java @@ -108,6 +108,7 @@ public class RemoteChunkingWorkerBuilder { * * @return the integration flow */ + @SuppressWarnings({"unchecked", "rawtypes"}) public IntegrationFlow build() { Assert.notNull(this.itemWriter, "An ItemWriter must be provided"); Assert.notNull(this.inputChannel, "An InputChannel must be provided"); diff --git a/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/RemoteChunkingMasterStepBuilderTest.java b/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/RemoteChunkingMasterStepBuilderTest.java index 89c03c93d..0f5c4c2e6 100644 --- a/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/RemoteChunkingMasterStepBuilderTest.java +++ b/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/RemoteChunkingMasterStepBuilderTest.java @@ -235,6 +235,7 @@ public class RemoteChunkingMasterStepBuilderTest { * The following test is to cover setters that override those from parent builders. */ @Test + @SuppressWarnings({"unchecked", "rawtypes"}) public void testSetters() throws Exception { // when DefaultTransactionAttribute transactionAttribute = new DefaultTransactionAttribute();