From adc2f792421bf59a2b318ce6e82641a415b7aaae Mon Sep 17 00:00:00 2001 From: Michael Minella Date: Tue, 31 Mar 2015 14:06:10 -0500 Subject: [PATCH] Removed dependency on ParameterizedRowMapper To support Spring Framework 4.2 which removes ParameterizedRowMapper, all references to that were switched to RowMapper. As of Spring 3, the interfaces are identicle so this should cause no backward compatability issues. BATCH-2369 --- .../internal/PlayerSummaryMapper.java | 4 +-- ...lerantStepFactoryBeanIntegrationTests.java | 8 +++-- ...epFactoryBeanRollbackIntegrationTests.java | 8 +++-- .../dao/JdbcExecutionContextDao.java | 4 +-- .../repository/dao/JdbcJobExecutionDao.java | 5 ++-- .../repository/dao/JdbcJobInstanceDao.java | 10 +++---- .../repository/dao/JdbcStepExecutionDao.java | 29 ++++++++++--------- .../JdbcPagingItemReaderAsyncTests.java | 7 +++-- .../JdbcPagingRestartIntegrationTests.java | 5 ++-- .../item/database/JdbcPagingItemReader.java | 2 +- .../JdbcPagingItemReaderAsyncTests.java | 7 +++-- ...PagingItemReaderClassicParameterTests.java | 5 ++-- .../JdbcPagingItemReaderCommonTests.java | 5 ++-- .../JdbcPagingItemReaderIntegrationTests.java | 4 +-- ...bcPagingItemReaderNamedParameterTests.java | 5 ++-- ...PagingItemReaderOrderIntegrationTests.java | 4 +-- .../sample/common/StagingItemReader.java | 7 +++-- .../internal/PlayerSummaryMapper.java | 4 +-- .../HibernateFailureJobFunctionalTests.java | 5 ++-- .../internal/JdbcGameDaoIntegrationTests.java | 5 ++-- .../batch/test/JobRepositoryTestUtils.java | 21 +++++++------- 21 files changed, 85 insertions(+), 69 deletions(-) diff --git a/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerSummaryMapper.java b/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerSummaryMapper.java index 2e72d3dfc..cc7cb9f1e 100644 --- a/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerSummaryMapper.java +++ b/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerSummaryMapper.java @@ -19,7 +19,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import org.springframework.batch.core.test.football.PlayerSummary; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; +import org.springframework.jdbc.core.RowMapper; /** * RowMapper used to map a ResultSet to a {@link PlayerSummary} @@ -27,7 +27,7 @@ import org.springframework.jdbc.core.simple.ParameterizedRowMapper; * @author Lucas Ward * */ -public class PlayerSummaryMapper implements ParameterizedRowMapper { +public class PlayerSummaryMapper implements RowMapper { /* (non-Javadoc) * @see org.springframework.jdbc.core.RowMapper#mapRow(java.sql.ResultSet, int) diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanIntegrationTests.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanIntegrationTests.java index a9433f70d..26e437afd 100644 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanIntegrationTests.java +++ b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanIntegrationTests.java @@ -32,6 +32,7 @@ import org.apache.commons.logging.LogFactory; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParameters; @@ -45,8 +46,9 @@ import org.springframework.batch.item.ItemWriter; import org.springframework.batch.item.ParseException; import org.springframework.batch.item.UnexpectedInputException; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.RowMapper; +import org.springframework.jdbc.core.simple.ParameterizedRowMapper; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -213,7 +215,7 @@ public class FaultTolerantStepFactoryBeanIntegrationTests { public List getCommitted() { return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='written'", - new ParameterizedRowMapper() { + new RowMapper() { @Override public String mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getString(1); @@ -259,7 +261,7 @@ public class FaultTolerantStepFactoryBeanIntegrationTests { public List getCommitted() { return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='processed'", - new ParameterizedRowMapper() { + new RowMapper() { @Override public String mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getString(1); diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanRollbackIntegrationTests.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanRollbackIntegrationTests.java index 5f21266df..76f968c19 100644 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanRollbackIntegrationTests.java +++ b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanRollbackIntegrationTests.java @@ -35,6 +35,7 @@ import org.apache.commons.logging.LogFactory; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParameters; @@ -48,8 +49,9 @@ import org.springframework.batch.item.ItemWriter; import org.springframework.batch.item.ParseException; import org.springframework.batch.item.UnexpectedInputException; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.RowMapper; +import org.springframework.jdbc.core.simple.ParameterizedRowMapper; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -238,7 +240,7 @@ public class FaultTolerantStepFactoryBeanRollbackIntegrationTests { public List getCommitted() { return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='written'", - new ParameterizedRowMapper() { + new RowMapper() { @Override public String mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getString(1); @@ -291,7 +293,7 @@ public class FaultTolerantStepFactoryBeanRollbackIntegrationTests { public List getCommitted() { return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='processed'", - new ParameterizedRowMapper() { + new RowMapper() { @Override public String mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getString(1); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcExecutionContextDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcExecutionContextDao.java index 905de6fc7..4aff271f0 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcExecutionContextDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcExecutionContextDao.java @@ -36,7 +36,7 @@ import org.springframework.batch.item.ExecutionContext; import org.springframework.core.serializer.Serializer; import org.springframework.jdbc.core.BatchPreparedStatementSetter; import org.springframework.jdbc.core.PreparedStatementSetter; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; +import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.support.lob.DefaultLobHandler; import org.springframework.jdbc.support.lob.LobHandler; import org.springframework.util.Assert; @@ -306,7 +306,7 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem return results; } - private class ExecutionContextRowMapper implements ParameterizedRowMapper { + private class ExecutionContextRowMapper implements RowMapper { @Override public ExecutionContext mapRow(ResultSet rs, int i) throws SQLException { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobExecutionDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobExecutionDao.java index 598502530..f5c8dd865 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobExecutionDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobExecutionDao.java @@ -29,6 +29,7 @@ import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.ExitStatus; import org.springframework.batch.core.JobExecution; @@ -40,7 +41,7 @@ import org.springframework.beans.factory.InitializingBean; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.dao.OptimisticLockingFailureException; import org.springframework.jdbc.core.RowCallbackHandler; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; +import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer; import org.springframework.util.Assert; @@ -390,7 +391,7 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements * @author Dave Syer * */ - private final class JobExecutionRowMapper implements ParameterizedRowMapper { + private final class JobExecutionRowMapper implements RowMapper { private JobInstance jobInstance; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDao.java index 7d4da1812..d09946ed3 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDao.java @@ -32,6 +32,7 @@ import org.springframework.beans.factory.InitializingBean; import org.springframework.dao.DataAccessException; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.ResultSetExtractor; +import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.simple.ParameterizedRowMapper; import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer; import org.springframework.util.Assert; @@ -138,7 +139,7 @@ JobInstanceDao, InitializingBean { String jobKey = jobKeyGenerator.generateKey(jobParameters); - ParameterizedRowMapper rowMapper = new JobInstanceRowMapper(); + RowMapper rowMapper = new JobInstanceRowMapper(); List instances; if (StringUtils.hasLength(jobKey)) { @@ -218,7 +219,7 @@ JobInstanceDao, InitializingBean { rowNum++; } while (rowNum < start + count && rs.next()) { - ParameterizedRowMapper rowMapper = new JobInstanceRowMapper(); + RowMapper rowMapper = new JobInstanceRowMapper(); list.add(rowMapper.mapRow(rs, rowNum)); rowNum++; } @@ -289,8 +290,7 @@ JobInstanceDao, InitializingBean { * @author Dave Syer * */ - private final class JobInstanceRowMapper implements - ParameterizedRowMapper { + private final class JobInstanceRowMapper implements RowMapper { public JobInstanceRowMapper() { } @@ -318,7 +318,7 @@ JobInstanceDao, InitializingBean { rowNum++; } while (rowNum < start + count && rs.next()) { - ParameterizedRowMapper rowMapper = new JobInstanceRowMapper(); + RowMapper rowMapper = new JobInstanceRowMapper(); list.add(rowMapper.mapRow(rs, rowNum)); rowNum++; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDao.java index 2ffcf03ab..4896827b5 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDao.java @@ -16,19 +16,6 @@ package org.springframework.batch.core.repository.dao; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.batch.core.BatchStatus; -import org.springframework.batch.core.ExitStatus; -import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.StepExecution; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.dao.OptimisticLockingFailureException; -import org.springframework.jdbc.core.BatchPreparedStatementSetter; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; -import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer; -import org.springframework.util.Assert; - import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -40,6 +27,20 @@ import java.util.Collection; import java.util.Iterator; import java.util.List; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.springframework.batch.core.BatchStatus; +import org.springframework.batch.core.ExitStatus; +import org.springframework.batch.core.JobExecution; +import org.springframework.batch.core.StepExecution; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.dao.OptimisticLockingFailureException; +import org.springframework.jdbc.core.BatchPreparedStatementSetter; +import org.springframework.jdbc.core.RowMapper; +import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer; +import org.springframework.util.Assert; + /** * JDBC implementation of {@link StepExecutionDao}.
* @@ -297,7 +298,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement jobExecution.getId()); } - private static class StepExecutionRowMapper implements ParameterizedRowMapper { + private static class StepExecutionRowMapper implements RowMapper { private final JobExecution jobExecution; diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderAsyncTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderAsyncTests.java index db09bdfb5..636df9b97 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderAsyncTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderAsyncTests.java @@ -40,15 +40,16 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.database.support.SqlPagingQueryProviderFactoryBean; import org.springframework.batch.item.sample.Foo; -import org.springframework.test.jdbc.JdbcTestUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; +import org.springframework.jdbc.core.RowMapper; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.jdbc.JdbcTestUtils; /** * @author Dave Syer @@ -168,7 +169,7 @@ public class JdbcPagingItemReaderAsyncTests { sortKeys.put("VALUE", Order.ASCENDING); factory.setSortKeys(sortKeys); reader.setQueryProvider(factory.getObject()); - reader.setRowMapper(new ParameterizedRowMapper() { + reader.setRowMapper(new RowMapper() { @Override public Foo mapRow(ResultSet rs, int i) throws SQLException { Foo foo = new Foo(); diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/JdbcPagingRestartIntegrationTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/JdbcPagingRestartIntegrationTests.java index 420f4a728..a594aa12d 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/JdbcPagingRestartIntegrationTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/JdbcPagingRestartIntegrationTests.java @@ -35,6 +35,7 @@ import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemStream; @@ -42,7 +43,7 @@ import org.springframework.batch.item.database.support.SqlPagingQueryProviderFac import org.springframework.batch.item.sample.Foo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; +import org.springframework.jdbc.core.RowMapper; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.jdbc.JdbcTestUtils; @@ -159,7 +160,7 @@ public class JdbcPagingRestartIntegrationTests { sortKeys.put("VALUE", Order.ASCENDING); factory.setSortKeys(sortKeys); reader.setQueryProvider(factory.getObject()); - reader.setRowMapper(new ParameterizedRowMapper() { + reader.setRowMapper(new RowMapper() { @Override public Foo mapRow(ResultSet rs, int i) throws SQLException { Foo foo = new Foo(); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JdbcPagingItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JdbcPagingItemReader.java index 2317b7e7d..805e6af67 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JdbcPagingItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JdbcPagingItemReader.java @@ -135,7 +135,7 @@ public class JdbcPagingItemReader extends AbstractPagingItemReader impleme * by the reader. * * @param rowMapper a - * {@link org.springframework.jdbc.core.simple.ParameterizedRowMapper} + * {@link RowMapper} * implementation */ public void setRowMapper(RowMapper rowMapper) { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderAsyncTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderAsyncTests.java index 57197f77e..d23c8b895 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderAsyncTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderAsyncTests.java @@ -40,15 +40,16 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.database.support.HsqlPagingQueryProvider; import org.springframework.batch.item.sample.Foo; -import org.springframework.test.jdbc.JdbcTestUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; +import org.springframework.jdbc.core.RowMapper; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.jdbc.JdbcTestUtils; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "JdbcPagingItemReaderCommonTests-context.xml") @@ -162,7 +163,7 @@ public class JdbcPagingItemReaderAsyncTests { sortKeys.put("ID", Order.ASCENDING); queryProvider.setSortKeys(sortKeys); reader.setQueryProvider(queryProvider); - reader.setRowMapper(new ParameterizedRowMapper() { + reader.setRowMapper(new RowMapper() { @Override public Foo mapRow(ResultSet rs, int i) throws SQLException { Foo foo = new Foo(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderClassicParameterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderClassicParameterTests.java index 7f9a09de3..240e9c9e3 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderClassicParameterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderClassicParameterTests.java @@ -23,9 +23,10 @@ import java.util.Map; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.batch.item.database.support.HsqlPagingQueryProvider; import org.springframework.batch.item.sample.Foo; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; +import org.springframework.jdbc.core.RowMapper; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.util.ReflectionTestUtils; @@ -65,7 +66,7 @@ public class JdbcPagingItemReaderClassicParameterTests extends AbstractJdbcPagin reader.setParameterValues(Collections.singletonMap("limit", 2)); reader.setQueryProvider(queryProvider); reader.setRowMapper( - new ParameterizedRowMapper() { + new RowMapper() { @Override public Foo mapRow(ResultSet rs, int i) throws SQLException { Foo foo = new Foo(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderCommonTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderCommonTests.java index 8950badab..65669663a 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderCommonTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderCommonTests.java @@ -23,13 +23,14 @@ import java.util.Map; import javax.sql.DataSource; import org.junit.runner.RunWith; + import org.springframework.batch.item.AbstractItemStreamItemReaderTests; import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.database.support.HsqlPagingQueryProvider; import org.springframework.batch.item.sample.Foo; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; +import org.springframework.jdbc.core.RowMapper; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -58,7 +59,7 @@ public class JdbcPagingItemReaderCommonTests extends AbstractItemStreamItemReade queryProvider.setSortKeys(sortKeys); reader.setQueryProvider(queryProvider); reader.setRowMapper( - new ParameterizedRowMapper() { + new RowMapper() { @Override public Foo mapRow(ResultSet rs, int i) throws SQLException { Foo foo = new Foo(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderIntegrationTests.java index 02e23040d..3e159e10b 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderIntegrationTests.java @@ -23,7 +23,7 @@ import java.util.Map; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.database.support.HsqlPagingQueryProvider; import org.springframework.batch.item.sample.Foo; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; +import org.springframework.jdbc.core.RowMapper; /** * Tests for {@link JpaPagingItemReader}. @@ -46,7 +46,7 @@ public class JdbcPagingItemReaderIntegrationTests extends AbstractGenericDataSou queryProvider.setSortKeys(sortKeys); inputSource.setQueryProvider(queryProvider); inputSource.setRowMapper( - new ParameterizedRowMapper() { + new RowMapper() { @Override public Foo mapRow(ResultSet rs, int i) throws SQLException { Foo foo = new Foo(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderNamedParameterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderNamedParameterTests.java index 6f19cf044..601c3c3e4 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderNamedParameterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderNamedParameterTests.java @@ -23,9 +23,10 @@ import java.util.Map; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.batch.item.database.support.HsqlPagingQueryProvider; import org.springframework.batch.item.sample.Foo; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; +import org.springframework.jdbc.core.RowMapper; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.util.ReflectionTestUtils; @@ -64,7 +65,7 @@ public class JdbcPagingItemReaderNamedParameterTests extends AbstractJdbcPagingI reader.setParameterValues(Collections.singletonMap("limit", 2)); reader.setQueryProvider(queryProvider); reader.setRowMapper( - new ParameterizedRowMapper() { + new RowMapper() { @Override public Foo mapRow(ResultSet rs, int i) throws SQLException { Foo foo = new Foo(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderOrderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderOrderIntegrationTests.java index 0839197dd..bc38300b5 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderOrderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderOrderIntegrationTests.java @@ -23,7 +23,7 @@ import java.util.Map; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.database.support.HsqlPagingQueryProvider; import org.springframework.batch.item.sample.Foo; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; +import org.springframework.jdbc.core.RowMapper; /** * Tests for {@link JpaPagingItemReader} with sort key not equal to ID. @@ -47,7 +47,7 @@ public class JdbcPagingItemReaderOrderIntegrationTests extends AbstractGenericDa queryProvider.setSortKeys(sortKeys); inputSource.setQueryProvider(queryProvider); inputSource.setRowMapper( - new ParameterizedRowMapper() { + new RowMapper() { @Override public Foo mapRow(ResultSet rs, int i) throws SQLException { Foo foo = new Foo(); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemReader.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemReader.java index fa706ec62..a70cf070a 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemReader.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemReader.java @@ -25,6 +25,7 @@ import javax.sql.DataSource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.batch.core.ExitStatus; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.StepExecutionListener; @@ -34,7 +35,7 @@ import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.jdbc.core.JdbcOperations; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; +import org.springframework.jdbc.core.RowMapper; import org.springframework.util.Assert; import org.springframework.util.SerializationUtils; @@ -82,7 +83,7 @@ InitializingBean, DisposableBean { "SELECT ID FROM BATCH_STAGING WHERE JOB_ID=? AND PROCESSED=? ORDER BY ID", - new ParameterizedRowMapper() { + new RowMapper() { @Override public Long mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getLong(1); @@ -114,7 +115,7 @@ InitializingBean, DisposableBean { } @SuppressWarnings("unchecked") T result = (T) jdbcTemplate.queryForObject("SELECT VALUE FROM BATCH_STAGING WHERE ID=?", - new ParameterizedRowMapper() { + new RowMapper() { @Override public Object mapRow(ResultSet rs, int rowNum) throws SQLException { byte[] blob = rs.getBytes(1); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerSummaryMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerSummaryMapper.java index 5a5778f40..a30ea3b29 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerSummaryMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerSummaryMapper.java @@ -19,7 +19,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import org.springframework.batch.sample.domain.football.PlayerSummary; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; +import org.springframework.jdbc.core.RowMapper; /** * RowMapper used to map a ResultSet to a {@link PlayerSummary} @@ -27,7 +27,7 @@ import org.springframework.jdbc.core.simple.ParameterizedRowMapper; * @author Lucas Ward * */ -public class PlayerSummaryMapper implements ParameterizedRowMapper { +public class PlayerSummaryMapper implements RowMapper { /* (non-Javadoc) * @see org.springframework.jdbc.core.RowMapper#mapRow(java.sql.ResultSet, int) diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/HibernateFailureJobFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/HibernateFailureJobFunctionalTests.java index 085d8755e..8f23b8d61 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/HibernateFailureJobFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/HibernateFailureJobFunctionalTests.java @@ -28,6 +28,7 @@ import javax.sql.DataSource; 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.domain.trade.internal.CustomerCreditIncreaseProcessor; @@ -38,7 +39,7 @@ import org.springframework.jdbc.UncategorizedSQLException; import org.springframework.jdbc.core.JdbcOperations; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowCallbackHandler; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; +import org.springframework.jdbc.core.RowMapper; import org.springframework.orm.hibernate3.HibernateJdbcException; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -121,7 +122,7 @@ public class HibernateFailureJobFunctionalTests { creditsBeforeUpdate = new TransactionTemplate(transactionManager).execute(new TransactionCallback>() { @Override public List doInTransaction(TransactionStatus status) { - return jdbcTemplate.query(ALL_CUSTOMERS, new ParameterizedRowMapper() { + return jdbcTemplate.query(ALL_CUSTOMERS, new RowMapper() { @Override public BigDecimal mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getBigDecimal(CREDIT_COLUMN); diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDaoIntegrationTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDaoIntegrationTests.java index 80dbc34e9..19d1b6c14 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDaoIntegrationTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDaoIntegrationTests.java @@ -26,11 +26,12 @@ import javax.sql.DataSource; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.batch.sample.domain.football.Game; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcOperations; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; +import org.springframework.jdbc.core.RowMapper; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; @@ -82,7 +83,7 @@ public class JdbcGameDaoIntegrationTests { assertEquals(tempGame, game); } - private static class GameRowMapper implements ParameterizedRowMapper { + private static class GameRowMapper implements RowMapper { @Override public Game mapRow(ResultSet rs, int arg1) throws SQLException { if (rs == null) { diff --git a/spring-batch-test/src/main/java/org/springframework/batch/test/JobRepositoryTestUtils.java b/spring-batch-test/src/main/java/org/springframework/batch/test/JobRepositoryTestUtils.java index e2b892708..3959bd593 100644 --- a/spring-batch-test/src/main/java/org/springframework/batch/test/JobRepositoryTestUtils.java +++ b/spring-batch-test/src/main/java/org/springframework/batch/test/JobRepositoryTestUtils.java @@ -15,6 +15,15 @@ */ package org.springframework.batch.test; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import javax.sql.DataSource; + import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobInstance; import org.springframework.batch.core.JobParameter; @@ -30,17 +39,9 @@ import org.springframework.beans.factory.InitializingBean; import org.springframework.dao.DataAccessException; import org.springframework.jdbc.core.JdbcOperations; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; +import org.springframework.jdbc.core.RowMapper; import org.springframework.util.Assert; -import javax.sql.DataSource; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - /** * Convenience class for creating and removing {@link JobExecution} instances * from a database. Typical usage in test case would be to create instances @@ -163,7 +164,7 @@ public class JobRepositoryTestUtils extends AbstractJdbcBatchMetadataDao impleme for (JobExecution jobExecution : list) { List stepExecutionIds = jdbcTemplate.query( getQuery("select STEP_EXECUTION_ID from %PREFIX%STEP_EXECUTION where JOB_EXECUTION_ID=?"), - new ParameterizedRowMapper() { + new RowMapper() { @Override public Long mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getLong(1);