IN PROGRESS - BATCH-693: Refactor samples along domain contours

packaged football job
This commit is contained in:
robokaso
2008-07-25 09:02:14 +00:00
parent eaa407a01d
commit 37b158f8b0
19 changed files with 31 additions and 29 deletions

View File

@@ -1,4 +1,4 @@
package org.springframework.batch.sample.mapping;
package org.springframework.batch.sample.football;
import org.springframework.batch.item.file.mapping.FieldSet;
import org.springframework.batch.item.file.mapping.FieldSetMapper;

View File

@@ -1,4 +1,4 @@
package org.springframework.batch.sample.dao;
package org.springframework.batch.sample.football;
import org.springframework.batch.item.ClearFailedException;
import org.springframework.batch.item.FlushFailedException;

View File

@@ -1,7 +1,7 @@
/**
*
*/
package org.springframework.batch.sample.dao;
package org.springframework.batch.sample.football;
import org.springframework.batch.sample.domain.Player;
import org.springframework.jdbc.core.support.JdbcDaoSupport;

View File

@@ -1,4 +1,4 @@
package org.springframework.batch.sample.dao;
package org.springframework.batch.sample.football;
import org.springframework.batch.item.ClearFailedException;
import org.springframework.batch.item.FlushFailedException;

View File

@@ -1,4 +1,4 @@
package org.springframework.batch.sample.dao;
package org.springframework.batch.sample.football;
import org.springframework.batch.sample.domain.Player;

View File

@@ -1,4 +1,4 @@
package org.springframework.batch.sample.mapping;
package org.springframework.batch.sample.football;
import org.springframework.batch.item.file.mapping.FieldSet;
import org.springframework.batch.item.file.mapping.FieldSetMapper;

View File

@@ -1,7 +1,6 @@
package org.springframework.batch.sample.item.writer;
package org.springframework.batch.sample.football;
import org.springframework.batch.item.support.AbstractItemWriter;
import org.springframework.batch.sample.dao.PlayerDao;
import org.springframework.batch.sample.domain.Player;
public class PlayerItemWriter extends AbstractItemWriter<Player> {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.sample.mapping;
package org.springframework.batch.sample.football;
import java.sql.ResultSet;
import java.sql.SQLException;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.sample.mapping;
package org.springframework.batch.sample.football;
import java.sql.ResultSet;
import java.sql.SQLException;

View File

@@ -12,7 +12,7 @@ import org.springframework.batch.sample.domain.Trade;
*
* @author Robert Kasanicky
*/
public class GeneratingItemReader implements ItemReader<Trade> {
public class GeneratingTradeItemReader implements ItemReader<Trade> {
private int limit = 1;

View File

@@ -19,10 +19,10 @@
ref="playerFileItemReader" />
<property name="itemWriter">
<bean
class="org.springframework.batch.sample.item.writer.PlayerItemWriter">
class="org.springframework.batch.sample.football.PlayerItemWriter">
<property name="playerDao">
<bean
class="org.springframework.batch.sample.dao.JdbcPlayerDao">
class="org.springframework.batch.sample.football.JdbcPlayerDao">
<property name="dataSource"
ref="dataSource" />
</bean>
@@ -35,7 +35,7 @@
ref="gameFileItemReader" />
<property name="itemWriter">
<bean
class="org.springframework.batch.sample.dao.JdbcGameDao">
class="org.springframework.batch.sample.football.JdbcGameDao">
<property name="dataSource"
ref="dataSource" />
</bean>
@@ -48,7 +48,7 @@
ref="playerSummarizationSource" />
<property name="itemWriter">
<bean
class="org.springframework.batch.sample.dao.JdbcPlayerSummaryDao">
class="org.springframework.batch.sample.football.JdbcPlayerSummaryDao">
<property name="dataSource"
ref="dataSource" />
</bean>
@@ -71,7 +71,7 @@
</property>
<property name="fieldSetMapper">
<bean
class="org.springframework.batch.sample.mapping.PlayerFieldSetMapper" />
class="org.springframework.batch.sample.football.PlayerFieldSetMapper" />
</property>
</bean>
@@ -88,7 +88,7 @@
</property>
<property name="fieldSetMapper">
<bean
class="org.springframework.batch.sample.mapping.GameFieldSetMapper" />
class="org.springframework.batch.sample.football.GameFieldSetMapper" />
</property>
</bean>
@@ -97,7 +97,7 @@
<property name="dataSource" ref="dataSource" />
<property name="mapper">
<bean
class="org.springframework.batch.sample.mapping.PlayerSummaryMapper" />
class="org.springframework.batch.sample.football.PlayerSummaryMapper" />
</property>
<property name="sql">
<value>

View File

@@ -25,7 +25,7 @@
</bean-->
<bean id="infiniteStep" parent="simpleStep">
<property name="itemReader">
<bean id="reader" class="org.springframework.batch.sample.item.reader.GeneratingItemReader">
<bean id="reader" class="org.springframework.batch.sample.item.reader.GeneratingTradeItemReader">
<property name="limit" value="1000000" />
</bean>
</property>

View File

@@ -19,7 +19,7 @@
</property>
</bean>
<bean id="itemGenerator" class="org.springframework.batch.sample.item.reader.GeneratingItemReader">
<bean id="itemGenerator" class="org.springframework.batch.sample.item.reader.GeneratingTradeItemReader">
<property name="limit" value="10" />
</bean>

View File

@@ -425,10 +425,10 @@ AbduKa00,1996,mia,15,nyg,0,0,0,0,0,17,96,,14,0
ref="playerFileItemReader" />
<property name="itemWriter">
<bean
class="org.springframework.batch.sample.item.writer.PlayerItemWriter">
class="org.springframework.batch.sample.football.PlayerItemWriter">
<property name="playerDao">
<bean
class="org.springframework.batch.sample.dao.JdbcPlayerDao">
class="org.springframework.batch.sample.football.JdbcPlayerDao">
<property name="dataSource"
ref="dataSource" />
</bean>
@@ -504,7 +504,7 @@ AbduKa00,1996,mia,15,nyg,0,0,0,0,0,17,96,,14,0
</property>
<property name="fieldSetMapper">
<bean
class="org.springframework.batch.sample.mapping.PlayerFieldSetMapper" />
class="org.springframework.batch.sample.football.PlayerFieldSetMapper" />
</property>
</bean>
+---
@@ -581,7 +581,7 @@ public class
<property name="dataSource" ref="dataSource" />
<property name="mapper">
<bean
class="org.springframework.batch.sample.mapping.PlayerSummaryMapper" />
class="org.springframework.batch.sample.football.PlayerSummaryMapper" />
</property>
<property name="sql">
<value>

View File

@@ -3,7 +3,7 @@ package org.springframework.batch.sample;
import static org.junit.Assert.*;
import org.junit.runner.RunWith;
import org.springframework.batch.sample.item.reader.GeneratingItemReader;
import org.springframework.batch.sample.item.reader.GeneratingTradeItemReader;
import org.springframework.batch.sample.item.writer.RetrySampleItemWriter;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.ContextConfiguration;
@@ -19,7 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
public class RetrySampleFunctionalTests extends AbstractValidatingBatchLauncherTests {
@Autowired
private GeneratingItemReader itemGenerator;
private GeneratingTradeItemReader itemGenerator;
@Autowired
private RetrySampleItemWriter<?> itemProcessor;

View File

@@ -20,6 +20,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.batch.sample.domain.Game;
import org.springframework.batch.sample.football.JdbcGameDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;

View File

@@ -26,6 +26,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.batch.sample.domain.Player;
import org.springframework.batch.sample.football.JdbcPlayerDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowCallbackHandler;

View File

@@ -20,7 +20,8 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.batch.sample.domain.PlayerSummary;
import org.springframework.batch.sample.mapping.PlayerSummaryMapper;
import org.springframework.batch.sample.football.JdbcPlayerSummaryDao;
import org.springframework.batch.sample.football.PlayerSummaryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.ContextConfiguration;

View File

@@ -4,13 +4,13 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
/**
* Tests for {@link GeneratingItemReader}.
* Tests for {@link GeneratingTradeItemReader}.
*
* @author Robert Kasanicky
*/
public class GeneratingItemReaderTests {
private GeneratingItemReader reader = new GeneratingItemReader();
private GeneratingTradeItemReader reader = new GeneratingTradeItemReader();
/**
* Generates a given number of not-null records,