RESOLVED - issue BATCH-788: Remove flush/clear from ItemWriter
Done
This commit is contained in:
@@ -26,11 +26,11 @@ import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.StepContribution;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.item.ItemProcessor;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.NoWorkFoundException;
|
||||
import org.springframework.batch.item.ParseException;
|
||||
import org.springframework.batch.item.UnexpectedInputException;
|
||||
import org.springframework.batch.item.support.AbstractItemReader;
|
||||
import org.springframework.batch.item.support.AbstractItemWriter;
|
||||
import org.springframework.batch.item.support.PassthroughItemProcessor;
|
||||
|
||||
/**
|
||||
@@ -90,7 +90,7 @@ public class ItemOrientedStepHandlerTests {
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
private final class StubItemWriter extends AbstractItemWriter<String> {
|
||||
private final class StubItemWriter implements ItemWriter<String> {
|
||||
private String values = "";
|
||||
|
||||
public void write(List<? extends String> items) throws Exception {
|
||||
|
||||
@@ -40,7 +40,6 @@ import org.springframework.batch.core.repository.support.SimpleJobRepository;
|
||||
import org.springframework.batch.core.step.AbstractStep;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.support.AbstractItemWriter;
|
||||
import org.springframework.batch.item.support.ListItemReader;
|
||||
import org.springframework.batch.repeat.RepeatContext;
|
||||
import org.springframework.batch.repeat.exception.ExceptionHandler;
|
||||
@@ -63,7 +62,7 @@ public class SimpleStepFactoryBeanTests extends TestCase {
|
||||
|
||||
private List<String> written = new ArrayList<String>();
|
||||
|
||||
private ItemWriter<String> writer = new AbstractItemWriter<String>() {
|
||||
private ItemWriter<String> writer = new ItemWriter<String>() {
|
||||
public void write(List<? extends String> data) throws Exception {
|
||||
written.addAll(data);
|
||||
}
|
||||
@@ -165,7 +164,7 @@ public class SimpleStepFactoryBeanTests extends TestCase {
|
||||
*/
|
||||
SimpleStepFactoryBean<String,String> factory = getStepFactory(new String[] { "foo", "bar", "spam" });
|
||||
|
||||
factory.setItemWriter(new AbstractItemWriter<String>() {
|
||||
factory.setItemWriter(new ItemWriter<String>() {
|
||||
public void write(List<? extends String> data) throws Exception {
|
||||
throw new RuntimeException("Error!");
|
||||
}
|
||||
@@ -198,7 +197,7 @@ public class SimpleStepFactoryBeanTests extends TestCase {
|
||||
public void testExceptionTerminates() throws Exception {
|
||||
SimpleStepFactoryBean<String,String> factory = getStepFactory(new String[] { "foo", "bar", "spam" });
|
||||
factory.setBeanName("exceptionStep");
|
||||
factory.setItemWriter(new AbstractItemWriter<String>() {
|
||||
factory.setItemWriter(new ItemWriter<String>() {
|
||||
public void write(List<? extends String> data) throws Exception {
|
||||
throw new RuntimeException("Foo");
|
||||
}
|
||||
@@ -222,7 +221,7 @@ public class SimpleStepFactoryBeanTests extends TestCase {
|
||||
SimpleStepFactoryBean<String,String> factory = getStepFactory(new String[] { "foo", "bar", "spam" });
|
||||
factory.setBeanName("exceptionStep");
|
||||
factory.setExceptionHandler(new SimpleLimitExceptionHandler(1));
|
||||
factory.setItemWriter(new AbstractItemWriter<String>() {
|
||||
factory.setItemWriter(new ItemWriter<String>() {
|
||||
int count = 0;
|
||||
|
||||
public void write(List<? extends String> data) throws Exception {
|
||||
|
||||
@@ -42,7 +42,6 @@ import org.springframework.batch.core.step.skip.SkipLimitExceededException;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.support.AbstractItemReader;
|
||||
import org.springframework.batch.item.support.AbstractItemWriter;
|
||||
import org.springframework.batch.item.support.ListItemReader;
|
||||
import org.springframework.batch.retry.RetryException;
|
||||
import org.springframework.batch.retry.policy.RetryCacheCapacityExceededException;
|
||||
@@ -72,7 +71,7 @@ public class StatefulRetryStepFactoryBeanTests extends TestCase {
|
||||
|
||||
JobExecution jobExecution;
|
||||
|
||||
private ItemWriter<Object> processor = new AbstractItemWriter<Object>() {
|
||||
private ItemWriter<Object> processor = new ItemWriter<Object>() {
|
||||
public void write(List<? extends Object> data) throws Exception {
|
||||
processed.addAll(data);
|
||||
}
|
||||
@@ -198,7 +197,7 @@ public class StatefulRetryStepFactoryBeanTests extends TestCase {
|
||||
}
|
||||
};
|
||||
|
||||
ItemWriter<Object> itemWriter = new AbstractItemWriter<Object>() {
|
||||
ItemWriter<Object> itemWriter = new ItemWriter<Object>() {
|
||||
public void write(List<? extends Object> item) throws Exception {
|
||||
logger.debug("Write Called! Item: [" + item + "]");
|
||||
if (item.contains("b") || item.contains("d")) {
|
||||
@@ -236,7 +235,7 @@ public class StatefulRetryStepFactoryBeanTests extends TestCase {
|
||||
return item;
|
||||
}
|
||||
};
|
||||
ItemWriter<Object> itemWriter = new AbstractItemWriter<Object>() {
|
||||
ItemWriter<Object> itemWriter = new ItemWriter<Object>() {
|
||||
public void write(List<? extends Object> item) throws Exception {
|
||||
logger.debug("Write Called! Item: [" + item + "]");
|
||||
throw new RuntimeException("Write error - planned but retryable.");
|
||||
@@ -273,7 +272,7 @@ public class StatefulRetryStepFactoryBeanTests extends TestCase {
|
||||
return item;
|
||||
}
|
||||
};
|
||||
ItemWriter<Object> itemWriter = new AbstractItemWriter<Object>() {
|
||||
ItemWriter<Object> itemWriter = new ItemWriter<Object>() {
|
||||
public void write(List<? extends Object> item) throws Exception {
|
||||
logger.debug("Write Called! Item: [" + item + "]");
|
||||
throw new RuntimeException("Write error - planned but retryable.");
|
||||
@@ -311,7 +310,7 @@ public class StatefulRetryStepFactoryBeanTests extends TestCase {
|
||||
return item;
|
||||
}
|
||||
};
|
||||
ItemWriter<Object> itemWriter = new AbstractItemWriter<Object>() {
|
||||
ItemWriter<Object> itemWriter = new ItemWriter<Object>() {
|
||||
public void write(List<? extends Object> item) throws Exception {
|
||||
logger.debug("Write Called! Item: [" + item + "]");
|
||||
throw new RuntimeException("Write error - planned but retryable.");
|
||||
|
||||
@@ -33,8 +33,8 @@ import org.springframework.batch.core.repository.dao.MapJobInstanceDao;
|
||||
import org.springframework.batch.core.repository.dao.MapStepExecutionDao;
|
||||
import org.springframework.batch.core.repository.support.SimpleJobRepository;
|
||||
import org.springframework.batch.core.step.StepExecutionSynchronizer;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.support.AbstractItemReader;
|
||||
import org.springframework.batch.item.support.AbstractItemWriter;
|
||||
import org.springframework.batch.repeat.policy.SimpleCompletionPolicy;
|
||||
import org.springframework.batch.repeat.support.RepeatTemplate;
|
||||
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
|
||||
@@ -45,7 +45,7 @@ public class StepExecutorInterruptionTests extends TestCase {
|
||||
|
||||
private JobExecution jobExecution;
|
||||
|
||||
private AbstractItemWriter<Object> itemWriter;
|
||||
private ItemWriter<Object> itemWriter;
|
||||
|
||||
private StepExecution stepExecution;
|
||||
|
||||
@@ -64,7 +64,7 @@ public class StepExecutorInterruptionTests extends TestCase {
|
||||
jobExecution = jobRepository.createJobExecution(jobConfiguration, new JobParameters());
|
||||
step.setJobRepository(jobRepository);
|
||||
step.setTransactionManager(new ResourcelessTransactionManager());
|
||||
itemWriter = new AbstractItemWriter<Object>() {
|
||||
itemWriter = new ItemWriter<Object>() {
|
||||
public void write(List<? extends Object> item) throws Exception {
|
||||
}
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.batch.core.repository.dao.MapStepExecutionDao;
|
||||
import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.support.AbstractItemWriter;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.support.ListItemReader;
|
||||
import org.springframework.batch.repeat.policy.SimpleCompletionPolicy;
|
||||
import org.springframework.batch.repeat.support.RepeatTemplate;
|
||||
@@ -112,7 +112,7 @@ public class StepHandlerStepIntegrationTests {
|
||||
public void testStatusForCommitFailedException() throws Exception {
|
||||
|
||||
step.setItemHandler(new SimpleStepHandler<String>(getReader(new String[] { "a", "b", "c" }),
|
||||
new AbstractItemWriter<String>() {
|
||||
new ItemWriter<String>() {
|
||||
public void write(List<? extends String> data) throws Exception {
|
||||
TransactionSynchronizationManager
|
||||
.registerSynchronization(new TransactionSynchronizationAdapter() {
|
||||
|
||||
@@ -53,7 +53,6 @@ import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.MarkFailedException;
|
||||
import org.springframework.batch.item.ResetFailedException;
|
||||
import org.springframework.batch.item.support.AbstractItemReader;
|
||||
import org.springframework.batch.item.support.AbstractItemWriter;
|
||||
import org.springframework.batch.item.support.ListItemReader;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.batch.repeat.policy.DefaultResultCompletionPolicy;
|
||||
@@ -70,7 +69,7 @@ public class StepHandlerStepTests extends TestCase {
|
||||
|
||||
private List<Serializable> list = new ArrayList<Serializable>();
|
||||
|
||||
ItemWriter<String> itemWriter = new AbstractItemWriter<String>() {
|
||||
ItemWriter<String> itemWriter = new ItemWriter<String>() {
|
||||
public void write(List<? extends String> data) throws Exception {
|
||||
processed.addAll(data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user