generified the integration module and cleaned up the warnings
This commit is contained in:
@@ -42,7 +42,7 @@ import org.springframework.util.StringUtils;
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class ChunkMessageItemWriterIntegrationTests {
|
||||
|
||||
private ChunkMessageChannelItemWriter writer = new ChunkMessageChannelItemWriter();
|
||||
private ChunkMessageChannelItemWriter<Object> writer = new ChunkMessageChannelItemWriter<Object>();
|
||||
|
||||
@Autowired
|
||||
@Qualifier("requests")
|
||||
@@ -52,7 +52,7 @@ public class ChunkMessageItemWriterIntegrationTests {
|
||||
@Qualifier("replies")
|
||||
private MessageChannel replies;
|
||||
|
||||
private SimpleStepFactoryBean factory;
|
||||
private SimpleStepFactoryBean<Object> factory;
|
||||
|
||||
private SimpleJobRepository jobRepository;
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ChunkMessageItemWriterIntegrationTests {
|
||||
@Before
|
||||
public void setUp() {
|
||||
|
||||
factory = new SimpleStepFactoryBean();
|
||||
factory = new SimpleStepFactoryBean<Object>();
|
||||
jobRepository = new SimpleJobRepository(new MapJobInstanceDao(),
|
||||
new MapJobExecutionDao(), new MapStepExecutionDao());
|
||||
factory.setJobRepository(jobRepository);
|
||||
@@ -114,7 +114,7 @@ public class ChunkMessageItemWriterIntegrationTests {
|
||||
@Test
|
||||
public void testVanillaIteration() throws Exception {
|
||||
|
||||
factory.setItemReader(new ListItemReader(Arrays.asList(StringUtils
|
||||
factory.setItemReader(new ListItemReader<String>(Arrays.asList(StringUtils
|
||||
.commaDelimitedListToStringArray("1,2,3,4,5,6"))));
|
||||
|
||||
Step step = (Step) factory.getObject();
|
||||
@@ -132,7 +132,7 @@ public class ChunkMessageItemWriterIntegrationTests {
|
||||
@Test
|
||||
public void testSimulatedRestart() throws Exception {
|
||||
|
||||
factory.setItemReader(new ListItemReader(Arrays.asList(StringUtils
|
||||
factory.setItemReader(new ListItemReader<String>(Arrays.asList(StringUtils
|
||||
.commaDelimitedListToStringArray("1,2,3,4,5,6"))));
|
||||
|
||||
Step step = (Step) factory.getObject();
|
||||
@@ -159,7 +159,7 @@ public class ChunkMessageItemWriterIntegrationTests {
|
||||
@Test
|
||||
public void testSimulatedRestartWithBadMessagesFromAnotherJob() throws Exception {
|
||||
|
||||
factory.setItemReader(new ListItemReader(Arrays.asList(StringUtils
|
||||
factory.setItemReader(new ListItemReader<String>(Arrays.asList(StringUtils
|
||||
.commaDelimitedListToStringArray("1,2,3,4,5,6"))));
|
||||
|
||||
Step step = (Step) factory.getObject();
|
||||
@@ -204,7 +204,7 @@ public class ChunkMessageItemWriterIntegrationTests {
|
||||
@Test
|
||||
public void testEarlyCompletionSignalledInHandler() throws Exception {
|
||||
|
||||
factory.setItemReader(new ListItemReader(Arrays.asList(StringUtils
|
||||
factory.setItemReader(new ListItemReader<String>(Arrays.asList(StringUtils
|
||||
.commaDelimitedListToStringArray("1,bad,3,4,5,6"))));
|
||||
factory.setCommitInterval(2);
|
||||
|
||||
@@ -232,7 +232,7 @@ public class ChunkMessageItemWriterIntegrationTests {
|
||||
@Test
|
||||
public void testSimulatedRestartWithNoBacklog() throws Exception {
|
||||
|
||||
factory.setItemReader(new ListItemReader(Arrays.asList(StringUtils
|
||||
factory.setItemReader(new ListItemReader<String>(Arrays.asList(StringUtils
|
||||
.commaDelimitedListToStringArray("1,2,3,4,5,6"))));
|
||||
|
||||
Step step = (Step) factory.getObject();
|
||||
@@ -272,7 +272,7 @@ public class ChunkMessageItemWriterIntegrationTests {
|
||||
@Test
|
||||
public void testFailureInStepListener() throws Exception {
|
||||
|
||||
factory.setItemReader(new ListItemReader(Arrays.asList(StringUtils
|
||||
factory.setItemReader(new ListItemReader<String>(Arrays.asList(StringUtils
|
||||
.commaDelimitedListToStringArray("wait,bad,3,4,5,6"))));
|
||||
|
||||
Step step = (Step) factory.getObject();
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
public class ItemWriterChunkHandlerTests {
|
||||
|
||||
private ItemWriterChunkHandler handler = new ItemWriterChunkHandler();
|
||||
private ItemWriterChunkHandler<Object> handler = new ItemWriterChunkHandler<Object>();
|
||||
|
||||
protected int count = 0;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.springframework.batch.item.support.AbstractItemWriter;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class TestItemWriter extends AbstractItemWriter {
|
||||
public class TestItemWriter<T> extends AbstractItemWriter<T> {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(TestItemWriter.class);
|
||||
|
||||
@@ -25,7 +25,7 @@ public class TestItemWriter extends AbstractItemWriter {
|
||||
*/
|
||||
public static final String WAIT_ON = "wait";
|
||||
|
||||
public void write(Object item) throws Exception {
|
||||
public void write(T item) throws Exception {
|
||||
|
||||
count++;
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
public class FileToMessagesJobFactoryBeanTests {
|
||||
|
||||
private static final String FILE_INPUT_PATH = ResourcePayloadAsJobParameterStrategy.FILE_INPUT_PATH;
|
||||
private FileToMessagesJobFactoryBean factory = new FileToMessagesJobFactoryBean();
|
||||
private FileToMessagesJobFactoryBean<FieldSet> factory = new FileToMessagesJobFactoryBean<FieldSet>();
|
||||
private ThreadLocalChannel receiver = new ThreadLocalChannel();
|
||||
private JobRepositorySupport jobRepository;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class FileToMessagesJobFactoryBeanTests {
|
||||
jobRepository = new JobRepositorySupport();
|
||||
factory.setJobRepository(jobRepository);
|
||||
factory.setTransactionManager(new ResourcelessTransactionManager());
|
||||
FlatFileItemReader itemReader = new FlatFileItemReader();
|
||||
FlatFileItemReader<FieldSet> itemReader = new FlatFileItemReader<FieldSet>();
|
||||
itemReader.setFieldSetMapper(new PassThroughFieldSetMapper());
|
||||
factory.setItemReader(itemReader);
|
||||
DirectChannel channel = new DirectChannel();
|
||||
@@ -158,7 +158,7 @@ public class FileToMessagesJobFactoryBeanTests {
|
||||
*/
|
||||
@Test
|
||||
public void testGetObjectType() {
|
||||
FileToMessagesJobFactoryBean factory = new FileToMessagesJobFactoryBean();
|
||||
FileToMessagesJobFactoryBean<?> factory = new FileToMessagesJobFactoryBean<Object>();
|
||||
assertEquals(Job.class, factory.getObjectType());
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ public class FileToMessagesJobFactoryBeanTests {
|
||||
*/
|
||||
@Test
|
||||
public void testIsSingleton() {
|
||||
FileToMessagesJobFactoryBean factory = new FileToMessagesJobFactoryBean();
|
||||
FileToMessagesJobFactoryBean<?> factory = new FileToMessagesJobFactoryBean<Object>();
|
||||
assertEquals(true, factory.isSingleton());
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class MessageChannelItemWriterIntegrationTests {
|
||||
private MessageChannel channel;
|
||||
|
||||
@Autowired
|
||||
private ItemWriter itemWriter;
|
||||
private ItemWriter<String> itemWriter;
|
||||
|
||||
@Test
|
||||
public void testSend() throws Exception {
|
||||
|
||||
@@ -61,7 +61,7 @@ public class MessageChannelItemWriterTests {
|
||||
DirectChannel channel = new DirectChannel();
|
||||
ThreadLocalChannel receiver = new ThreadLocalChannel();
|
||||
channel.subscribe(receiver);
|
||||
MessageChannelItemWriter writer = new MessageChannelItemWriter();
|
||||
MessageChannelItemWriter<String> writer = new MessageChannelItemWriter<String>();
|
||||
writer.setChannel(channel);
|
||||
writer.write("foo");
|
||||
Message<?> message = receiver.receive(10);
|
||||
@@ -81,7 +81,7 @@ public class MessageChannelItemWriterTests {
|
||||
throw new RuntimeException("Planned failure");
|
||||
}
|
||||
});
|
||||
MessageChannelItemWriter writer = new MessageChannelItemWriter();
|
||||
MessageChannelItemWriter<String> writer = new MessageChannelItemWriter<String>();
|
||||
writer.setChannel(channel);
|
||||
try {
|
||||
writer.write("foo");
|
||||
@@ -105,7 +105,7 @@ public class MessageChannelItemWriterTests {
|
||||
}
|
||||
});
|
||||
channel.subscribe(endpoint);
|
||||
MessageChannelItemWriter writer = new MessageChannelItemWriter();
|
||||
MessageChannelItemWriter<String> writer = new MessageChannelItemWriter<String>();
|
||||
writer.setChannel(channel);
|
||||
try {
|
||||
writer.write("foo");
|
||||
|
||||
@@ -76,7 +76,6 @@ public class StepExecutionMessageHandlerTests {
|
||||
assertEquals(Required.class, annotations[0].annotationType());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testVanillaHandle() throws Exception {
|
||||
JobRepositorySupport jobRepository = new JobRepositorySupport();
|
||||
@@ -87,7 +86,6 @@ public class StepExecutionMessageHandlerTests {
|
||||
assertEquals(BatchStatus.COMPLETED, message.getStatus());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testHandleWithInputs() throws Exception {
|
||||
JobRepositorySupport jobRepository = new JobRepositorySupport();
|
||||
@@ -101,7 +99,6 @@ public class StepExecutionMessageHandlerTests {
|
||||
assertTrue(jobExecution.getExecutionContext().containsKey("foo"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testHandleWithInputsAndOutputs() throws Exception {
|
||||
JobRepositorySupport jobRepository = new JobRepositorySupport();
|
||||
@@ -122,7 +119,6 @@ public class StepExecutionMessageHandlerTests {
|
||||
assertTrue(jobExecution.getExecutionContext().containsKey("bar"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testHandleFailedJob() throws Exception {
|
||||
JobRepositorySupport jobRepository = new JobRepositorySupport();
|
||||
@@ -133,7 +129,6 @@ public class StepExecutionMessageHandlerTests {
|
||||
assertEquals(0, message.getJobExecution().getStepExecutions().size());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testHandleRestart() throws Exception {
|
||||
JobRepositorySupport jobRepository = new JobRepositorySupport() {
|
||||
@@ -171,7 +166,6 @@ public class StepExecutionMessageHandlerTests {
|
||||
assertTrue(stepExecution.getExecutionContext().containsKey("foo"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testHandleRestartAlreadyComplete() throws Exception {
|
||||
JobRepositorySupport jobRepository = new JobRepositorySupport() {
|
||||
@@ -199,7 +193,6 @@ public class StepExecutionMessageHandlerTests {
|
||||
assertTrue(stepExecution.getExecutionContext().containsKey("foo"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testHandleRestartStartLimitExceeded() throws Exception {
|
||||
JobRepositorySupport jobRepository = new JobRepositorySupport() {
|
||||
|
||||
@@ -71,7 +71,6 @@ public class PollableSourceRetryTests {
|
||||
|
||||
private PlatformTransactionManager transactionManager = new ResourcelessTransactionManager();;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testSimpleTransactionalPolling() throws Exception {
|
||||
|
||||
@@ -104,7 +103,6 @@ public class PollableSourceRetryTests {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testNonTransactionalPollingWithRollback() throws Exception {
|
||||
|
||||
@@ -139,7 +137,6 @@ public class PollableSourceRetryTests {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testTransactionalHandlingWithUnconditionalRollback() throws Exception {
|
||||
|
||||
@@ -177,7 +174,6 @@ public class PollableSourceRetryTests {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testTransactionalHandlingWithRollback() throws Exception {
|
||||
|
||||
@@ -222,7 +218,6 @@ public class PollableSourceRetryTests {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testTransactionalHandlingWithRepeat() throws Exception {
|
||||
|
||||
@@ -269,7 +264,6 @@ public class PollableSourceRetryTests {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testTransactionalHandlingWithRetry() throws Exception {
|
||||
|
||||
@@ -322,7 +316,6 @@ public class PollableSourceRetryTests {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testTransactionalHandlingWithRepeatAndRetry() throws Exception {
|
||||
|
||||
@@ -408,9 +401,9 @@ public class PollableSourceRetryTests {
|
||||
}
|
||||
|
||||
private MessageSource<Object> getPollableSource(List<String> list) {
|
||||
final ItemReader reader = new ListItemReader(list) {
|
||||
public Object read() {
|
||||
Object item = super.read();
|
||||
final ItemReader<String> reader = new ListItemReader<String>(list) {
|
||||
public String read() {
|
||||
String item = super.read();
|
||||
logger.debug("Reading: " + item);
|
||||
return item;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user