Kill javadoc warnings
This commit is contained in:
@@ -129,15 +129,13 @@ public class FaultTolerantStepFactoryBeanRetryTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessAllItemsWhenErrorInWriterTransformation()
|
||||
public void testProcessAllItemsWhenErrorInWriterTransformationWhenReaderTransactional()
|
||||
throws Exception {
|
||||
final int RETRY_LIMIT = 3;
|
||||
final List<String> ITEM_LIST = Arrays.asList("1", "2", "3");
|
||||
final List<String> ITEM_LIST = TransactionAwareProxyFactory.createTransactionalList(Arrays.asList("1", "2", "3"));
|
||||
FaultTolerantStepFactoryBean<String, Integer> factory = new FaultTolerantStepFactoryBean<String, Integer>();
|
||||
factory.setBeanName("step");
|
||||
|
||||
factory.setItemReader(new ListItemReader<String>(
|
||||
new ArrayList<String>()));
|
||||
factory.setJobRepository(repository);
|
||||
factory.setTransactionManager(new ResourcelessTransactionManager());
|
||||
ItemWriter<Integer> failingWriter = new ItemWriter<Integer>() {
|
||||
@@ -158,10 +156,11 @@ public class FaultTolerantStepFactoryBeanRetryTests {
|
||||
return Integer.parseInt(item);
|
||||
}
|
||||
};
|
||||
ItemReader<String> reader = new ListItemReader<String>(ITEM_LIST);
|
||||
ItemReader<String> reader = new ListItemReader<String>(TransactionAwareProxyFactory.createTransactionalList(ITEM_LIST));
|
||||
factory.setCommitInterval(3);
|
||||
factory.setRetryLimit(RETRY_LIMIT);
|
||||
factory.setSkipLimit(1);
|
||||
factory.setIsReaderTransactionalQueue(true);
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<Class<? extends Throwable>, Boolean> exceptionMap = getExceptionMap(Exception.class);
|
||||
factory.setSkippableExceptionClasses(exceptionMap);
|
||||
@@ -176,6 +175,7 @@ public class FaultTolerantStepFactoryBeanRetryTests {
|
||||
repository.add(stepExecution);
|
||||
step.execute(stepExecution);
|
||||
// System.out.println(stepExecution.getWriteCount());
|
||||
// System.out.println(stepExecution.getSkipCount());
|
||||
// System.out.println(processed.size());
|
||||
// System.out.println(processed);
|
||||
// System.out.println(written);
|
||||
|
||||
@@ -30,7 +30,10 @@ import org.springframework.batch.core.StepListener;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.batch.core.step.FatalStepExecutionException;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.support.ListItemReader;
|
||||
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
|
||||
import org.springframework.batch.support.transaction.TransactionAwareProxyFactory;
|
||||
import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
||||
import org.springframework.transaction.interceptor.RollbackRuleAttribute;
|
||||
import org.springframework.transaction.interceptor.RuleBasedTransactionAttribute;
|
||||
@@ -499,6 +502,25 @@ public class FaultTolerantStepFactoryBeanRollbackTests {
|
||||
assertEquals("[1, 2, 3, 4, 5]", processor.getProcessed().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipInWriterTransactionalReader() throws Exception {
|
||||
writer.setFailures("4");
|
||||
ItemReader<String> reader = new ListItemReader<String>(TransactionAwareProxyFactory.createTransactionalList(Arrays.asList("1", "2", "3", "4", "5")));
|
||||
factory.setItemReader(reader);
|
||||
factory.setCommitInterval(30);
|
||||
factory.setSkipLimit(10);
|
||||
factory.setIsReaderTransactionalQueue(true);
|
||||
|
||||
Step step = (Step) factory.getObject();
|
||||
|
||||
step.execute(stepExecution);
|
||||
assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus());
|
||||
|
||||
assertEquals("[]", writer.getCommitted().toString());
|
||||
assertEquals("[1, 2, 3, 4]", writer.getWritten().toString());
|
||||
assertEquals("[1, 2, 3, 4, 5, 1, 2, 3, 4, 5]", processor.getProcessed().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultithreadedSkipInWriter() throws Exception {
|
||||
writer.setFailures("1", "2", "3", "4", "5");
|
||||
|
||||
Reference in New Issue
Block a user