IN PROGRESS - BATCH-693: Refactor samples along domain contours
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.sample.domain;
|
||||
package org.springframework.batch.sample.person;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.sample.domain;
|
||||
package org.springframework.batch.sample.person;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -14,12 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.sample.item.writer;
|
||||
package org.springframework.batch.sample.person;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.batch.item.support.AbstractItemWriter;
|
||||
import org.springframework.batch.sample.domain.Person;
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.batch.sample.item.writer;
|
||||
package org.springframework.batch.sample.retry;
|
||||
|
||||
import org.springframework.batch.item.support.AbstractItemWriter;
|
||||
|
||||
@@ -14,9 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.sample.dao;
|
||||
package org.springframework.batch.sample.trade;
|
||||
|
||||
import org.springframework.batch.sample.trade.CustomerCredit;
|
||||
|
||||
/**
|
||||
* Interface for writing customer's credit information to output.
|
||||
@@ -3,7 +3,6 @@ package org.springframework.batch.sample.trade;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.springframework.batch.item.support.AbstractItemWriter;
|
||||
import org.springframework.batch.sample.dao.CustomerCreditDao;
|
||||
|
||||
/**
|
||||
* Increases customer's credit by fixed amount.
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.springframework.batch.sample.trade;
|
||||
|
||||
import org.springframework.batch.item.support.AbstractItemWriter;
|
||||
import org.springframework.batch.sample.dao.CustomerCreditDao;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -14,9 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.sample.dao;
|
||||
package org.springframework.batch.sample.trade;
|
||||
|
||||
import org.springframework.batch.sample.trade.CustomerDebit;
|
||||
|
||||
/**
|
||||
* Interface for writing {@link CustomerDebitDao} object to arbitrary output.
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.springframework.batch.sample.trade;
|
||||
|
||||
import org.springframework.batch.item.support.AbstractItemWriter;
|
||||
import org.springframework.batch.sample.dao.CustomerDebitDao;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,12 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.sample.dao;
|
||||
package org.springframework.batch.sample.trade;
|
||||
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.item.ItemStream;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.sample.trade.CustomerCredit;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
|
||||
/**
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.sample.dao;
|
||||
package org.springframework.batch.sample.trade;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -21,7 +21,6 @@ import java.util.List;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.batch.repeat.RepeatContext;
|
||||
import org.springframework.batch.repeat.RepeatListener;
|
||||
import org.springframework.batch.sample.trade.CustomerCredit;
|
||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
|
||||
/**
|
||||
@@ -13,9 +13,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.sample.dao;
|
||||
package org.springframework.batch.sample.trade;
|
||||
|
||||
import org.springframework.batch.sample.trade.CustomerCredit;
|
||||
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
|
||||
|
||||
/**
|
||||
@@ -14,11 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.sample.dao;
|
||||
package org.springframework.batch.sample.trade;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.batch.sample.trade.CustomerDebit;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcOperations;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||
@@ -14,11 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.sample.dao;
|
||||
package org.springframework.batch.sample.trade;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.batch.sample.trade.Trade;
|
||||
import org.springframework.jdbc.core.JdbcOperations;
|
||||
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;
|
||||
|
||||
@@ -14,9 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.sample.dao;
|
||||
package org.springframework.batch.sample.trade;
|
||||
|
||||
import org.springframework.batch.sample.trade.Trade;
|
||||
|
||||
/**
|
||||
* Interface for writing a Trade object to an arbitrary output.
|
||||
@@ -19,7 +19,6 @@ package org.springframework.batch.sample.trade;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.batch.item.support.AbstractItemWriter;
|
||||
import org.springframework.batch.sample.dao.TradeDao;
|
||||
|
||||
/**
|
||||
* Delegates the actual writing to custom DAO delegate. Allows configurable
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
ref="personFileItemReader" />
|
||||
<property name="itemWriter">
|
||||
<bean
|
||||
class="org.springframework.batch.sample.item.writer.PersonWriter" />
|
||||
class="org.springframework.batch.sample.person.PersonWriter" />
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
</bean>
|
||||
|
||||
<bean id="tradeDao"
|
||||
class="org.springframework.batch.sample.dao.JdbcTradeDao">
|
||||
class="org.springframework.batch.sample.trade.JdbcTradeDao">
|
||||
<property name="jdbcTemplate" ref="jdbcTemplate" />
|
||||
<property name="incrementer">
|
||||
<bean parent="incrementerParent">
|
||||
@@ -115,7 +115,7 @@
|
||||
scope="prototype" />
|
||||
|
||||
<bean id="person"
|
||||
class="org.springframework.batch.sample.domain.Person"
|
||||
class="org.springframework.batch.sample.person.Person"
|
||||
scope="prototype" />
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
</bean>
|
||||
|
||||
<bean id="tradeDao"
|
||||
class="org.springframework.batch.sample.dao.JdbcTradeDao">
|
||||
class="org.springframework.batch.sample.trade.JdbcTradeDao">
|
||||
<property name="jdbcTemplate" ref="jdbcTemplate" />
|
||||
<property name="incrementer">
|
||||
<bean parent="incrementerParent">
|
||||
|
||||
@@ -47,6 +47,6 @@
|
||||
</bean>
|
||||
|
||||
<bean id="delegateObject"
|
||||
class="org.springframework.batch.sample.domain.PersonService" />
|
||||
class="org.springframework.batch.sample.person.PersonService" />
|
||||
|
||||
</beans>
|
||||
@@ -57,7 +57,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="tradeDao" class="org.springframework.batch.sample.dao.JdbcTradeDao">
|
||||
<bean id="tradeDao" class="org.springframework.batch.sample.trade.JdbcTradeDao">
|
||||
<property name="jdbcTemplate" ref="jdbcTemplate" />
|
||||
<property name="incrementer">
|
||||
<bean parent="incrementerParent">
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
</bean>
|
||||
|
||||
<bean id="customerCreditDao"
|
||||
class="org.springframework.batch.sample.dao.HibernateCreditDao">
|
||||
class="org.springframework.batch.sample.trade.HibernateCreditDao">
|
||||
<property name="sessionFactory" ref="sessionFactory" />
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
class="org.springframework.batch.sample.trade.CustomerCreditIncreaseWriter">
|
||||
<property name="customerCreditDao">
|
||||
<bean
|
||||
class="org.springframework.batch.sample.dao.IbatisCustomerCreditDao">
|
||||
class="org.springframework.batch.sample.trade.IbatisCustomerCreditDao">
|
||||
<property name="sqlMapClient"
|
||||
ref="sqlMapClient" />
|
||||
<property name="statementId"
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
</bean>
|
||||
|
||||
<bean id="tradeDao"
|
||||
class="org.springframework.batch.sample.dao.JdbcTradeDao">
|
||||
class="org.springframework.batch.sample.trade.JdbcTradeDao">
|
||||
<property name="jdbcTemplate" ref="jdbcTemplate" />
|
||||
<property name="incrementer">
|
||||
<bean parent="incrementerParent">
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
</bean>
|
||||
|
||||
<bean id="tradeDao"
|
||||
class="org.springframework.batch.sample.dao.JdbcTradeDao">
|
||||
class="org.springframework.batch.sample.trade.JdbcTradeDao">
|
||||
<property name="jdbcTemplate" ref="jdbcTemplate" />
|
||||
<property name="incrementer">
|
||||
<bean parent="incrementerParent">
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
</bean>
|
||||
|
||||
<bean id="tradeDao"
|
||||
class="org.springframework.batch.sample.dao.JdbcTradeDao">
|
||||
class="org.springframework.batch.sample.trade.JdbcTradeDao">
|
||||
<property name="jdbcTemplate" ref="jdbcTemplate" />
|
||||
<property name="incrementer">
|
||||
<bean parent="incrementerParent">
|
||||
|
||||
@@ -23,6 +23,6 @@
|
||||
<property name="limit" value="10" />
|
||||
</bean>
|
||||
|
||||
<bean id="itemWriter" class="org.springframework.batch.sample.item.writer.RetrySampleItemWriter" />
|
||||
<bean id="itemWriter" class="org.springframework.batch.sample.retry.RetrySampleItemWriter" />
|
||||
|
||||
</beans>
|
||||
@@ -9,7 +9,7 @@
|
||||
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
|
||||
|
||||
|
||||
<bean class="org.springframework.batch.sample.dao.JdbcTradeDao"
|
||||
<bean class="org.springframework.batch.sample.trade.JdbcTradeDao"
|
||||
id="tradeDao" p:jdbcTemplate-ref="jdbcTemplate">
|
||||
<property name="incrementer">
|
||||
<bean parent="incrementerParent">
|
||||
@@ -19,11 +19,11 @@
|
||||
</bean>
|
||||
|
||||
<bean
|
||||
class="org.springframework.batch.sample.dao.JdbcCustomerDebitDao"
|
||||
class="org.springframework.batch.sample.trade.JdbcCustomerDebitDao"
|
||||
id="customerDao" p:dataSource-ref="dataSource" />
|
||||
|
||||
<bean
|
||||
class="org.springframework.batch.sample.dao.FlatFileCustomerCreditDao"
|
||||
class="org.springframework.batch.sample.trade.FlatFileCustomerCreditDao"
|
||||
id="customerReportItemWriter">
|
||||
<property name="itemWriter">
|
||||
<bean
|
||||
|
||||
@@ -4,7 +4,7 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.sample.domain.PersonService;
|
||||
import org.springframework.batch.sample.person.PersonService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.JobParametersBuilder;
|
||||
import org.springframework.batch.sample.dao.HibernateCreditDao;
|
||||
import org.springframework.batch.sample.trade.HibernateCreditDao;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.UncategorizedSQLException;
|
||||
import org.springframework.orm.hibernate3.HibernateJdbcException;
|
||||
|
||||
@@ -3,7 +3,7 @@ package org.springframework.batch.sample;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.sample.item.writer.RetrySampleItemWriter;
|
||||
import org.springframework.batch.sample.retry.RetrySampleItemWriter;
|
||||
import org.springframework.batch.sample.trade.GeneratingTradeItemReader;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.item.ItemStream;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.sample.trade.CustomerCredit;
|
||||
import org.springframework.batch.sample.trade.FlatFileCustomerCreditDao;
|
||||
|
||||
public class FlatFileCustomerCreditDaoTests {
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import javax.sql.DataSource;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.sample.trade.CustomerDebit;
|
||||
import org.springframework.batch.sample.trade.JdbcCustomerDebitDao;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.RowCallbackHandler;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||
|
||||
@@ -25,6 +25,7 @@ import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.sample.trade.JdbcTradeDao;
|
||||
import org.springframework.batch.sample.trade.Trade;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
@@ -5,8 +5,8 @@ import static org.junit.Assert.assertTrue;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.sample.dao.CustomerCreditDao;
|
||||
import org.springframework.batch.sample.trade.CustomerCredit;
|
||||
import org.springframework.batch.sample.trade.CustomerCreditDao;
|
||||
import org.springframework.batch.sample.trade.CustomerCreditIncreaseWriter;
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.math.BigDecimal;
|
||||
import org.easymock.MockControl;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.sample.dao.CustomerCreditDao;
|
||||
import org.springframework.batch.sample.trade.CustomerCredit;
|
||||
import org.springframework.batch.sample.trade.CustomerCreditDao;
|
||||
import org.springframework.batch.sample.trade.CustomerCreditUpdateWriter;
|
||||
|
||||
public class CustomerCreditUpdateProcessorTests {
|
||||
|
||||
@@ -5,8 +5,8 @@ import static org.junit.Assert.assertEquals;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.sample.dao.CustomerDebitDao;
|
||||
import org.springframework.batch.sample.trade.CustomerDebit;
|
||||
import org.springframework.batch.sample.trade.CustomerDebitDao;
|
||||
import org.springframework.batch.sample.trade.CustomerUpdateWriter;
|
||||
import org.springframework.batch.sample.trade.Trade;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.sample.retry.RetrySampleItemWriter;
|
||||
|
||||
/**
|
||||
* Tests for {@link RetrySampleItemWriter}.
|
||||
|
||||
@@ -3,8 +3,8 @@ package org.springframework.batch.sample.item.writer;
|
||||
import org.easymock.MockControl;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.sample.dao.TradeDao;
|
||||
import org.springframework.batch.sample.trade.Trade;
|
||||
import org.springframework.batch.sample.trade.TradeDao;
|
||||
import org.springframework.batch.sample.trade.TradeWriter;
|
||||
|
||||
public class TradeProcessorTests {
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
<import resource="classpath:data-source-context.xml"/>
|
||||
|
||||
<bean class="org.springframework.batch.sample.dao.JdbcCustomerDebitDao"/>
|
||||
<bean class="org.springframework.batch.sample.trade.JdbcCustomerDebitDao"/>
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user