IN PROGRESS - issue BATCH-476: samples cleanup
http://jira.springframework.org/browse/BATCH-476
This commit is contained in:
@@ -53,8 +53,8 @@ public class FlatFileCustomerCreditDao implements CustomerCreditDao,
|
||||
this.separator = separator;
|
||||
}
|
||||
|
||||
public void setOutputSource(ItemWriter outputSource) {
|
||||
this.itemWriter = outputSource;
|
||||
public void setItemWriter(ItemWriter itemWriter) {
|
||||
this.itemWriter = itemWriter;
|
||||
}
|
||||
|
||||
public void open(ExecutionContext executionContext) throws Exception {
|
||||
|
||||
@@ -38,11 +38,8 @@ public class CustomerCreditUpdateWriter extends AbstractItemWriter {
|
||||
this.creditFilter = creditFilter;
|
||||
}
|
||||
|
||||
public void setWriter(CustomerCreditDao writer) {
|
||||
this.dao = writer;
|
||||
public void setDao(CustomerCreditDao dao) {
|
||||
this.dao = dao;
|
||||
}
|
||||
|
||||
public void close() throws Exception {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,10 +41,4 @@ public class CustomerUpdateWriter extends AbstractItemWriter {
|
||||
public void setDao(JdbcCustomerDebitDao outputSource) {
|
||||
this.dao = outputSource;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
}
|
||||
|
||||
public void init() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,27 +15,16 @@
|
||||
*/
|
||||
package org.springframework.batch.sample.item.writer;
|
||||
|
||||
import org.springframework.batch.item.ClearFailedException;
|
||||
import org.springframework.batch.item.FlushFailedException;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.AbstractItemWriter;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class DummyItemWriter implements ItemWriter {
|
||||
public class DummyItemWriter extends AbstractItemWriter {
|
||||
|
||||
public void write(Object item) throws Exception {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
public void close() throws Exception {
|
||||
}
|
||||
|
||||
public void clear() throws ClearFailedException {
|
||||
}
|
||||
|
||||
public void flush() throws FlushFailedException {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,9 +36,4 @@ public class PersonWriter extends AbstractItemWriter {
|
||||
log.debug("Processing: " + data);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
}
|
||||
|
||||
public void init() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.springframework.batch.sample.domain.Player;
|
||||
|
||||
public class PlayerItemWriter extends AbstractItemWriter {
|
||||
|
||||
PlayerDao playerDao;
|
||||
private PlayerDao playerDao;
|
||||
|
||||
public void write(Object data) throws Exception {
|
||||
playerDao.savePlayer((Player)data);
|
||||
@@ -15,7 +15,5 @@ public class PlayerItemWriter extends AbstractItemWriter {
|
||||
public void setPlayerDao(PlayerDao playerDao) {
|
||||
this.playerDao = playerDao;
|
||||
}
|
||||
|
||||
public void close() throws Exception {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -84,9 +84,6 @@ public class StagingItemWriter extends JdbcDaoSupport implements StepListener, I
|
||||
});
|
||||
}
|
||||
|
||||
public void close() throws Exception {
|
||||
}
|
||||
|
||||
public void clear() throws ClearFailedException {
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<property name="itemWriter">
|
||||
<bean
|
||||
class="org.springframework.batch.sample.item.writer.CustomerCreditUpdateWriter"
|
||||
p:writer-ref="customerReportOutputSource" />
|
||||
p:dao-ref="customerReportOutputSource" />
|
||||
</property>
|
||||
</bean>
|
||||
</list>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<bean
|
||||
class="org.springframework.batch.sample.dao.FlatFileCustomerCreditDao"
|
||||
id="customerReportOutputSource">
|
||||
<property name="outputSource">
|
||||
<property name="itemWriter">
|
||||
<bean
|
||||
class="org.springframework.batch.item.file.FlatFileItemWriter"
|
||||
id="customerFlatFileOutputSource">
|
||||
|
||||
@@ -25,7 +25,7 @@ public class FlatFileCustomerCreditDaoTests extends TestCase {
|
||||
|
||||
//create new writer
|
||||
writer = new FlatFileCustomerCreditDao();
|
||||
writer.setOutputSource(output);
|
||||
writer.setItemWriter(output);
|
||||
}
|
||||
|
||||
public void testOpen() throws Exception {
|
||||
|
||||
@@ -22,7 +22,7 @@ public class CustomerCreditUpdateProcessorTests extends TestCase {
|
||||
dao = (CustomerCreditDao) daoControl.getMock();
|
||||
//create processor, set writer and credit filter
|
||||
writer = new CustomerCreditUpdateWriter();
|
||||
writer.setWriter(dao);
|
||||
writer.setDao(dao);
|
||||
writer.setCreditFilter(CREDIT_FILTER);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user