diff --git a/dictionary.txt b/dictionary.txt index 2b131be9f..9aba8f63e 100644 --- a/dictionary.txt +++ b/dictionary.txt @@ -101,3 +101,213 @@ ajax javascript chris schaefer +unescaped +namespace +autowired +registrar +ref +configurer +callable +classpath +config +registries +stephane +nicoll +href +fischer +sebastien +gerard +xml +gt +garrette +thomas +risberg +josh +preconfigured +lob +hydrated +hydrate +subflow +validator +subflows +wildcard +foo +wildcards +pre +morten +andersen +gott +validators +enum +init +elvis +refactored +autowire +batchlet +upfront +glenn +renfro +arg +chunking +spec +honour +ids +exiter +stdin +stijn +maller +schipp +javadocs +prioritising +recognise +summarise +summarising +analyse +no-op +multicaster +optimisation +deserializes +david +turanski +serializer +multi +charsets +jettison +deserialization +jimmy +praet +behaviour +unregistration +initialised +hydrating +aop +analysed +ignorable +tarred +generics +memorise +modularise +skippability +panicking +eric +evans +deserialize +wonky +rawtypes +internet +inline +foobar +sergey +shcherbakov +jsr +blah +txt +spam +punk +min +downgrade +weirdnesses +varchar +warmup +tobias +flohre +backstop +timestamp +recognised +attrs +ouch +tripped +barf +baz +phil +webb +costin +leau +hsql +vs +payload +mongo +cypher +iterable +anatoly +polinsky +sybase +thexton +postgres +luke +taylor +rowid +num +externalized +juergen +hoeller +capitalised +capitalisation +tokenization +tomas +slanina +tokenizing +alef +arjen +arendsen +poutsma +levenshtein +unset +unparseable +tokenizers +parseable +regex +customisation +waseem +malik +synced +charset +juliusz +brzostek +marshallers +unmarshaller +marshaller +uri +namespaces +xmlns +woodstox +inits +marshalled +precache +douglas +kaminsky +endeavour +uncategorised +specialisation +tenuous +checkpointing +mutex +signalling +customise +rethrowing +queueing +runnables +resourceless +initialisation +args +params +delegator +val +asc +desc +unmarshalling +unmarshallers +resettable +dataset +signalled +injectable +asynch +flakey +usecase +tokenize +debit +isin +fieldsets +mockito +mappers +adhoc diff --git a/spring-batch-core-tests/.springBeans b/spring-batch-core-tests/.springBeans index 5f141c431..5dbfbb4be 100644 --- a/spring-batch-core-tests/.springBeans +++ b/spring-batch-core-tests/.springBeans @@ -1,240 +1,308 @@ - - - 1 - - - - - - - src/test/resources/data-source-context.xml - src/test/resources/simple-job-launcher-context.xml - src/test/resources/org/springframework/batch/core/test/step/SplitJobMapRepositoryIntegrationTests-context.xml - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - - true - false - - - - - + + + 1 + + + + + + + src/test/resources/data-source-context.xml + src/test/resources/simple-job-launcher-context.xml + src/test/resources/org/springframework/batch/core/test/step/SplitJobMapRepositoryIntegrationTests-context.xml + src/main/resources/META-INF/batch/footballJob.xml + src/main/resources/META-INF/batch/footballSkipJob.xml + src/main/resources/META-INF/batch/parallelJob.xml + src/main/resources/META-INF/batch/timeoutJob.xml + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + + true + false + + + + + + + diff --git a/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/football/Game.java b/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/football/Game.java index 1f74b2c58..77b6b6d16 100644 --- a/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/football/Game.java +++ b/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/football/Game.java @@ -18,6 +18,7 @@ package org.springframework.batch.core.test.football; import java.io.Serializable; +@SuppressWarnings("serial") public class Game implements Serializable { private String id; @@ -260,6 +261,7 @@ public class Game implements Serializable { this.totalTd = totalTd; } + @Override public String toString() { return "Game: ID=" + id + " " + team + " vs. " + opponent + " - " + year; diff --git a/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/football/Player.java b/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/football/Player.java index 5314be5ba..c220b2fa0 100644 --- a/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/football/Player.java +++ b/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/football/Player.java @@ -18,6 +18,7 @@ package org.springframework.batch.core.test.football; import java.io.Serializable; +@SuppressWarnings("serial") public class Player implements Serializable { private String id; @@ -27,6 +28,7 @@ public class Player implements Serializable { private int birthYear; private int debutYear; + @Override public String toString() { return "PLAYER:id=" + id + ",Last Name=" + lastName + diff --git a/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/football/PlayerSummary.java b/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/football/PlayerSummary.java index 2d906a5dd..fcc7445b5 100644 --- a/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/football/PlayerSummary.java +++ b/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/football/PlayerSummary.java @@ -113,6 +113,7 @@ public class PlayerSummary { } + @Override public String toString() { return "Player Summary: ID=" + id + " Year=" + year + "[" + completes + ";" + attempts + ";" + passingYards + ";" + passingTd + ";" + interceptions + ";" + rushes + ";" + rushYards + ";" + receptions + diff --git a/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/timeout/LoggingItemWriter.java b/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/timeout/LoggingItemWriter.java index beb53ecfd..9c59d0a0d 100644 --- a/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/timeout/LoggingItemWriter.java +++ b/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/timeout/LoggingItemWriter.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.test.timeout; import java.util.List; diff --git a/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/timeout/SleepingItemProcessor.java b/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/timeout/SleepingItemProcessor.java index 3592086bc..b6281cb4f 100644 --- a/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/timeout/SleepingItemProcessor.java +++ b/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/timeout/SleepingItemProcessor.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.test.timeout; import org.springframework.batch.item.ItemProcessor; diff --git a/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/timeout/SleepingTasklet.java b/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/timeout/SleepingTasklet.java index 5a09056c6..58267ad8f 100644 --- a/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/timeout/SleepingTasklet.java +++ b/spring-batch-core-tests/src/main/java/org/springframework/batch/core/test/timeout/SleepingTasklet.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.test.timeout; import org.springframework.batch.core.StepContribution; diff --git a/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/FootballExceptionHandler.java b/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/FootballExceptionHandler.java index a1ff7afcb..9a8131c77 100644 --- a/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/FootballExceptionHandler.java +++ b/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/FootballExceptionHandler.java @@ -26,6 +26,7 @@ public class FootballExceptionHandler implements ExceptionHandler { private static final Log logger = LogFactory .getLog(FootballExceptionHandler.class); + @Override public void handleException(RepeatContext context, Throwable throwable) throws Throwable { diff --git a/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/GameFieldSetMapper.java b/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/GameFieldSetMapper.java index 197d4f525..de7143f94 100644 --- a/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/GameFieldSetMapper.java +++ b/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/GameFieldSetMapper.java @@ -22,6 +22,7 @@ import org.springframework.batch.item.file.transform.FieldSet; public class GameFieldSetMapper implements FieldSetMapper { + @Override public Game mapFieldSet(FieldSet fs) { if(fs == null){ diff --git a/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDao.java b/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDao.java index 2e8e48ef4..7d6589cec 100644 --- a/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDao.java +++ b/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDao.java @@ -29,6 +29,7 @@ public class JdbcGameDao extends JdbcDaoSupport implements ItemWriter { private SimpleJdbcInsert insertGame; + @Override protected void initDao() throws Exception { super.initDao(); insertGame = new SimpleJdbcInsert(getDataSource()).withTableName("GAMES").usingColumns("player_id", "year_no", @@ -36,6 +37,7 @@ public class JdbcGameDao extends JdbcDaoSupport implements ItemWriter { "rushes", "rush_yards", "receptions", "receptions_yards", "total_td"); } + @Override public void write(List games) { for (Game game : games) { diff --git a/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerDao.java b/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerDao.java index 281f346b1..cd059c423 100644 --- a/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerDao.java +++ b/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerDao.java @@ -35,7 +35,8 @@ public class JdbcPlayerDao implements PlayerDao { private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - public void savePlayer(Player player) { + @Override + public void savePlayer(Player player) { namedParameterJdbcTemplate.update(INSERT_PLAYER, new BeanPropertySqlParameterSource(player)); } diff --git a/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerSummaryDao.java b/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerSummaryDao.java index beb8bb40e..953ffa5fb 100644 --- a/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerSummaryDao.java +++ b/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerSummaryDao.java @@ -34,7 +34,8 @@ public class JdbcPlayerSummaryDao implements ItemWriter { private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - public void write(List summaries) { + @Override + public void write(List summaries) { for (PlayerSummary summary : summaries) { diff --git a/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerFieldSetMapper.java b/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerFieldSetMapper.java index 6b40468b4..0b517703b 100644 --- a/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerFieldSetMapper.java +++ b/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerFieldSetMapper.java @@ -22,6 +22,7 @@ import org.springframework.batch.item.file.transform.FieldSet; public class PlayerFieldSetMapper implements FieldSetMapper { + @Override public Player mapFieldSet(FieldSet fs) { if(fs == null){ diff --git a/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerItemWriter.java b/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerItemWriter.java index 13eda4b09..16f53d616 100644 --- a/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerItemWriter.java +++ b/spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerItemWriter.java @@ -26,6 +26,7 @@ public class PlayerItemWriter implements ItemWriter { private PlayerDao playerDao; + @Override public void write(List players) throws Exception { for (Player player : players) { playerDao.savePlayer(player); 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 ae14ccef0..2e72d3dfc 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 @@ -32,6 +32,7 @@ public class PlayerSummaryMapper implements ParameterizedRowMapper { /* (non-Javadoc) * @see org.springframework.jdbc.core.RowMapper#mapRow(java.sql.ResultSet, int) */ - public Object mapRow(ResultSet rs, int rowNum) throws SQLException { + @Override + public PlayerSummary mapRow(ResultSet rs, int rowNum) throws SQLException { PlayerSummary summary = new PlayerSummary(); diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/repository/ConcurrentMapExecutionContextDaoTests.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/repository/ConcurrentMapExecutionContextDaoTests.java index 1fe63dd59..c8812091f 100644 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/repository/ConcurrentMapExecutionContextDaoTests.java +++ b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/repository/ConcurrentMapExecutionContextDaoTests.java @@ -60,8 +60,9 @@ public class ConcurrentMapExecutionContextDaoTests { public void testTransactionalSaveUpdate() throws Exception { final StepExecution stepExecution = new StepExecution("step", new JobExecution(11L)); stepExecution.setId(123L); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { - public Object doInTransaction(TransactionStatus status) { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + @Override + public Void doInTransaction(TransactionStatus status) { stepExecution.getExecutionContext().put("foo", "bar"); dao.saveExecutionContext(stepExecution); return null; @@ -89,6 +90,7 @@ public class ConcurrentMapExecutionContextDaoTests { stepExecution2.setId(1234L + i); completionService.submit(new Callable() { + @Override public StepExecution call() throws Exception { for (int i = 0; i < innerMax; i++) { String value = "bar" + i; @@ -99,6 +101,7 @@ public class ConcurrentMapExecutionContextDaoTests { }); completionService.submit(new Callable() { + @Override public StepExecution call() throws Exception { for (int i = 0; i < innerMax; i++) { String value = "spam" + i; @@ -119,8 +122,9 @@ public class ConcurrentMapExecutionContextDaoTests { private void saveAndAssert(final StepExecution stepExecution, final String value) { - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { - public Object doInTransaction(TransactionStatus status) { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + @Override + public Void doInTransaction(TransactionStatus status) { stepExecution.getExecutionContext().put("foo", value); dao.saveExecutionContext(stepExecution); return null; diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/repository/JdbcJobRepositoryTests.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/repository/JdbcJobRepositoryTests.java index 8614b2e4f..8085c4ed7 100644 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/repository/JdbcJobRepositoryTests.java +++ b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/repository/JdbcJobRepositoryTests.java @@ -92,8 +92,8 @@ public class JdbcJobRepositoryTests { jdbcTemplate.update("DELETE FROM BATCH_JOB_INSTANCE where JOB_INSTANCE_ID=?", id); } for (Long id : jobIds) { - int count = jdbcTemplate.queryForInt( - "SELECT COUNT(*) FROM BATCH_JOB_INSTANCE where JOB_INSTANCE_ID=?", id); + int count = jdbcTemplate.queryForObject( + "SELECT COUNT(*) FROM BATCH_JOB_INSTANCE where JOB_INSTANCE_ID=?", Integer.class, id); assertEquals(0, count); } } @@ -103,7 +103,7 @@ public class JdbcJobRepositoryTests { job.setName("foo"); int before = 0; JobExecution execution = repository.createJobExecution(job.getName(), new JobParameters()); - int after = jdbcTemplate.queryForInt("SELECT COUNT(*) FROM BATCH_JOB_INSTANCE"); + int after = jdbcTemplate.queryForObject("SELECT COUNT(*) FROM BATCH_JOB_INSTANCE", Integer.class); assertEquals(before + 1, after); assertNotNull(execution.getId()); } @@ -115,7 +115,7 @@ public class JdbcJobRepositoryTests { JobExecution execution = repository.createJobExecution(job.getName(), new JobParameters()); execution.getExecutionContext().put("foo", "bar"); repository.updateExecutionContext(execution); - int after = jdbcTemplate.queryForInt("SELECT COUNT(*) FROM BATCH_JOB_EXECUTION_CONTEXT"); + int after = jdbcTemplate.queryForObject("SELECT COUNT(*) FROM BATCH_JOB_EXECUTION_CONTEXT", Integer.class); assertEquals(before + 1, after); assertNotNull(execution.getId()); JobExecution last = repository.getLastJobExecution(job.getName(), new JobParameters()); @@ -145,7 +145,7 @@ public class JdbcJobRepositoryTests { assertNotNull(execution); - int after = jdbcTemplate.queryForInt("SELECT COUNT(*) FROM BATCH_JOB_INSTANCE"); + int after = jdbcTemplate.queryForObject("SELECT COUNT(*) FROM BATCH_JOB_INSTANCE", Integer.class); assertNotNull(execution.getId()); assertEquals(before + 1, after); @@ -166,7 +166,7 @@ public class JdbcJobRepositoryTests { repository.update(execution); execution.setStatus(BatchStatus.FAILED); - int before = jdbcTemplate.queryForInt("SELECT COUNT(*) FROM BATCH_JOB_INSTANCE"); + int before = jdbcTemplate.queryForObject("SELECT COUNT(*) FROM BATCH_JOB_INSTANCE", Integer.class); assertEquals(1, before); long t0 = System.currentTimeMillis(); @@ -179,7 +179,7 @@ public class JdbcJobRepositoryTests { } long t1 = System.currentTimeMillis(); - int after = jdbcTemplate.queryForInt("SELECT COUNT(*) FROM BATCH_JOB_INSTANCE"); + int after = jdbcTemplate.queryForObject("SELECT COUNT(*) FROM BATCH_JOB_INSTANCE", Integer.class); assertNotNull(execution.getId()); assertEquals(before, after); @@ -197,6 +197,7 @@ public class JdbcJobRepositoryTests { private JobExecution doConcurrentStart() throws Exception { new Thread(new Runnable() { + @Override public void run() { try { diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/repository/JobSupport.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/repository/JobSupport.java index 9183ce255..ff9ea9d93 100644 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/repository/JobSupport.java +++ b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/repository/JobSupport.java @@ -77,6 +77,7 @@ public class JobSupport implements BeanNameAware, Job { * * @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String) */ + @Override public void setBeanName(String name) { if (this.name == null) { this.name = name; @@ -97,6 +98,7 @@ public class JobSupport implements BeanNameAware, Job { /* (non-Javadoc) * @see org.springframework.batch.core.domain.IJob#getName() */ + @Override public String getName() { return name; } @@ -139,6 +141,7 @@ public class JobSupport implements BeanNameAware, Job { /* (non-Javadoc) * @see org.springframework.batch.core.domain.IJob#isRestartable() */ + @Override public boolean isRestartable() { return restartable; } @@ -146,10 +149,12 @@ public class JobSupport implements BeanNameAware, Job { /* (non-Javadoc) * @see org.springframework.batch.core.Job#getJobParametersIncrementer() */ + @Override public JobParametersIncrementer getJobParametersIncrementer() { return null; } + @Override public JobParametersValidator getJobParametersValidator() { return jobParametersValidator; } @@ -157,10 +162,12 @@ public class JobSupport implements BeanNameAware, Job { /* (non-Javadoc) * @see org.springframework.batch.core.domain.Job#run(org.springframework.batch.core.domain.JobExecution) */ + @Override public void execute(JobExecution execution) throws UnexpectedJobExecutionException { throw new UnsupportedOperationException("JobSupport does not provide an implementation of run(). Use a smarter subclass."); } + @Override public String toString() { return ClassUtils.getShortName(getClass()) + ": [name=" + name + "]"; } 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 cb2ce008a..a9433f70d 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 @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.test.step; import static org.junit.Assert.assertEquals; @@ -129,7 +144,7 @@ public class FaultTolerantStepFactoryBeanIntegrationTests { try { - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); stepExecution = jobExecution.createStepExecution(factory.getName()); repository.add(stepExecution); @@ -173,6 +188,7 @@ public class FaultTolerantStepFactoryBeanIntegrationTests { counter = -1; } + @Override public synchronized String read() throws Exception, UnexpectedInputException, ParseException { counter++; if (counter >= items.length) { @@ -198,6 +214,7 @@ public class FaultTolerantStepFactoryBeanIntegrationTests { public List getCommitted() { return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='written'", new ParameterizedRowMapper() { + @Override public String mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getString(1); } @@ -209,6 +226,7 @@ public class FaultTolerantStepFactoryBeanIntegrationTests { jdbcTemplate.update("DELETE FROM ERROR_LOG where STEP_NAME='written'"); } + @Override public void write(List items) throws Exception { for (String item : items) { written.add(item); @@ -242,6 +260,7 @@ public class FaultTolerantStepFactoryBeanIntegrationTests { public List getCommitted() { return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='processed'", new ParameterizedRowMapper() { + @Override public String mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getString(1); } @@ -253,6 +272,7 @@ public class FaultTolerantStepFactoryBeanIntegrationTests { jdbcTemplate.update("DELETE FROM ERROR_LOG where STEP_NAME='processed'"); } + @Override public String process(String item) throws Exception { processed.add(item); logger.debug("Processed item: "+item); 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 dd223f94a..5f21266df 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 @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.test.step; import static org.junit.Assert.assertEquals; @@ -143,7 +158,7 @@ public class FaultTolerantStepFactoryBeanRollbackIntegrationTests { writer.setFailures("1", "2", "3", "4", "5"); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); stepExecution = jobExecution.createStepExecution(factory.getName()); repository.add(stepExecution); @@ -194,6 +209,7 @@ public class FaultTolerantStepFactoryBeanRollbackIntegrationTests { counter = -1; } + @Override public synchronized String read() throws Exception, UnexpectedInputException, ParseException { counter++; if (counter >= items.length) { @@ -223,6 +239,7 @@ public class FaultTolerantStepFactoryBeanRollbackIntegrationTests { public List getCommitted() { return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='written'", new ParameterizedRowMapper() { + @Override public String mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getString(1); } @@ -234,6 +251,7 @@ public class FaultTolerantStepFactoryBeanRollbackIntegrationTests { jdbcTemplate.update("DELETE FROM ERROR_LOG where STEP_NAME='written'"); } + @Override public void write(List items) throws Exception { for (String item : items) { written.add(item); @@ -274,6 +292,7 @@ public class FaultTolerantStepFactoryBeanRollbackIntegrationTests { public List getCommitted() { return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='processed'", new ParameterizedRowMapper() { + @Override public String mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getString(1); } @@ -285,6 +304,7 @@ public class FaultTolerantStepFactoryBeanRollbackIntegrationTests { jdbcTemplate.update("DELETE FROM ERROR_LOG where STEP_NAME='processed'"); } + @Override public String process(String item) throws Exception { processed.add(item); logger.debug("Processed item: " + item); diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/MapRepositoryFaultTolerantStepFactoryBeanRollbackTests.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/MapRepositoryFaultTolerantStepFactoryBeanRollbackTests.java index cfd47fa1a..ff467ff4e 100644 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/MapRepositoryFaultTolerantStepFactoryBeanRollbackTests.java +++ b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/MapRepositoryFaultTolerantStepFactoryBeanRollbackTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.test.step; import static org.junit.Assert.assertEquals; @@ -104,7 +119,7 @@ public class MapRepositoryFaultTolerantStepFactoryBeanRollbackTests { if (i%100==0) { logger.info("Starting step: "+i); - repository = new MapJobRepositoryFactoryBean(transactionManager).getJobRepository(); + repository = new MapJobRepositoryFactoryBean(transactionManager).getObject(); factory.setJobRepository(repository); jobExecution = repository.createJobExecution("vanillaJob", new JobParameters()); } @@ -121,7 +136,7 @@ public class MapRepositoryFaultTolerantStepFactoryBeanRollbackTests { try { - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); stepExecution = jobExecution.createStepExecution(factory.getName()); repository.add(stepExecution); @@ -162,6 +177,7 @@ public class MapRepositoryFaultTolerantStepFactoryBeanRollbackTests { counter = -1; } + @Override public synchronized String read() throws Exception, UnexpectedInputException, ParseException { counter++; if (counter >= items.length) { @@ -192,6 +208,7 @@ public class MapRepositoryFaultTolerantStepFactoryBeanRollbackTests { written.clear(); } + @Override public void write(List items) throws Exception { for (String item : items) { logger.trace("Writing: "+item); @@ -221,6 +238,7 @@ public class MapRepositoryFaultTolerantStepFactoryBeanRollbackTests { processed.clear(); } + @Override public String process(String item) throws Exception { processed.add(item); logger.debug("Processed item: "+item); diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/MapRepositoryFaultTolerantStepFactoryBeanTests.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/MapRepositoryFaultTolerantStepFactoryBeanTests.java index 6044d1f13..f5fdf64c5 100644 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/MapRepositoryFaultTolerantStepFactoryBeanTests.java +++ b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/MapRepositoryFaultTolerantStepFactoryBeanTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.test.step; import static org.junit.Assert.assertEquals; @@ -98,7 +113,7 @@ public class MapRepositoryFaultTolerantStepFactoryBeanTests { if (i%100==0) { logger.info("Starting step: "+i); - repository = new MapJobRepositoryFactoryBean(transactionManager).getJobRepository(); + repository = new MapJobRepositoryFactoryBean(transactionManager).getObject(); factory.setJobRepository(repository); jobExecution = repository.createJobExecution("vanillaJob", new JobParameters()); } @@ -113,7 +128,7 @@ public class MapRepositoryFaultTolerantStepFactoryBeanTests { try { - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); stepExecution = jobExecution.createStepExecution(factory.getName()); repository.add(stepExecution); @@ -157,6 +172,7 @@ public class MapRepositoryFaultTolerantStepFactoryBeanTests { counter = -1; } + @Override public synchronized String read() throws Exception, UnexpectedInputException, ParseException { counter++; if (counter >= items.length) { @@ -181,6 +197,7 @@ public class MapRepositoryFaultTolerantStepFactoryBeanTests { written.clear(); } + @Override public void write(List items) throws Exception { for (String item : items) { written.add(item); @@ -209,6 +226,7 @@ public class MapRepositoryFaultTolerantStepFactoryBeanTests { processed.clear(); } + @Override public String process(String item) throws Exception { processed.add(item); logger.debug("Processed item: "+item); diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/SplitJobMapRepositoryIntegrationTests.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/SplitJobMapRepositoryIntegrationTests.java index 47a0e1dc4..6c238d294 100644 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/SplitJobMapRepositoryIntegrationTests.java +++ b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/SplitJobMapRepositoryIntegrationTests.java @@ -45,12 +45,13 @@ public class SplitJobMapRepositoryIntegrationTests { /** Logger */ private final Log logger = LogFactory.getLog(getClass()); + @SuppressWarnings("resource") @Test public void testMultithreadedSplit() throws Throwable { JobLauncher jobLauncher = null; Job job = null; - + ClassPathXmlApplicationContext context = null; for (int i = 0; i < MAX_COUNT; i++) { @@ -62,8 +63,8 @@ public class SplitJobMapRepositoryIntegrationTests { logger.info("Starting job: " + i); context = new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass()); - jobLauncher = (JobLauncher) context.getBean("jobLauncher", JobLauncher.class); - job = (Job) context.getBean("job", Job.class); + jobLauncher = context.getBean("jobLauncher", JobLauncher.class); + job = context.getBean("job", Job.class); } try { @@ -86,6 +87,7 @@ public class SplitJobMapRepositoryIntegrationTests { private AtomicInteger count = new AtomicInteger(0); + @Override public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { contribution.incrementReadCount(); contribution.incrementWriteCount(1); diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/timeout/TimeoutJobIntegrationTests.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/timeout/TimeoutJobIntegrationTests.java index 93c3c34d9..eec8e7fed 100644 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/timeout/TimeoutJobIntegrationTests.java +++ b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/timeout/TimeoutJobIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.test.timeout; import static org.junit.Assert.assertEquals; @@ -21,6 +36,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; public class TimeoutJobIntegrationTests { /** Logger */ + @SuppressWarnings("unused") private final Log logger = LogFactory.getLog(getClass()); @Autowired diff --git a/spring-batch-core-tests/src/test/java/test/jdbc/datasource/DataSourceInitializer.java b/spring-batch-core-tests/src/test/java/test/jdbc/datasource/DataSourceInitializer.java index 5d4aad94c..a2dc03f58 100644 --- a/spring-batch-core-tests/src/test/java/test/jdbc/datasource/DataSourceInitializer.java +++ b/spring-batch-core-tests/src/test/java/test/jdbc/datasource/DataSourceInitializer.java @@ -56,6 +56,7 @@ public class DataSourceInitializer implements InitializingBean, DisposableBean { this.initialize = initialize; } + @Override public void destroy() throws Exception { if (!initialized) { return; @@ -76,6 +77,7 @@ public class DataSourceInitializer implements InitializingBean, DisposableBean { } } + @Override public void afterPropertiesSet() throws Exception { Assert.notNull(dataSource); logger.info("Initializing with scripts: "+Arrays.asList(initScripts)); @@ -101,10 +103,11 @@ public class DataSourceInitializer implements InitializingBean, DisposableBean { if (scriptResource == null || !scriptResource.exists()) return; TransactionTemplate transactionTemplate = new TransactionTemplate(new DataSourceTransactionManager(dataSource)); - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { + @Override @SuppressWarnings("unchecked") - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String[] scripts; try { diff --git a/spring-batch-core-tests/src/test/java/test/jdbc/datasource/DerbyDataSourceFactoryBean.java b/spring-batch-core-tests/src/test/java/test/jdbc/datasource/DerbyDataSourceFactoryBean.java index 2a16eb389..8bd47a4a5 100644 --- a/spring-batch-core-tests/src/test/java/test/jdbc/datasource/DerbyDataSourceFactoryBean.java +++ b/spring-batch-core-tests/src/test/java/test/jdbc/datasource/DerbyDataSourceFactoryBean.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package test.jdbc.datasource; import java.io.File; @@ -7,7 +22,7 @@ import javax.sql.DataSource; import org.apache.derby.jdbc.EmbeddedDataSource; import org.springframework.beans.factory.config.AbstractFactoryBean; -public class DerbyDataSourceFactoryBean extends AbstractFactoryBean { +public class DerbyDataSourceFactoryBean extends AbstractFactoryBean { private String dataDirectory = "derby-home"; @@ -15,7 +30,8 @@ public class DerbyDataSourceFactoryBean extends AbstractFactoryBean { this.dataDirectory = dataDirectory; } - protected Object createInstance() throws Exception { + @Override + protected DataSource createInstance() throws Exception { File directory = new File(dataDirectory); System.setProperty("derby.system.home", directory.getCanonicalPath()); System.setProperty("derby.storage.fileSyncTransactionLog", "true"); @@ -28,6 +44,7 @@ public class DerbyDataSourceFactoryBean extends AbstractFactoryBean { return ds; } + @Override public Class getObjectType() { return DataSource.class; } diff --git a/spring-batch-core/.springBeans b/spring-batch-core/.springBeans index 2fe6e96d3..b0422b610 100644 --- a/spring-batch-core/.springBeans +++ b/spring-batch-core/.springBeans @@ -1,118 +1,209 @@ - - - 1 - - - - - - - src/test/resources/org/springframework/batch/core/configuration/support/test-context.xml - src/test/resources/org/springframework/batch/core/launch/support/job.xml - src/test/resources/org/springframework/batch/core/launch/support/test-environment.xml - src/test/resources/org/springframework/batch/core/launch/support/2jobs.xml - src/test/resources/org/springframework/batch/core/repository/dao/data-source-context.xml - src/test/resources/org/springframework/batch/core/launch/support/job2.xml - src/test/resources/org/springframework/batch/core/repository/dao/sql-dao-test.xml - src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry.xml - src/test/resources/org/springframework/batch/core/configuration/support/trivial-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/BranchStepJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/common-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/OneStepJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/TwoStepJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/scope/util/AsyncPlaceholderTargetSourceTests-context.xml - src/test/resources/org/springframework/batch/core/scope/AsyncStepScopeIntegrationTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/DecisionJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/JobExecutionListenerParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/JobRepositoryParserTests-context.xml - src/test/resources/org/springframework/batch/core/partition/launch-context.xml - src/test/resources/org/springframework/batch/core/scope/util/MultipleContextPlaceholderTargetSourceTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/NextAttributeJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/RepositoryJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/scope/util/SimplePlaceholderTargetSourceTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/SplitJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/scope/StepScopeDestructionCallbackIntegrationTests-context.xml - src/test/resources/org/springframework/batch/core/scope/StepScopeIntegrationTests-context.xml - src/test/resources/org/springframework/batch/core/scope/StepScopeNestedIntegrationTests-context.xml - src/test/resources/org/springframework/batch/core/scope/StepScopePlaceholderIntegrationTests-context.xml - src/test/resources/org/springframework/batch/core/scope/StepScopeStartupIntegrationTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StepWithBasicProcessTaskJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StepWithFaultTolerantProcessTaskJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StepWithSimpleTaskJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StopJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/EndTransitionJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/DefaultFailureJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/DefaultSuccessJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/EndTransitionDefaultStatusJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/FailTransitionDefaultStatusJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/FailTransitionJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/SplitDifferentResultsFailFirstJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/SplitDifferentResultsFailSecondJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StepParserBeanNameTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StepParserTaskletAttributesTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StopIncompleteJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/AutoRegisteringStepScopeForJobElementTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/AutoRegisteringStepScopeForStepElementTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StopAndRestartJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StopRestartOnCompletedStepJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StopRestartOnFailedStepJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/JobRegistryJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/launch/JobLauncherIntegrationTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StopCustomStatusJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceCustomEditorTests-context.xml - src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceErrorTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/support/child-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementParentAttributeParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/DuplicateTransitionJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/launch/support/error.xml - src/test/resources/org/springframework/batch/core/step/item/FaultTolerantExceptionClassesTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/FlowJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/InlineItemHandlerParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/JobParserNextOutOfScopeTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/JobParserParentAttributeTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/JobParserUnreachableStepInFlowTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/JobParserUnreachableStepTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/JobRepositoryParserReferenceTests-context.xml - src/test/resources/org/springframework/batch/core/launch/support/launcher-with-environment.xml - src/test/resources/org/springframework/batch/core/launch/support/launcher-with-locator.xml - src/test/resources/org/springframework/batch/core/resource/ListPreparedStatementSetterTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/NextAttributeMultipleFinalJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/support/parent-context.xml - src/test/resources/org/springframework/batch/core/repository/support/SimpleJobRepositoryProxyTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/SplitInterruptedJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StepListenerParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StepParserBadRetryListenerTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StepParserBadStepListenerTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StepParserCommitIntervalCompletionPolicyTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StepParserCommitIntervalTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StepParserCompletionPolicyTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StepParserNoCommitIntervalOrCompletionPolicyTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StepParserParentAttributeTests-context.xml - src/test/resources/org/springframework/batch/core/scope/StepScopePerformanceTests-context.xml - src/test/resources/org/springframework/batch/core/scope/StepScopeProxyTargetClassIntegrationTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/StopAndRestartFailedJobParserTests-context.xml - src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry-and-auto-register.xml - src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementIllegalAttributeParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementIllegalTransactionalAttributeParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementSimpleAttributeParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementTransactionalAttributeParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/FlowStepParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/JobParserWrongSchemaInRootTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/PartitionStepParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementSkipPolicyParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/xml/JobStepParserTests-context.xml - src/test/resources/org/springframework/batch/core/configuration/support/AutomaticJobRegistrarContextTests-context.xml - - - - - true - false - - src/test/resources/org/springframework/batch/core/launch/support/job.xml - src/test/resources/org/springframework/batch/core/launch/support/test-environment.xml - - - - + + + 1 + + + + + + + src/test/resources/org/springframework/batch/core/configuration/support/test-context.xml + src/test/resources/org/springframework/batch/core/launch/support/job.xml + src/test/resources/org/springframework/batch/core/launch/support/test-environment.xml + src/test/resources/org/springframework/batch/core/launch/support/2jobs.xml + src/test/resources/org/springframework/batch/core/repository/dao/data-source-context.xml + src/test/resources/org/springframework/batch/core/launch/support/job2.xml + src/test/resources/org/springframework/batch/core/repository/dao/sql-dao-test.xml + src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry.xml + src/test/resources/org/springframework/batch/core/configuration/support/trivial-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/BranchStepJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/common-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/OneStepJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/TwoStepJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/scope/AsyncStepScopeIntegrationTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/DecisionJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/JobExecutionListenerParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/JobRepositoryParserTests-context.xml + src/test/resources/org/springframework/batch/core/partition/launch-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/NextAttributeJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/RepositoryJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/SplitJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/scope/StepScopeDestructionCallbackIntegrationTests-context.xml + src/test/resources/org/springframework/batch/core/scope/StepScopeIntegrationTests-context.xml + src/test/resources/org/springframework/batch/core/scope/StepScopeNestedIntegrationTests-context.xml + src/test/resources/org/springframework/batch/core/scope/StepScopePlaceholderIntegrationTests-context.xml + src/test/resources/org/springframework/batch/core/scope/StepScopeStartupIntegrationTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/StepWithBasicProcessTaskJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/StepWithFaultTolerantProcessTaskJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/StepWithSimpleTaskJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/StopJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/EndTransitionJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/DefaultFailureJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/DefaultSuccessJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/EndTransitionDefaultStatusJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/FailTransitionDefaultStatusJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/FailTransitionJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/SplitDifferentResultsFailFirstJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/SplitDifferentResultsFailSecondJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/StepParserBeanNameTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/StepParserTaskletAttributesTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/StopIncompleteJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/AutoRegisteringStepScopeForJobElementTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/AutoRegisteringStepScopeForStepElementTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/StopAndRestartJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/StopRestartOnCompletedStepJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/StopRestartOnFailedStepJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/JobRegistryJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/launch/JobLauncherIntegrationTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/StopCustomStatusJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/support/child-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementParentAttributeParserTests-context.xml + src/test/resources/org/springframework/batch/core/launch/support/error.xml + src/test/resources/org/springframework/batch/core/step/item/FaultTolerantExceptionClassesTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/FlowJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/InlineItemHandlerParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/JobParserNextOutOfScopeTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/JobParserParentAttributeTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/JobRepositoryParserReferenceTests-context.xml + src/test/resources/org/springframework/batch/core/launch/support/launcher-with-environment.xml + src/test/resources/org/springframework/batch/core/launch/support/launcher-with-locator.xml + src/test/resources/org/springframework/batch/core/resource/ListPreparedStatementSetterTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/support/parent-context.xml + src/test/resources/org/springframework/batch/core/repository/support/SimpleJobRepositoryProxyTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/SplitInterruptedJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/StepListenerParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/StepParserCommitIntervalTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/StepParserCompletionPolicyTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/StepParserParentAttributeTests-context.xml + src/test/resources/org/springframework/batch/core/scope/StepScopePerformanceTests-context.xml + src/test/resources/org/springframework/batch/core/scope/StepScopeProxyTargetClassIntegrationTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/StopAndRestartFailedJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry-and-auto-register.xml + src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementIllegalAttributeParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementIllegalTransactionalAttributeParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementSimpleAttributeParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementTransactionalAttributeParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/FlowStepParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/PartitionStepParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementSkipPolicyParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/JobStepParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/support/AutomaticJobRegistrarContextTests-context.xml + src/test/resources/org/springframework/batch/core/scope/AsyncJobScopeIntegrationTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/AutoRegisteringJobScopeForJobElementTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/AutoRegisteringJobScopeForStepElementTests-context.xml + src/main/resources/baseContext.xml + src/main/resources/beanRefContext.xml + src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementIllegalSkipAndRetryAttributeParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementLateBindingParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementRetryPolicyParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementSkipAndRetryAttributeParserTests-context.xml + src/test/resources/org/springframework/batch/core/jsr/configuration/xml/ChunkListenerParsingTests-context.xml + src/test/resources/META-INF/batch-jobs/contextClosingTests.xml + src/test/resources/META-INF/batch-jobs/DecisionStepTests-decisionAfterFlow-context.xml + src/test/resources/META-INF/batch-jobs/DecisionStepTests-decisionAfterSplit-context.xml + src/test/resources/META-INF/batch-jobs/DecisionStepTests-decisionAsFirstStep-context.xml + src/test/resources/META-INF/batch-jobs/DecisionStepTests-decisionCustomExitStatus-context.xml + src/test/resources/META-INF/batch-jobs/DecisionStepTests-decisionInvalidExitStatus-context.xml + src/test/resources/META-INF/batch-jobs/DecisionStepTests-decisionThrowsException-context.xml + src/test/resources/META-INF/batch-jobs/DecisionStepTests-decisionValidExitStatus-context.xml + src/test/resources/META-INF/batch-jobs/DecisionStepTests-restart-context.xml + src/test/resources/org/springframework/batch/core/jsr/configuration/xml/default-split-task-executor-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/DefaultUnknownJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/jsr/configuration/xml/ExceptionHandlingParsingTests-context.xml + src/test/resources/META-INF/batch-jobs/FlowParserTests-context.xml + src/test/resources/META-INF/batch-jobs/FlowParserTestsStepGetsFailedTransitionWhenNextAttributePresent.xml + src/test/resources/META-INF/batch-jobs/FlowParserTestsStepNoOverrideWhenNextAndFailedTransitionElementExists.xml + src/test/resources/META-INF/batch-jobs/FlowParserTestsWildcardAndNextAttrJob.xml + src/test/resources/org/springframework/batch/core/configuration/xml/InlineItemHandlerWithStepScopeParserTests-context.xml + src/test/resources/org/springframework/batch/core/jsr/configuration/xml/ItemListenerParsingTests-context.xml + src/test/resources/org/springframework/batch/core/jsr/configuration/xml/ItemSkipParsingTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/support/job-context-with-separate-steps.xml + src/test/resources/org/springframework/batch/core/configuration/support/job-context-with-steps.xml + src/test/resources/org/springframework/batch/core/configuration/xml/JobExecutionListenerMethodAttributeParserTests-context.xml + src/test/resources/org/springframework/batch/core/jsr/configuration/xml/JobListenerParsingTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/JobParserValidatorTests-context.xml + src/test/resources/org/springframework/batch/core/jsr/configuration/xml/JobPropertySubstitutionTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/support/JobRegistryIntegrationTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/JobRepositoryDefaultParserTests-context.xml + src/test/resources/org/springframework/batch/core/scope/JobScopeDestructionCallbackIntegrationTests-context.xml + src/test/resources/org/springframework/batch/core/scope/JobScopeIntegrationTests-context.xml + src/test/resources/org/springframework/batch/core/scope/JobScopeNestedIntegrationTests-context.xml + src/test/resources/org/springframework/batch/core/scope/JobScopePlaceholderIntegrationTests-context.xml + src/test/resources/org/springframework/batch/core/scope/JobScopeProxyTargetClassIntegrationTests-context.xml + src/test/resources/org/springframework/batch/core/scope/JobScopeStartupIntegrationTests-context.xml + src/test/resources/org/springframework/batch/core/jsr/configuration/xml/JsrDecisionParsingTests-context.xml + src/test/resources/META-INF/batch-jobs/JsrSplitParsingTests-context.xml + src/test/resources/META-INF/batch-jobs/jsrSpringInstanceTests.xml + src/test/resources/org/springframework/batch/core/configuration/xml/NamespacePrefixedJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/NextAttributeUnknownJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/jsr/configuration/xml/override_batch.xml + src/test/resources/org/springframework/batch/core/configuration/xml/ParentRetryableLateBindingStepFactoryBeanParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/ParentRetryableStepFactoryBeanParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/ParentSkippableLateBindingStepFactoryBeanParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/ParentSkippableStepFactoryBeanParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/ParentStepFactoryBeanParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/PartitionStepWithFlowParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/PartitionStepWithLateBindingParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/PartitionStepWithNonDefaultTransactionManagerParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/support/placeholder-context.xml + src/test/resources/org/springframework/batch/core/configuration/support/profiles.xml + src/test/resources/org/springframework/batch/core/step/RestartInPriorStepTests-context.xml + src/test/resources/org/springframework/batch/core/jsr/configuration/xml/RetryListenerTestBase-context.xml + src/test/resources/org/springframework/batch/core/jsr/configuration/xml/RetryReadListenerExhausted.xml + src/test/resources/org/springframework/batch/core/jsr/configuration/xml/RetryReadListenerListenerException.xml + src/test/resources/org/springframework/batch/core/jsr/configuration/xml/RetryReadListenerRetryOnce.xml + src/test/resources/org/springframework/batch/core/jsr/configuration/xml/SimpleItemBasedJobParsingTests-context.xml + src/test/resources/org/springframework/batch/core/jsr/configuration/xml/SimpleJobParsingTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/SplitNestedJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/StepListenerInStepParserTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/StepListenerMethodAttributeParserTests-context.xml + src/test/resources/org/springframework/batch/core/jsr/configuration/xml/StepListenerParsingTests-context.xml + src/test/resources/org/springframework/batch/core/scope/StepScopeClassIntegrationTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/annotation/StepScopeConfigurationTestsInheritence-context.xml + src/test/resources/org/springframework/batch/core/configuration/annotation/StepScopeConfigurationTestsInterface-context.xml + src/test/resources/org/springframework/batch/core/configuration/annotation/StepScopeConfigurationTestsProxyTargetClass-context.xml + src/test/resources/org/springframework/batch/core/scope/StepScopeProxyTargetClassOverrideIntegrationTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/StepWithPojoListenerJobParserTests-context.xml + src/test/resources/org/springframework/batch/core/repository/dao/TablePrefixTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/TaskletParserAdapterTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/TaskletParserBeanPropertiesTests-context.xml + src/test/resources/org/springframework/batch/core/configuration/xml/TaskletStepAllowStartIfCompleteTest-context.xml + src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-loader.xml + src/test/resources/org/springframework/batch/core/configuration/support/trivial-context-autoregister.xml + src/test/resources/org/springframework/batch/core/jsr/configuration/xml/user-specified-split-task-executor-context.xml + java:org.springframework.batch.core.configuration.annotation.AbstractBatchConfiguration + java:org.springframework.batch.core.configuration.annotation.JobBuilderConfigurationTests$AnotherConfiguration + java:org.springframework.batch.core.jsr.configuration.xml.BatchParserTests$BaseConfiguration + java:org.springframework.batch.core.configuration.annotation.JobBuilderConfigurationTests$BeansConfigurer + java:org.springframework.batch.core.explore.support.SimpleJobExplorerIntegrationTests$Config + java:org.springframework.batch.core.configuration.annotation.DataSourceConfiguration + java:org.springframework.batch.core.configuration.annotation.JobLoaderConfigurationTests$LoaderFactoryConfiguration + java:org.springframework.batch.core.configuration.annotation.JobLoaderConfigurationTests$LoaderRegistrarConfiguration + java:org.springframework.batch.core.configuration.annotation.ModularBatchConfiguration + java:org.springframework.batch.core.step.builder.RegisterMultiListenerTests$MultiListenerFaultTolerantTestConfiguration + java:org.springframework.batch.core.step.builder.RegisterMultiListenerTests$MultiListenerTestConfiguration + java:org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration + java:org.springframework.batch.core.configuration.annotation.StepScopeConfigurationTests$StepScopeConfigurationForcingInterfaceProxy + java:org.springframework.batch.core.configuration.annotation.StepScopeConfigurationTests$StepScopeConfigurationInjectingProxy + java:org.springframework.batch.core.configuration.annotation.StepScopeConfigurationTests$StepScopeConfigurationRequiringProxyTargetClass + java:org.springframework.batch.core.configuration.annotation.StepScopeConfigurationTests$StepScopeConfigurationWithDefaults + java:org.springframework.batch.core.configuration.annotation.JobLoaderConfigurationTests$TestConfiguration + java:org.springframework.batch.core.configuration.annotation.JobBuilderConfigurationTests$TestConfiguration + java:org.springframework.batch.core.configuration.annotation.JobBuilderConfigurationTests$TestConfigurer + java:org.springframework.batch.core.configuration.annotation.JobLoaderConfigurationTests$VanillaConfiguration + java:org.springframework.batch.core.configuration.annotation.StepScopeConfiguration + + + + + true + false + + src/test/resources/org/springframework/batch/core/launch/support/job.xml + src/test/resources/org/springframework/batch/core/launch/support/test-environment.xml + + + + + + diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.java b/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.java index f38d891e6..45be8fc33 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.java @@ -347,7 +347,7 @@ public class JobExecution extends Entity { } /** - * Deserialise and ensure transient fields are re-instantiated when read + * Deserialize and ensure transient fields are re-instantiated when read * back */ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecutionException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecutionException.java index 5e87b6304..4e6a46e65 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecutionException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecutionException.java @@ -24,6 +24,7 @@ package org.springframework.batch.core; * @author Dave Syer * */ +@SuppressWarnings("serial") public class JobExecutionException extends Exception { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/JobInterruptedException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/JobInterruptedException.java index 8d2ba0d51..a91f7398e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/JobInterruptedException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/JobInterruptedException.java @@ -28,6 +28,7 @@ package org.springframework.batch.core; * @author Dave Syer * */ +@SuppressWarnings("serial") public class JobInterruptedException extends JobExecutionException { private BatchStatus status = BatchStatus.STOPPED; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersInvalidException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersInvalidException.java index cbb0eab7e..e7a6d1f71 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersInvalidException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersInvalidException.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core; /** @@ -7,6 +22,7 @@ package org.springframework.batch.core; * @author Dave Syer * */ +@SuppressWarnings("serial") public class JobParametersInvalidException extends JobExecutionException { public JobParametersInvalidException(String msg) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersValidator.java b/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersValidator.java index 8e21e2ada..730916f60 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersValidator.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersValidator.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/StartLimitExceededException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/StartLimitExceededException.java index 7776b2b71..4d61a50bd 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/StartLimitExceededException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/StartLimitExceededException.java @@ -19,6 +19,7 @@ package org.springframework.batch.core; /** * Indicates the step's start limit has been exceeded. */ +@SuppressWarnings("serial") public class StartLimitExceededException extends RuntimeException { public StartLimitExceededException(String message) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/StepExecution.java b/spring-batch-core/src/main/java/org/springframework/batch/core/StepExecution.java index 7b410efd0..f53e8036d 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/StepExecution.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/StepExecution.java @@ -499,7 +499,7 @@ public class StepExecution extends Entity { } /** - * Deserialise and ensure transient fields are re-instantiated when read + * Deserialize and ensure transient fields are re-instantiated when read * back */ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/DuplicateJobException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/DuplicateJobException.java index 777ead743..886ed4e61 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/DuplicateJobException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/DuplicateJobException.java @@ -25,6 +25,7 @@ import org.springframework.batch.core.JobExecutionException; * @author Dave Syer * */ +@SuppressWarnings("serial") public class DuplicateJobException extends JobExecutionException { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/StepRegistry.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/StepRegistry.java index c3e857c38..67b5dbe39 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/StepRegistry.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/StepRegistry.java @@ -1,3 +1,18 @@ +/* + * Copyright 2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration; import org.springframework.batch.core.Step; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/StepBuilderFactory.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/StepBuilderFactory.java index fecca1672..7e8993201 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/StepBuilderFactory.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/StepBuilderFactory.java @@ -45,7 +45,7 @@ public class StepBuilderFactory { * @return a step builder */ public StepBuilder get(String name) { - StepBuilder builder = (StepBuilder) new StepBuilder(name).repository(jobRepository).transactionManager( + StepBuilder builder = new StepBuilder(name).repository(jobRepository).transactionManager( transactionManager); return builder; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/StepScope.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/StepScope.java index cee43408f..b95c4c129 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/StepScope.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/StepScope.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.annotation; import java.lang.annotation.Documented; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ApplicationContextJobFactory.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ApplicationContextJobFactory.java index 125e3daa9..9c194b4b0 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ApplicationContextJobFactory.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ApplicationContextJobFactory.java @@ -38,6 +38,7 @@ public class ApplicationContextJobFactory implements JobFactory { * containing a job with the job name provided */ public ApplicationContextJobFactory(String jobName, ApplicationContextFactory applicationContextFactory) { + @SuppressWarnings("resource") ConfigurableApplicationContext context = applicationContextFactory.createApplicationContext(); this.job = context.getBean(jobName, Job.class); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/AutomaticJobRegistrar.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/AutomaticJobRegistrar.java index 293108b74..716a4e999 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/AutomaticJobRegistrar.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/AutomaticJobRegistrar.java @@ -43,7 +43,7 @@ import org.springframework.util.Assert; * * @since 2.1 */ -public class AutomaticJobRegistrar implements Ordered, Lifecycle, ApplicationListener, ApplicationContextAware, +public class AutomaticJobRegistrar implements Ordered, Lifecycle, ApplicationListener, ApplicationContextAware, InitializingBean { private Collection applicationContextFactories = new ArrayList(); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ClassPathXmlJobRegistry.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ClassPathXmlJobRegistry.java index 728c7a8f4..278481676 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ClassPathXmlJobRegistry.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ClassPathXmlJobRegistry.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.support; /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ClasspathXmlApplicationContextsFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ClasspathXmlApplicationContextsFactoryBean.java index ba8b9d263..9e4d7fb5e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ClasspathXmlApplicationContextsFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ClasspathXmlApplicationContextsFactoryBean.java @@ -37,7 +37,7 @@ import org.springframework.core.io.Resource; * @author Dave Syer * */ -public class ClasspathXmlApplicationContextsFactoryBean implements FactoryBean, ApplicationContextAware { +public class ClasspathXmlApplicationContextsFactoryBean implements FactoryBean, ApplicationContextAware { private List resources = new ArrayList(); @@ -109,7 +109,7 @@ public class ClasspathXmlApplicationContextsFactoryBean implements FactoryBean, * @see org.springframework.beans.factory.FactoryBean#getObject() */ @Override - public Object getObject() throws Exception { + public ApplicationContextFactory[] getObject() throws Exception { if (resources == null) { return new ApplicationContextFactory[0]; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultJobLoader.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultJobLoader.java index cf3bc97db..260618e28 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultJobLoader.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultJobLoader.java @@ -147,6 +147,7 @@ public class DefaultJobLoader implements JobLoader, InitializingBean { return doLoad(factory, false); } + @SuppressWarnings("resource") private Collection doLoad(ApplicationContextFactory factory, boolean unregister) throws DuplicateJobException { Collection jobNamesBefore = jobRegistry.getJobNames(); @@ -226,7 +227,6 @@ public class DefaultJobLoader implements JobLoader, InitializingBean { // Because some steps are referenced by name, we need to look in the context to see if there // are more Step instances defined. Right now they are registered as being available in the // context of the job but we have no idea if they are linked to that Job or not. - @SuppressWarnings("unchecked") final Map allSteps = jobApplicationContext.getBeansOfType(Step.class); for (Map.Entry entry : allSteps.entrySet()) { if (!stepNames.contains(entry.getKey())) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobRegistryBeanPostProcessor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobRegistryBeanPostProcessor.java index 643e9c439..555d8d47e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobRegistryBeanPostProcessor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobRegistryBeanPostProcessor.java @@ -106,7 +106,7 @@ DisposableBean { } /** - * De-register all the {@link Job} instances that were regsistered by this + * Unregister all the {@link Job} instances that were registered by this * post processor. * @see org.springframework.beans.factory.DisposableBean#destroy() */ diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractFlowParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractFlowParser.java index 8950cfa27..abaafb4da 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractFlowParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractFlowParser.java @@ -18,7 +18,6 @@ package org.springframework.batch.core.configuration.xml; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; @@ -311,7 +310,7 @@ public abstract class AbstractFlowParser extends AbstractSingleBeanDefinitionPar * @param transitionElement The element to parse * @param stateDef The bean definition for the current state * @param parserContext the parser context for the bean factory - * @param a collection of + * @return a collection of * {@link org.springframework.batch.core.job.flow.support.StateTransition} * references */ @@ -342,7 +341,7 @@ public abstract class AbstractFlowParser extends AbstractSingleBeanDefinitionPar * default to batchStatus. * @param stateDef The bean definition for the current state * @param parserContext the parser context for the bean factory - * @param a collection of + * @return a collection of * {@link org.springframework.batch.core.job.flow.support.StateTransition} * references */ diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractListenerParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractListenerParser.java index 870195a49..779447f02 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractListenerParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractListenerParser.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import java.util.ArrayList; @@ -39,11 +54,10 @@ public abstract class AbstractListenerParser { return builder.getBeanDefinition(); } - @SuppressWarnings("unchecked") public void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { builder.addPropertyValue("delegate", parseListenerElement(element, parserContext, builder.getRawBeanDefinition())); - ManagedMap metaDataMap = new ManagedMap(); + ManagedMap metaDataMap = new ManagedMap(); for (String metaDataPropertyName : getMethodNameAttributes()) { String listenerMethod = element.getAttribute(metaDataPropertyName); if (StringUtils.hasText(listenerMethod)) { @@ -53,7 +67,6 @@ public abstract class AbstractListenerParser { builder.addPropertyValue("metaDataMap", metaDataMap); } - @SuppressWarnings("unchecked") public static BeanMetadataElement parseListenerElement(Element element, ParserContext parserContext, BeanDefinition enclosing) { String listenerRef = element.getAttribute(REF_ATTR); List beanElements = DomUtils.getChildElementsByTagName(element, BEAN_ELE); @@ -119,7 +132,7 @@ public abstract class AbstractListenerParser { return methodNameAttributes; } - protected abstract Class getBeanClass(); + protected abstract Class> getBeanClass(); protected abstract ListenerMetaData[] getMetaDataValues(); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/ChunkElementParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/ChunkElementParser.java index fa05bba2a..693b52c05 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/ChunkElementParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/ChunkElementParser.java @@ -19,10 +19,12 @@ import java.util.List; import org.springframework.batch.core.listener.StepListenerMetaData; import org.springframework.batch.repeat.policy.SimpleCompletionPolicy; +import org.springframework.beans.BeanMetadataElement; import org.springframework.beans.MutablePropertyValues; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanDefinitionHolder; import org.springframework.beans.factory.config.RuntimeBeanReference; +import org.springframework.beans.factory.config.TypedStringValue; import org.springframework.beans.factory.parsing.CompositeComponentDefinition; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; @@ -118,10 +120,11 @@ public class ChunkElementParser { } String skipLimit = element.getAttribute("skip-limit"); - ManagedMap skippableExceptions = new ExceptionElementParser().parse(element, parserContext, "skippable-exception-classes"); + ManagedMap skippableExceptions = + new ExceptionElementParser().parse(element, parserContext, "skippable-exception-classes"); if (StringUtils.hasText(skipLimit)) { if (skippableExceptions == null) { - skippableExceptions = new ManagedMap(); + skippableExceptions = new ManagedMap(); skippableExceptions.setMergeEnabled(true); } propertyValues.addPropertyValue("skipLimit", skipLimit); @@ -142,10 +145,11 @@ public class ChunkElementParser { underspecified); String retryLimit = element.getAttribute("retry-limit"); - ManagedMap retryableExceptions = new ExceptionElementParser().parse(element, parserContext, "retryable-exception-classes"); + ManagedMap retryableExceptions = + new ExceptionElementParser().parse(element, parserContext, "retryable-exception-classes"); if (StringUtils.hasText(retryLimit)) { if (retryableExceptions == null) { - retryableExceptions = new ManagedMap(); + retryableExceptions = new ManagedMap(); retryableExceptions.setMergeEnabled(true); } propertyValues.addPropertyValue("retryLimit", retryLimit); @@ -194,7 +198,6 @@ public class ChunkElementParser { private void handleItemHandler(AbstractBeanDefinition enclosing, String handlerName, String propertyName, String adapterClassName, boolean required, Element element, ParserContext parserContext, MutablePropertyValues propertyValues, boolean underspecified) { String refName = element.getAttribute(handlerName); - @SuppressWarnings("unchecked") List children = DomUtils.getChildElementsByTagName(element, handlerName); if (children.size() == 1) { if (StringUtils.hasText(refName)) { @@ -223,7 +226,6 @@ public class ChunkElementParser { * Handle the <reader/>, <processor/>, or <writer/> that * is defined within the item handler. */ - @SuppressWarnings("unchecked") private void handleItemHandlerElement(AbstractBeanDefinition enclosing, String propertyName, String adapterClassName, MutablePropertyValues propertyValues, Element element, ParserContext parserContext) { List beanElements = DomUtils.getChildElementsByTagName(element, BEAN_ELE); @@ -281,7 +283,7 @@ public class ChunkElementParser { CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(listenersElement.getTagName(), parserContext.extractSource(element)); parserContext.pushContainingComponent(compositeDef); - ManagedList retryListenerBeans = new ManagedList(); + ManagedList retryListenerBeans = new ManagedList(); retryListenerBeans.setMergeEnabled(listenersElement.hasAttribute(MERGE_ATTR) && Boolean.valueOf(listenersElement.getAttribute(MERGE_ATTR))); handleRetryListenerElements(parserContext, listenersElement, retryListenerBeans, enclosing); @@ -290,8 +292,7 @@ public class ChunkElementParser { } } - @SuppressWarnings("unchecked") - private void handleRetryListenerElements(ParserContext parserContext, Element element, ManagedList beans, + private void handleRetryListenerElements(ParserContext parserContext, Element element, ManagedList beans, BeanDefinition enclosing) { List listenerElements = DomUtils.getChildElementsByTagName(element, "listener"); if (listenerElements != null) { @@ -301,11 +302,10 @@ public class ChunkElementParser { } } - @SuppressWarnings("unchecked") private void handleStreamsElement(Element element, MutablePropertyValues propertyValues, ParserContext parserContext) { Element streamsElement = DomUtils.getChildElementByTagName(element, "streams"); if (streamsElement != null) { - ManagedList streamBeans = new ManagedList(); + ManagedList streamBeans = new ManagedList(); streamBeans.setMergeEnabled(streamsElement.hasAttribute(MERGE_ATTR) && Boolean.valueOf(streamsElement.getAttribute(MERGE_ATTR))); List streamElements = DomUtils.getChildElementsByTagName(streamsElement, "stream"); @@ -324,35 +324,5 @@ public class ChunkElementParser { propertyValues.addPropertyValue("streams", streamBeans); } } - // - // @SuppressWarnings("unchecked") - // private ManagedMap handleExceptionElement(Element element, ParserContext parserContext, String exceptionListName) { - // List children = DomUtils.getChildElementsByTagName(element, exceptionListName); - // if (children.size() == 1) { - // ManagedMap map = new ManagedMap(); - // Element exceptionClassesElement = children.get(0); - // map.setMergeEnabled(exceptionClassesElement.hasAttribute(MERGE_ATTR) - // && Boolean.valueOf(exceptionClassesElement.getAttribute(MERGE_ATTR))); - // addExceptionClasses("include", true, exceptionClassesElement, map, parserContext); - // addExceptionClasses("exclude", false, exceptionClassesElement, map, parserContext); - // map.put(ForceRollbackForWriteSkipException.class, true); - // return map; - // } - // else if (children.size() > 1) { - // parserContext.getReaderContext().error( - // "The <" + exceptionListName + "/> element may not appear more than once in a single <" - // + element.getNodeName() + "/>.", element); - // } - // return null; - // } - // - // @SuppressWarnings("unchecked") - // private void addExceptionClasses(String elementName, boolean include, Element exceptionClassesElement, - // ManagedMap map, ParserContext parserContext) { - // for (Element child : (List) DomUtils.getChildElementsByTagName(exceptionClassesElement, elementName)) { - // String className = child.getAttribute("class"); - // map.put(new TypedStringValue(className, Class.class), include); - // } - // } - // + } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/ExceptionElementParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/ExceptionElementParser.java index a5bf3501b..180626207 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/ExceptionElementParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/ExceptionElementParser.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import java.util.List; @@ -11,15 +26,14 @@ import org.w3c.dom.Element; public class ExceptionElementParser { - @SuppressWarnings("unchecked") - public ManagedMap parse(Element element, ParserContext parserContext, String exceptionListName) { + public ManagedMap parse(Element element, ParserContext parserContext, String exceptionListName) { List children = DomUtils.getChildElementsByTagName(element, exceptionListName); if (children.size() == 1) { - ManagedMap map = new ManagedMap(); + ManagedMap map = new ManagedMap(); Element exceptionClassesElement = children.get(0); addExceptionClasses("include", true, exceptionClassesElement, map, parserContext); addExceptionClasses("exclude", false, exceptionClassesElement, map, parserContext); - map.put(ForceRollbackForWriteSkipException.class, true); + map.put(new TypedStringValue(ForceRollbackForWriteSkipException.class.getName(), Class.class), true); return map; } else if (children.size() > 1) { @@ -30,9 +44,8 @@ public class ExceptionElementParser { return null; } - @SuppressWarnings("unchecked") private void addExceptionClasses(String elementName, boolean include, Element exceptionClassesElement, - ManagedMap map, ParserContext parserContext) { + ManagedMap map, ParserContext parserContext) { for (Element child : DomUtils.getChildElementsByTagName(exceptionClassesElement, elementName)) { String className = child.getAttribute("class"); map.put(new TypedStringValue(className, Class.class), include); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/FlowElementParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/FlowElementParser.java index c13e75d2a..de7aeef18 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/FlowElementParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/FlowElementParser.java @@ -26,7 +26,7 @@ import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** - * Internal parser for the <flow/> elements inside a job.. + * Internal parser for the <flow/> elements inside a job. * * @see JobParser * diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobExecutionListenerParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobExecutionListenerParser.java index 7065b75f6..be5311b64 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobExecutionListenerParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobExecutionListenerParser.java @@ -32,7 +32,7 @@ import org.springframework.batch.core.listener.ListenerMetaData; public class JobExecutionListenerParser extends AbstractListenerParser { @Override - protected Class getBeanClass() { + protected Class> getBeanClass() { return JobListenerFactoryBean.class; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobParser.java index 4a7796330..d93e09411 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobParser.java @@ -32,7 +32,7 @@ import org.springframework.util.xml.DomUtils; import org.w3c.dom.Element; /** - * Parser for the lt;job/gt; element in the Batch namespace. Sets up and returns + * Parser for the <job/> element in the Batch namespace. Sets up and returns * a bean definition for a {@link org.springframework.batch.core.Job}. * * @author Dave Syer @@ -63,7 +63,6 @@ public class JobParser extends AbstractSingleBeanDefinitionParser { * @see AbstractSingleBeanDefinitionParser#doParse(Element, ParserContext, * BeanDefinitionBuilder) */ - @SuppressWarnings("unchecked") @Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { @@ -134,7 +133,7 @@ public class JobParser extends AbstractSingleBeanDefinitionParser { CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(listenersElement.getTagName(), parserContext.extractSource(element)); parserContext.pushContainingComponent(compositeDef); - ManagedList listeners = new ManagedList(); + ManagedList listeners = new ManagedList(); listeners.setMergeEnabled(listenersElement.hasAttribute(MERGE_ATTR) && Boolean.valueOf(listenersElement.getAttribute(MERGE_ATTR))); List listenerElements = DomUtils.getChildElementsByTagName(listenersElement, "listener"); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobParserJobFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobParserJobFactoryBean.java index 45abbadc6..886c104ad 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobParserJobFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobParserJobFactoryBean.java @@ -35,7 +35,7 @@ import org.springframework.util.StringUtils; * @author Dave Syer * @since 2.0.1 */ -public class JobParserJobFactoryBean implements SmartFactoryBean { +public class JobParserJobFactoryBean implements SmartFactoryBean { private String name; @@ -56,7 +56,7 @@ public class JobParserJobFactoryBean implements SmartFactoryBean { } @Override - public final Object getObject() throws Exception { + public final FlowJob getObject() throws Exception { Assert.isTrue(StringUtils.hasText(name), "The job must have an id."); FlowJob flowJob = new FlowJob(name); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobRepositoryParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobRepositoryParser.java index bf61d561e..15f2a8c48 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobRepositoryParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobRepositoryParser.java @@ -27,7 +27,7 @@ import org.springframework.util.StringUtils; import org.w3c.dom.Element; /** - * Parser for the lt;job-repository/gt; element in the Batch namespace. Sets up + * Parser for the <job-repository/> element in the Batch namespace. Sets up * and returns a JobRepositoryFactoryBean. * * @author Thomas Risberg diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/SimpleFlowFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/SimpleFlowFactoryBean.java index 947596d8f..f64b8ed6f 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/SimpleFlowFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/SimpleFlowFactoryBean.java @@ -42,10 +42,8 @@ import org.springframework.util.Assert; * * @author Dave Syer * @author Michael Minella - * */ -@SuppressWarnings("rawtypes") -public class SimpleFlowFactoryBean implements FactoryBean, InitializingBean { +public class SimpleFlowFactoryBean implements FactoryBean, InitializingBean { private String name; @@ -111,7 +109,7 @@ public class SimpleFlowFactoryBean implements FactoryBean, InitializingBean { * @see org.springframework.beans.factory.FactoryBean#getObject() */ @Override - public Object getObject() throws Exception { + public SimpleFlow getObject() throws Exception { SimpleFlow flow = flowType.getConstructor(String.class).newInstance(name); flow.setStateTransitionComparator(stateTransitionComparator); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/SplitParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/SplitParser.java index cd3c12477..789f799e4 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/SplitParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/SplitParser.java @@ -44,9 +44,6 @@ import org.w3c.dom.Element; */ public class SplitParser { - /** - * - */ private static final String PARENT_ATTR = "parent"; private final String jobFactoryRef; @@ -90,8 +87,7 @@ public class SplitParser { parserContext.getReaderContext().error("A must contain at least two 'flow' elements.", element); } - @SuppressWarnings({"rawtypes", "unchecked"}) - Collection flows = new ManagedList(); + Collection flows = new ManagedList(); int i = 0; String prefix = idAttribute; for (Element nextElement : flowElements) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepListenerParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepListenerParser.java index bc33146f6..5f87b2bd1 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepListenerParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepListenerParser.java @@ -54,7 +54,7 @@ public class StepListenerParser extends AbstractListenerParser { } @Override - protected Class getBeanClass() { + protected Class> getBeanClass() { return StepListenerFactoryBean.class; } @@ -63,7 +63,7 @@ public class StepListenerParser extends AbstractListenerParser { return listenerMetaData; } - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings("unchecked") public void handleListenersElement(Element stepElement, BeanDefinition beanDefinition, ParserContext parserContext) { MutablePropertyValues propertyValues = beanDefinition.getPropertyValues(); @@ -73,9 +73,9 @@ public class StepListenerParser extends AbstractListenerParser { CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(listenersElement.getTagName(), parserContext.extractSource(stepElement)); parserContext.pushContainingComponent(compositeDef); - ManagedList listenerBeans = new ManagedList(); + ManagedList listenerBeans = new ManagedList(); if (propertyValues.contains("listeners")) { - listenerBeans = (ManagedList) propertyValues.getPropertyValue("listeners").getValue(); + listenerBeans = (ManagedList) propertyValues.getPropertyValue("listeners").getValue(); } listenerBeans.setMergeEnabled(listenersElement.hasAttribute(MERGE_ATTR) && Boolean.valueOf(listenersElement.getAttribute(MERGE_ATTR))); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBean.java index fa1e0efbb..7953432c1 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBean.java @@ -112,8 +112,7 @@ import org.springframework.util.Assert; * @see TaskletStep * @since 2.0 */ -@SuppressWarnings("rawtypes") -public class StepParserStepFactoryBean implements FactoryBean, BeanNameAware { +public class StepParserStepFactoryBean implements FactoryBean, BeanNameAware { // // Step Attributes @@ -266,7 +265,7 @@ public class StepParserStepFactoryBean implements FactoryBean, BeanNameAwa * @see FactoryBean#getObject() */ @Override - public Object getObject() throws Exception { + public Step getObject() throws Exception { if (hasChunkElement) { Assert.isNull(tasklet, "Step [" + name + "] has both a element and a 'ref' attribute referencing a Tasklet."); @@ -442,9 +441,8 @@ public class StepParserStepFactoryBean implements FactoryBean, BeanNameAwa } } - @SuppressWarnings("unchecked") protected Step createSimpleStep() { - SimpleStepBuilder builder = getSimpleStepBuilder(name); + SimpleStepBuilder builder = getSimpleStepBuilder(name); setChunk(builder); @@ -456,7 +454,7 @@ public class StepParserStepFactoryBean implements FactoryBean, BeanNameAwa return builder.build(); } - protected void setChunk(SimpleStepBuilder builder) { + protected void setChunk(SimpleStepBuilder builder) { if (commitInterval != null) { builder.chunk(commitInterval); } @@ -467,9 +465,8 @@ public class StepParserStepFactoryBean implements FactoryBean, BeanNameAwa return this.chunkCompletionPolicy; } - @SuppressWarnings("unchecked") - protected SimpleStepBuilder getSimpleStepBuilder(String stepName) { - return new SimpleStepBuilder(new StepBuilder(stepName)); + protected SimpleStepBuilder getSimpleStepBuilder(String stepName) { + return new SimpleStepBuilder(new StepBuilder(stepName)); } /** @@ -818,15 +815,15 @@ public class StepParserStepFactoryBean implements FactoryBean, BeanNameAwa skipListeners.add(skipListener); } if(listener instanceof SkipReadListener) { - SkipListener skipListener = new SkipListenerAdapter((SkipReadListener) listener, null, null); + SkipListener skipListener = new SkipListenerAdapter((SkipReadListener) listener, null, null); skipListeners.add(skipListener); } if(listener instanceof SkipProcessListener) { - SkipListener skipListener = new SkipListenerAdapter(null,(SkipProcessListener) listener, null); + SkipListener skipListener = new SkipListenerAdapter(null,(SkipProcessListener) listener, null); skipListeners.add(skipListener); } if(listener instanceof SkipWriteListener) { - SkipListener skipListener = new SkipListenerAdapter(null, null, (SkipWriteListener) listener); + SkipListener skipListener = new SkipListenerAdapter(null, null, (SkipWriteListener) listener); skipListeners.add(skipListener); } if (listener instanceof StepExecutionListener) { @@ -850,7 +847,7 @@ public class StepParserStepFactoryBean implements FactoryBean, BeanNameAwa readListeners.add(readListener); } if(listener instanceof javax.batch.api.chunk.listener.ItemReadListener) { - ItemReadListener itemListener = new ItemReadListenerAdapter((javax.batch.api.chunk.listener.ItemReadListener) listener); + ItemReadListener itemListener = new ItemReadListenerAdapter((javax.batch.api.chunk.listener.ItemReadListener) listener); readListeners.add(itemListener); } if (listener instanceof ItemWriteListener) { @@ -858,7 +855,7 @@ public class StepParserStepFactoryBean implements FactoryBean, BeanNameAwa writeListeners.add(writeListener); } if(listener instanceof javax.batch.api.chunk.listener.ItemWriteListener) { - ItemWriteListener itemListener = new ItemWriteListenerAdapter((javax.batch.api.chunk.listener.ItemWriteListener) listener); + ItemWriteListener itemListener = new ItemWriteListenerAdapter((javax.batch.api.chunk.listener.ItemWriteListener) listener); writeListeners.add(itemListener); } if (listener instanceof ItemProcessListener) { @@ -866,7 +863,7 @@ public class StepParserStepFactoryBean implements FactoryBean, BeanNameAwa processListeners.add(processListener); } if(listener instanceof javax.batch.api.chunk.listener.ItemProcessListener) { - ItemProcessListener itemListener = new ItemProcessListenerAdapter((javax.batch.api.chunk.listener.ItemProcessListener) listener); + ItemProcessListener itemListener = new ItemProcessListenerAdapter((javax.batch.api.chunk.listener.ItemProcessListener) listener); processListeners.add(itemListener); } if(listener instanceof RetryReadListener) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/TaskletParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/TaskletParser.java index 25b8e3971..a8c262a25 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/TaskletParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/TaskletParser.java @@ -42,9 +42,6 @@ import org.w3c.dom.Element; */ public class TaskletParser { - /** - * - */ private static final String TRANSACTION_MANAGER_ATTR = "transaction-manager"; private static final String TASKLET_REF_ATTR = "ref"; @@ -76,11 +73,8 @@ public class TaskletParser { String taskletRef = taskletElement.getAttribute(TASKLET_REF_ATTR); String taskletMethod = taskletElement.getAttribute(TASKLET_METHOD_ATTR); - @SuppressWarnings("unchecked") List chunkElements = DomUtils.getChildElementsByTagName(taskletElement, CHUNK_ELE); - @SuppressWarnings("unchecked") List beanElements = DomUtils.getChildElementsByTagName(taskletElement, BEAN_ELE); - @SuppressWarnings("unchecked") List refElements = DomUtils.getChildElementsByTagName(taskletElement, REF_ELE); validateTaskletAttributesAndSubelements(taskletElement, parserContext, stepUnderspecified, taskletRef, @@ -193,7 +187,6 @@ public class TaskletParser { } private void handleTransactionAttributesElement(Element stepElement, MutablePropertyValues propertyValues) { - @SuppressWarnings("unchecked") List txAttrElements = DomUtils.getChildElementsByTagName(stepElement, TX_ATTRIBUTES_ELE); if (txAttrElements.size() == 1) { Element txAttrElement = txAttrElements.get(0); @@ -212,13 +205,12 @@ public class TaskletParser { } } - @SuppressWarnings("unchecked") private void handleExceptionElement(Element element, ParserContext parserContext, MutablePropertyValues propertyValues, String exceptionListName, String propertyName) { List children = DomUtils.getChildElementsByTagName(element, exceptionListName); if (children.size() == 1) { Element exceptionClassesElement = children.get(0); - ManagedList list = new ManagedList(); + ManagedList list = new ManagedList(); list.setMergeEnabled(exceptionClassesElement.hasAttribute(MERGE_ATTR) && Boolean.valueOf(exceptionClassesElement.getAttribute(MERGE_ATTR))); addExceptionClasses("include", exceptionClassesElement, list, parserContext); @@ -231,10 +223,9 @@ public class TaskletParser { } } - @SuppressWarnings("unchecked") - private void addExceptionClasses(String elementName, Element exceptionClassesElement, ManagedList list, + private void addExceptionClasses(String elementName, Element exceptionClassesElement, ManagedList list, ParserContext parserContext) { - for (Element child : (List) DomUtils.getChildElementsByTagName(exceptionClassesElement, elementName)) { + for (Element child : DomUtils.getChildElementsByTagName(exceptionClassesElement, elementName)) { String className = child.getAttribute("class"); list.add(new TypedStringValue(className, Class.class)); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/TopLevelJobListenerParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/TopLevelJobListenerParser.java index c74beaa9f..98409f6d4 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/TopLevelJobListenerParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/TopLevelJobListenerParser.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import org.springframework.batch.core.listener.AbstractListenerFactoryBean; @@ -23,7 +38,7 @@ public class TopLevelJobListenerParser extends AbstractSingleBeanDefinitionParse } @Override - protected Class getBeanClass(Element element) { + protected Class> getBeanClass(Element element) { return jobListenerParser.getBeanClass(); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/TopLevelStepListenerParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/TopLevelStepListenerParser.java index 070dddddc..3904768b5 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/TopLevelStepListenerParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/TopLevelStepListenerParser.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import org.springframework.batch.core.listener.AbstractListenerFactoryBean; @@ -23,7 +38,7 @@ public class TopLevelStepListenerParser extends AbstractSingleBeanDefinitionPars } @Override - protected Class getBeanClass(Element element) { + protected Class> getBeanClass(Element element) { return stepListenerParser.getBeanClass(); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/TopLevelStepParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/TopLevelStepParser.java index d43be0157..3ea5a424f 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/TopLevelStepParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/TopLevelStepParser.java @@ -21,7 +21,7 @@ import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** - * Parser for the lt;step/gt; top level element in the Batch namespace. Sets up + * Parser for the <step/> top level element in the Batch namespace. Sets up * and returns a bean definition for a * {@link org.springframework.batch.core.Step}. * diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/AbstractJobExplorerFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/AbstractJobExplorerFactoryBean.java index a6219d8d1..06acf8d1a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/AbstractJobExplorerFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/AbstractJobExplorerFactoryBean.java @@ -34,8 +34,7 @@ import org.springframework.beans.factory.FactoryBean; * @author Dave Syer * @since 2.0 */ -@SuppressWarnings("rawtypes") -public abstract class AbstractJobExplorerFactoryBean implements FactoryBean { +public abstract class AbstractJobExplorerFactoryBean implements FactoryBean { /** * @return fully configured {@link JobInstanceDao} implementation. diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/JobExplorerFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/JobExplorerFactoryBean.java index e2c2f7017..8db481fe0 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/JobExplorerFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/JobExplorerFactoryBean.java @@ -18,6 +18,7 @@ package org.springframework.batch.core.explore.support; import javax.sql.DataSource; +import org.springframework.batch.core.explore.JobExplorer; import org.springframework.batch.core.repository.ExecutionContextSerializer; import org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao; import org.springframework.batch.core.repository.dao.ExecutionContextDao; @@ -133,7 +134,7 @@ implements InitializingBean { } } - private Object getTarget() throws Exception { + private JobExplorer getTarget() throws Exception { return new SimpleJobExplorer(createJobInstanceDao(), createJobExecutionDao(), createStepExecutionDao(), createExecutionContextDao()); @@ -181,7 +182,7 @@ implements InitializingBean { } @Override - public Object getObject() throws Exception { + public JobExplorer getObject() throws Exception { return getTarget(); } } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/MapJobExplorerFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/MapJobExplorerFactoryBean.java index b8df7e977..aa5ef961a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/MapJobExplorerFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/MapJobExplorerFactoryBean.java @@ -16,6 +16,7 @@ package org.springframework.batch.core.explore.support; +import org.springframework.batch.core.explore.JobExplorer; import org.springframework.batch.core.repository.dao.ExecutionContextDao; import org.springframework.batch.core.repository.dao.JobExecutionDao; import org.springframework.batch.core.repository.dao.JobInstanceDao; @@ -38,7 +39,7 @@ public class MapJobExplorerFactoryBean extends AbstractJobExplorerFactoryBean im /** * Create an instance with the provided {@link MapJobRepositoryFactoryBean} - * as a source of Dao instances. + * as a source of DAO instances. * @param repositoryFactory */ public MapJobExplorerFactoryBean(MapJobRepositoryFactoryBean repositoryFactory) { @@ -92,7 +93,7 @@ public class MapJobExplorerFactoryBean extends AbstractJobExplorerFactoryBean im } @Override - public Object getObject() throws Exception { + public JobExplorer getObject() throws Exception { return new SimpleJobExplorer(createJobInstanceDao(), createJobExecutionDao(), createStepExecutionDao(), createExecutionContextDao()); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/SimpleStepHandler.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/SimpleStepHandler.java index d2cd131c6..0ea08a8d7 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/SimpleStepHandler.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/SimpleStepHandler.java @@ -183,7 +183,7 @@ public class SimpleStepHandler implements StepHandler, InitializingBean { * Given a step and configuration, return true if the step should start, * false if it should not, and throw an exception if the job should finish. * @param lastStepExecution the last step execution - * @param jobInstance + * @param jobExecution * @param step * * @throws StartLimitExceededException if the start limit has been exceeded diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/StepHandler.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/StepHandler.java index 10df10892..2e497ed5c 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/StepHandler.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/StepHandler.java @@ -36,7 +36,7 @@ public interface StepHandler { * Handle a step and return the execution for it. Does not save the * {@link JobExecution}, but should manage the persistence of the * {@link StepExecution} if required (e.g. at least it needs to be added to - * a repository before the step can eb executed). + * a repository before the step can be executed). * * @param step a {@link Step} * @param jobExecution a {@link JobExecution} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/FlowBuilderException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/FlowBuilderException.java index 7a065b5ff..0f1ad83ec 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/FlowBuilderException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/FlowBuilderException.java @@ -21,6 +21,7 @@ package org.springframework.batch.core.job.builder; * @since 2.2 * */ +@SuppressWarnings("serial") public class FlowBuilderException extends RuntimeException { public FlowBuilderException(String msg, Exception e) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/JobBuilderException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/JobBuilderException.java index c59ff9757..b5d2522e6 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/JobBuilderException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/JobBuilderException.java @@ -21,6 +21,7 @@ package org.springframework.batch.core.job.builder; * @since 2.2 * */ +@SuppressWarnings("serial") public class JobBuilderException extends RuntimeException { public JobBuilderException(Exception e) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowExecutionStatus.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowExecutionStatus.java index 24416fe93..b9be52264 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowExecutionStatus.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowExecutionStatus.java @@ -61,7 +61,7 @@ public class FlowExecutionStatus implements Comparable { return COMPLETED; } - }; + } /** * @param status diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowStep.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowStep.java index 735ff4149..dd2b7a1fb 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowStep.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowStep.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.job.flow; import org.springframework.batch.core.JobExecutionException; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/State.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/State.java index c9ba62ca6..ea56be97e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/State.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/State.java @@ -35,7 +35,7 @@ public interface State { * {@link FlowExecution}. The context can be used by implementations to do * whatever they need to do. The same context will be passed to all * {@link State} instances, so implementations should be careful that the - * context is thread safe, or used in a thread safe manner. + * context is thread-safe, or used in a thread-safe manner. * * @param executor the context passed in by the caller * @return a status for the execution diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/SimpleFlow.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/SimpleFlow.java index 75bc03f1e..bdfba5d16 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/SimpleFlow.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/SimpleFlow.java @@ -28,7 +28,6 @@ import java.util.TreeSet; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.springframework.batch.core.JobExecutionException; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.job.flow.Flow; @@ -194,7 +193,7 @@ public class SimpleFlow implements Flow, InitializingBean { /** * @return the next {@link Step} (or null if this is the end) - * @throws JobExecutionException + * @throws FlowExecutionException */ protected State nextState(String stateName, FlowExecutionStatus status, StepExecution stepExecution) throws FlowExecutionException { Set set = transitionMap.get(stateName); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/ItemWriteListenerAdapter.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/ItemWriteListenerAdapter.java index abe4c48f4..0eed96c4a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/ItemWriteListenerAdapter.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/ItemWriteListenerAdapter.java @@ -32,7 +32,6 @@ import org.springframework.util.Assert; * @param type to be written by the associated {@link ItemWriter} * @since 3.0 */ -@SuppressWarnings({"rawtypes", "unchecked"}) public class ItemWriteListenerAdapter implements ItemWriteListener { private javax.batch.api.chunk.listener.ItemWriteListener delegate; @@ -42,28 +41,31 @@ public class ItemWriteListenerAdapter implements ItemWriteListener { this.delegate = delegate; } + @SuppressWarnings("unchecked") @Override - public void beforeWrite(List items) { + public void beforeWrite(List items) { try { - delegate.beforeWrite(items); + delegate.beforeWrite((List) items); } catch (Exception e) { throw new BatchRuntimeException(e); } } + @SuppressWarnings("unchecked") @Override - public void afterWrite(List items) { + public void afterWrite(List items) { try { - delegate.afterWrite(items); + delegate.afterWrite((List) items); } catch (Exception e) { throw new BatchRuntimeException(e); } } + @SuppressWarnings("unchecked") @Override - public void onWriteError(Exception exception, List items) { + public void onWriteError(Exception exception, List items) { try { - delegate.onWriteError(items, exception); + delegate.onWriteError((List) items, exception); } catch (Exception e) { throw new BatchRuntimeException(e); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/JsrJobContextFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/JsrJobContextFactoryBean.java index 65df3c567..df2703d9c 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/JsrJobContextFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/JsrJobContextFactoryBean.java @@ -17,6 +17,7 @@ package org.springframework.batch.core.jsr; import java.util.Properties; +import javax.batch.runtime.StepExecution; import javax.batch.runtime.context.JobContext; import org.springframework.batch.core.JobExecution; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/JsrStepListenerMetaData.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/JsrStepListenerMetaData.java index cb0fddbef..5c0d68d74 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/JsrStepListenerMetaData.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/JsrStepListenerMetaData.java @@ -68,12 +68,11 @@ public enum JsrStepListenerMetaData implements ListenerMetaData { private final String methodName; private final String propertyName; - private final Class listenerInterface; + private final Class listenerInterface; private static final Map propertyMap; private final Class[] paramTypes; - @SuppressWarnings({"rawtypes", "unchecked"}) - JsrStepListenerMetaData(String methodName, String propertyName, Class listenerInterface, Class... paramTypes) { + JsrStepListenerMetaData(String methodName, String propertyName, Class listenerInterface, Class... paramTypes) { this.propertyName = propertyName; this.methodName = methodName; this.listenerInterface = listenerInterface; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/SimpleMetric.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/SimpleMetric.java index 2fc0b04dc..a6ab5c127 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/SimpleMetric.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/SimpleMetric.java @@ -32,10 +32,10 @@ public class SimpleMetric implements Metric { /** * Basic constructor. The attributes are immutable so this class is - * threadsafe. + * thread-safe. * * @param type as defined by JSR-352 - * @param value the count of the times the related type has occured. + * @param value the count of the times the related type has occurred. */ public SimpleMetric(MetricType type, long value) { Assert.notNull(type, "A MetricType is required"); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/SkipListenerAdapter.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/SkipListenerAdapter.java index 2fd7e7f44..c39dd497a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/SkipListenerAdapter.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/SkipListenerAdapter.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr; import javax.batch.api.chunk.listener.SkipProcessListener; @@ -31,10 +46,15 @@ public class SkipListenerAdapter implements SkipListener { } } + @SuppressWarnings("unchecked") @Override public void onSkipInWrite(S item, Throwable t) { if(skipWriteDelegate != null && t instanceof Exception) { try { + /* + * assuming this SkipListenerAdapter will only be called from JsrFaultTolerantChunkProcessor, + * which calls onSkipInWrite() with the whole chunk (List) of items instead of single item + */ skipWriteDelegate.onSkipWriteItem((List) item, (Exception) t); } catch (Exception e) { throw new BatchRuntimeException(e); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/BatchPropertyContext.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/BatchPropertyContext.java index 107a4e07d..aeae64efc 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/BatchPropertyContext.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/BatchPropertyContext.java @@ -218,6 +218,7 @@ public class BatchPropertyContext { * * @param properties the step artifact {@link Properties} to add */ + @SuppressWarnings("serial") public void setStepArtifactProperties(Map> properties) { Assert.notNull(properties, "Step artifact properties cannot be null"); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/SpringAutowiredAnnotationBeanPostProcessor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/SpringAutowiredAnnotationBeanPostProcessor.java index 33eacccc6..6f161b085 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/SpringAutowiredAnnotationBeanPostProcessor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/SpringAutowiredAnnotationBeanPostProcessor.java @@ -168,11 +168,13 @@ class SpringAutowiredAnnotationBeanPostProcessor extends InstantiationAwareBeanP this.order = order; } - public int getOrder() { + @Override + public int getOrder() { return this.order; } - public void setBeanFactory(BeanFactory beanFactory) throws BeansException { + @Override + public void setBeanFactory(BeanFactory beanFactory) throws BeansException { if (!(beanFactory instanceof ConfigurableListableBeanFactory)) { throw new IllegalArgumentException( "AutowiredAnnotationBeanPostProcessor requires a ConfigurableListableBeanFactory"); @@ -181,7 +183,8 @@ class SpringAutowiredAnnotationBeanPostProcessor extends InstantiationAwareBeanP } - public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class beanType, String beanName) { + @Override + public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class beanType, String beanName) { if (beanType != null) { InjectionMetadata metadata = findAutowiringMetadata(beanType); metadata.checkConfigMembers(beanDefinition); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/ThreadLocalClassloaderBeanPostProcessor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/ThreadLocalClassloaderBeanPostProcessor.java index cad2fe9a8..cd19e5eab 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/ThreadLocalClassloaderBeanPostProcessor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/ThreadLocalClassloaderBeanPostProcessor.java @@ -64,7 +64,7 @@ public class ThreadLocalClassloaderBeanPostProcessor implements BeanFactoryPostP } /** - * Sets this {@link BeanFactoryPostProcessor} to the lowest precdenece so that + * Sets this {@link BeanFactoryPostProcessor} to the lowest precedence so that * it is executed as late as possible in the chain of {@link BeanFactoryPostProcessor}s */ @Override diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/ChunkParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/ChunkParser.java index 9ccfff3b3..24b55d5f4 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/ChunkParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/ChunkParser.java @@ -116,7 +116,6 @@ public class ChunkParser { } } - @SuppressWarnings({"unchecked", "rawtypes"}) private void parseChildElement(Element element, ParserContext parserContext, MutablePropertyValues propertyValues, Node nd, String stepName) { if (nd instanceof Element) { @@ -143,18 +142,18 @@ public class ChunkParser { new PropertyParser(artifactName, parserContext, BatchArtifactType.STEP_ARTIFACT, stepName).parseProperties(nestedElement); } else if(name.equals(SKIPPABLE_EXCEPTION_CLASSES_ELEMENT)) { - ManagedMap exceptionClasses = new ExceptionElementParser().parse(element, parserContext, SKIPPABLE_EXCEPTION_CLASSES_ELEMENT); + ManagedMap exceptionClasses = new ExceptionElementParser().parse(element, parserContext, SKIPPABLE_EXCEPTION_CLASSES_ELEMENT); if(exceptionClasses != null) { propertyValues.addPropertyValue("skippableExceptionClasses", exceptionClasses); } } else if(name.equals(RETRYABLE_EXCEPTION_CLASSES_ELEMENT)) { - ManagedMap exceptionClasses = new ExceptionElementParser().parse(element, parserContext, RETRYABLE_EXCEPTION_CLASSES_ELEMENT); + ManagedMap exceptionClasses = new ExceptionElementParser().parse(element, parserContext, RETRYABLE_EXCEPTION_CLASSES_ELEMENT); if(exceptionClasses != null) { propertyValues.addPropertyValue("retryableExceptionClasses", exceptionClasses); } } else if(name.equals(NO_ROLLBACK_EXCEPTION_CLASSES_ELEMENT)) { //TODO: Update to support excludes - ManagedList list = new ManagedList(); + ManagedList list = new ManagedList(); for (Element child : DomUtils.getChildElementsByTagName(nestedElement, INCLUDE_ELEMENT)) { String className = child.getAttribute(CLASS_ATTRIBUTE); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/FlowParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/FlowParser.java index 4daf50081..063a51337 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/FlowParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/FlowParser.java @@ -217,7 +217,7 @@ public class FlowParser extends AbstractFlowParser { * default to batchStatus. * @param stateDef The bean definition for the current state * @param parserContext the parser context for the bean factory - * @param a collection of + * @return a collection of * {@link org.springframework.batch.core.job.flow.support.StateTransition} * references */ diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/ListenerParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/ListenerParser.java index 16b94d829..68ae18cbc 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/ListenerParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/ListenerParser.java @@ -45,12 +45,10 @@ public class ListenerParser { private static final String SCOPE_STEP = "step"; private static final String SCOPE_JOB = "job"; - @SuppressWarnings("rawtypes") - private Class listenerType; + private Class listenerType; private String propertyKey; - @SuppressWarnings("rawtypes") - public ListenerParser(Class listenerType, String propertyKey) { + public ListenerParser(Class listenerType, String propertyKey) { this.propertyKey = propertyKey; this.listenerType = listenerType; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/PropertyParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/PropertyParser.java index 9f86f2bed..48d222b7e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/PropertyParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/PropertyParser.java @@ -105,7 +105,6 @@ public class PropertyParser { setJobPropertiesBean(properties); } - @SuppressWarnings("unchecked") private void setProperties(Properties properties) { Object propertyValue; BeanDefinition beanDefinition = parserContext.getRegistry().getBeanDefinition(BATCH_PROPERTY_CONTEXT_BEAN_NAME); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/StepFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/StepFactoryBean.java index b7800f92b..6e15817a6 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/StepFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/StepFactoryBean.java @@ -57,9 +57,9 @@ import org.springframework.util.Assert; * @author Chris Schaefer * @since 3.0 */ -@SuppressWarnings({"rawtypes", "unchecked"}) -public class StepFactoryBean extends StepParserStepFactoryBean { +public class StepFactoryBean extends StepParserStepFactoryBean { + @SuppressWarnings("unused") private int partitions; private BatchPropertyContext batchPropertyContext; @@ -85,7 +85,7 @@ public class StepFactoryBean extends StepParserStepFactoryBean { * @see FactoryBean#getObject() */ @Override - public Object getObject() throws Exception { + public Step getObject() throws Exception { if(hasPartitionElement()) { return createPartitionStep(); } @@ -123,7 +123,7 @@ public class StepFactoryBean extends StepParserStepFactoryBean { } @Override - protected void setChunk(SimpleStepBuilder builder) { + protected void setChunk(SimpleStepBuilder builder) { if(timeout != null && getCommitInterval() != null) { CompositeCompletionPolicy completionPolicy = new CompositeCompletionPolicy(); CompletionPolicy [] policies = new CompletionPolicy[2]; @@ -167,7 +167,7 @@ public class StepFactoryBean extends StepParserStepFactoryBean { ((JsrPartitionHandler) super.getPartitionHandler()).setStep(executedStep); - JsrPartitionStepBuilder builder = new JsrSimpleStepBuilder(new StepBuilder(executedStep.getName())).partitioner(executedStep); + JsrPartitionStepBuilder builder = new JsrSimpleStepBuilder(new StepBuilder(executedStep.getName())).partitioner(executedStep); enhanceCommonStep(builder); @@ -209,11 +209,12 @@ public class StepFactoryBean extends StepParserStepFactoryBean { * @param itemReader {@link ItemReader} or {@link org.springframework.batch.item.ItemReader} implementation * @throws IllegalArgumentException if itemReader does not implement either version of ItemReader */ + @SuppressWarnings("unchecked") public void setStepItemReader(Object itemReader) { if(itemReader instanceof org.springframework.batch.item.ItemReader) { - super.setItemReader((org.springframework.batch.item.ItemReader) itemReader); + super.setItemReader((org.springframework.batch.item.ItemReader) itemReader); } else if(itemReader instanceof ItemReader){ - super.setItemReader(new ItemReaderAdapter((ItemReader) itemReader)); + super.setItemReader(new ItemReaderAdapter((ItemReader) itemReader)); } else { throw new IllegalArgumentException("The definition of an item reader must implement either " + "org.springframework.batch.item.ItemReader or javax.batch.api.chunk.ItemReader"); @@ -227,11 +228,12 @@ public class StepFactoryBean extends StepParserStepFactoryBean { * @param itemProcessor {@link ItemProcessor} or {@link org.springframework.batch.item.ItemProcessor} implementation * @throws IllegalArgumentException if itemProcessor does not implement either version of ItemProcessor */ + @SuppressWarnings("unchecked") public void setStepItemProcessor(Object itemProcessor) { if(itemProcessor instanceof org.springframework.batch.item.ItemProcessor) { - super.setItemProcessor((org.springframework.batch.item.ItemProcessor) itemProcessor); + super.setItemProcessor((org.springframework.batch.item.ItemProcessor) itemProcessor); } else if(itemProcessor instanceof ItemProcessor){ - super.setItemProcessor(new ItemProcessorAdapter((ItemProcessor)itemProcessor)); + super.setItemProcessor(new ItemProcessorAdapter((ItemProcessor)itemProcessor)); } else { throw new IllegalArgumentException("The definition of an item processor must implement either " + "org.springframework.batch.item.ItemProcessor or javax.batch.api.chunk.ItemProcessor"); @@ -245,11 +247,12 @@ public class StepFactoryBean extends StepParserStepFactoryBean { * @param itemWriter {@link ItemWriter} or {@link org.springframework.batch.item.ItemWriter} implementation * @throws IllegalArgumentException if itemWriter does not implement either version of ItemWriter */ + @SuppressWarnings("unchecked") public void setStepItemWriter(Object itemWriter) { if(itemWriter instanceof org.springframework.batch.item.ItemWriter) { - super.setItemWriter((org.springframework.batch.item.ItemWriter) itemWriter); + super.setItemWriter((org.springframework.batch.item.ItemWriter) itemWriter); } else if(itemWriter instanceof ItemWriter){ - super.setItemWriter(new ItemWriterAdapter((ItemWriter) itemWriter)); + super.setItemWriter(new ItemWriterAdapter((ItemWriter) itemWriter)); } else { throw new IllegalArgumentException("The definition of an item writer must implement either " + "org.springframework.batch.item.ItemWriter or javax.batch.api.chunk.ItemWriter"); @@ -275,15 +278,15 @@ public class StepFactoryBean extends StepParserStepFactoryBean { } @Override - protected FaultTolerantStepBuilder getFaultTolerantStepBuilder(String stepName) { - JsrFaultTolerantStepBuilder jsrFaultTolerantStepBuilder = new JsrFaultTolerantStepBuilder(new StepBuilder(stepName)); + protected FaultTolerantStepBuilder getFaultTolerantStepBuilder(String stepName) { + JsrFaultTolerantStepBuilder jsrFaultTolerantStepBuilder = new JsrFaultTolerantStepBuilder(new StepBuilder(stepName)); jsrFaultTolerantStepBuilder.setBatchPropertyContext(batchPropertyContext); return jsrFaultTolerantStepBuilder; } @Override - protected SimpleStepBuilder getSimpleStepBuilder(String stepName) { - JsrSimpleStepBuilder jsrSimpleStepBuilder = new JsrSimpleStepBuilder(new StepBuilder(stepName)); + protected SimpleStepBuilder getSimpleStepBuilder(String stepName) { + JsrSimpleStepBuilder jsrSimpleStepBuilder = new JsrSimpleStepBuilder(new StepBuilder(stepName)); jsrSimpleStepBuilder.setBatchPropertyContext(batchPropertyContext); return jsrSimpleStepBuilder; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/JsrStepHandler.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/JsrStepHandler.java index a745da83d..3b9d7777e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/JsrStepHandler.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/JsrStepHandler.java @@ -65,7 +65,7 @@ public class JsrStepHandler extends SimpleStepHandler { * Given a step and configuration, return true if the step should start, * false if it should not, and throw an exception if the job should finish. * @param lastStepExecution the last step execution - * @param jobInstance + * @param jobExecution * @param step * * @throws StartLimitExceededException if the start limit has been exceeded diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/support/JsrFlow.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/support/JsrFlow.java index 783f0030d..226c9a411 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/support/JsrFlow.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/support/JsrFlow.java @@ -17,7 +17,6 @@ package org.springframework.batch.core.jsr.job.flow.support; import java.util.Set; -import org.springframework.batch.core.JobExecutionException; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.configuration.xml.SimpleFlowFactoryBean.DelegateState; @@ -95,7 +94,7 @@ public class JsrFlow extends SimpleFlow { /** * @return the next {@link Step} (or null if this is the end) - * @throws JobExecutionException + * @throws FlowExecutionException */ private State findState(String stateName, FlowExecutionStatus status, StepExecution stepExecution) throws FlowExecutionException { Set set = getTransitionMap().get(stateName); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/launch/JsrJobOperator.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/launch/JsrJobOperator.java index 709e3b99e..2ce7efdcd 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/launch/JsrJobOperator.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/launch/JsrJobOperator.java @@ -424,7 +424,6 @@ public class JsrJobOperator implements JobOperator, InitializingBean { * @throws JobRestartException thrown for any general errors during the job restart process */ @Override - @SuppressWarnings("resource") public long restart(long executionId, Properties params) throws JobExecutionAlreadyCompleteException, NoSuchJobExecutionException, JobExecutionNotMostRecentException, @@ -587,7 +586,6 @@ public class JsrJobOperator implements JobOperator, InitializingBean { * @param params any job parameters to be used during the execution of this job. */ @Override - @SuppressWarnings("resource") public long start(String jobName, Properties params) throws JobStartException, JobSecurityException { final JsrXmlApplicationContext batchContext = new JsrXmlApplicationContext(params); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/partition/PartitionCollectorAdapter.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/partition/PartitionCollectorAdapter.java index f6c574884..9beee363e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/partition/PartitionCollectorAdapter.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/partition/PartitionCollectorAdapter.java @@ -28,7 +28,7 @@ import org.springframework.util.Assert; /** * Adapter class used to wrap a {@link PartitionCollector} so that it can be consumed - * as a {@link ChunkListener}. A thread safe {@link Queue} is required along with the + * as a {@link ChunkListener}. A thread-safe {@link Queue} is required along with the * {@link PartitionCollector}. The {@link Queue} is where the result of the call to * the PartitionCollector will be placed. * @@ -42,7 +42,7 @@ public class PartitionCollectorAdapter implements ChunkListener { private ReentrantLock lock; public PartitionCollectorAdapter(Queue queue, PartitionCollector collector) { - Assert.notNull(queue, "A thread safe Queue is required"); + Assert.notNull(queue, "A thread-safe Queue is required"); Assert.notNull(collector, "A PartitionCollector is required"); this.partitionQueue = queue; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/builder/JsrBatchletStepBuilder.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/builder/JsrBatchletStepBuilder.java index 7c28908d3..059ef89a6 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/builder/JsrBatchletStepBuilder.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/builder/JsrBatchletStepBuilder.java @@ -45,7 +45,7 @@ public class JsrBatchletStepBuilder extends TaskletStepBuilder { this.batchPropertyContext = context; } - public JsrBatchletStepBuilder(StepBuilderHelper parent) { + public JsrBatchletStepBuilder(StepBuilderHelper> parent) { super(parent); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/builder/JsrFaultTolerantStepBuilder.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/builder/JsrFaultTolerantStepBuilder.java index 24058fa0f..4a817a4b3 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/builder/JsrFaultTolerantStepBuilder.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/builder/JsrFaultTolerantStepBuilder.java @@ -129,13 +129,13 @@ public class JsrFaultTolerantStepBuilder extends FaultTolerantStepBuilder< * within the {@link ChunkOrientedTasklet} * * @return a JSR-352 implementation of the {@link ChunkProcessor} - * @see {@link JsrFaultTolerantChunkProcessor} + * @see JsrFaultTolerantChunkProcessor */ @Override - @SuppressWarnings({"unchecked", "rawtypes"}) protected ChunkProcessor createChunkProcessor() { SkipPolicy skipPolicy = getFatalExceptionAwareProxy(createSkipPolicy()); - JsrFaultTolerantChunkProcessor chunkProcessor = new JsrFaultTolerantChunkProcessor(getReader(), getProcessor(), + JsrFaultTolerantChunkProcessor chunkProcessor = + new JsrFaultTolerantChunkProcessor(getReader(), getProcessor(), getWriter(), createChunkOperations(), createRetryOperations()); chunkProcessor.setSkipPolicy(skipPolicy); chunkProcessor.setRollbackClassifier(getRollbackClassifier()); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/builder/JsrSimpleStepBuilder.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/builder/JsrSimpleStepBuilder.java index 3c45896ff..ecd783543 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/builder/JsrSimpleStepBuilder.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/builder/JsrSimpleStepBuilder.java @@ -119,13 +119,12 @@ public class JsrSimpleStepBuilder extends SimpleStepBuilder { } @Override - @SuppressWarnings({"unchecked", "rawtypes"}) protected Tasklet createTasklet() { Assert.state(getReader() != null, "ItemReader must be provided"); Assert.state(getProcessor() != null || getWriter() != null, "ItemWriter or ItemProcessor must be provided"); RepeatOperations repeatOperations = createRepeatOperations(); ChunkProvider chunkProvider = new JsrChunkProvider(); - JsrChunkProcessor chunkProcessor = new JsrChunkProcessor(getReader(), getProcessor(), getWriter(), repeatOperations); + JsrChunkProcessor chunkProcessor = new JsrChunkProcessor(getReader(), getProcessor(), getWriter(), repeatOperations); chunkProcessor.setListeners(new ArrayList(getItemListeners())); ChunkOrientedTasklet tasklet = new ChunkOrientedTasklet(chunkProvider, chunkProcessor); tasklet.setBuffering(!isReaderTransactionalQueue()); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/item/JsrChunkProcessor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/item/JsrChunkProcessor.java index cd93c05b9..953310262 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/item/JsrChunkProcessor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/item/JsrChunkProcessor.java @@ -48,8 +48,7 @@ public class JsrChunkProcessor implements ChunkProcessor { private final Log logger = LogFactory.getLog(getClass()); private ItemReader itemReader; - @SuppressWarnings("rawtypes") - private final MulticasterBatchListener listener = new MulticasterBatchListener(); + private final MulticasterBatchListener listener = new MulticasterBatchListener(); private RepeatOperations repeatTemplate; private ItemProcessor itemProcessor; private ItemWriter itemWriter; @@ -58,15 +57,14 @@ public class JsrChunkProcessor implements ChunkProcessor { this(null, null, null, null); } - public JsrChunkProcessor(ItemReader reader, ItemProcessor processor, ItemWriter writer, RepeatOperations repeatTemplate) { + public JsrChunkProcessor(ItemReader reader, ItemProcessor processor, ItemWriter writer, RepeatOperations repeatTemplate) { this.itemReader = reader; this.itemProcessor = processor; this.itemWriter = writer; this.repeatTemplate = repeatTemplate; } - @SuppressWarnings("rawtypes") - protected MulticasterBatchListener getListener() { + protected MulticasterBatchListener getListener() { return listener; } @@ -159,7 +157,6 @@ public class JsrChunkProcessor implements ChunkProcessor { * @return an item * @throws Exception */ - @SuppressWarnings("unchecked") protected final I doProvide(final StepContribution contribution, final Chunk chunk) throws Exception { try { listener.beforeRead(); @@ -184,7 +181,7 @@ public class JsrChunkProcessor implements ChunkProcessor { * {@link #doTransform(Object)} if a processor is available (returns the item unmodified if it is not) * * @param contribution a {@link StepContribution} - * @param chunk a {@link Chunk} + * @param item an item * @return a processed item if a processor is present (the unmodified item if it is not) * @throws Exception */ @@ -205,7 +202,6 @@ public class JsrChunkProcessor implements ChunkProcessor { * @return the processed item * @throws Exception */ - @SuppressWarnings("unchecked") protected final O doTransform(I item) throws Exception { try { listener.beforeProcess(item); @@ -240,7 +236,6 @@ public class JsrChunkProcessor implements ChunkProcessor { * @param chunk a {@link Chunk} * @throws Exception */ - @SuppressWarnings("unchecked") protected final void doPersist(final StepContribution contribution, final Chunk chunk) throws Exception { try { List items = chunk.getItems(); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/item/JsrFaultTolerantChunkProcessor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/item/JsrFaultTolerantChunkProcessor.java index 2f45c5270..4e9ae0ab6 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/item/JsrFaultTolerantChunkProcessor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/item/JsrFaultTolerantChunkProcessor.java @@ -22,6 +22,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.batch.core.StepContribution; import org.springframework.batch.core.StepListener; +import org.springframework.batch.core.listener.MulticasterBatchListener; import org.springframework.batch.core.step.item.BatchRetryTemplate; import org.springframework.batch.core.step.item.Chunk; import org.springframework.batch.core.step.item.ChunkMonitor; @@ -59,7 +60,7 @@ public class JsrFaultTolerantChunkProcessor extends JsrChunkProcessor private ChunkMonitor chunkMonitor = new ChunkMonitor(); private boolean hasProcessor = false; - public JsrFaultTolerantChunkProcessor(ItemReader reader, ItemProcessor processor, ItemWriter writer, RepeatOperations repeatTemplate, BatchRetryTemplate batchRetryTemplate) { + public JsrFaultTolerantChunkProcessor(ItemReader reader, ItemProcessor processor, ItemWriter writer, RepeatOperations repeatTemplate, BatchRetryTemplate batchRetryTemplate) { super(reader, processor, writer, repeatTemplate); hasProcessor = processor != null; this.batchRetryTemplate = batchRetryTemplate; @@ -290,7 +291,7 @@ public class JsrFaultTolerantChunkProcessor extends JsrChunkProcessor RetryCallback retryCallback = new RetryCallback() { @Override - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public Object doWithRetry(RetryContext context) throws Exception { chunkMonitor.setChunkSize(chunk.size()); @@ -298,10 +299,11 @@ public class JsrFaultTolerantChunkProcessor extends JsrChunkProcessor doPersist(contribution, chunk); } catch (Exception e) { - if(shouldSkip(skipPolicy, e, contribution.getStepSkipCount())) { - getListener().onSkipInWrite(chunk.getItems(), e); + if (shouldSkip(skipPolicy, e, contribution.getStepSkipCount())) { + // Per section 9.2.7 of JSR-352, the SkipListener receives all the items within the chunk + ((MulticasterBatchListener) getListener()).onSkipInWrite(chunk.getItems(), e); } else { - getListener().onRetryWriteException(chunk.getItems(), e); + getListener().onRetryWriteException((List) chunk.getItems(), e); if (rollbackClassifier.classify(e)) { throw e; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotFailedException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotFailedException.java index f972d7ce1..91a53535a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotFailedException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotFailedException.java @@ -24,6 +24,7 @@ import org.springframework.batch.core.JobExecutionException; * @author Dave Syer * */ +@SuppressWarnings("serial") public class JobExecutionNotFailedException extends JobExecutionException { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotRunningException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotRunningException.java index d64367a8a..1c71c6af6 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotRunningException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotRunningException.java @@ -24,6 +24,7 @@ import org.springframework.batch.core.JobExecutionException; * @author Dave Syer * @since 2.0 */ +@SuppressWarnings("serial") public class JobExecutionNotRunningException extends JobExecutionException { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotStoppedException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotStoppedException.java index 2afba836d..7a6fea66b 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotStoppedException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotStoppedException.java @@ -24,6 +24,7 @@ import org.springframework.batch.core.JobExecutionException; * @author Dave Syer * */ +@SuppressWarnings("serial") public class JobExecutionNotStoppedException extends JobExecutionException { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobInstanceAlreadyExistsException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobInstanceAlreadyExistsException.java index 10d5a251b..e8d4815cd 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobInstanceAlreadyExistsException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobInstanceAlreadyExistsException.java @@ -26,6 +26,7 @@ import org.springframework.batch.core.JobExecutionException; * @author Dave Syer * */ +@SuppressWarnings("serial") public class JobInstanceAlreadyExistsException extends JobExecutionException { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobParametersNotFoundException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobParametersNotFoundException.java index aa80e52ab..be654d162 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobParametersNotFoundException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobParametersNotFoundException.java @@ -26,6 +26,7 @@ import org.springframework.batch.core.JobParametersIncrementer; * @author Dave Syer * */ +@SuppressWarnings("serial") public class JobParametersNotFoundException extends JobExecutionException { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobException.java index 44d39abd2..906a47b1e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobException.java @@ -26,6 +26,7 @@ import org.springframework.batch.core.JobExecutionException; * @author Dave Syer * */ +@SuppressWarnings("serial") public class NoSuchJobException extends JobExecutionException { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobExecutionException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobExecutionException.java index 63e863bf2..16c05b473 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobExecutionException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobExecutionException.java @@ -25,6 +25,7 @@ import org.springframework.batch.core.JobExecutionException; * @author Dave Syer * */ +@SuppressWarnings("serial") public class NoSuchJobExecutionException extends JobExecutionException { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobInstanceException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobInstanceException.java index 01629991f..c806cc5ca 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobInstanceException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobInstanceException.java @@ -25,6 +25,7 @@ import org.springframework.batch.core.JobInstance; * @author Dave Syer * */ +@SuppressWarnings("serial") public class NoSuchJobInstanceException extends JobExecutionException { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java index f4d05ace1..1091218e6 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java @@ -279,6 +279,7 @@ public class CommandLineJobRunner { * job paths. If a JobLocator has been set, then use it to obtain an actual * job, if not ask the context for it. */ + @SuppressWarnings("resource") int start(String jobPath, String jobIdentifier, String[] parameters, Set opts) { ConfigurableApplicationContext context = null; @@ -509,7 +510,7 @@ public class CommandLineJobRunner { *
    *
  • -restart: (optional) if the job has failed or stopped and the most * should be restarted. If specified then the jobIdentifier parameter can be - * interpreted either as the name of the job or the id of teh job execution + * interpreted either as the name of the job or the id of the job execution * that failed.
  • *
  • -next: (optional) if the job has a {@link JobParametersIncrementer} * that can be used to launch the next in a sequence
  • diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunner.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunner.java index 0cffcdfd7..e2f3b6809 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunner.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunner.java @@ -211,7 +211,7 @@ public class JobRegistryBackgroundJobRunner { errors.add(e); throw e; } - }; + } }).start(); logger.info("Waiting for parent context to start."); @@ -249,7 +249,7 @@ public class JobRegistryBackgroundJobRunner { } /** - * De-register all the {@link Job} instances that were regsistered by this + * Unregister all the {@link Job} instances that were registered by this * post processor. * @see org.springframework.beans.factory.DisposableBean#destroy() */ diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJobOperator.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJobOperator.java index 1ec5a5641..f892f93bd 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJobOperator.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJobOperator.java @@ -83,9 +83,6 @@ import org.springframework.util.Assert; */ public class SimpleJobOperator implements JobOperator, InitializingBean { - /** - * - */ private static final String ILLEGAL_STATE_MSG = "Illegal state (only happens on a race condition): " + "%s with name=%s and parameters=%s"; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapper.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapper.java index e97776b24..37340f0fc 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapper.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapper.java @@ -62,8 +62,8 @@ public class SimpleJvmExitCodeMapper implements ExitCodeMapper { /** * Get the operating system exit status that matches a certain Batch - * Framework Exitcode - * @param exitCode The exitcode of the Batch Job as known by the Batch + * Framework exit code + * @param exitCode The exit code of the Batch Job as known by the Batch * Framework * @return The exitCode of the Batch Job as known by the JVM */ diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/AbstractListenerFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/AbstractListenerFactoryBean.java index a631dc4de..2e2967889 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/AbstractListenerFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/AbstractListenerFactoryBean.java @@ -64,8 +64,7 @@ import org.springframework.util.Assert; * @since 2.0 * @see ListenerMetaData */ -@SuppressWarnings("rawtypes") -public abstract class AbstractListenerFactoryBean implements FactoryBean, InitializingBean { +public abstract class AbstractListenerFactoryBean implements FactoryBean, InitializingBean { private static final Log logger = LogFactory.getLog(AbstractListenerFactoryBean.class); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/JobListenerFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/JobListenerFactoryBean.java index bb39640fc..cda112986 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/JobListenerFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/JobListenerFactoryBean.java @@ -27,7 +27,7 @@ import org.springframework.batch.core.JobExecutionListener; * @see AbstractListenerFactoryBean * @see JobListenerMetaData */ -public class JobListenerFactoryBean extends AbstractListenerFactoryBean { +public class JobListenerFactoryBean extends AbstractListenerFactoryBean { @Override protected ListenerMetaData getMetaDataFromPropertyName(String propertyName) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/OrderedComposite.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/OrderedComposite.java index 19377dcd1..c5314256a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/OrderedComposite.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/OrderedComposite.java @@ -36,7 +36,6 @@ class OrderedComposite { private List ordered = new ArrayList(); - @SuppressWarnings("unchecked") private Comparator comparator = new AnnotationAwareOrderComparator(); private List list = new ArrayList(); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFactoryBean.java index 087746034..6aa56e4ff 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFactoryBean.java @@ -32,7 +32,7 @@ import org.springframework.batch.core.jsr.JsrStepListenerMetaData; * @see AbstractListenerFactoryBean * @see StepListenerMetaData */ -public class StepListenerFactoryBean extends AbstractListenerFactoryBean { +public class StepListenerFactoryBean extends AbstractListenerFactoryBean { @Override protected ListenerMetaData getMetaDataFromPropertyName(String propertyName) { @@ -60,8 +60,7 @@ public class StepListenerFactoryBean extends AbstractListenerFactoryBean { } @Override - @SuppressWarnings("rawtypes") - public Class getObjectType() { + public Class getObjectType() { return StepListener.class; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFailedException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFailedException.java index 0bd597f7e..7f78e94d5 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFailedException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFailedException.java @@ -23,6 +23,7 @@ package org.springframework.batch.core.listener; * @author Michael Minella * */ +@SuppressWarnings("serial") public class StepListenerFailedException extends RuntimeException { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/StepExecutionAggregator.java b/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/StepExecutionAggregator.java index 570ce5879..0d559b31b 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/StepExecutionAggregator.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/StepExecutionAggregator.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.partition.support; import java.util.Collection; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/ExecutionContextSerializer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/ExecutionContextSerializer.java index c17f806d6..45718f6df 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/ExecutionContextSerializer.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/ExecutionContextSerializer.java @@ -15,6 +15,8 @@ */ package org.springframework.batch.core.repository; +import java.util.Map; + import org.springframework.core.serializer.Deserializer; import org.springframework.core.serializer.Serializer; @@ -29,6 +31,6 @@ import org.springframework.core.serializer.Serializer; * @see Serializer * @see Deserializer */ -public interface ExecutionContextSerializer extends Serializer, Deserializer { +public interface ExecutionContextSerializer extends Serializer>, Deserializer> { } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobExecutionAlreadyRunningException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobExecutionAlreadyRunningException.java index 48390971d..f37a75556 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobExecutionAlreadyRunningException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobExecutionAlreadyRunningException.java @@ -21,6 +21,7 @@ import org.springframework.batch.core.JobExecutionException; * @author Dave Syer * */ +@SuppressWarnings("serial") public class JobExecutionAlreadyRunningException extends JobExecutionException { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobInstanceAlreadyCompleteException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobInstanceAlreadyCompleteException.java index d92132987..3128184cc 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobInstanceAlreadyCompleteException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobInstanceAlreadyCompleteException.java @@ -24,6 +24,7 @@ import org.springframework.batch.core.JobExecutionException; * @author Dave Syer * */ +@SuppressWarnings("serial") public class JobInstanceAlreadyCompleteException extends JobExecutionException { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRepository.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRepository.java index b970de23f..d4d48a448 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRepository.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRepository.java @@ -147,7 +147,7 @@ public interface JobRepository { * * Preconditions: {@link StepExecution} must have a valid {@link Step}. * - * @param stepExecution + * @param stepExecutions */ void addAll(Collection stepExecutions); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRestartException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRestartException.java index 778367c39..da632e1af 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRestartException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRestartException.java @@ -23,6 +23,7 @@ import org.springframework.batch.core.JobExecutionException; * @author Dave Syer * */ +@SuppressWarnings("serial") public class JobRestartException extends JobExecutionException { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/DefaultExecutionContextSerializer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/DefaultExecutionContextSerializer.java index 93323eb8a..924fe6fd2 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/DefaultExecutionContextSerializer.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/DefaultExecutionContextSerializer.java @@ -18,6 +18,7 @@ package org.springframework.batch.core.repository.dao; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.util.Map; import org.springframework.batch.core.repository.ExecutionContextSerializer; import org.springframework.core.serializer.DefaultDeserializer; @@ -49,7 +50,7 @@ public class DefaultExecutionContextSerializer implements ExecutionContextSerial */ @Override @SuppressWarnings("unchecked") - public void serialize(Object context, OutputStream out) throws IOException { + public void serialize(Map context, OutputStream out) throws IOException { Assert.notNull(context); Assert.notNull(out); @@ -62,9 +63,10 @@ public class DefaultExecutionContextSerializer implements ExecutionContextSerial * @param inputStream * @return the object serialized in the provided {@link InputStream} */ + @SuppressWarnings("unchecked") @Override - public Object deserialize(InputStream inputStream) throws IOException { - return deserializer.deserialize(inputStream); + public Map deserialize(InputStream inputStream) throws IOException { + return (Map) deserializer.deserialize(inputStream); } } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/ExecutionContextDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/ExecutionContextDao.java index 601777120..759012577 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/ExecutionContextDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/ExecutionContextDao.java @@ -59,7 +59,7 @@ public interface ExecutionContextDao { /** * Persist the execution context associated with each stepExecution in a given collection, * persistent entry for the context should not exist yet. - * @param stepExecution + * @param stepExecutions */ void saveExecutionContexts(final Collection stepExecutions); 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 c6365efb9..905de6fc7 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 @@ -246,8 +246,7 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem } /** - * @param executionId - * @param serializedContext + * @param serializedContexts * @param sql with parameters (shortContext, longContext, executionId) */ private void persistSerializedContexts(final Map serializedContexts, String sql) { @@ -287,7 +286,6 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem } } - @SuppressWarnings("unchecked") private String serializeContext(ExecutionContext ctx) { Map m = new HashMap(); for (Entry me : ctx.entrySet()) { @@ -308,7 +306,6 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem return results; } - @SuppressWarnings("unchecked") private class ExecutionContextRowMapper implements ParameterizedRowMapper { @Override @@ -322,7 +319,7 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem Map map; try { ByteArrayInputStream in = new ByteArrayInputStream(serializedContext.getBytes("ISO-8859-1")); - map = (Map) serializer.deserialize(in); + map = serializer.deserialize(in); } catch (IOException ioe) { throw new IllegalArgumentException("Unable to deserialize the execution context", ioe); 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 dfa1b6fc3..598502530 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 @@ -213,7 +213,7 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements // it // is invalid and // an exception should be thrown. - if (getJdbcTemplate().queryForInt(getQuery(CHECK_JOB_EXECUTION_EXISTS), + if (getJdbcTemplate().queryForObject(getQuery(CHECK_JOB_EXECUTION_EXISTS), Integer.class, new Object[] { jobExecution.getId() }) != 1) { throw new NoSuchObjectException("Invalid JobExecution, ID " + jobExecution.getId() + " not found."); } @@ -226,7 +226,7 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements // Avoid concurrent modifications... if (count == 0) { - int curentVersion = getJdbcTemplate().queryForInt(getQuery(CURRENT_VERSION_JOB_EXECUTION), + int curentVersion = getJdbcTemplate().queryForObject(getQuery(CURRENT_VERSION_JOB_EXECUTION), Integer.class, new Object[] { jobExecution.getId() }); throw new OptimisticLockingFailureException("Attempt to update job execution id=" + jobExecution.getId() + " with wrong version (" + jobExecution.getVersion() @@ -297,7 +297,7 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements @Override public void synchronizeStatus(JobExecution jobExecution) { - int currentVersion = getJdbcTemplate().queryForInt(getQuery(CURRENT_VERSION_JOB_EXECUTION), + int currentVersion = getJdbcTemplate().queryForObject(getQuery(CURRENT_VERSION_JOB_EXECUTION), Integer.class, jobExecution.getId()); if (currentVersion != jobExecution.getVersion().intValue()) { 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 ddba1ff31..e8f2f2d36 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 @@ -80,7 +80,7 @@ JobInstanceDao, InitializingBean { private JobKeyGenerator jobKeyGenerator = new DefaultJobKeyGenerator(); /** - * In this jdbc implementation a job id is obtained by asking the + * In this JDBC implementation a job id is obtained by asking the * jobIncrementer (which is likely a sequence) for the next long value, and * then passing the Id and parameter values into an INSERT statement. * @@ -196,16 +196,15 @@ JobInstanceDao, InitializingBean { * getLastJobInstances(java.lang.String, int) */ @Override - @SuppressWarnings("rawtypes") public List getJobInstances(String jobName, final int start, final int count) { - ResultSetExtractor extractor = new ResultSetExtractor() { + ResultSetExtractor> extractor = new ResultSetExtractor>() { private List list = new ArrayList(); @Override - public Object extractData(ResultSet rs) throws SQLException, + public List extractData(ResultSet rs) throws SQLException, DataAccessException { int rowNum = 0; while (rowNum < start && rs.next()) { @@ -221,8 +220,7 @@ JobInstanceDao, InitializingBean { }; - @SuppressWarnings("unchecked") - List result = (List) getJdbcTemplate().query(getQuery(FIND_LAST_JOBS_BY_NAME), + List result = getJdbcTemplate().query(getQuery(FIND_LAST_JOBS_BY_NAME), new Object[] { jobName }, extractor); return result; @@ -254,8 +252,9 @@ JobInstanceDao, InitializingBean { public int getJobInstanceCount(String jobName) throws NoSuchJobException { try { - return getJdbcTemplate().queryForInt( + return getJdbcTemplate().queryForObject( getQuery(COUNT_JOBS_WITH_NAME), + Integer.class, jobName); } catch (EmptyResultDataAccessException e) { throw new NoSuchJobException("No job instances were found for job name " + jobName); 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 84af2cd0b..42c9a347e 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 @@ -115,7 +115,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement @Override public void saveStepExecution(StepExecution stepExecution) { List parameters = buildStepExecutionParameters(stepExecution); - Object[] parameterValues = (Object[])parameters.get(0); + Object[] parameterValues = parameters.get(0); //Template expects an int array fails with Integer int[] parameterTypes = new int[parameters.get(1).length]; @@ -147,7 +147,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement public void setValues(PreparedStatement ps, int i) throws SQLException { StepExecution stepExecution = iterator.next(); List parameters = buildStepExecutionParameters(stepExecution); - Object[] parameterValues = (Object[]) parameters.get(0); + Object[] parameterValues = parameters.get(0); Integer[] parameterTypes = (Integer[]) parameters.get(1); for (int indx = 0; indx < parameterValues.length; indx++) { switch (parameterTypes[indx]) { @@ -250,8 +250,8 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement // Avoid concurrent modifications... if (count == 0) { - int curentVersion = getJdbcTemplate().queryForInt(getQuery(CURRENT_VERSION_STEP_EXECUTION), - new Object[] { stepExecution.getId() }); + int curentVersion = getJdbcTemplate().queryForObject(getQuery(CURRENT_VERSION_STEP_EXECUTION), + new Object[] { stepExecution.getId() }, Integer.class); throw new OptimisticLockingFailureException("Attempt to update step execution id=" + stepExecution.getId() + " with wrong version (" + stepExecution.getVersion() + "), where current version is " + curentVersion); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/XStreamExecutionContextStringSerializer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/XStreamExecutionContextStringSerializer.java index 4f050ebb6..fc48a1b2a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/XStreamExecutionContextStringSerializer.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/XStreamExecutionContextStringSerializer.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; +import java.util.Map; import org.springframework.batch.core.repository.ExecutionContextSerializer; import org.springframework.beans.factory.InitializingBean; @@ -82,7 +83,7 @@ public class XStreamExecutionContextStringSerializer implements ExecutionContext * @see Serializer#serialize(Object, OutputStream) */ @Override - public void serialize(Object context, OutputStream out) throws IOException { + public void serialize(Map context, OutputStream out) throws IOException { Assert.notNull(context); Assert.notNull(out); @@ -96,8 +97,9 @@ public class XStreamExecutionContextStringSerializer implements ExecutionContext * @return a reconstructed execution context * @see Deserializer#deserialize(InputStream) */ + @SuppressWarnings("unchecked") @Override - public Object deserialize(InputStream in) throws IOException { + public Map deserialize(InputStream in) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(in)); StringBuilder sb = new StringBuilder(); @@ -107,6 +109,6 @@ public class XStreamExecutionContextStringSerializer implements ExecutionContext sb.append(line); } - return xstream.fromXML(sb.toString()); + return (Map) xstream.fromXML(sb.toString()); } } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/AbstractJobRepositoryFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/AbstractJobRepositoryFactoryBean.java index bfda2e121..7250ef576 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/AbstractJobRepositoryFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/AbstractJobRepositoryFactoryBean.java @@ -46,7 +46,6 @@ import org.springframework.util.Assert; * @author Lucas Ward * @author Robert Kasanicky */ -@SuppressWarnings("rawtypes") public abstract class AbstractJobRepositoryFactoryBean implements FactoryBean, InitializingBean { private PlatformTransactionManager transactionManager; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/MapJobRepositoryFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/MapJobRepositoryFactoryBean.java index a66aca255..40799945a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/MapJobRepositoryFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/MapJobRepositoryFactoryBean.java @@ -83,7 +83,7 @@ public class MapJobRepositoryFactoryBean extends AbstractJobRepositoryFactoryBea } /** - * Convenience method to clear all the map daos globally, removing all + * Convenience method to clear all the map DAOs globally, removing all * entities. */ public void clear() { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/JobScope.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/JobScope.java index d49667a5f..c7cdd33e9 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/JobScope.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/JobScope.java @@ -87,9 +87,8 @@ public class JobScope extends BatchScopeSupport { /** * @see Scope#get(String, ObjectFactory) */ - @SuppressWarnings("rawtypes") @Override - public Object get(String name, ObjectFactory objectFactory) { + public Object get(String name, ObjectFactory objectFactory) { JobContext context = getContext(); Object scopedObject = context.getAttribute(name); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/StepScope.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/StepScope.java index 0959d4d70..b1f933358 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/StepScope.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/StepScope.java @@ -94,9 +94,8 @@ public class StepScope extends BatchScopeSupport { /** * @see Scope#get(String, ObjectFactory) */ - @SuppressWarnings("rawtypes") @Override - public Object get(String name, ObjectFactory objectFactory) { + public Object get(String name, ObjectFactory objectFactory) { StepContext context = getContext(); Object scopedObject = context.getAttribute(name); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/ChunkContext.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/ChunkContext.java index 26831dfb6..5927838df 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/ChunkContext.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/ChunkContext.java @@ -29,6 +29,7 @@ import org.springframework.core.AttributeAccessorSupport; * @author Dave Syer * */ +@SuppressWarnings("serial") public class ChunkContext extends AttributeAccessorSupport { private final StepContext stepContext; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/JobSynchronizationManager.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/JobSynchronizationManager.java index b3a35a323..6d34ffa27 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/JobSynchronizationManager.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/JobSynchronizationManager.java @@ -69,7 +69,7 @@ public class JobSynchronizationManager { } /** - * Method for de-registering the current context - should always and only be + * Method for unregistering the current context - should always and only be * used by in conjunction with a matching {@link #register(JobExecution)} * to ensure that {@link #getContext()} always returns the correct value. * Does not call {@link JobContext#close()} - that is left up to the caller diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepContextRepeatCallback.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepContextRepeatCallback.java index b4a383e81..c47e8f89a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepContextRepeatCallback.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepContextRepeatCallback.java @@ -54,7 +54,7 @@ public abstract class StepContextRepeatCallback implements RepeatCallback { * delegated to {@link #doInChunkContext(RepeatContext, ChunkContext)}. This * is to ensure that the current thread has a reference to the context, even * if the callback is executed in a pooled thread. Handles the registration - * and de-registration of the step context, so clients should not duplicate + * and unregistration of the step context, so clients should not duplicate * those calls. * * @see RepeatCallback#doInIteration(RepeatContext) diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepSynchronizationManager.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepSynchronizationManager.java index a1c16c295..8c4c5c6ef 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepSynchronizationManager.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepSynchronizationManager.java @@ -91,7 +91,7 @@ public class StepSynchronizationManager { } /** - * Method for de-registering the current context - should always and only be + * Method for unregistering the current context - should always and only be * used by in conjunction with a matching {@link #register(StepExecution)} * to ensure that {@link #getContext()} always returns the correct value. * Does not call {@link StepContext#close()} - that is left up to the caller diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/SynchronizationManagerSupport.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/SynchronizationManagerSupport.java index d7cf71feb..9f6eb78a0 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/SynchronizationManagerSupport.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/SynchronizationManagerSupport.java @@ -128,7 +128,7 @@ public abstract class SynchronizationManagerSupport { } /** - * Method for de-registering the current context - should always and only be + * Method for unregistering the current context - should always and only be * used by in conjunction with a matching {@link #register(Object)} to ensure that {@link #getContext()} always returns * the correct value. * Does not call close on the context - that is left up to the caller diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/FatalStepExecutionException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/FatalStepExecutionException.java index 4aac34109..7512c8227 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/FatalStepExecutionException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/FatalStepExecutionException.java @@ -21,6 +21,7 @@ import org.springframework.batch.core.UnexpectedJobExecutionException; * @author Dave Syer * */ +@SuppressWarnings("serial") public class FatalStepExecutionException extends UnexpectedJobExecutionException { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/NoSuchStepException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/NoSuchStepException.java index 7b8871fd0..eb7b42c54 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/NoSuchStepException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/NoSuchStepException.java @@ -22,6 +22,7 @@ package org.springframework.batch.core.step; * @author Dave Syer * */ +@SuppressWarnings("serial") public class NoSuchStepException extends RuntimeException { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/StepHolder.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/StepHolder.java index 175c723fd..9d6dd1f6e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/StepHolder.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/StepHolder.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step; import org.springframework.batch.core.Step; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/StepLocator.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/StepLocator.java index 7328cc84b..e18d75592 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/StepLocator.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/StepLocator.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step; import java.util.Collection; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/AbstractTaskletStepBuilder.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/AbstractTaskletStepBuilder.java index 332213a2f..a9ff578ad 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/AbstractTaskletStepBuilder.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/AbstractTaskletStepBuilder.java @@ -164,7 +164,7 @@ StepBuilderHelper> { * can be throttled (beyond any throttling provided by a thread pool). The throttle limit should be less than the * data source pool size used in the job repository for this step. * - * @param throttleLimit maximium number of concurrent tasklet executions allowed + * @param throttleLimit maximum number of concurrent tasklet executions allowed * @return this for fluent chaining */ public AbstractTaskletStepBuilder throttleLimit(int throttleLimit) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/FaultTolerantStepBuilder.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/FaultTolerantStepBuilder.java index 1ddc7673b..6a0932301 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/FaultTolerantStepBuilder.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/FaultTolerantStepBuilder.java @@ -285,7 +285,7 @@ public class FaultTolerantStepBuilder extends SimpleStepBuilder { } /** - * Sets the maximium number of failed items to skip before the step fails. Ignored if an explicit + * Sets the maximum number of failed items to skip before the step fails. Ignored if an explicit * {@link #skipPolicy(SkipPolicy)} is provided. * * @param skipLimit the skip limit to set @@ -576,7 +576,7 @@ public class FaultTolerantStepBuilder extends SimpleStepBuilder { } batchRetryTemplate.setRetryPolicy(retryPolicyWrapper); - // Co-ordinate the retry policy with the exception handler: + // Coordinate the retry policy with the exception handler: RepeatOperations stepOperations = getStepOperations(); if (stepOperations instanceof RepeatTemplate) { SimpleRetryExceptionHandler exceptionHandler = new SimpleRetryExceptionHandler(retryPolicyWrapper, @@ -608,7 +608,7 @@ public class FaultTolerantStepBuilder extends SimpleStepBuilder { } /** - * Wrap the provided {@link #setRetryPolicy(RetryPolicy)} so that it never retries explicitly non-retryable + * Wrap the provided {@link RetryPolicy} so that it never retries explicitly non-retryable * exceptions. */ private RetryPolicy getFatalExceptionAwareProxy(RetryPolicy retryPolicy) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/SimpleStepBuilder.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/SimpleStepBuilder.java index 79309b188..f3428ce10 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/SimpleStepBuilder.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/SimpleStepBuilder.java @@ -267,7 +267,7 @@ public class SimpleStepBuilder extends AbstractTaskletStepBuilder chunkOperations(RepeatOperations repeatTemplate) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/StepBuilderException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/StepBuilderException.java index 1415817aa..4cbe3cb62 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/StepBuilderException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/StepBuilderException.java @@ -22,6 +22,7 @@ package org.springframework.batch.core.step.builder; * * @since 2.2 */ +@SuppressWarnings("serial") public class StepBuilderException extends RuntimeException { public StepBuilderException(Exception e) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/TaskletStepBuilder.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/TaskletStepBuilder.java index 81edc487b..74e90e63a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/TaskletStepBuilder.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/TaskletStepBuilder.java @@ -38,7 +38,7 @@ public class TaskletStepBuilder extends AbstractTaskletStepBuilder implements FactoryBean, BeanNameAware { +public class SimpleStepFactoryBean implements FactoryBean, BeanNameAware { private String name; @@ -317,7 +316,7 @@ public class SimpleStepFactoryBean implements FactoryBean, BeanNameAware { * @see FactoryBean#getObject() */ @Override - public final Object getObject() throws Exception { + public final Step getObject() throws Exception { SimpleStepBuilder builder = createBuilder(getName()); applyConfiguration(builder); TaskletStep step = builder.build(); @@ -334,7 +333,7 @@ public class SimpleStepFactoryBean implements FactoryBean, BeanNameAware { } /** - * Returns true by default, but in most cases a {@link Step} should not be treated as thread safe. Clients are + * Returns true by default, but in most cases a {@link Step} should not be treated as thread-safe. Clients are * recommended to create a new step for each job execution. * * @see org.springframework.beans.factory.FactoryBean#isSingleton() @@ -431,7 +430,7 @@ public class SimpleStepFactoryBean implements FactoryBean, BeanNameAware { } /** - * Mkae the {@link TaskExecutor} available to subclasses + * Make the {@link TaskExecutor} available to subclasses * @return the taskExecutor to be used to execute chunks */ protected TaskExecutor getTaskExecutor() { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/Chunk.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/Chunk.java index dfce3e0cd..e12662f65 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/Chunk.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/Chunk.java @@ -96,7 +96,7 @@ public class Chunk implements Iterable { } /** - * @return a copy of the anonymous errros as an unmodifiable list + * @return a copy of the anonymous errors as an unmodifiable list */ public List getErrors() { return Collections.unmodifiableList(errors); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ChunkMonitor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ChunkMonitor.java index 3968c4009..a9edf7124 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ChunkMonitor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ChunkMonitor.java @@ -27,7 +27,7 @@ import org.springframework.batch.item.support.CompositeItemStream; /** * Manage the offset data between the last successful commit and updates made to * an input chunk. Only works with single threaded steps because it has to use a - * {@link ThreadLocal} to manage the state and co-ordinate between the caller + * {@link ThreadLocal} to manage the state and coordinate between the caller * and the wrapped {@link ItemStream}. * * @author Dave Syer diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantChunkProvider.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantChunkProvider.java index e22fbb5d2..3f69afaf8 100755 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantChunkProvider.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantChunkProvider.java @@ -71,7 +71,7 @@ public class FaultTolerantChunkProvider extends SimpleChunkProvider { /** * Classifier to determine whether exceptions have been marked as - * no-rollback (as opposed to skippable). If ecnounterd they are simply + * no-rollback (as opposed to skippable). If encountered they are simply * ignored, unless also skippable. * * @param rollbackClassifier the rollback classifier to set diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ForceRollbackForWriteSkipException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ForceRollbackForWriteSkipException.java index bd602c5ed..f6e0d96ff 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ForceRollbackForWriteSkipException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ForceRollbackForWriteSkipException.java @@ -23,6 +23,7 @@ package org.springframework.batch.core.step.item; * @author Dave Syer * */ +@SuppressWarnings("serial") public class ForceRollbackForWriteSkipException extends RuntimeException { public ForceRollbackForWriteSkipException(String msg, Throwable cause) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SimpleChunkProcessor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SimpleChunkProcessor.java index 485f89a7f..34214d35c 100755 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SimpleChunkProcessor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SimpleChunkProcessor.java @@ -265,7 +265,7 @@ public class SimpleChunkProcessor implements ChunkProcessor, Initializi * skipped they should be removed from the inputs as well. * * @param contribution the current step contribution - * @param inputs the inputs that gave rise to the ouputs + * @param inputs the inputs that gave rise to the outputs * @param outputs the outputs to write * @throws Exception if there is a problem */ diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SkipOverflowException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SkipOverflowException.java index f818c47ab..33826c457 100755 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SkipOverflowException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SkipOverflowException.java @@ -22,6 +22,7 @@ import org.springframework.batch.core.step.skip.SkipException; * @author Dave Syer * */ +@SuppressWarnings("serial") public class SkipOverflowException extends SkipException { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/NonSkippableProcessException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/NonSkippableProcessException.java index 2b82b30b9..566772d87 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/NonSkippableProcessException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/NonSkippableProcessException.java @@ -22,6 +22,7 @@ package org.springframework.batch.core.step.skip; * @author Dave Syer * */ +@SuppressWarnings("serial") public class NonSkippableProcessException extends SkipException { public NonSkippableProcessException(String msg, Throwable cause) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/NonSkippableReadException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/NonSkippableReadException.java index 7f02760b2..f287c3bb7 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/NonSkippableReadException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/NonSkippableReadException.java @@ -22,6 +22,7 @@ package org.springframework.batch.core.step.skip; * @author Dave Syer * */ +@SuppressWarnings("serial") public class NonSkippableReadException extends SkipException { public NonSkippableReadException(String msg, Throwable cause) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/NonSkippableWriteException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/NonSkippableWriteException.java index 039a8d79f..99e3cc3b9 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/NonSkippableWriteException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/NonSkippableWriteException.java @@ -22,6 +22,7 @@ package org.springframework.batch.core.step.skip; * @author Dave Syer * */ +@SuppressWarnings("serial") public class NonSkippableWriteException extends SkipException { public NonSkippableWriteException(String msg, Throwable cause) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/SkipException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/SkipException.java index bbfe3eca2..b13aa79a7 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/SkipException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/SkipException.java @@ -22,6 +22,7 @@ import org.springframework.batch.core.UnexpectedJobExecutionException; * * @author Dave Syer */ +@SuppressWarnings("serial") public abstract class SkipException extends UnexpectedJobExecutionException { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/SkipLimitExceededException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/SkipLimitExceededException.java index c3dd89ab2..e20b2d6ee 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/SkipLimitExceededException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/SkipLimitExceededException.java @@ -24,6 +24,7 @@ package org.springframework.batch.core.step.skip; * @author Lucas Ward * @author Dave Syer */ +@SuppressWarnings("serial") public class SkipLimitExceededException extends SkipException { private final int skipLimit; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/SkipListenerFailedException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/SkipListenerFailedException.java index 0e7d8e745..772ba4c78 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/SkipListenerFailedException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/SkipListenerFailedException.java @@ -26,6 +26,7 @@ import org.springframework.batch.core.UnexpectedJobExecutionException; * @author Dave Syer * */ +@SuppressWarnings("serial") public class SkipListenerFailedException extends UnexpectedJobExecutionException { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/SkipPolicyFailedException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/SkipPolicyFailedException.java index 25ccc75cc..ed388a0f2 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/SkipPolicyFailedException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/SkipPolicyFailedException.java @@ -25,6 +25,7 @@ import org.springframework.batch.core.UnexpectedJobExecutionException; * @author Dave Syer * */ +@SuppressWarnings("serial") public class SkipPolicyFailedException extends UnexpectedJobExecutionException { /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java index 6a7c42117..be8e58180 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java @@ -241,7 +241,6 @@ public class TaskletStep extends AbstractStep { * */ @Override - @SuppressWarnings("unchecked") protected void doExecute(StepExecution stepExecution) throws Exception { stream.update(stepExecution.getExecutionContext()); @@ -265,7 +264,7 @@ public class TaskletStep extends AbstractStep { RepeatStatus result; try { - result = (RepeatStatus) new TransactionTemplate(transactionManager, transactionAttribute) + result = new TransactionTemplate(transactionManager, transactionAttribute) .execute(new ChunkTransactionCallback(chunkContext, semaphore)); } catch (UncheckedTransactionException e) { @@ -324,8 +323,7 @@ public class TaskletStep extends AbstractStep { * @author Dave Syer * */ - @SuppressWarnings("rawtypes") - private class ChunkTransactionCallback extends TransactionSynchronizationAdapter implements TransactionCallback { + private class ChunkTransactionCallback extends TransactionSynchronizationAdapter implements TransactionCallback { private final StepExecution stepExecution; @@ -383,7 +381,7 @@ public class TaskletStep extends AbstractStep { } @Override - public Object doInTransaction(TransactionStatus status) { + public RepeatStatus doInTransaction(TransactionStatus status) { TransactionSynchronizationManager.registerSynchronization(this); RepeatStatus result = RepeatStatus.CONTINUABLE; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/DefaultJobKeyGeneratorTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/DefaultJobKeyGeneratorTests.java index cdca6355b..b2b3c7cb8 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/DefaultJobKeyGeneratorTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/DefaultJobKeyGeneratorTests.java @@ -35,7 +35,7 @@ public class DefaultJobKeyGeneratorTests { "foo", "bar").addString("bar", "foo").toJobParameters(); JobParameters jobParameters2 = new JobParametersBuilder().addString( "foo", "bar", true).addString("bar", "foo", true) - .addString("ignoreMe", "irrelivant", false).toJobParameters(); + .addString("ignoreMe", "irrelevant", false).toJobParameters(); String key1 = jobKeyGenerator.generateKey(jobParameters1); String key2 = jobKeyGenerator.generateKey(jobParameters2); assertEquals(key1, key2); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/JobParameterTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/JobParameterTests.java index 1baca9168..fd0179ee9 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/JobParameterTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/JobParameterTests.java @@ -1,5 +1,17 @@ -/** +/* + * Copyright 2008-2013 the original author or authors. * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.springframework.batch.core; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/JobParametersBuilderTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/JobParametersBuilderTests.java index aca692377..881884489 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/JobParametersBuilderTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/JobParametersBuilderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/JobParametersTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/JobParametersTests.java index ba454ebfd..3094ae945 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/JobParametersTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/JobParametersTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/MapJobRepositoryConfigurationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/MapJobRepositoryConfigurationTests.java index e82a4f59e..e7aaf36cc 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/MapJobRepositoryConfigurationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/MapJobRepositoryConfigurationTests.java @@ -60,7 +60,7 @@ public class MapJobRepositoryConfigurationTests { testConfigurationClass(InvalidBatchConfiguration.class); } - private void testConfigurationClass(Class clazz) throws Exception { + private void testConfigurationClass(Class clazz) throws Exception { GenericApplicationContext context = new AnnotationConfigApplicationContext(clazz); this.jobLauncher = context.getBean(JobLauncher.class); this.jobRepository = context.getBean(JobRepository.class); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/ApplicationContextJobFactoryTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/ApplicationContextJobFactoryTests.java index 2b7b8960c..41a77d1df 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/ApplicationContextJobFactoryTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/ApplicationContextJobFactoryTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.support; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/AutomaticJobRegistrarContextTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/AutomaticJobRegistrarContextTests.java index 0c9b3ea2c..98f9ddac8 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/AutomaticJobRegistrarContextTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/AutomaticJobRegistrarContextTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.support; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/AutomaticJobRegistrarTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/AutomaticJobRegistrarTests.java index 69aaf61a5..956b28a61 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/AutomaticJobRegistrarTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/AutomaticJobRegistrarTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.support; import static org.junit.Assert.assertEquals; @@ -40,6 +55,7 @@ public class AutomaticJobRegistrarTests { registrar.setJobLoader(jobLoader); } + @SuppressWarnings("cast") @Test public void testOrderedImplemented() throws Exception { @@ -57,6 +73,7 @@ public class AutomaticJobRegistrarTests { new ClassPathResource("org/springframework/batch/core/launch/support/job.xml"), new ClassPathResource("org/springframework/batch/core/launch/support/job2.xml") }; + @SuppressWarnings("resource") GenericApplicationContext applicationContext = new GenericApplicationContext(); applicationContext.refresh(); setUpApplicationContextFactories(jobPaths, applicationContext); @@ -79,6 +96,7 @@ public class AutomaticJobRegistrarTests { Resource[] jobPaths = new Resource[] { new ClassPathResource( "org/springframework/batch/core/launch/support/test-environment.xml") }; + @SuppressWarnings("resource") GenericApplicationContext applicationContext = new GenericApplicationContext(); applicationContext.refresh(); setUpApplicationContextFactories(jobPaths, applicationContext); @@ -91,6 +109,7 @@ public class AutomaticJobRegistrarTests { Resource[] jobPaths = new Resource[] { new ClassPathResource( "org/springframework/batch/core/launch/support/2jobs.xml") }; + @SuppressWarnings("resource") GenericApplicationContext applicationContext = new GenericApplicationContext(); applicationContext.refresh(); setUpApplicationContextFactories(jobPaths, applicationContext); @@ -104,6 +123,7 @@ public class AutomaticJobRegistrarTests { Resource[] jobPaths = new Resource[] { new ClassPathResource( "org/springframework/batch/core/launch/support/2jobs.xml") }; + @SuppressWarnings("resource") ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext( "/org/springframework/batch/core/launch/support/test-environment-with-registry-and-auto-register.xml"); registrar.setApplicationContext(applicationContext); @@ -156,6 +176,7 @@ public class AutomaticJobRegistrarTests { } + @SuppressWarnings("resource") @Test public void testInitCalledOnContextRefreshed() throws Exception { @@ -176,6 +197,7 @@ public class AutomaticJobRegistrarTests { Resource[] jobPaths = new Resource[] { new ClassPathResource( "org/springframework/batch/core/launch/support/2jobs.xml") }; + @SuppressWarnings("resource") GenericApplicationContext applicationContext = new GenericApplicationContext(); applicationContext.refresh(); setUpApplicationContextFactories(jobPaths, applicationContext); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/DefaultJobLoaderTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/DefaultJobLoaderTests.java index 3d1538f52..1e4fc82ae 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/DefaultJobLoaderTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/DefaultJobLoaderTests.java @@ -28,7 +28,6 @@ import org.springframework.batch.core.JobParametersIncrementer; import org.springframework.batch.core.JobParametersValidator; import org.springframework.batch.core.Step; import org.springframework.batch.core.configuration.DuplicateJobException; -import org.springframework.batch.core.configuration.JobFactory; import org.springframework.batch.core.configuration.JobRegistry; import org.springframework.batch.core.configuration.StepRegistry; import org.springframework.batch.core.launch.NoSuchJobException; @@ -257,25 +256,4 @@ public class DefaultJobLoaderTests { } } - private static class JobRegistryMock implements JobRegistry { - @Override - public void register(JobFactory jobFactory) throws DuplicateJobException { - // dummy - } - - @Override - public void unregister(String jobName) { - // dummy - } - - @Override - public Collection getJobNames() { - return Collections.emptyList(); - } - - @Override - public Job getJob(String name) throws NoSuchJobException { - throw new NoSuchJobException("Mock implementation does not hold any job."); - } - } } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/GenericApplicationContextFactoryTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/GenericApplicationContextFactoryTests.java index 922c575a6..5f6db5f65 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/GenericApplicationContextFactoryTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/GenericApplicationContextFactoryTests.java @@ -38,6 +38,7 @@ public class GenericApplicationContextFactoryTests { public void testCreateJob() { GenericApplicationContextFactory factory = new GenericApplicationContextFactory( new ClassPathResource(ClassUtils.addResourcePathToPackagePath(getClass(), "trivial-context.xml"))); + @SuppressWarnings("resource") ConfigurableApplicationContext context = factory.createApplicationContext(); assertNotNull(context); assertTrue("Wrong id: " + context, context.getId().contains("trivial-context.xml")); @@ -50,6 +51,7 @@ public class GenericApplicationContextFactoryTests { assertEquals("test-job", factory.createApplicationContext().getBeanNamesForType(Job.class)[0]); } + @SuppressWarnings("resource") @Test public void testParentConfigurationInherited() { GenericApplicationContextFactory factory = new GenericApplicationContextFactory( @@ -62,6 +64,7 @@ public class GenericApplicationContextFactoryTests { assertEquals(4, context.getBean("foo", Foo.class).values[1], 0.01); } + @SuppressWarnings("resource") @Test public void testBeanFactoryPostProcessorOrderRespected() { GenericApplicationContextFactory factory = new GenericApplicationContextFactory( @@ -77,15 +80,18 @@ public class GenericApplicationContextFactoryTests { public void testBeanFactoryProfileRespected() { GenericApplicationContextFactory factory = new GenericApplicationContextFactory( new ClassPathResource(ClassUtils.addResourcePathToPackagePath(getClass(), "profiles.xml"))); + @SuppressWarnings("resource") ClassPathXmlApplicationContext parentContext = new ClassPathXmlApplicationContext(ClassUtils.addResourcePathToPackagePath( getClass(), "parent-context.xml")); parentContext.getEnvironment().setActiveProfiles("preferred"); factory.setApplicationContext(parentContext); + @SuppressWarnings("resource") ConfigurableApplicationContext context = factory.createApplicationContext(); assertEquals("test-job", context.getBeanNamesForType(Job.class)[0]); assertEquals("spam", context.getBean("test-job", Job.class).getName()); } + @SuppressWarnings("resource") @Test public void testBeanFactoryPostProcessorsNotCopied() { GenericApplicationContextFactory factory = new GenericApplicationContextFactory( @@ -101,6 +107,7 @@ public class GenericApplicationContextFactoryTests { assertEquals(4, context.getBean("foo", Foo.class).values[1], 0.01); } + @SuppressWarnings("resource") @Test public void testBeanFactoryConfigurationNotCopied() { GenericApplicationContextFactory factory = new GenericApplicationContextFactory(new ClassPathResource(ClassUtils.addResourcePathToPackagePath(getClass(), diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/JobRegistryBeanPostProcessorTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/JobRegistryBeanPostProcessorTests.java index 9e9d9d934..5affb1ce4 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/JobRegistryBeanPostProcessorTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/JobRegistryBeanPostProcessorTests.java @@ -110,6 +110,7 @@ public class JobRegistryBeanPostProcessorTests { } @Test + @SuppressWarnings("resource") public void testExecutionWithApplicationContext() throws Exception { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("test-context.xml", getClass()); MapJobRegistry registry = (MapJobRegistry) context.getBean("registry"); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/MapStepRegistryTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/MapStepRegistryTests.java index fefa1a3da..6c0859790 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/MapStepRegistryTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/MapStepRegistryTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.support; import org.junit.Assert; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AbstractJobParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AbstractJobParserTests.java index caa1e4209..4eb885103 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AbstractJobParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AbstractJobParserTests.java @@ -60,7 +60,7 @@ public abstract class AbstractJobParserTests { */ protected JobExecution createJobExecution() throws JobInstanceAlreadyCompleteException, JobRestartException, JobExecutionAlreadyRunningException { - return jobRepository.createJobExecution(job.getName(), new JobParametersBuilder().addLong("key1", 1l).toJobParameters()); + return jobRepository.createJobExecution(job.getName(), new JobParametersBuilder().addLong("key1", 1L).toJobParameters()); } /** diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AbstractTestComponent.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AbstractTestComponent.java index f8c82cc8b..08fd897cd 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AbstractTestComponent.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AbstractTestComponent.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; public abstract class AbstractTestComponent { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AutoRegisteringJobScopeTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AutoRegisteringJobScopeTests.java index 1be49773c..70e73d19a 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AutoRegisteringJobScopeTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AutoRegisteringJobScopeTests.java @@ -32,21 +32,21 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; public class AutoRegisteringJobScopeTests { @Test + @SuppressWarnings("resource") public void testJobElement() throws Exception { ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/AutoRegisteringJobScopeForJobElementTests-context.xml"); - @SuppressWarnings("unchecked") Map beans = ctx.getBeansOfType(JobScope.class); assertTrue("JobScope not defined properly", beans.size() == 1); } @Test + @SuppressWarnings("resource") public void testStepElement() throws Exception { ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/AutoRegisteringJobScopeForStepElementTests-context.xml"); - @SuppressWarnings("unchecked") Map beans = ctx.getBeansOfType(JobScope.class); assertTrue("JobScope not defined properly", beans.size() == 1); } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AutoRegisteringStepScopeTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AutoRegisteringStepScopeTests.java index 216eefce0..f6e280e7c 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AutoRegisteringStepScopeTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AutoRegisteringStepScopeTests.java @@ -31,19 +31,19 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; public class AutoRegisteringStepScopeTests { @Test + @SuppressWarnings("resource") public void testJobElement() throws Exception { ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext("org/springframework/batch/core/configuration/xml/AutoRegisteringStepScopeForJobElementTests-context.xml"); - @SuppressWarnings("unchecked") Map beans = ctx.getBeansOfType(StepScope.class); assertTrue("StepScope not defined properly", beans.size() == 1); } @Test + @SuppressWarnings("resource") public void testStepElement() throws Exception { ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext("org/springframework/batch/core/configuration/xml/AutoRegisteringStepScopeForStepElementTests-context.xml"); - @SuppressWarnings("unchecked") Map beans = ctx.getBeansOfType(StepScope.class); assertTrue("StepScope not defined properly", beans.size() == 1); } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ChunkElementParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ChunkElementParserTests.java index e71b349e4..0e9d668af 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ChunkElementParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ChunkElementParserTests.java @@ -58,6 +58,7 @@ import org.springframework.util.StringUtils; public class ChunkElementParserTests { @Test + @SuppressWarnings("resource") public void testSimpleAttributes() throws Exception { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/ChunkElementSimpleAttributeParserTests-context.xml"); @@ -69,27 +70,30 @@ public class ChunkElementParserTests { } @Test + @SuppressWarnings("resource") public void testCommitIntervalLateBinding() throws Exception { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/ChunkElementLateBindingParserTests-context.xml"); - Step step = (Step) context.getBean("s1", Step.class); + Step step = context.getBean("s1", Step.class); assertNotNull("Step not parsed", step); } @Test + @SuppressWarnings("resource") public void testSkipAndRetryAttributes() throws Exception { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/ChunkElementSkipAndRetryAttributeParserTests-context.xml"); - Step step = (Step) context.getBean("s1", Step.class); + Step step = context.getBean("s1", Step.class); assertNotNull("Step not parsed", step); } @Test + @SuppressWarnings("resource") public void testIllegalSkipAndRetryAttributes() throws Exception { try { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/ChunkElementIllegalSkipAndRetryAttributeParserTests-context.xml"); - Step step = (Step) context.getBean("s1", Step.class); + Step step = context.getBean("s1", Step.class); assertNotNull("Step not parsed", step); fail("Expected BeanCreationException"); } catch (BeanCreationException e) { @@ -99,6 +103,7 @@ public class ChunkElementParserTests { @Test public void testRetryPolicyAttribute() throws Exception { + @SuppressWarnings("resource") ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/ChunkElementRetryPolicyParserTests-context.xml"); Map, Boolean> retryable = getNestedExceptionMap("s1", context, @@ -111,6 +116,7 @@ public class ChunkElementParserTests { @Test public void testRetryPolicyElement() throws Exception { + @SuppressWarnings("resource") ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/ChunkElementRetryPolicyParserTests-context.xml"); SimpleRetryPolicy policy = (SimpleRetryPolicy) getPolicy("s2", context, @@ -120,6 +126,7 @@ public class ChunkElementParserTests { @Test public void testSkipPolicyAttribute() throws Exception { + @SuppressWarnings("resource") ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/ChunkElementSkipPolicyParserTests-context.xml"); SkipPolicy policy = getSkipPolicy("s1", context); @@ -129,6 +136,7 @@ public class ChunkElementParserTests { @Test public void testSkipPolicyElement() throws Exception { + @SuppressWarnings("resource") ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/ChunkElementSkipPolicyParserTests-context.xml"); SkipPolicy policy = getSkipPolicy("s2", context); @@ -137,6 +145,7 @@ public class ChunkElementParserTests { } @Test + @SuppressWarnings("resource") public void testProcessorTransactionalAttributes() throws Exception { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/ChunkElementTransactionalAttributeParserTests-context.xml"); @@ -150,6 +159,7 @@ public class ChunkElementParserTests { } @Test + @SuppressWarnings("resource") public void testProcessorTransactionalNotAllowedOnSimpleProcessor() throws Exception { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/ChunkElementIllegalAttributeParserTests-context.xml"); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyAnnotationJobExecutionListener.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyAnnotationJobExecutionListener.java index 1acef2c0a..36a8e4dc0 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyAnnotationJobExecutionListener.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyAnnotationJobExecutionListener.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import org.springframework.batch.core.annotation.BeforeJob; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyAnnotationStepExecutionListener.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyAnnotationStepExecutionListener.java index a9574d9d9..47907ff82 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyAnnotationStepExecutionListener.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyAnnotationStepExecutionListener.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import org.springframework.batch.core.annotation.BeforeStep; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyCompletionPolicy.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyCompletionPolicy.java index e27f05073..65a120fdf 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyCompletionPolicy.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyCompletionPolicy.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import org.springframework.batch.repeat.CompletionPolicy; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyItemHandlerAdapter.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyItemHandlerAdapter.java index 5c9ee2edf..747299bb3 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyItemHandlerAdapter.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyItemHandlerAdapter.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; /** diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyItemProcessor.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyItemProcessor.java index c8fd3e1a8..0538de8b8 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyItemProcessor.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyItemProcessor.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import org.springframework.batch.item.ItemProcessor; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyItemReader.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyItemReader.java index 8b6b580ef..90b5998af 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyItemReader.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyItemReader.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import org.springframework.batch.item.ItemReader; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyItemWriter.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyItemWriter.java index 7374d52ff..eaa6d5fbf 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyItemWriter.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyItemWriter.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import java.util.List; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyPojoStepExecutionListener.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyPojoStepExecutionListener.java index f40ade7ae..d38200429 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyPojoStepExecutionListener.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyPojoStepExecutionListener.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyRetryListener.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyRetryListener.java index e4220e547..8a006034e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyRetryListener.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyRetryListener.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import org.springframework.retry.RetryCallback; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyTasklet.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyTasklet.java index 232888dca..7e74edc1f 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyTasklet.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyTasklet.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import org.springframework.batch.core.StepContribution; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DuplicateTransitionJobParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DuplicateTransitionJobParserTests.java index 0f52093f1..36eb4318e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DuplicateTransitionJobParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DuplicateTransitionJobParserTests.java @@ -28,12 +28,14 @@ import org.springframework.util.ClassUtils; public class DuplicateTransitionJobParserTests { @Test(expected = BeanDefinitionStoreException.class) + @SuppressWarnings("resource") public void testNextAttributeWithNestedElement() throws Exception { new ClassPathXmlApplicationContext(ClassUtils.addResourcePathToPackagePath(getClass(), "NextAttributeMultipleFinalJobParserTests-context.xml")); } @Test(expected = BeanDefinitionStoreException.class) + @SuppressWarnings("resource") public void testDuplicateTransition() throws Exception { new ClassPathXmlApplicationContext(ClassUtils.addResourcePathToPackagePath(getClass(), "DuplicateTransitionJobParserTests-context.xml")); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/FailingTasklet.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/FailingTasklet.java index dd3fbad06..7d1fb1f8d 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/FailingTasklet.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/FailingTasklet.java @@ -22,7 +22,7 @@ import org.springframework.batch.repeat.RepeatStatus; /** * This tasklet will call * {@link NameStoringTasklet#execute(StepContribution, ChunkContext)} and then - * throw an exeception. + * throw an exception. * * @author Dan Garrette * @since 2.0 diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/InlineItemHandlerParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/InlineItemHandlerParserTests.java index 3ffa5ef2b..57b66b178 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/InlineItemHandlerParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/InlineItemHandlerParserTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import static org.junit.Assert.assertEquals; @@ -88,7 +103,7 @@ public class InlineItemHandlerParserTests { "org/springframework/batch/core/configuration/xml/InlineItemHandlerWithStepScopeParserTests-context.xml"); StepSynchronizationManager.register(new StepExecution("step", new JobExecution(123L))); - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({ "rawtypes" }) Map readers = context.getBeansOfType(ItemReader.class); // Should be 2 each (proxy and target) for the two readers in the steps defined assertEquals(4, readers.size()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/JobParserExceptionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/JobParserExceptionTests.java index 2b4a188b7..f9f949f6f 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/JobParserExceptionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/JobParserExceptionTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import static org.junit.Assert.assertTrue; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/JobParserJobFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/JobParserJobFactoryBeanTests.java index 03b780d69..2d0cc26d9 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/JobParserJobFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/JobParserJobFactoryBeanTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import static org.junit.Assert.*; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/NoopTasklet.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/NoopTasklet.java index 55151ed0f..3c4cc51a7 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/NoopTasklet.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/NoopTasklet.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import org.springframework.batch.core.ExitStatus; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ParentStepFactoryBeanParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ParentStepFactoryBeanParserTests.java index 648628a7b..65674c8b3 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ParentStepFactoryBeanParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ParentStepFactoryBeanParserTests.java @@ -32,6 +32,7 @@ import org.springframework.test.util.ReflectionTestUtils; public class ParentStepFactoryBeanParserTests { @Test + @SuppressWarnings("resource") public void testSimpleAttributes() throws Exception { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/ParentStepFactoryBeanParserTests-context.xml"); @@ -43,6 +44,7 @@ public class ParentStepFactoryBeanParserTests { } @Test + @SuppressWarnings("resource") public void testSkippableAttributes() throws Exception { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/ParentSkippableStepFactoryBeanParserTests-context.xml"); @@ -54,6 +56,7 @@ public class ParentStepFactoryBeanParserTests { } @Test + @SuppressWarnings("resource") public void testRetryableAttributes() throws Exception { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/ParentRetryableStepFactoryBeanParserTests-context.xml"); @@ -66,6 +69,7 @@ public class ParentStepFactoryBeanParserTests { // BATCH-1396 @Test + @SuppressWarnings("resource") public void testRetryableLateBindingAttributes() throws Exception { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/ParentRetryableLateBindingStepFactoryBeanParserTests-context.xml"); @@ -78,6 +82,7 @@ public class ParentStepFactoryBeanParserTests { // BATCH-1396 @Test + @SuppressWarnings("resource") public void testSkippableLateBindingAttributes() throws Exception { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/ParentSkippableLateBindingStepFactoryBeanParserTests-context.xml"); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/PartitionStepParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/PartitionStepParserTests.java index 04a5da4ef..797b976b2 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/PartitionStepParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/PartitionStepParserTests.java @@ -143,8 +143,8 @@ public class PartitionStepParserTests implements ApplicationContextAware { /** * BATCH-1509 we now support the ability define steps inline for partitioned - * steps. this demonstates that the execution proceeds as expected and that - * the partitionhandler has a reference to the inline step definition + * steps. this demonstrates that the execution proceeds as expected and that + * the partition handler has a reference to the inline step definition */ @Test public void testNestedPartitionStepStepReference() throws Throwable { @@ -178,8 +178,8 @@ public class PartitionStepParserTests implements ApplicationContextAware { /** * BATCH-1509 we now support the ability define steps inline for partitioned - * steps. this demonstates that the execution proceeds as expected and that - * the partitionhandler has a reference to the inline step definition + * steps. this demonstrates that the execution proceeds as expected and that + * the partition handler has a reference to the inline step definition */ @Test public void testNestedPartitionStep() throws Throwable { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepNameTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepNameTests.java index d9a8e5364..80e37f477 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepNameTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepNameTests.java @@ -55,7 +55,6 @@ public class StepNameTests { catch (BeanCreationException e) { return; } - @SuppressWarnings("unchecked") Map stepLocators = context.getBeansOfType(StepLocator.class); this.stepLocators = stepLocators; } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java index 5e8adf708..aa6caa7b5 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java @@ -77,10 +77,11 @@ public class StepParserTests { } @Test + @SuppressWarnings("resource") public void testTaskletStepAttributes() throws Exception { ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/StepParserTaskletAttributesTests-context.xml"); - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({ "rawtypes" }) Map beans = ctx.getBeansOfType(StepParserStepFactoryBean.class); String factoryName = (String) beans.keySet().toArray()[0]; @SuppressWarnings("unchecked") @@ -92,10 +93,10 @@ public class StepParserTests { } @Test + @SuppressWarnings("resource") public void testStepParserBeanName() throws Exception { ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/StepParserBeanNameTests-context.xml"); - @SuppressWarnings("unchecked") Map beans = ctx.getBeansOfType(Step.class); assertTrue("'s1' bean not found", beans.containsKey("s1")); Step s1 = (Step) ctx.getBean("s1"); @@ -103,16 +104,17 @@ public class StepParserTests { } @Test(expected = BeanDefinitionParsingException.class) + @SuppressWarnings("resource") public void testStepParserCommitIntervalCompletionPolicy() throws Exception { new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/StepParserCommitIntervalCompletionPolicyTests-context.xml"); } @Test + @SuppressWarnings("resource") public void testStepParserCommitInterval() throws Exception { ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/StepParserCommitIntervalTests-context.xml"); - @SuppressWarnings("unchecked") Map beans = ctx.getBeansOfType(Step.class); assertTrue("'s1' bean not found", beans.containsKey("s1")); Step s1 = (Step) ctx.getBean("s1"); @@ -122,10 +124,10 @@ public class StepParserTests { } @Test + @SuppressWarnings("resource") public void testStepParserCompletionPolicy() throws Exception { ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/StepParserCompletionPolicyTests-context.xml"); - @SuppressWarnings("unchecked") Map beans = ctx.getBeansOfType(Step.class); assertTrue("'s1' bean not found", beans.containsKey("s1")); Step s1 = (Step) ctx.getBean("s1"); @@ -141,18 +143,21 @@ public class StepParserTests { } @Test(expected = BeanDefinitionParsingException.class) + @SuppressWarnings("resource") public void testStepParserNoCommitIntervalOrCompletionPolicy() throws Exception { new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/StepParserNoCommitIntervalOrCompletionPolicyTests-context.xml"); } @Test(expected = BeanDefinitionParsingException.class) + @SuppressWarnings("resource") public void testTaskletStepWithBadStepListener() throws Exception { new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/StepParserBadStepListenerTests-context.xml"); } @Test(expected = BeanDefinitionParsingException.class) + @SuppressWarnings("resource") public void testTaskletStepWithBadRetryListener() throws Exception { new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/StepParserBadRetryListenerTests-context.xml"); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepWithSimpleTaskJobParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepWithSimpleTaskJobParserTests.java index 9071a486f..3524157cd 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepWithSimpleTaskJobParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepWithSimpleTaskJobParserTests.java @@ -78,7 +78,7 @@ public class StepWithSimpleTaskJobParserTests { private TestTasklet assertTasklet(Job job, String stepName, String taskletName) { System.err.println(((FlowJob) job).getStepNames()); Step step = ((FlowJob) job).getStep(stepName); - assertTrue("Wong type for step name="+stepName+": "+step, step instanceof TaskletStep); + assertTrue("Wrong type for step name="+stepName+": "+step, step instanceof TaskletStep); Object tasklet = ReflectionTestUtils.getField(step, "tasklet"); assertTrue(tasklet instanceof TestTasklet); TestTasklet testTasklet = (TestTasklet) tasklet; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TaskletStepAllowStartIfCompleteTest.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TaskletStepAllowStartIfCompleteTest.java index 66cbcc8d8..0902eb4db 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TaskletStepAllowStartIfCompleteTest.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TaskletStepAllowStartIfCompleteTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestCustomStatusListener.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestCustomStatusListener.java index 424814218..ed4587fab 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestCustomStatusListener.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestCustomStatusListener.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import org.springframework.batch.core.ExitStatus; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestIncrementer.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestIncrementer.java index 1fea100df..7ce11a721 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestIncrementer.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestIncrementer.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import org.springframework.batch.core.JobParameters; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestJobListener.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestJobListener.java index 4b14b0725..8ec828fe2 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestJobListener.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestJobListener.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import org.springframework.batch.core.annotation.BeforeJob; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestListener.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestListener.java index ba24f7e67..d977119e1 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestListener.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestListener.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import org.springframework.batch.core.ExitStatus; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestPojoListener.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestPojoListener.java index 529672f7c..609da5160 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestPojoListener.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestPojoListener.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import java.util.List; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestProcessor.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestProcessor.java index 731ec465d..15dd11393 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestProcessor.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestProcessor.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import org.springframework.batch.item.ItemProcessor; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestReader.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestReader.java index 7aa95a896..6178199fa 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestReader.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestReader.java @@ -1,10 +1,24 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.springframework.batch.item.ExecutionContext; -import org.springframework.batch.item.ItemStreamException; import org.springframework.batch.item.ItemStreamReader; import org.springframework.batch.item.ParseException; import org.springframework.batch.item.UnexpectedInputException; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestRetryListener.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestRetryListener.java index 7d6b9381a..48b365a0f 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestRetryListener.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestRetryListener.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import org.springframework.retry.RetryCallback; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestTasklet.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestTasklet.java index 3e526e515..4e7095c02 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestTasklet.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestTasklet.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import org.springframework.batch.core.StepContribution; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestWriter.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestWriter.java index b4e1ae90d..9168383fa 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestWriter.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestWriter.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.configuration.xml; import java.util.List; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/converter/JobParametersConverterSupport.java b/spring-batch-core/src/test/java/org/springframework/batch/core/converter/JobParametersConverterSupport.java index 2e02f324f..68ae4130c 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/converter/JobParametersConverterSupport.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/converter/JobParametersConverterSupport.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.converter; import java.util.Map; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/explore/support/JobExplorerFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/explore/support/JobExplorerFactoryBeanTests.java index 393fc0eb2..6a98a52bc 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/explore/support/JobExplorerFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/explore/support/JobExplorerFactoryBeanTests.java @@ -92,7 +92,7 @@ public class JobExplorerFactoryBeanTests { public void testCreateExplorer() throws Exception { factory.afterPropertiesSet(); - JobExplorer explorer = (JobExplorer) factory.getObject(); + JobExplorer explorer = factory.getObject(); assertNotNull(explorer); } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/explore/support/MapJobExplorerFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/explore/support/MapJobExplorerFactoryBeanTests.java index 57a88d5d1..c565cab08 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/explore/support/MapJobExplorerFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/explore/support/MapJobExplorerFactoryBeanTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.explore.support; import static org.junit.Assert.assertEquals; @@ -6,7 +21,6 @@ import org.junit.Test; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.explore.JobExplorer; import org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean; -import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean; /** @@ -22,12 +36,12 @@ public class MapJobExplorerFactoryBeanTests { public void testCreateExplorer() throws Exception { MapJobRepositoryFactoryBean repositoryFactory = new MapJobRepositoryFactoryBean(); - (repositoryFactory.getObject()).createJobExecution("foo", new JobParameters()); + repositoryFactory.getObject().createJobExecution("foo", new JobParameters()); MapJobExplorerFactoryBean tested = new MapJobExplorerFactoryBean(repositoryFactory); tested.afterPropertiesSet(); - JobExplorer explorer = (JobExplorer) tested.getObject(); + JobExplorer explorer = tested.getObject(); assertEquals(1, explorer.findRunningJobExecutions("foo").size()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/explore/support/MapJobExplorerIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/explore/support/MapJobExplorerIntegrationTests.java index bd959b524..215406b06 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/explore/support/MapJobExplorerIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/explore/support/MapJobExplorerIntegrationTests.java @@ -74,7 +74,7 @@ public class MapJobExplorerIntegrationTests { jobLauncher.run(job, new JobParametersBuilder().addString("test", getClass().getName()).toJobParameters()); Thread.sleep(500L); - JobExplorer explorer = (JobExplorer) new MapJobExplorerFactoryBean(repositoryFactory).getObject(); + JobExplorer explorer = new MapJobExplorerFactoryBean(repositoryFactory).getObject(); Set executions = explorer.findRunningJobExecutions("job"); assertEquals(1, executions.size()); assertEquals(1, executions.iterator().next().getStepExecutions().size()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/explore/support/SimpleJobExplorerIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/explore/support/SimpleJobExplorerIntegrationTests.java index 8af18a9a8..658b6c7e3 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/explore/support/SimpleJobExplorerIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/explore/support/SimpleJobExplorerIntegrationTests.java @@ -1,5 +1,17 @@ -/** - * +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.springframework.batch.core.explore.support; @@ -50,7 +62,7 @@ import test.jdbc.datasource.DataSourceInitializer; * To illustrate the issue the test simulates the behavior of the {@code StepExecutionRequestHandler} * from the spring-batch-integration project. * - * @author "Sergey Shcherbakov" + * @author Sergey Shcherbakov */ @ContextConfiguration(classes={SimpleJobExplorerIntegrationTests.Config.class}) @RunWith(SpringJUnit4ClassRunner.class) @@ -65,7 +77,7 @@ public class SimpleJobExplorerIntegrationTests { @Bean public JobExplorer jobExplorer() throws Exception { - return (JobExplorer) jobExplorerFactoryBean().getObject(); + return jobExplorerFactoryBean().getObject(); } @Bean diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/DefaultJobParametersValidatorTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/DefaultJobParametersValidatorTests.java index 68848a182..135ed7348 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/DefaultJobParametersValidatorTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/DefaultJobParametersValidatorTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.job; import org.junit.Test; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobFailureTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobFailureTests.java index e9b686379..f71d0fbde 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobFailureTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobFailureTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.job; import static org.junit.Assert.assertEquals; @@ -32,7 +47,7 @@ public class SimpleJobFailureTests { @Before public void init() throws Exception { - JobRepository jobRepository = new MapJobRepositoryFactoryBean().getJobRepository(); + JobRepository jobRepository = new MapJobRepositoryFactoryBean().getObject(); job.setJobRepository(jobRepository); execution = jobRepository.createJobExecution("job", new JobParameters()); } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobTests.java index 0ba40976f..141f63b63 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobTests.java @@ -17,7 +17,6 @@ package org.springframework.batch.core.job; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -529,7 +528,7 @@ public class SimpleJobTests { */ private void checkRepository(BatchStatus status, ExitStatus exitStatus) { assertEquals(jobInstance, jobInstanceDao.getJobInstance(job.getName(), jobParameters)); - // because map dao stores in memory, it can be checked directly + // because map DAO stores in memory, it can be checked directly JobExecution jobExecution = jobExecutionDao.findJobExecutions(jobInstance).get(0); assertEquals(jobInstance.getId(), jobExecution.getJobId()); assertEquals(status, jobExecution.getStatus()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleStepHandlerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleStepHandlerTests.java index 2764c69a9..83cfa6601 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleStepHandlerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleStepHandlerTests.java @@ -45,7 +45,7 @@ public class SimpleStepHandlerTests { @Before public void setUp() throws Exception { MapJobRepositoryFactoryBean jobRepositoryFactoryBean = new MapJobRepositoryFactoryBean(); - jobRepository = jobRepositoryFactoryBean.getJobRepository(); + jobRepository = jobRepositoryFactoryBean.getObject(); jobExecution = jobRepository.createJobExecution("job", new JobParameters()); stepHandler = new SimpleStepHandler(jobRepository); stepHandler.afterPropertiesSet(); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/builder/FlowBuilderTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/builder/FlowBuilderTests.java index 067c09485..f4d995e79 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/builder/FlowBuilderTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/builder/FlowBuilderTests.java @@ -37,7 +37,7 @@ public class FlowBuilderTests { @Test public void test() throws Exception { FlowBuilder builder = new FlowBuilder("flow"); - JobRepository jobRepository = new MapJobRepositoryFactoryBean().getJobRepository(); + JobRepository jobRepository = new MapJobRepositoryFactoryBean().getObject(); JobExecution execution = jobRepository.createJobExecution("foo", new JobParameters()); builder.start(new StepSupport("step") { @Override diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/builder/FlowJobBuilderTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/builder/FlowJobBuilderTests.java index daead9e30..2f7608af0 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/builder/FlowJobBuilderTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/builder/FlowJobBuilderTests.java @@ -87,7 +87,7 @@ public class FlowJobBuilderTests { @Before public void init() throws Exception { - jobRepository = new MapJobRepositoryFactoryBean().getJobRepository(); + jobRepository = new MapJobRepositoryFactoryBean().getObject(); execution = jobRepository.createJobExecution("flow", new JobParameters()); } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/FlowJobFailureTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/FlowJobFailureTests.java index 5f93182fb..73fa731dc 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/FlowJobFailureTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/FlowJobFailureTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.job.flow; import static org.junit.Assert.assertEquals; @@ -37,7 +52,7 @@ public class FlowJobFailureTests { @Before public void init() throws Exception { - JobRepository jobRepository = new MapJobRepositoryFactoryBean().getJobRepository(); + JobRepository jobRepository = new MapJobRepositoryFactoryBean().getObject(); job.setJobRepository(jobRepository); execution = jobRepository.createJobExecution("job", new JobParameters()); } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/FlowStepTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/FlowStepTests.java index a4c084114..25f6d7e7b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/FlowStepTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/FlowStepTests.java @@ -49,7 +49,7 @@ public class FlowStepTests { @Before public void setUp() throws Exception { - jobRepository = new MapJobRepositoryFactoryBean().getJobRepository(); + jobRepository = new MapJobRepositoryFactoryBean().getObject(); jobExecution = jobRepository.createJobExecution("job", new JobParameters()); } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/ItemProcessListenerAdapterTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/ItemProcessListenerAdapterTests.java index 947d4810b..ae9208ed2 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/ItemProcessListenerAdapterTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/ItemProcessListenerAdapterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr; import static org.mockito.Mockito.doThrow; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/ItemReadListenerAdapterTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/ItemReadListenerAdapterTests.java index 9cc12cdd8..0c9eca8d4 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/ItemReadListenerAdapterTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/ItemReadListenerAdapterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr; import static org.mockito.Mockito.doThrow; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/ItemWriteListenerAdapterTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/ItemWriteListenerAdapterTests.java index fce7b3590..0eccb802b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/ItemWriteListenerAdapterTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/ItemWriteListenerAdapterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr; import static org.mockito.Mockito.doThrow; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JobListenerAdapterTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JobListenerAdapterTests.java index b9a78da2f..626429151 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JobListenerAdapterTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JobListenerAdapterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr; import static org.mockito.Mockito.doThrow; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrJobContextFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrJobContextFactoryBeanTests.java index b082ae79f..799a28582 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrJobContextFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrJobContextFactoryBeanTests.java @@ -59,7 +59,7 @@ public class JsrJobContextFactoryBeanTests { @Test public void testIntialCreationSingleThread() throws Exception { - factoryBean.setJobExecution(new JobExecution(5l)); + factoryBean.setJobExecution(new JobExecution(5L)); factoryBean.setBatchPropertyContext(propertyContext); assertTrue(factoryBean.getObjectType().isAssignableFrom(JobContext.class)); @@ -68,8 +68,8 @@ public class JsrJobContextFactoryBeanTests { JobContext jobContext1 = factoryBean.getObject(); JobContext jobContext2 = factoryBean.getObject(); - assertEquals(5l, jobContext1.getExecutionId()); - assertEquals(5l, jobContext2.getExecutionId()); + assertEquals(5L, jobContext1.getExecutionId()); + assertEquals(5L, jobContext2.getExecutionId()); assertTrue(jobContext1 == jobContext2); } @@ -77,11 +77,11 @@ public class JsrJobContextFactoryBeanTests { public void testInitialCreationSingleThreadUsingStepScope() throws Exception { factoryBean.setBatchPropertyContext(propertyContext); - StepSynchronizationManager.register(new StepExecution("step1", new JobExecution(5l))); + StepSynchronizationManager.register(new StepExecution("step1", new JobExecution(5L))); JobContext jobContext = factoryBean.getObject(); - assertEquals(5l, jobContext.getExecutionId()); + assertEquals(5L, jobContext.getExecutionId()); StepSynchronizationManager.close(); } @@ -105,7 +105,7 @@ public class JsrJobContextFactoryBeanTests { try { StepSynchronizationManager.register(new StepExecution("step" + count, new JobExecution(count))); JobContext context = factoryBean.getObject(); - Thread.sleep(1000l); + Thread.sleep(1000L); return context; } catch (Throwable ignore) { return null; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrJobExecutionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrJobExecutionTests.java index c87b739fe..185522a65 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrJobExecutionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrJobExecutionTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr; import static org.junit.Assert.assertEquals; @@ -29,7 +44,7 @@ public class JsrJobExecutionTests { execution.setId(5L); execution.setCreateTime(new Date(0)); - execution.setEndTime(new Date(999999999l)); + execution.setEndTime(new Date(999999999L)); execution.setExitStatus(new ExitStatus("exit status")); execution.setLastUpdated(new Date(12345)); execution.setStartTime(new Date(98765)); @@ -48,7 +63,7 @@ public class JsrJobExecutionTests { public void testGetBasicValues() { assertEquals(javax.batch.runtime.BatchStatus.FAILED, adapter.getBatchStatus()); assertEquals(new Date(0), adapter.getCreateTime()); - assertEquals(new Date(999999999l), adapter.getEndTime()); + assertEquals(new Date(999999999L), adapter.getEndTime()); assertEquals(5L, adapter.getExecutionId()); assertEquals("exit status", adapter.getExitStatus()); assertEquals("job name", adapter.getJobName()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrJobParametersConverterTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrJobParametersConverterTests.java index 80598be36..079bf7d75 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrJobParametersConverterTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrJobParametersConverterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr; import static org.junit.Assert.assertEquals; @@ -59,7 +74,7 @@ public class JsrJobParametersConverterTests { @Test public void testNonStringJobParameters() { - JobParameters parameters = new JobParametersBuilder().addLong("key", 5l, false).toJobParameters(); + JobParameters parameters = new JobParametersBuilder().addLong("key", 5L, false).toJobParameters(); Properties props = converter.getProperties(parameters); assertNotNull(props); Set> properties = props.entrySet(); @@ -70,7 +85,7 @@ public class JsrJobParametersConverterTests { @Test public void testJobParametersWithRunId() { - JobParameters parameters = new JobParametersBuilder().addLong("key", 5l, false).addLong(JsrJobParametersConverter.JOB_RUN_ID, 2l).toJobParameters(); + JobParameters parameters = new JobParametersBuilder().addLong("key", 5L, false).addLong(JsrJobParametersConverter.JOB_RUN_ID, 2L).toJobParameters(); Properties props = converter.getProperties(parameters); assertNotNull(props); Set> properties = props.entrySet(); @@ -105,7 +120,7 @@ public class JsrJobParametersConverterTests { JobParameters parameters = converter.getJobParameters(properties); assertEquals(2, parameters.getParameters().size()); assertEquals("value", parameters.getString("key")); - assertEquals(Long.valueOf(3l), parameters.getLong(JsrJobParametersConverter.JOB_RUN_ID)); + assertEquals(Long.valueOf(3L), parameters.getLong(JsrJobParametersConverter.JOB_RUN_ID)); assertTrue(parameters.getParameters().get(JsrJobParametersConverter.JOB_RUN_ID).isIdentifying()); } } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrStepContextFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrStepContextFactoryBeanTests.java index 84f80fbae..0ee25411b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrStepContextFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrStepContextFactoryBeanTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr; import static org.junit.Assert.assertEquals; @@ -62,24 +77,24 @@ public class JsrStepContextFactoryBeanTests { @Test public void getObjectSingleThread() throws Exception { - StepSynchronizationManager.register(new StepExecution("step1", new JobExecution(5l), 3l)); + StepSynchronizationManager.register(new StepExecution("step1", new JobExecution(5L), 3L)); StepContext context1 = factory.getObject(); StepContext context2 = factory.getObject(); assertTrue(context1 == context2); - assertEquals(3l, context1.getStepExecutionId()); + assertEquals(3L, context1.getStepExecutionId()); StepSynchronizationManager.close(); - StepSynchronizationManager.register(new StepExecution("step2", new JobExecution(5l), 2l)); + StepSynchronizationManager.register(new StepExecution("step2", new JobExecution(5L), 2L)); StepContext context3 = factory.getObject(); StepContext context4 = factory.getObject(); assertTrue(context3 == context4); assertTrue(context3 != context2); - assertEquals(2l, context3.getStepExecutionId()); + assertEquals(2L, context3.getStepExecutionId()); StepSynchronizationManager.close(); } @@ -91,13 +106,13 @@ public class JsrStepContextFactoryBeanTests { when(propertyContext.getStepProperties("step3")).thenReturn(props); - StepSynchronizationManager.register(new StepExecution("step3", new JobExecution(5l), 3l)); + StepSynchronizationManager.register(new StepExecution("step3", new JobExecution(5L), 3L)); StepContext context1 = factory.getObject(); StepContext context2 = factory.getObject(); assertTrue(context1 == context2); - assertEquals(3l, context1.getStepExecutionId()); + assertEquals(3L, context1.getStepExecutionId()); assertEquals("value1", context1.getProperties().get("key1")); StepSynchronizationManager.close(); @@ -118,7 +133,7 @@ public class JsrStepContextFactoryBeanTests { try { StepSynchronizationManager.register(new StepExecution("step" + count, new JobExecution(count))); StepContext context = factory.getObject(); - Thread.sleep(1000l); + Thread.sleep(1000L); return context; } catch (Throwable ignore) { return null; @@ -159,7 +174,7 @@ public class JsrStepContextFactoryBeanTests { try { StepSynchronizationManager.register(new StepExecution("step" + count, new JobExecution(count))); StepContext context = factory.getObject(); - Thread.sleep(1000l); + Thread.sleep(1000L); return context; } catch (Throwable ignore) { return null; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrStepContextTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrStepContextTests.java index a4c4550fc..b0fc7971a 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrStepContextTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrStepContextTests.java @@ -45,10 +45,10 @@ public class JsrStepContextTests { @Before public void setUp() throws Exception { - JobExecution jobExecution = new JobExecution(1l, new JobParametersBuilder().addString("key", "value").toJobParameters()); + JobExecution jobExecution = new JobExecution(1L, new JobParametersBuilder().addString("key", "value").toJobParameters()); stepExecution = new StepExecution("testStep", jobExecution); - stepExecution.setId(5l); + stepExecution.setId(5L); stepExecution.setStatus(BatchStatus.STARTED); stepExecution.setExitStatus(new ExitStatus("customExitStatus")); stepExecution.setCommitCount(1); @@ -75,7 +75,7 @@ public class JsrStepContextTests { assertEquals(null, stepContext.getExitStatus()); stepContext.setExitStatus("customExitStatus"); assertEquals("customExitStatus", stepContext.getExitStatus()); - assertEquals(5l, stepContext.getStepExecutionId()); + assertEquals(5L, stepContext.getStepExecutionId()); assertEquals("testStep", stepContext.getStepName()); assertEquals("This is my transient data", stepContext.getTransientUserData()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrStepExecutionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrStepExecutionTests.java index 9083ddf47..91bbda1db 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrStepExecutionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/JsrStepExecutionTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr; import static org.junit.Assert.assertEquals; @@ -27,10 +42,10 @@ public class JsrStepExecutionTests { @Before public void setUp() throws Exception { - JobExecution jobExecution = new JobExecution(1l, new JobParametersBuilder().addString("key", "value").toJobParameters()); + JobExecution jobExecution = new JobExecution(1L, new JobParametersBuilder().addString("key", "value").toJobParameters()); stepExecution = new StepExecution("testStep", jobExecution); - stepExecution.setId(5l); + stepExecution.setId(5L); stepExecution.setStatus(BatchStatus.STARTED); stepExecution.setExitStatus(new ExitStatus("customExitStatus")); stepExecution.setCommitCount(1); @@ -62,7 +77,7 @@ public class JsrStepExecutionTests { @Test public void testBaseValues() { - assertEquals(5l, jsrStepExecution.getStepExecutionId()); + assertEquals(5L, jsrStepExecution.getStepExecutionId()); assertEquals("testStep", jsrStepExecution.getStepName()); assertEquals(javax.batch.runtime.BatchStatus.STARTED, jsrStepExecution.getBatchStatus()); assertEquals(new Date(0), jsrStepExecution.getStartTime()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/SimpleMetricTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/SimpleMetricTests.java index ef588366e..3dcbf63ba 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/SimpleMetricTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/SimpleMetricTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr; import static org.junit.Assert.assertEquals; @@ -11,7 +26,7 @@ public class SimpleMetricTests { @Test(expected=IllegalArgumentException.class) public void testNullType() { - Metric metric = new SimpleMetric(null, 0); + new SimpleMetric(null, 0); } @Test diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/StepListenerAdapterTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/StepListenerAdapterTests.java index 12587f958..70382d4a9 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/StepListenerAdapterTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/StepListenerAdapterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/support/BatchPropertyContextTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/support/BatchPropertyContextTests.java index 2ab952715..0fc394e28 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/support/BatchPropertyContextTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/support/BatchPropertyContextTests.java @@ -38,6 +38,7 @@ public class BatchPropertyContextTests { private Map> partitionProperties = new HashMap>(); private Map> stepArtifactProperties = new HashMap>(); + @SuppressWarnings("serial") @Before public void setUp() { Properties step1Properties = new Properties(); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/CountingItemProcessor.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/CountingItemProcessor.java index 3f43ac299..c3c3ece9e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/CountingItemProcessor.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/CountingItemProcessor.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr.configuration.xml; import javax.batch.api.chunk.ItemProcessor; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/DecisionStepFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/DecisionStepFactoryBeanTests.java index ba47e3d5b..9b88f2bcd 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/DecisionStepFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/DecisionStepFactoryBeanTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr.configuration.xml; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/ExceptionHandlingParsingTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/ExceptionHandlingParsingTests.java index e7905668e..5556132db 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/ExceptionHandlingParsingTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/ExceptionHandlingParsingTests.java @@ -48,25 +48,25 @@ public class ExceptionHandlingParsingTests { @Test @Ignore public void testSkippable() throws Exception { - JobExecution execution1 = jobLauncher.run(job, new JobParametersBuilder().addLong("run", 1l).toJobParameters()); + JobExecution execution1 = jobLauncher.run(job, new JobParametersBuilder().addLong("run", 1L).toJobParameters()); assertEquals(BatchStatus.FAILED, execution1.getStatus()); assertEquals(1, execution1.getStepExecutions().size()); assertEquals(1, execution1.getStepExecutions().iterator().next().getSkipCount()); assertTrue(execution1.getAllFailureExceptions().get(0).getMessage().contains("But don't skip me")); - JobExecution execution2 = jobLauncher.run(job, new JobParametersBuilder().addLong("run", 2l).toJobParameters()); + JobExecution execution2 = jobLauncher.run(job, new JobParametersBuilder().addLong("run", 2L).toJobParameters()); assertEquals(BatchStatus.FAILED, execution2.getStatus()); assertEquals(2, execution2.getStepExecutions().size()); assertTrue(execution2.getAllFailureExceptions().get(0).getMessage().contains("But don't retry me")); - JobExecution execution3 = jobLauncher.run(job, new JobParametersBuilder().addLong("run", 3l).toJobParameters()); + JobExecution execution3 = jobLauncher.run(job, new JobParametersBuilder().addLong("run", 3L).toJobParameters()); assertEquals(BatchStatus.COMPLETED, execution3.getStatus()); assertEquals(3, execution3.getStepExecutions().size()); List stepExecutions = new ArrayList(execution3.getStepExecutions()); assertEquals(0, stepExecutions.get(2).getRollbackCount()); - JobExecution execution4 = jobLauncher.run(job, new JobParametersBuilder().addLong("run", 4l).toJobParameters()); + JobExecution execution4 = jobLauncher.run(job, new JobParametersBuilder().addLong("run", 4L).toJobParameters()); assertEquals(BatchStatus.COMPLETED, execution4.getStatus()); assertEquals(3, execution4.getStepExecutions().size()); } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/FlowParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/FlowParserTests.java index 2aa6c963c..48bd656ca 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/FlowParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/FlowParserTests.java @@ -45,16 +45,16 @@ import org.springframework.batch.core.ExitStatus; public class FlowParserTests { @Test public void testDuplicateTransitionPatternsAllowed() throws Exception { - JobExecution stoppedExecution = runJob("FlowParserTests-context", new Properties(), 10000l); + JobExecution stoppedExecution = runJob("FlowParserTests-context", new Properties(), 10000L); assertEquals(ExitStatus.STOPPED.getExitCode(), stoppedExecution.getExitStatus()); - JobExecution endedExecution = restartJob(stoppedExecution.getExecutionId(), new Properties(), 10000l); + JobExecution endedExecution = restartJob(stoppedExecution.getExecutionId(), new Properties(), 10000L); assertEquals(ExitStatus.COMPLETED.getExitCode(), endedExecution.getExitStatus()); } @Test public void testWildcardAddedLastWhenUsedWithNextAttrAndNoTransitionElements() throws Exception { - JobExecution jobExecution = runJob("FlowParserTestsWildcardAndNextAttrJob", new Properties(), 1000l); + JobExecution jobExecution = runJob("FlowParserTestsWildcardAndNextAttrJob", new Properties(), 1000L); assertEquals(ExitStatus.FAILED.getExitCode(), jobExecution.getExitStatus()); JobOperator jobOperator = BatchRuntime.getJobOperator(); @@ -66,7 +66,7 @@ public class FlowParserTests { @Test public void testStepGetsFailedTransitionWhenNextAttributePresent() throws Exception { - JobExecution jobExecution = runJob("FlowParserTestsStepGetsFailedTransitionWhenNextAttributePresent", new Properties(), 10000l); + JobExecution jobExecution = runJob("FlowParserTestsStepGetsFailedTransitionWhenNextAttributePresent", new Properties(), 10000L); assertEquals(ExitStatus.FAILED.getExitCode(), jobExecution.getExitStatus()); JobOperator jobOperator = BatchRuntime.getJobOperator(); @@ -79,7 +79,7 @@ public class FlowParserTests { @Test public void testStepNoOverrideWhenNextAndFailedTransitionElementExists() throws Exception { - JobExecution jobExecution = runJob("FlowParserTestsStepNoOverrideWhenNextAndFailedTransitionElementExists", new Properties(), 10000l); + JobExecution jobExecution = runJob("FlowParserTestsStepNoOverrideWhenNextAndFailedTransitionElementExists", new Properties(), 10000L); assertEquals(ExitStatus.FAILED.getExitCode(), jobExecution.getExitStatus()); JobOperator jobOperator = BatchRuntime.getJobOperator(); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/ItemListenerParsingTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/ItemListenerParsingTests.java index 094a2f6ed..262fac040 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/ItemListenerParsingTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/ItemListenerParsingTests.java @@ -68,8 +68,7 @@ public class ItemListenerParsingTests { assertEquals(2, jsrListener.afterWriteCount); } - @SuppressWarnings("rawtypes") - public static class SpringItemListener implements ItemReadListener, ItemProcessListener, ItemWriteListener { + public static class SpringItemListener implements ItemReadListener, ItemProcessListener, ItemWriteListener { protected int beforeReadCount = 0; protected int afterReadCount = 0; @@ -97,17 +96,17 @@ public class ItemListenerParsingTests { } @Override - public void beforeWrite(List items) { + public void beforeWrite(List items) { beforeWriteCount++; } @Override - public void afterWrite(List items) { + public void afterWrite(List items) { afterWriteCount++; } @Override - public void onWriteError(Exception exception, List items) { + public void onWriteError(Exception exception, List items) { onWriteErrorCount++; } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/JsrBeanDefinitionDocumentReaderTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/JsrBeanDefinitionDocumentReaderTests.java index 4c1d458f0..2b6f9ef98 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/JsrBeanDefinitionDocumentReaderTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/JsrBeanDefinitionDocumentReaderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr.configuration.xml; import java.io.IOException; @@ -40,6 +55,7 @@ public class JsrBeanDefinitionDocumentReaderTests { private ErrorHandler errorHandler = new SimpleSaxErrorHandler(logger); @Test + @SuppressWarnings("resource") public void testGetJobParameters() { Properties jobParameters = new Properties(); jobParameters.setProperty("jobParameter1", "jobParameter1Value"); @@ -65,6 +81,7 @@ public class JsrBeanDefinitionDocumentReaderTests { public void testGetJobProperties() { Document document = getDocument("/META-INF/batch-jobs/jsrPropertyPreparseTestJob.xml"); + @SuppressWarnings("resource") JsrXmlApplicationContext applicationContext = new JsrXmlApplicationContext(); JsrBeanDefinitionDocumentReader documentReader = new JsrBeanDefinitionDocumentReader(applicationContext); documentReader.initProperties(document.getDocumentElement()); @@ -84,6 +101,7 @@ public class JsrBeanDefinitionDocumentReaderTests { jobParameters.setProperty("jobParameter2", "#{jobProperties['jobProperty2']}"); jobParameters.setProperty("jobParameter3", "#{jobParameters['jobParameter1']}"); + @SuppressWarnings("resource") JsrXmlApplicationContext applicationContext = new JsrXmlApplicationContext(jobParameters); applicationContext.setValidating(false); applicationContext.load(new ClassPathResource("baseContext.xml"), @@ -110,6 +128,7 @@ public class JsrBeanDefinitionDocumentReaderTests { Properties jobParameters = new Properties(); jobParameters.setProperty("file.name", "myfile.txt"); + @SuppressWarnings("resource") JsrXmlApplicationContext applicationContext = new JsrXmlApplicationContext(jobParameters); applicationContext.setValidating(false); applicationContext.load(new ClassPathResource("baseContext.xml"), @@ -130,6 +149,7 @@ public class JsrBeanDefinitionDocumentReaderTests { assertEquals("myfile.txt", resolvedProperties.getProperty("jobProperty3")); } + @SuppressWarnings("resource") @Test public void testGenerationOfBeanDefinitionsForMultipleReferences() throws Exception { JsrXmlApplicationContext applicationContext = new JsrXmlApplicationContext(new Properties()); @@ -184,6 +204,7 @@ public class JsrBeanDefinitionDocumentReaderTests { } @Test + @SuppressWarnings("resource") public void testGenerationOfSpringBeanDefinitionsForMultipleReferences() { JsrXmlApplicationContext applicationContext = new JsrXmlApplicationContext(new Properties()); applicationContext.setValidating(false); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/JsrSplitParsingTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/JsrSplitParsingTests.java index 68e7192c2..d04540ef2 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/JsrSplitParsingTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/JsrSplitParsingTests.java @@ -46,7 +46,7 @@ public class JsrSplitParsingTests { @Test public void test() throws Exception { - javax.batch.runtime.JobExecution execution = runJob("JsrSplitParsingTests-context", null, 10000l); + javax.batch.runtime.JobExecution execution = runJob("JsrSplitParsingTests-context", null, 10000L); assertEquals(javax.batch.runtime.BatchStatus.COMPLETED, execution.getBatchStatus()); assertEquals("COMPLETED", execution.getExitStatus()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/JsrXmlApplicationContextTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/JsrXmlApplicationContextTests.java index ded10112c..9dcc0c523 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/JsrXmlApplicationContextTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/JsrXmlApplicationContextTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr.configuration.xml; import java.util.Properties; @@ -19,6 +34,7 @@ public class JsrXmlApplicationContextTests { private static final String JOB_PARAMETERS_BEAN_DEFINITION_NAME = "jsr_jobParameters"; @Test + @SuppressWarnings("resource") public void testNullProperties() { JsrXmlApplicationContext applicationContext = new JsrXmlApplicationContext(null); @@ -30,6 +46,7 @@ public class JsrXmlApplicationContextTests { } @Test + @SuppressWarnings("resource") public void testWithProperties() { Properties properties = new Properties(); properties.put("prop1key", "prop1val"); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/ListenerParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/ListenerParserTests.java index 993ba8d79..340223370 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/ListenerParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/ListenerParserTests.java @@ -33,6 +33,7 @@ import static org.junit.Assert.assertEquals; public class ListenerParserTests { @Test public void testStepListenerStepScoped() { + @SuppressWarnings("resource") GenericApplicationContext applicationContext = new GenericApplicationContext(); AbstractBeanDefinition newBeanDefinition = BeanDefinitionBuilder.genericBeanDefinition("stepListener").getBeanDefinition(); @@ -49,6 +50,7 @@ public class ListenerParserTests { @Test public void testJobListenerSingletonScoped() { + @SuppressWarnings("resource") GenericApplicationContext applicationContext = new GenericApplicationContext(); AbstractBeanDefinition newBeanDefinition = BeanDefinitionBuilder.genericBeanDefinition("jobListener").getBeanDefinition(); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/PartitionParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/PartitionParserTests.java index 13663f081..c5ce44646 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/PartitionParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/PartitionParserTests.java @@ -49,7 +49,7 @@ import org.springframework.util.Assert; public class PartitionParserTests { private Pattern caPattern = Pattern.compile("ca"); private Pattern asPattern = Pattern.compile("AS"); - private static final long TIMEOUT = 10000l; + private static final long TIMEOUT = 10000L; @Before public void before() { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/RetryListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/RetryListenerTests.java index 4d8c1dd4a..9ad9fc772 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/RetryListenerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/RetryListenerTests.java @@ -53,6 +53,7 @@ public class RetryListenerTests { private static final Log LOG = LogFactory.getLog(RetryListenerTests.class); @Test + @SuppressWarnings("resource") public void testReadRetryExhausted() throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext("org/springframework/batch/core/jsr/configuration/xml/RetryReadListenerExhausted.xml"); @@ -68,6 +69,7 @@ public class RetryListenerTests { } @Test + @SuppressWarnings("resource") public void testReadRetryOnce() throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext("org/springframework/batch/core/jsr/configuration/xml/RetryReadListenerRetryOnce.xml"); @@ -85,6 +87,7 @@ public class RetryListenerTests { } @Test + @SuppressWarnings("resource") public void testReadRetryExceptionInListener() throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext("org/springframework/batch/core/jsr/configuration/xml/RetryReadListenerListenerException.xml"); @@ -222,7 +225,7 @@ public class RetryListenerTests { @Override public void writeItems(List items) throws Exception { - for(Object item : items) { + for(@SuppressWarnings("unused") Object item : items) { if(cnt == 0) { cnt++; LOG.info("one"); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/SimpleJobParsingTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/SimpleJobParsingTests.java index 2c1588379..f4cfcb89e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/SimpleJobParsingTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/configuration/xml/SimpleJobParsingTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr.configuration.xml; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/job/flow/JsrFlowJobTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/job/flow/JsrFlowJobTests.java index f53bebc45..1c59f6792 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/job/flow/JsrFlowJobTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/job/flow/JsrFlowJobTests.java @@ -88,7 +88,7 @@ public class JsrFlowJobTests { MapJobExplorerFactoryBean jobExplorerFactory = new MapJobExplorerFactoryBean(jobRepositoryFactory); jobExplorerFactory.afterPropertiesSet(); - jobExplorer = (JobExplorer) jobExplorerFactory.getObject(); + jobExplorer = jobExplorerFactory.getObject(); job.setJobExplorer(jobExplorer); } @@ -750,7 +750,7 @@ public class JsrFlowJobTests { } private void checkRepository(BatchStatus status, ExitStatus exitStatus) { - // because map dao stores in memory, it can be checked directly + // because map DAO stores in memory, it can be checked directly JobInstance jobInstance = jobExecution.getJobInstance(); JobExecution other = jobExecutionDao.findJobExecutions(jobInstance).get(0); assertEquals(jobInstance.getId(), other.getJobId()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/job/flow/support/JsrFlowTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/job/flow/support/JsrFlowTests.java index 64b98e8cd..6c6d8d1da 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/job/flow/support/JsrFlowTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/job/flow/support/JsrFlowTests.java @@ -41,7 +41,7 @@ public class JsrFlowTests extends SimpleFlowTests { @Test public void testNextBasedOnBatchStatus() throws Exception { - StepExecution stepExecution = new StepExecution("step1", new JobExecution(5l)); + StepExecution stepExecution = new StepExecution("step1", new JobExecution(5L)); stepExecution.setExitStatus(new ExitStatus("unmapped exit code")); stepExecution.setStatus(BatchStatus.FAILED); executor = new FlowExecutor(stepExecution); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/job/flow/support/state/JsrEndStateTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/job/flow/support/state/JsrEndStateTests.java index 21bc5d189..0d472220e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/job/flow/support/state/JsrEndStateTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/job/flow/support/state/JsrEndStateTests.java @@ -34,7 +34,7 @@ public class JsrEndStateTests { @Test public void test() throws Exception { - JobExecution jobExecution = JsrTestUtils.runJob("jobWithEndTransition", null, 10000l); + JobExecution jobExecution = JsrTestUtils.runJob("jobWithEndTransition", null, 10000L); assertEquals(BatchStatus.COMPLETED, jobExecution.getBatchStatus()); assertEquals("SUCCESS", jobExecution.getExitStatus()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/launch/JsrJobOperatorTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/launch/JsrJobOperatorTests.java index 4849ec387..090ff5401 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/launch/JsrJobOperatorTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/launch/JsrJobOperatorTests.java @@ -71,7 +71,7 @@ public class JsrJobOperatorTests { @Mock private JobRepository jobRepository; private JobParametersConverter parameterConverter; - private static final long TIMEOUT = 10000l; + private static final long TIMEOUT = 10000L; @Before public void setup() { @@ -128,11 +128,11 @@ public class JsrJobOperatorTests { @Test public void testAbandonRoseyScenario() throws Exception { - JobExecution jobExecution = new JobExecution(5l); + JobExecution jobExecution = new JobExecution(5L); jobExecution.setEndTime(new Date()); - when(jobExplorer.getJobExecution(5l)).thenReturn(jobExecution); + when(jobExplorer.getJobExecution(5L)).thenReturn(jobExecution); - jsrJobOperator.abandon(5l); + jsrJobOperator.abandon(5L); ArgumentCaptor executionCaptor = ArgumentCaptor.forClass(JobExecution.class); verify(jobRepository).update(executionCaptor.capture()); @@ -142,40 +142,40 @@ public class JsrJobOperatorTests { @Test(expected=NoSuchJobExecutionException.class) public void testAbandonNoSuchJob() throws Exception { - jsrJobOperator.abandon(5l); + jsrJobOperator.abandon(5L); } @Test(expected=JobExecutionIsRunningException.class) public void testAbandonJobRunning() throws Exception { - JobExecution jobExecution = new JobExecution(5l); - when(jobExplorer.getJobExecution(5l)).thenReturn(jobExecution); + JobExecution jobExecution = new JobExecution(5L); + when(jobExplorer.getJobExecution(5L)).thenReturn(jobExecution); - jsrJobOperator.abandon(5l); + jsrJobOperator.abandon(5L); } @Test public void testGetJobExecutionRoseyScenario() { - when(jobExplorer.getJobExecution(5l)).thenReturn(new JobExecution(5l)); + when(jobExplorer.getJobExecution(5L)).thenReturn(new JobExecution(5L)); - assertEquals(5l, jsrJobOperator.getJobExecution(5l).getExecutionId()); + assertEquals(5L, jsrJobOperator.getJobExecution(5L).getExecutionId()); } @Test(expected=NoSuchJobExecutionException.class) public void testGetJobExecutionNoExecutionFound() { - jsrJobOperator.getJobExecution(5l); + jsrJobOperator.getJobExecution(5L); } @Test public void testGetJobExecutionsRoseyScenario() { - org.springframework.batch.core.JobInstance jobInstance = new org.springframework.batch.core.JobInstance(5l, "my job"); + org.springframework.batch.core.JobInstance jobInstance = new org.springframework.batch.core.JobInstance(5L, "my job"); List executions = new ArrayList(); - executions.add(new JobExecution(2l)); + executions.add(new JobExecution(2L)); when(jobExplorer.getJobExecutions(jobInstance)).thenReturn(executions); List jobExecutions = jsrJobOperator.getJobExecutions(jobInstance); assertEquals(1, jobExecutions.size()); - assertEquals(2l, executions.get(0).getId().longValue()); + assertEquals(2L, executions.get(0).getId().longValue()); } @Test(expected=NoSuchJobInstanceException.class) @@ -185,14 +185,14 @@ public class JsrJobOperatorTests { @Test(expected=NoSuchJobInstanceException.class) public void testGetJobExecutionsNullReturned() { - org.springframework.batch.core.JobInstance jobInstance = new org.springframework.batch.core.JobInstance(5l, "my job"); + org.springframework.batch.core.JobInstance jobInstance = new org.springframework.batch.core.JobInstance(5L, "my job"); jsrJobOperator.getJobExecutions(jobInstance); } @Test(expected=NoSuchJobInstanceException.class) public void testGetJobExecutionsNoneReturned() { - org.springframework.batch.core.JobInstance jobInstance = new org.springframework.batch.core.JobInstance(5l, "my job"); + org.springframework.batch.core.JobInstance jobInstance = new org.springframework.batch.core.JobInstance(5L, "my job"); List executions = new ArrayList(); when(jobExplorer.getJobExecutions(jobInstance)).thenReturn(executions); @@ -202,26 +202,26 @@ public class JsrJobOperatorTests { @Test public void testGetJobInstanceRoseyScenario() { - JobInstance instance = new JobInstance(1l, "my job"); - JobExecution execution = new JobExecution(5l); + JobInstance instance = new JobInstance(1L, "my job"); + JobExecution execution = new JobExecution(5L); execution.setJobInstance(instance); - when(jobExplorer.getJobExecution(5l)).thenReturn(execution); - when(jobExplorer.getJobInstance(1l)).thenReturn(instance); + when(jobExplorer.getJobExecution(5L)).thenReturn(execution); + when(jobExplorer.getJobInstance(1L)).thenReturn(instance); - javax.batch.runtime.JobInstance jobInstance = jsrJobOperator.getJobInstance(5l); + javax.batch.runtime.JobInstance jobInstance = jsrJobOperator.getJobInstance(5L); - assertEquals(1l, jobInstance.getInstanceId()); + assertEquals(1L, jobInstance.getInstanceId()); assertEquals("my job", jobInstance.getJobName()); } @Test(expected=NoSuchJobExecutionException.class) public void testGetJobInstanceNoExecution() { - JobInstance instance = new JobInstance(1l, "my job"); - JobExecution execution = new JobExecution(5l); + JobInstance instance = new JobInstance(1L, "my job"); + JobExecution execution = new JobExecution(5L); execution.setJobInstance(instance); - jsrJobOperator.getJobInstance(5l); + jsrJobOperator.getJobInstance(5L); } @Test @@ -248,18 +248,18 @@ public class JsrJobOperatorTests { @Test public void testGetJobInstancesRoseyScenario() { List instances = new ArrayList(); - instances.add(new JobInstance(1l, "myJob")); - instances.add(new JobInstance(2l, "myJob")); - instances.add(new JobInstance(3l, "myJob")); + instances.add(new JobInstance(1L, "myJob")); + instances.add(new JobInstance(2L, "myJob")); + instances.add(new JobInstance(3L, "myJob")); when(jobExplorer.getJobInstances("myJob", 0, 3)).thenReturn(instances); List jobInstances = jsrJobOperator.getJobInstances("myJob", 0, 3); assertEquals(3, jobInstances.size()); - assertEquals(1l, jobInstances.get(0).getInstanceId()); - assertEquals(2l, jobInstances.get(1).getInstanceId()); - assertEquals(3l, jobInstances.get(2).getInstanceId()); + assertEquals(1L, jobInstances.get(0).getInstanceId()); + assertEquals(2L, jobInstances.get(1).getInstanceId()); + assertEquals(3L, jobInstances.get(2).getInstanceId()); } @Test(expected=NoSuchJobException.class) @@ -293,11 +293,11 @@ public class JsrJobOperatorTests { @Test public void testGetParametersRoseyScenario() { - JobExecution jobExecution = new JobExecution(5l, new JobParametersBuilder().addString("key1", "value1").addLong(JsrJobParametersConverter.JOB_RUN_ID, 5l).toJobParameters()); + JobExecution jobExecution = new JobExecution(5L, new JobParametersBuilder().addString("key1", "value1").addLong(JsrJobParametersConverter.JOB_RUN_ID, 5L).toJobParameters()); - when(jobExplorer.getJobExecution(5l)).thenReturn(jobExecution); + when(jobExplorer.getJobExecution(5L)).thenReturn(jobExecution); - Properties params = jsrJobOperator.getParameters(5l); + Properties params = jsrJobOperator.getParameters(5L); assertEquals("value1", params.get("key1")); assertNull(params.get(JsrJobParametersConverter.JOB_RUN_ID)); @@ -305,7 +305,7 @@ public class JsrJobOperatorTests { @Test(expected=NoSuchJobExecutionException.class) public void testGetParametersNoExecution() { - jsrJobOperator.getParameters(5l); + jsrJobOperator.getParameters(5L); } @Test(expected=NoSuchJobException.class) @@ -320,26 +320,26 @@ public class JsrJobOperatorTests { @Test public void testGetRunningExecutions() { Set executions = new HashSet(); - executions.add(new JobExecution(5l)); + executions.add(new JobExecution(5L)); when(jobExplorer.findRunningJobExecutions("myJob")).thenReturn(executions); - assertEquals(5l, jsrJobOperator.getRunningExecutions("myJob").get(0).longValue()); + assertEquals(5L, jsrJobOperator.getRunningExecutions("myJob").get(0).longValue()); } @Test public void testGetStepExecutionsRoseyScenario() { - JobExecution jobExecution = new JobExecution(5l); + JobExecution jobExecution = new JobExecution(5L); List stepExecutions = new ArrayList(); - stepExecutions.add(new StepExecution("step1", jobExecution, 1l)); - stepExecutions.add(new StepExecution("step2", jobExecution, 2l)); + stepExecutions.add(new StepExecution("step1", jobExecution, 1L)); + stepExecutions.add(new StepExecution("step2", jobExecution, 2L)); jobExecution.addStepExecutions(stepExecutions); - when(jobExplorer.getJobExecution(5l)).thenReturn(jobExecution); - when(jobExplorer.getStepExecution(5l, 1l)).thenReturn(new StepExecution("step1", jobExecution, 1l)); - when(jobExplorer.getStepExecution(5l, 2l)).thenReturn(new StepExecution("step2", jobExecution, 2l)); + when(jobExplorer.getJobExecution(5L)).thenReturn(jobExecution); + when(jobExplorer.getStepExecution(5L, 1L)).thenReturn(new StepExecution("step1", jobExecution, 1L)); + when(jobExplorer.getStepExecution(5L, 2L)).thenReturn(new StepExecution("step2", jobExecution, 2L)); - List results = jsrJobOperator.getStepExecutions(5l); + List results = jsrJobOperator.getStepExecutions(5L); assertEquals("step1", results.get(0).getStepName()); assertEquals("step2", results.get(1).getStepName()); @@ -347,25 +347,25 @@ public class JsrJobOperatorTests { @Test(expected=NoSuchJobException.class) public void testGetStepExecutionsNoExecutionReturned() { - jsrJobOperator.getStepExecutions(5l); + jsrJobOperator.getStepExecutions(5L); } @Test public void testGetStepExecutionsPartitionedStepScenario() { - JobExecution jobExecution = new JobExecution(5l); + JobExecution jobExecution = new JobExecution(5L); List stepExecutions = new ArrayList(); - stepExecutions.add(new StepExecution("step1", jobExecution, 1l)); - stepExecutions.add(new StepExecution("step2", jobExecution, 2l)); - stepExecutions.add(new StepExecution("step2:partition0", jobExecution, 2l)); - stepExecutions.add(new StepExecution("step2:partition1", jobExecution, 2l)); - stepExecutions.add(new StepExecution("step2:partition2", jobExecution, 2l)); + stepExecutions.add(new StepExecution("step1", jobExecution, 1L)); + stepExecutions.add(new StepExecution("step2", jobExecution, 2L)); + stepExecutions.add(new StepExecution("step2:partition0", jobExecution, 2L)); + stepExecutions.add(new StepExecution("step2:partition1", jobExecution, 2L)); + stepExecutions.add(new StepExecution("step2:partition2", jobExecution, 2L)); jobExecution.addStepExecutions(stepExecutions); - when(jobExplorer.getJobExecution(5l)).thenReturn(jobExecution); - when(jobExplorer.getStepExecution(5l, 1l)).thenReturn(new StepExecution("step1", jobExecution, 1l)); - when(jobExplorer.getStepExecution(5l, 2l)).thenReturn(new StepExecution("step2", jobExecution, 2l)); + when(jobExplorer.getJobExecution(5L)).thenReturn(jobExecution); + when(jobExplorer.getStepExecution(5L, 1L)).thenReturn(new StepExecution("step1", jobExecution, 1L)); + when(jobExplorer.getStepExecution(5L, 2L)).thenReturn(new StepExecution("step2", jobExecution, 2L)); - List results = jsrJobOperator.getStepExecutions(5l); + List results = jsrJobOperator.getStepExecutions(5L); assertEquals("step1", results.get(0).getStepName()); assertEquals("step2", results.get(1).getStepName()); @@ -373,11 +373,11 @@ public class JsrJobOperatorTests { @Test public void testGetStepExecutionsNoStepExecutions() { - JobExecution jobExecution = new JobExecution(5l); + JobExecution jobExecution = new JobExecution(5L); - when(jobExplorer.getJobExecution(5l)).thenReturn(jobExecution); + when(jobExplorer.getJobExecution(5L)).thenReturn(jobExecution); - List results = jsrJobOperator.getStepExecutions(5l); + List results = jsrJobOperator.getStepExecutions(5L); assertEquals(0, results.size()); } @@ -534,10 +534,10 @@ public class JsrJobOperatorTests { jsrJobOperator = BatchRuntime.getJobOperator(); long executionId = jsrJobOperator.start("longRunningJob", null); // Give the job a chance to get started - Thread.sleep(1000l); + Thread.sleep(1000L); jsrJobOperator.stop(executionId); // Give the job the chance to finish stopping - Thread.sleep(1000l); + Thread.sleep(1000L); assertEquals(BatchStatus.STOPPED, jsrJobOperator.getJobExecution(executionId).getBatchStatus()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/partition/JsrPartitionHandlerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/partition/JsrPartitionHandlerTests.java index e6a6c32e9..c16fedda7 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/partition/JsrPartitionHandlerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/partition/JsrPartitionHandlerTests.java @@ -62,7 +62,7 @@ public class JsrPartitionHandlerTests { @Before public void setUp() throws Exception { JobExecution jobExecution = new JobExecution(1L); - jobExecution.setJobInstance(new JobInstance(1l, "job")); + jobExecution.setJobInstance(new JobInstance(1L, "job")); stepExecution = new StepExecution("step1", jobExecution); stepSplitter = new JsrStepExecutionSplitter(repository, false, "step1", true); Analyzer.collectorData = ""; @@ -79,7 +79,7 @@ public class JsrPartitionHandlerTests { }); propertyContext = new BatchPropertyContext(); handler.setPropertyContext(propertyContext); - repository = new MapJobRepositoryFactoryBean().getJobRepository(); + repository = new MapJobRepositoryFactoryBean().getObject(); handler.setJobRepository(repository); MyPartitionReducer.reset(); CountingPartitionCollector.reset(); @@ -223,7 +223,7 @@ public class JsrPartitionHandlerTests { @Test public void testRestartNoOverride() throws Exception { - javax.batch.runtime.JobExecution execution1 = JsrTestUtils.runJob("jsrPartitionHandlerRestartWithOverrideJob", null, 1000000l); + javax.batch.runtime.JobExecution execution1 = JsrTestUtils.runJob("jsrPartitionHandlerRestartWithOverrideJob", null, 1000000L); assertEquals(BatchStatus.FAILED, execution1.getBatchStatus()); assertEquals(1, MyPartitionReducer.beginCount); assertEquals(0, MyPartitionReducer.beforeCount); @@ -234,7 +234,7 @@ public class JsrPartitionHandlerTests { MyPartitionReducer.reset(); CountingPartitionCollector.reset(); - javax.batch.runtime.JobExecution execution2 = JsrTestUtils.restartJob(execution1.getExecutionId(), null, 1000000l); + javax.batch.runtime.JobExecution execution2 = JsrTestUtils.restartJob(execution1.getExecutionId(), null, 1000000L); assertEquals(BatchStatus.COMPLETED, execution2.getBatchStatus()); assertEquals(1, MyPartitionReducer.beginCount); assertEquals(1, MyPartitionReducer.beforeCount); @@ -249,7 +249,7 @@ public class JsrPartitionHandlerTests { Properties jobParameters = new Properties(); jobParameters.put("mapper.override", "true"); - javax.batch.runtime.JobExecution execution1 = JsrTestUtils.runJob("jsrPartitionHandlerRestartWithOverrideJob", jobParameters, 1000000l); + javax.batch.runtime.JobExecution execution1 = JsrTestUtils.runJob("jsrPartitionHandlerRestartWithOverrideJob", jobParameters, 1000000L); assertEquals(BatchStatus.FAILED, execution1.getBatchStatus()); assertEquals(1, MyPartitionReducer.beginCount); assertEquals(0, MyPartitionReducer.beforeCount); @@ -260,7 +260,7 @@ public class JsrPartitionHandlerTests { MyPartitionReducer.reset(); CountingPartitionCollector.reset(); - javax.batch.runtime.JobExecution execution2 = JsrTestUtils.restartJob(execution1.getExecutionId(), jobParameters, 1000000l); + javax.batch.runtime.JobExecution execution2 = JsrTestUtils.restartJob(execution1.getExecutionId(), jobParameters, 1000000L); assertEquals(BatchStatus.COMPLETED, execution2.getBatchStatus()); assertEquals(1, MyPartitionReducer.beginCount); assertEquals(1, MyPartitionReducer.beforeCount); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/partition/JsrStepExecutionSplitterTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/partition/JsrStepExecutionSplitterTests.java index d22da20b3..a1c409495 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/partition/JsrStepExecutionSplitterTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/partition/JsrStepExecutionSplitterTests.java @@ -38,7 +38,7 @@ public class JsrStepExecutionSplitterTests { @Test public void test() throws Exception { - Set executions = splitter.split(new StepExecution("step1", new JobExecution(5l)), 3); + Set executions = splitter.split(new StepExecution("step1", new JobExecution(5L)), 3); assertEquals(3, executions.size()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/DecisionStepTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/DecisionStepTests.java index 4ea381988..5742c9e24 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/DecisionStepTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/DecisionStepTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr.step; import static org.junit.Assert.assertEquals; @@ -49,28 +64,28 @@ public class DecisionStepTests { @Test public void testDecisionAsFirstStepOfJob() throws Exception { - JobExecution execution = runJob("DecisionStepTests-decisionAsFirstStep-context", new Properties(), 10000l); + JobExecution execution = runJob("DecisionStepTests-decisionAsFirstStep-context", new Properties(), 10000L); assertEquals(BatchStatus.FAILED, execution.getBatchStatus()); assertEquals(0, BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId()).size()); } @Test public void testDecisionThrowsException() throws Exception { - JobExecution execution = runJob("DecisionStepTests-decisionThrowsException-context", new Properties(), 10000l); + JobExecution execution = runJob("DecisionStepTests-decisionThrowsException-context", new Properties(), 10000L); assertEquals(BatchStatus.FAILED, execution.getBatchStatus()); assertEquals(2, BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId()).size()); } @Test public void testDecisionValidExitStatus() throws Exception { - JobExecution execution = runJob("DecisionStepTests-decisionValidExitStatus-context", new Properties(), 10000l); + JobExecution execution = runJob("DecisionStepTests-decisionValidExitStatus-context", new Properties(), 10000L); assertEquals(BatchStatus.COMPLETED, execution.getBatchStatus()); assertEquals(3, BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId()).size()); } @Test public void testDecisionUnmappedExitStatus() throws Exception { - JobExecution execution = runJob("DecisionStepTests-decisionInvalidExitStatus-context", new Properties(), 10000l); + JobExecution execution = runJob("DecisionStepTests-decisionInvalidExitStatus-context", new Properties(), 10000L); assertEquals(BatchStatus.COMPLETED, execution.getBatchStatus()); List stepExecutions = BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId()); assertEquals(2, stepExecutions.size()); @@ -82,7 +97,7 @@ public class DecisionStepTests { @Test public void testDecisionCustomExitStatus() throws Exception { - JobExecution execution = runJob("DecisionStepTests-decisionCustomExitStatus-context", new Properties(), 10000l); + JobExecution execution = runJob("DecisionStepTests-decisionCustomExitStatus-context", new Properties(), 10000L); assertEquals(BatchStatus.FAILED, execution.getBatchStatus()); assertEquals(2, BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId()).size()); assertEquals("CustomFail", execution.getExitStatus()); @@ -90,14 +105,14 @@ public class DecisionStepTests { @Test public void testDecisionAfterFlow() throws Exception { - JobExecution execution = runJob("DecisionStepTests-decisionAfterFlow-context", new Properties(), 10000l); + JobExecution execution = runJob("DecisionStepTests-decisionAfterFlow-context", new Properties(), 10000L); assertEquals(BatchStatus.COMPLETED, execution.getBatchStatus()); assertEquals(3, BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId()).size()); } @Test public void testDecisionAfterSplit() throws Exception { - JobExecution execution = runJob("DecisionStepTests-decisionAfterSplit-context", new Properties(), 10000l); + JobExecution execution = runJob("DecisionStepTests-decisionAfterSplit-context", new Properties(), 10000L); assertEquals(BatchStatus.COMPLETED, execution.getBatchStatus()); assertEquals(4, BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId()).size()); assertEquals(2, StepExecutionCountingDecider.previousStepCount); @@ -105,7 +120,7 @@ public class DecisionStepTests { @Test public void testDecisionRestart() throws Exception { - JobExecution execution = runJob("DecisionStepTests-restart-context", new Properties(), 10000l); + JobExecution execution = runJob("DecisionStepTests-restart-context", new Properties(), 10000L); assertEquals(BatchStatus.STOPPED, execution.getBatchStatus()); List stepExecutions = BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId()); @@ -114,7 +129,7 @@ public class DecisionStepTests { assertEquals("step1", stepExecutions.get(0).getStepName()); assertEquals("decision1", stepExecutions.get(1).getStepName()); - JobExecution execution2 = restartJob(execution.getExecutionId(), new Properties(), 10000l); + JobExecution execution2 = restartJob(execution.getExecutionId(), new Properties(), 10000L); assertEquals(BatchStatus.COMPLETED, execution2.getBatchStatus()); List stepExecutions2 = BatchRuntime.getJobOperator().getStepExecutions(execution2.getExecutionId()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/batchlet/BatchletAdapterTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/batchlet/BatchletAdapterTests.java index fd7ff3ec0..72398a74a 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/batchlet/BatchletAdapterTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/batchlet/BatchletAdapterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr.step.batchlet; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/batchlet/BatchletSupport.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/batchlet/BatchletSupport.java index e7f0016ad..4d7f742c4 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/batchlet/BatchletSupport.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/batchlet/BatchletSupport.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr.step.batchlet; import javax.batch.api.Batchlet; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/batchlet/FailingBatchlet.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/batchlet/FailingBatchlet.java index 73268170c..716febfbe 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/batchlet/FailingBatchlet.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/batchlet/FailingBatchlet.java @@ -19,7 +19,7 @@ import javax.batch.api.Batchlet; /** *

    - * Test batchlet that always fails.. + * Test batchlet that always fails. *

    * * @author Chris Schaefer diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/batchlet/RestartBatchlet.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/batchlet/RestartBatchlet.java index 65a56c0fe..abbefad7d 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/batchlet/RestartBatchlet.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/batchlet/RestartBatchlet.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr.step.batchlet; import javax.batch.api.Batchlet; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/item/JsrChunkProcessorTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/item/JsrChunkProcessorTests.java index 91a97de9c..9e99b5b1c 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/item/JsrChunkProcessorTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/item/JsrChunkProcessorTests.java @@ -70,7 +70,7 @@ public class JsrChunkProcessorTests { builder = new JsrSimpleStepBuilder(new StepBuilder("step1")); builder.setBatchPropertyContext(new BatchPropertyContext()); - repository = new MapJobRepositoryFactoryBean().getJobRepository(); + repository = new MapJobRepositoryFactoryBean().getObject(); builder.repository(repository); builder.transactionManager(new ResourcelessTransactionManager()); stepExecution = null; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/item/JsrFaultTolerantChunkProcessorTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/item/JsrFaultTolerantChunkProcessorTests.java index 814115a3d..d0d606ed7 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/item/JsrFaultTolerantChunkProcessorTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/item/JsrFaultTolerantChunkProcessorTests.java @@ -30,6 +30,7 @@ import org.springframework.batch.core.ItemWriteListener; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobInterruptedException; import org.springframework.batch.core.JobParameters; +import org.springframework.batch.core.SkipListener; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.jsr.configuration.support.BatchPropertyContext; @@ -50,7 +51,7 @@ public class JsrFaultTolerantChunkProcessorTests { private FailingListItemReader reader; private FailingCountingItemProcessor processor; private StoringItemWriter writer; - private CountingListener readListener; + private CountingListener listener; private JsrFaultTolerantStepBuilder builder; private JobRepository repository; private StepExecution stepExecution; @@ -67,11 +68,11 @@ public class JsrFaultTolerantChunkProcessorTests { reader = new FailingListItemReader(items); processor = new FailingCountingItemProcessor(); writer = new StoringItemWriter(); - readListener = new CountingListener(); + listener = new CountingListener(); builder = new JsrFaultTolerantStepBuilder(new StepBuilder("step1")); builder.setBatchPropertyContext(new BatchPropertyContext()); - repository = new MapJobRepositoryFactoryBean().getJobRepository(); + repository = new MapJobRepositoryFactoryBean().getObject(); builder.repository(repository); builder.transactionManager(new ResourcelessTransactionManager()); stepExecution = null; @@ -80,7 +81,7 @@ public class JsrFaultTolerantChunkProcessorTests { @Test public void testNoInputNoListeners() throws Exception{ reader = new FailingListItemReader(new ArrayList()); - Step step = builder.chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) readListener).build(); + Step step = builder.chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) listener).build(); runStep(step); @@ -122,7 +123,7 @@ public class JsrFaultTolerantChunkProcessorTests { @Test public void testSimpleScenarioNoProcessor() throws Exception{ - Step step = builder.chunk(25).reader(reader).writer(writer).listener((ItemReadListener) readListener).build(); + Step step = builder.chunk(25).reader(reader).writer(writer).listener((ItemReadListener) listener).build(); runStep(step); @@ -134,15 +135,15 @@ public class JsrFaultTolerantChunkProcessorTests { assertEquals(25, stepExecution.getWriteCount()); assertEquals(0, stepExecution.getFilterCount()); assertEquals(0, stepExecution.getWriteSkipCount()); - assertEquals(0, readListener.afterProcess); - assertEquals(25, readListener.afterRead); - assertEquals(1, readListener.afterWrite); - assertEquals(0, readListener.beforeProcess); - assertEquals(26, readListener.beforeRead); - assertEquals(1, readListener.beforeWriteCount); - assertEquals(0, readListener.onProcessError); - assertEquals(0, readListener.onReadError); - assertEquals(0, readListener.onWriteError); + assertEquals(0, listener.afterProcess); + assertEquals(25, listener.afterRead); + assertEquals(1, listener.afterWrite); + assertEquals(0, listener.beforeProcess); + assertEquals(26, listener.beforeRead); + assertEquals(1, listener.beforeWriteCount); + assertEquals(0, listener.onProcessError); + assertEquals(0, listener.onReadError); + assertEquals(0, listener.onWriteError); assertEquals(0, processor.count); int count = 0; @@ -155,7 +156,7 @@ public class JsrFaultTolerantChunkProcessorTests { @Test public void testProcessorFilteringNoListeners() throws Exception{ processor.filter = true; - Step step = builder.chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) readListener).build(); + Step step = builder.chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) listener).build(); runStep(step); @@ -180,7 +181,7 @@ public class JsrFaultTolerantChunkProcessorTests { public void testSkipReadError() throws Exception{ reader.failCount = 10; - Step step = builder.faultTolerant().skip(RuntimeException.class).skipLimit(20).chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) readListener).build(); + Step step = builder.faultTolerant().skip(RuntimeException.class).skipLimit(20).chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) listener).build(); runStep(step); @@ -196,22 +197,22 @@ public class JsrFaultTolerantChunkProcessorTests { assertEquals(0, stepExecution.getFilterCount()); assertEquals(0, stepExecution.getWriteSkipCount()); assertEquals(0, stepExecution.getFailureExceptions().size()); - assertEquals(25, readListener.afterProcess); - assertEquals(25, readListener.afterRead); - assertEquals(1, readListener.afterWrite); - assertEquals(25, readListener.beforeProcess); - assertEquals(27, readListener.beforeRead); - assertEquals(1, readListener.beforeWriteCount); - assertEquals(0, readListener.onProcessError); - assertEquals(1, readListener.onReadError); - assertEquals(0, readListener.onWriteError); + assertEquals(25, listener.afterProcess); + assertEquals(25, listener.afterRead); + assertEquals(1, listener.afterWrite); + assertEquals(25, listener.beforeProcess); + assertEquals(27, listener.beforeRead); + assertEquals(1, listener.beforeWriteCount); + assertEquals(0, listener.onProcessError); + assertEquals(1, listener.onReadError); + assertEquals(0, listener.onWriteError); } @Test public void testRetryReadError() throws Exception{ reader.failCount = 10; - Step step = builder.faultTolerant().retry(RuntimeException.class).retryLimit(20).chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) readListener).build(); + Step step = builder.faultTolerant().retry(RuntimeException.class).retryLimit(20).chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) listener).build(); runStep(step); @@ -226,22 +227,22 @@ public class JsrFaultTolerantChunkProcessorTests { assertEquals(0, stepExecution.getFilterCount()); assertEquals(0, stepExecution.getWriteSkipCount()); assertEquals(0, stepExecution.getFailureExceptions().size()); - assertEquals(25, readListener.afterProcess); - assertEquals(25, readListener.afterRead); - assertEquals(1, readListener.afterWrite); - assertEquals(25, readListener.beforeProcess); - assertEquals(27, readListener.beforeRead); - assertEquals(1, readListener.beforeWriteCount); - assertEquals(0, readListener.onProcessError); - assertEquals(1, readListener.onReadError); - assertEquals(0, readListener.onWriteError); + assertEquals(25, listener.afterProcess); + assertEquals(25, listener.afterRead); + assertEquals(1, listener.afterWrite); + assertEquals(25, listener.beforeProcess); + assertEquals(27, listener.beforeRead); + assertEquals(1, listener.beforeWriteCount); + assertEquals(0, listener.onProcessError); + assertEquals(1, listener.onReadError); + assertEquals(0, listener.onWriteError); } @Test public void testReadError() throws Exception{ reader.failCount = 10; - Step step = builder.chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) readListener).build(); + Step step = builder.chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) listener).build(); runStep(step); @@ -258,22 +259,22 @@ public class JsrFaultTolerantChunkProcessorTests { assertEquals(0, stepExecution.getWriteSkipCount()); assertEquals(1, stepExecution.getFailureExceptions().size()); assertEquals("expected at read index 10", stepExecution.getFailureExceptions().get(0).getCause().getMessage()); - assertEquals(9, readListener.afterProcess); - assertEquals(9, readListener.afterRead); - assertEquals(0, readListener.afterWrite); - assertEquals(9, readListener.beforeProcess); - assertEquals(10, readListener.beforeRead); - assertEquals(0, readListener.beforeWriteCount); - assertEquals(0, readListener.onProcessError); - assertEquals(1, readListener.onReadError); - assertEquals(0, readListener.onWriteError); + assertEquals(9, listener.afterProcess); + assertEquals(9, listener.afterRead); + assertEquals(0, listener.afterWrite); + assertEquals(9, listener.beforeProcess); + assertEquals(10, listener.beforeRead); + assertEquals(0, listener.beforeWriteCount); + assertEquals(0, listener.onProcessError); + assertEquals(1, listener.onReadError); + assertEquals(0, listener.onWriteError); } @Test public void testProcessError() throws Exception{ processor.failCount = 10; - Step step = builder.chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) readListener).build(); + Step step = builder.chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) listener).build(); runStep(step); @@ -288,22 +289,22 @@ public class JsrFaultTolerantChunkProcessorTests { assertEquals(0, stepExecution.getFilterCount()); assertEquals(0, stepExecution.getWriteSkipCount()); assertEquals("expected at process index 10", stepExecution.getFailureExceptions().get(0).getCause().getMessage()); - assertEquals(9, readListener.afterProcess); - assertEquals(10, readListener.afterRead); - assertEquals(0, readListener.afterWrite); - assertEquals(10, readListener.beforeProcess); - assertEquals(10, readListener.beforeRead); - assertEquals(0, readListener.beforeWriteCount); - assertEquals(1, readListener.onProcessError); - assertEquals(0, readListener.onReadError); - assertEquals(0, readListener.onWriteError); + assertEquals(9, listener.afterProcess); + assertEquals(10, listener.afterRead); + assertEquals(0, listener.afterWrite); + assertEquals(10, listener.beforeProcess); + assertEquals(10, listener.beforeRead); + assertEquals(0, listener.beforeWriteCount); + assertEquals(1, listener.onProcessError); + assertEquals(0, listener.onReadError); + assertEquals(0, listener.onWriteError); } @Test public void testSkipProcessError() throws Exception{ processor.failCount = 10; - Step step = builder.faultTolerant().skip(RuntimeException.class).skipLimit(20).chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) readListener).build(); + Step step = builder.faultTolerant().skip(RuntimeException.class).skipLimit(20).chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) listener).build(); runStep(step); @@ -319,22 +320,22 @@ public class JsrFaultTolerantChunkProcessorTests { assertEquals(1, stepExecution.getFilterCount()); assertEquals(0, stepExecution.getWriteSkipCount()); assertEquals(0, stepExecution.getFailureExceptions().size()); - assertEquals(24, readListener.afterProcess); - assertEquals(25, readListener.afterRead); - assertEquals(1, readListener.afterWrite); - assertEquals(25, readListener.beforeProcess); - assertEquals(26, readListener.beforeRead); - assertEquals(1, readListener.beforeWriteCount); - assertEquals(1, readListener.onProcessError); - assertEquals(0, readListener.onReadError); - assertEquals(0, readListener.onWriteError); + assertEquals(24, listener.afterProcess); + assertEquals(25, listener.afterRead); + assertEquals(1, listener.afterWrite); + assertEquals(25, listener.beforeProcess); + assertEquals(26, listener.beforeRead); + assertEquals(1, listener.beforeWriteCount); + assertEquals(1, listener.onProcessError); + assertEquals(0, listener.onReadError); + assertEquals(0, listener.onWriteError); } @Test public void testRetryProcessError() throws Exception{ processor.failCount = 10; - Step step = builder.faultTolerant().retry(RuntimeException.class).retryLimit(20).chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) readListener).build(); + Step step = builder.faultTolerant().retry(RuntimeException.class).retryLimit(20).chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) listener).build(); runStep(step); @@ -350,22 +351,22 @@ public class JsrFaultTolerantChunkProcessorTests { assertEquals(0, stepExecution.getFilterCount()); assertEquals(0, stepExecution.getWriteSkipCount()); assertEquals(0, stepExecution.getFailureExceptions().size()); - assertEquals(25, readListener.afterProcess); - assertEquals(25, readListener.afterRead); - assertEquals(1, readListener.afterWrite); - assertEquals(26, readListener.beforeProcess); - assertEquals(26, readListener.beforeRead); - assertEquals(1, readListener.beforeWriteCount); - assertEquals(1, readListener.onProcessError); - assertEquals(0, readListener.onReadError); - assertEquals(0, readListener.onWriteError); + assertEquals(25, listener.afterProcess); + assertEquals(25, listener.afterRead); + assertEquals(1, listener.afterWrite); + assertEquals(26, listener.beforeProcess); + assertEquals(26, listener.beforeRead); + assertEquals(1, listener.beforeWriteCount); + assertEquals(1, listener.onProcessError); + assertEquals(0, listener.onReadError); + assertEquals(0, listener.onWriteError); } @Test public void testWriteError() throws Exception{ writer.fail = true; - Step step = builder.chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) readListener).build(); + Step step = builder.chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) listener).build(); runStep(step); @@ -379,22 +380,22 @@ public class JsrFaultTolerantChunkProcessorTests { assertEquals(0, stepExecution.getWriteCount()); assertEquals(0, stepExecution.getFilterCount()); assertEquals(0, stepExecution.getWriteSkipCount()); - assertEquals(25, readListener.afterProcess); - assertEquals(25, readListener.afterRead); - assertEquals(0, readListener.afterWrite); - assertEquals(25, readListener.beforeProcess); - assertEquals(25, readListener.beforeRead); - assertEquals(1, readListener.beforeWriteCount); - assertEquals(0, readListener.onProcessError); - assertEquals(0, readListener.onReadError); - assertEquals(1, readListener.onWriteError); + assertEquals(25, listener.afterProcess); + assertEquals(25, listener.afterRead); + assertEquals(0, listener.afterWrite); + assertEquals(25, listener.beforeProcess); + assertEquals(25, listener.beforeRead); + assertEquals(1, listener.beforeWriteCount); + assertEquals(0, listener.onProcessError); + assertEquals(0, listener.onReadError); + assertEquals(1, listener.onWriteError); } @Test public void testRetryWriteError() throws Exception{ writer.fail = true; - Step step = builder.faultTolerant().retry(RuntimeException.class).retryLimit(25).chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) readListener).build(); + Step step = builder.faultTolerant().retry(RuntimeException.class).retryLimit(25).chunk(25).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) listener).build(); runStep(step); @@ -408,22 +409,22 @@ public class JsrFaultTolerantChunkProcessorTests { assertEquals(25, stepExecution.getWriteCount()); assertEquals(0, stepExecution.getFilterCount()); assertEquals(0, stepExecution.getWriteSkipCount()); - assertEquals(25, readListener.afterProcess); - assertEquals(25, readListener.afterRead); - assertEquals(1, readListener.afterWrite); - assertEquals(25, readListener.beforeProcess); - assertEquals(26, readListener.beforeRead); - assertEquals(2, readListener.beforeWriteCount); - assertEquals(0, readListener.onProcessError); - assertEquals(0, readListener.onReadError); - assertEquals(1, readListener.onWriteError); + assertEquals(25, listener.afterProcess); + assertEquals(25, listener.afterRead); + assertEquals(1, listener.afterWrite); + assertEquals(25, listener.beforeProcess); + assertEquals(26, listener.beforeRead); + assertEquals(2, listener.beforeWriteCount); + assertEquals(0, listener.onProcessError); + assertEquals(0, listener.onReadError); + assertEquals(1, listener.onWriteError); } @Test public void testSkipWriteError() throws Exception{ writer.fail = true; - Step step = builder.faultTolerant().skip(RuntimeException.class).skipLimit(25).chunk(7).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) readListener).build(); + Step step = builder.faultTolerant().skip(RuntimeException.class).skipLimit(25).chunk(7).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) listener).build(); runStep(step); @@ -437,21 +438,24 @@ public class JsrFaultTolerantChunkProcessorTests { assertEquals(18, stepExecution.getWriteCount()); assertEquals(0, stepExecution.getFilterCount()); assertEquals(1, stepExecution.getWriteSkipCount()); - assertEquals(25, readListener.afterProcess); - assertEquals(25, readListener.afterRead); - assertEquals(3, readListener.afterWrite); - assertEquals(25, readListener.beforeProcess); - assertEquals(26, readListener.beforeRead); - assertEquals(4, readListener.beforeWriteCount); - assertEquals(0, readListener.onProcessError); - assertEquals(0, readListener.onReadError); - assertEquals(1, readListener.onWriteError); + assertEquals(25, listener.afterProcess); + assertEquals(25, listener.afterRead); + assertEquals(3, listener.afterWrite); + assertEquals(25, listener.beforeProcess); + assertEquals(26, listener.beforeRead); + assertEquals(4, listener.beforeWriteCount); + assertEquals(0, listener.onProcessError); + assertEquals(0, listener.onReadError); + assertEquals(1, listener.onWriteError); + assertEquals(0, listener.onSkipInRead); + assertEquals(0, listener.onSkipInProcess); + assertEquals(1, listener.onSkipInWrite); } - + @Test public void testMultipleChunks() throws Exception{ - Step step = builder.chunk(10).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) readListener).build(); + Step step = builder.chunk(10).reader(reader).processor(processor).writer(writer).listener((ItemReadListener) listener).build(); runStep(step); @@ -465,15 +469,15 @@ public class JsrFaultTolerantChunkProcessorTests { assertEquals(25, stepExecution.getWriteCount()); assertEquals(0, stepExecution.getFilterCount()); assertEquals(0, stepExecution.getWriteSkipCount()); - assertEquals(25, readListener.afterProcess); - assertEquals(25, readListener.afterRead); - assertEquals(3, readListener.afterWrite); - assertEquals(25, readListener.beforeProcess); - assertEquals(26, readListener.beforeRead); - assertEquals(3, readListener.beforeWriteCount); - assertEquals(0, readListener.onProcessError); - assertEquals(0, readListener.onReadError); - assertEquals(0, readListener.onWriteError); + assertEquals(25, listener.afterProcess); + assertEquals(25, listener.afterRead); + assertEquals(3, listener.afterWrite); + assertEquals(25, listener.beforeProcess); + assertEquals(26, listener.beforeRead); + assertEquals(3, listener.beforeWriteCount); + assertEquals(0, listener.onProcessError); + assertEquals(0, listener.onReadError); + assertEquals(0, listener.onWriteError); } protected void runStep(Step step) @@ -542,7 +546,7 @@ public class JsrFaultTolerantChunkProcessorTests { } } - public static class CountingListener implements ItemReadListener, ItemProcessListener, ItemWriteListener { + public static class CountingListener implements ItemReadListener, ItemProcessListener, ItemWriteListener, SkipListener> { protected int beforeWriteCount = 0; protected int afterWrite = 0; @@ -553,6 +557,9 @@ public class JsrFaultTolerantChunkProcessorTests { protected int beforeRead = 0; protected int afterRead = 0; protected int onReadError = 0; + protected int onSkipInRead = 0; + protected int onSkipInProcess = 0; + protected int onSkipInWrite = 0; @Override public void beforeWrite(List items) { @@ -599,5 +606,20 @@ public class JsrFaultTolerantChunkProcessorTests { public void onReadError(Exception ex) { onReadError++; } + + @Override + public void onSkipInRead(Throwable t) { + onSkipInRead++; + } + + @Override + public void onSkipInWrite(List items, Throwable t) { + onSkipInWrite++; + } + + @Override + public void onSkipInProcess(String item, Throwable t) { + onSkipInProcess++; + } } } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/listener/ExitStatusSettingStepListener.java b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/listener/ExitStatusSettingStepListener.java index 63d341b14..54132ae80 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/listener/ExitStatusSettingStepListener.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/jsr/step/listener/ExitStatusSettingStepListener.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.jsr.step.listener; import javax.batch.api.BatchProperty; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/JobLauncherIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/JobLauncherIntegrationTests.java index e1c255bf2..82821d698 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/JobLauncherIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/JobLauncherIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.launch; import static org.junit.Assert.assertEquals; @@ -38,13 +53,13 @@ public class JobLauncherIntegrationTests { @Test public void testLaunchAndRelaunch() throws Exception { - int before = jdbcTemplate.queryForInt("select count(*) from BATCH_JOB_INSTANCE"); + int before = jdbcTemplate.queryForObject("select count(*) from BATCH_JOB_INSTANCE", Integer.class); JobExecution jobExecution = launch(true,0); launch(false, jobExecution.getId()); launch(false, jobExecution.getId()); - int after = jdbcTemplate.queryForInt("select count(*) from BATCH_JOB_INSTANCE"); + int after = jdbcTemplate.queryForObject("select count(*) from BATCH_JOB_INSTANCE", Integer.class); assertEquals(before+1, after); } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/SimpleJobOperatorTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/SimpleJobOperatorTests.java index fa0e4cbdb..fd88f88d6 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/SimpleJobOperatorTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/SimpleJobOperatorTests.java @@ -111,10 +111,9 @@ public class SimpleJobOperatorTests { throw new NoSuchJobException("foo"); } - @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public Set getJobNames() { - return new HashSet(Arrays.asList(new String[] { "foo", "bar" })); + return new HashSet(Arrays.asList(new String[] { "foo", "bar" })); } }); @@ -202,7 +201,7 @@ public class SimpleJobOperatorTests { @Test public void testResumeSunnyDay() throws Exception { jobParameters = new JobParameters(); - when(jobExplorer.getJobExecution(111l)).thenReturn(new JobExecution(new JobInstance(123L, job.getName()), 111L, jobParameters, null)); + when(jobExplorer.getJobExecution(111L)).thenReturn(new JobExecution(new JobInstance(123L, job.getName()), 111L, jobParameters, null)); jobExplorer.getJobExecution(111L); Long value = jobOperator.restart(111L); assertEquals(999, value.longValue()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/StubJobLauncher.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/StubJobLauncher.java index a28fa153f..87af79fa8 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/StubJobLauncher.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/StubJobLauncher.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.launch.support; import org.springframework.batch.core.Job; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/TestJobParametersIncrementer.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/TestJobParametersIncrementer.java index bde47fef7..ae2ca6b6e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/TestJobParametersIncrementer.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/TestJobParametersIncrementer.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.launch.support; import org.springframework.batch.core.JobParameters; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemReadListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemReadListenerTests.java index 09b42daf3..8d692448e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemReadListenerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemReadListenerTests.java @@ -63,6 +63,7 @@ public class CompositeItemReadListenerTests { compositeListener.onReadError(ex); } + @SuppressWarnings("serial") @Test public void testSetListeners() throws Exception { compositeListener.setListeners(new ArrayList>() { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemWriteListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemWriteListenerTests.java index 15980e932..69613ea87 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemWriteListenerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemWriteListenerTests.java @@ -66,6 +66,7 @@ public class CompositeItemWriteListenerTests { compositeListener.onWriteError(ex, item); } + @SuppressWarnings("serial") @Test public void testSetListeners() throws Exception { compositeListener.setListeners(new ArrayList>() { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeStepExecutionListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeStepExecutionListenerTests.java index 750e19a1c..554f39d2d 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeStepExecutionListenerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeStepExecutionListenerTests.java @@ -41,7 +41,7 @@ public class CompositeStepExecutionListenerTests extends TestCase { * . */ public void testSetListeners() { - JobExecution jobExecution = new JobExecution(1l); + JobExecution jobExecution = new JobExecution(1L); StepExecution stepExecution = new StepExecution("s1", jobExecution); listener.setListeners(new StepExecutionListener[] { new StepExecutionListenerSupport() { @Override @@ -67,7 +67,7 @@ public class CompositeStepExecutionListenerTests extends TestCase { * . */ public void testSetListener() { - JobExecution jobExecution = new JobExecution(1l); + JobExecution jobExecution = new JobExecution(1L); StepExecution stepExecution = new StepExecution("s1", jobExecution); listener.register(new StepExecutionListenerSupport() { @Override diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/ExecutionContextPromotionListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/ExecutionContextPromotionListenerTests.java index cf76e5b1d..5c2997e51 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/ExecutionContextPromotionListenerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/ExecutionContextPromotionListenerTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.listener; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java index 5bb5fc0fe..69629b58b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java @@ -47,7 +47,7 @@ public class MulticasterBatchListenerTests { @Test public void testSetListeners() { - JobExecution jobExecution = new JobExecution(1l); + JobExecution jobExecution = new JobExecution(1L); StepExecution stepExecution = new StepExecution("s1", jobExecution); multicast.setListeners(Arrays.asList(new StepListenerSupport() { @Override @@ -68,7 +68,7 @@ public class MulticasterBatchListenerTests { */ @Test public void testRegister() { - JobExecution jobExecution = new JobExecution(1l); + JobExecution jobExecution = new JobExecution(1L); StepExecution stepExecution = new StepExecution("s1", jobExecution); multicast.register(new StepListenerSupport() { @Override diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/StepListenerMethodInterceptorTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/StepListenerMethodInterceptorTests.java index 297c9cea0..fbaa49f5a 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/StepListenerMethodInterceptorTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/StepListenerMethodInterceptorTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.listener; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemReader.java b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemReader.java index 131bcf32c..3e8c2b33d 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemReader.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemReader.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.partition; import org.apache.commons.logging.Log; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemReaderTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemReaderTests.java index e78e4b5a1..478542b39 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemReaderTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemReaderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.partition; import static org.junit.Assert.*; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemWriter.java b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemWriter.java index 9026a8e04..09965ac0a 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemWriter.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemWriter.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.partition; import java.util.ArrayList; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/RestartIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/RestartIntegrationTests.java index 9e6f3b619..87a537d47 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/RestartIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/RestartIntegrationTests.java @@ -74,8 +74,8 @@ public class RestartIntegrationTests { ExampleItemReader.fail = true; JobParameters jobParameters = new JobParametersBuilder().addString("restart", "yes").toJobParameters(); - int beforeMaster = jdbcTemplate.queryForInt("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:master'"); - int beforePartition = jdbcTemplate.queryForInt("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME like 'step1:partition%'"); + int beforeMaster = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:master'", Integer.class); + int beforePartition = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME like 'step1:partition%'", Integer.class); ExampleItemWriter.clear(); JobExecution execution = jobLauncher.run(job, jobParameters); @@ -88,8 +88,8 @@ public class RestartIntegrationTests { // Only 4 because the others were processed in the first attempt assertEquals(4, ExampleItemWriter.getItems().size()); - int afterMaster = jdbcTemplate.queryForInt("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:master'"); - int afterPartition = jdbcTemplate.queryForInt("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME like 'step1:partition%'"); + int afterMaster = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:master'", Integer.class); + int afterPartition = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME like 'step1:partition%'", Integer.class); // Two attempts assertEquals(2, afterMaster-beforeMaster); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/VanillaIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/VanillaIntegrationTests.java index 1f3619f45..f07f9e27d 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/VanillaIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/VanillaIntegrationTests.java @@ -58,11 +58,11 @@ public class VanillaIntegrationTests { @Test public void testLaunchJob() throws Exception { - int beforeMaster = jdbcTemplate.queryForInt("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:master'"); - int beforePartition = jdbcTemplate.queryForInt("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME like 'step1:partition%'"); + int beforeMaster = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:master'", Integer.class); + int beforePartition = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME like 'step1:partition%'", Integer.class); assertNotNull(jobLauncher.run(job, new JobParameters())); - int afterMaster = jdbcTemplate.queryForInt("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:master'"); - int afterPartition = jdbcTemplate.queryForInt("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME like 'step1:partition%'"); + int afterMaster = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:master'", Integer.class); + int afterPartition = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME like 'step1:partition%'", Integer.class); assertEquals(1, afterMaster-beforeMaster); // Should be same as grid size in step splitter assertEquals(2, afterPartition-beforePartition); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/DefaultStepExecutionAggregatorTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/DefaultStepExecutionAggregatorTests.java index 3111f7d3b..eccb89bd1 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/DefaultStepExecutionAggregatorTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/DefaultStepExecutionAggregatorTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.partition.support; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/MultiResourcePartitionerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/MultiResourcePartitionerTests.java index 34a323d97..37eed1e6a 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/MultiResourcePartitionerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/MultiResourcePartitionerTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.partition.support; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/RemoteStepExecutionAggregatorTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/RemoteStepExecutionAggregatorTests.java index 6efdbed7f..47e088912 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/RemoteStepExecutionAggregatorTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/RemoteStepExecutionAggregatorTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2011-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.partition.support; import org.junit.Before; @@ -6,7 +21,6 @@ import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.StepExecution; -import org.springframework.batch.core.explore.JobExplorer; import org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean; @@ -33,7 +47,7 @@ public class RemoteStepExecutionAggregatorTests { public void init() throws Exception { MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean(); JobRepository jobRepository = factory.getObject(); - aggregator.setJobExplorer((JobExplorer) new MapJobExplorerFactoryBean(factory).getObject()); + aggregator.setJobExplorer(new MapJobExplorerFactoryBean(factory).getObject()); jobExecution = jobRepository.createJobExecution("job", new JobParameters()); result = jobExecution.createStepExecution("aggregate"); stepExecution1 = jobExecution.createStepExecution("foo:1"); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/SimpleStepExecutionSplitterTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/SimpleStepExecutionSplitterTests.java index 143868828..07ec3b58b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/SimpleStepExecutionSplitterTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/SimpleStepExecutionSplitterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.partition.support; import org.junit.Before; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/TaskExecutorPartitionHandlerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/TaskExecutorPartitionHandlerTests.java index b6287cdd1..5280cbe5b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/TaskExecutorPartitionHandlerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/TaskExecutorPartitionHandlerTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.partition.support; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractExecutionContextDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractExecutionContextDaoTests.java index 5f5ce9ab6..f695c287f 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractExecutionContextDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractExecutionContextDaoTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.repository.dao; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobDaoTests.java index b90cc45c6..6d60135ae 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobDaoTests.java @@ -97,15 +97,15 @@ public abstract class AbstractJobDaoTests { @Transactional @Test public void testVersionIsNotNullForJob() throws Exception { - int version = jdbcTemplate.queryForInt("select version from BATCH_JOB_INSTANCE where JOB_INSTANCE_ID=" - + jobInstance.getId()); + int version = jdbcTemplate.queryForObject("select version from BATCH_JOB_INSTANCE where JOB_INSTANCE_ID=" + + jobInstance.getId(), Integer.class); assertEquals(0, version); } @Transactional @Test public void testVersionIsNotNullForJobExecution() throws Exception { - int version = jdbcTemplate.queryForInt("select version from BATCH_JOB_EXECUTION where JOB_EXECUTION_ID=" - + jobExecution.getId()); + int version = jdbcTemplate.queryForObject("select version from BATCH_JOB_EXECUTION where JOB_EXECUTION_ID=" + + jobExecution.getId(), Integer.class); assertEquals(0, version); } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobExecutionDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobExecutionDaoTests.java index b7d84e212..564d5e991 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobExecutionDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobExecutionDaoTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.repository.dao; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobInstanceDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobInstanceDaoTests.java index c48ceff0c..0d557cb45 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobInstanceDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobInstanceDaoTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.repository.dao; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractStepExecutionDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractStepExecutionDaoTests.java index 967af7925..44863bc63 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractStepExecutionDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractStepExecutionDaoTests.java @@ -65,7 +65,7 @@ public abstract class AbstractStepExecutionDaoTests extends AbstractTransactiona protected abstract StepExecutionDao getStepExecutionDao(); /** - * @return {@link JobRepository} that uses the stepExecution dao. + * @return {@link JobRepository} that uses the stepExecution DAO. */ protected abstract JobRepository getJobRepository(); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/DefaultExecutionContextSerializerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/DefaultExecutionContextSerializerTests.java index 9973f22df..0817afb4d 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/DefaultExecutionContextSerializerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/DefaultExecutionContextSerializerTests.java @@ -1,5 +1,17 @@ -/** +/* + * Copyright 2012-2014 the original author or authors. * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.springframework.batch.core.repository.dao; @@ -81,7 +93,6 @@ public class DefaultExecutionContextSerializerTests { } } - @SuppressWarnings("unchecked") private Map serializationRoundTrip(Map m1) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); serializer.serialize(m1, out); @@ -89,7 +100,7 @@ public class DefaultExecutionContextSerializerTests { String s = new String(out.toByteArray(), "ISO-8859-1"); InputStream in = new ByteArrayInputStream(s.getBytes("ISO-8859-1")); - Map m2 = (Map) serializer.deserialize(in); + Map m2 = serializer.deserialize(in); return m2; } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcExecutionContextDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcExecutionContextDaoTests.java index 96a019eae..2843fcfcf 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcExecutionContextDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcExecutionContextDaoTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.repository.dao; import org.junit.runner.RunWith; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcJobDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcJobDaoTests.java index 81bca09ab..d5f1bebb3 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcJobDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcJobDaoTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.repository.dao; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcJobExecutionDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcJobExecutionDaoTests.java index 339ba22fc..1322cb3d0 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcJobExecutionDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcJobExecutionDaoTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.repository.dao; import javax.sql.DataSource; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDaoTests.java index c454d84d4..dcbe80f54 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDaoTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.repository.dao; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDaoTests.java index 223ebbf0d..03e761675 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDaoTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.repository.dao; import static org.junit.Assert.assertTrue; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/MapExecutionContextDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/MapExecutionContextDaoTests.java index eba9470a5..1fbc9246d 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/MapExecutionContextDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/MapExecutionContextDaoTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.repository.dao; import static org.junit.Assert.*; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/MapJobExecutionDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/MapJobExecutionDaoTests.java index 21d5df1d2..1b72e7b7b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/MapJobExecutionDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/MapJobExecutionDaoTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.repository.dao; import static org.junit.Assert.assertNull; @@ -98,7 +113,7 @@ public class MapJobExecutionDaoTests extends AbstractJobExecutionDaoTests { // Ensure no general exceptions arose if(exception.get() != null) { - throw new RuntimeException("Excepion occurred under high concurrency usage", exception.get()); + throw new RuntimeException("Exception occurred under high concurrency usage", exception.get()); } // Validate the ids: we'd expect one of these three things to fail diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/MapJobInstanceDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/MapJobInstanceDaoTests.java index 4314df6ec..b5fd057ec 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/MapJobInstanceDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/MapJobInstanceDaoTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.repository.dao; import org.junit.runner.RunWith; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/MapStepExecutionDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/MapStepExecutionDaoTests.java index 5f2d8422c..f6d8cb7c3 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/MapStepExecutionDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/MapStepExecutionDaoTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.repository.dao; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/XStreamExecutionContextStringSerializerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/XStreamExecutionContextStringSerializerTests.java index 834b2624c..439b4c5ed 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/XStreamExecutionContextStringSerializerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/XStreamExecutionContextStringSerializerTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.repository.dao; import static org.junit.Assert.assertEquals; @@ -9,7 +24,6 @@ import java.math.BigDecimal; import java.util.Date; import java.util.HashMap; import java.util.Map; -import java.util.Properties; import org.junit.Before; import org.junit.Test; @@ -31,15 +45,6 @@ public class XStreamExecutionContextStringSerializerTests { serializer = serializerDeserializer; } - @Test - public void testSerializePropertiesArrayContainer() throws Exception { - PropertiesArrayContainer container = new PropertiesArrayContainer(); - container.setProps(new Properties[3]); - - PropertiesArrayContainer result = (PropertiesArrayContainer) serializationRoundTrip(container); - assertEquals(3, result.getProps().length); - } - @Test public void testSerializeAMap() throws Exception { Map m1 = new HashMap(); @@ -49,7 +54,7 @@ public class XStreamExecutionContextStringSerializerTests { m1.put("object3", new Date(123456790123L)); m1.put("object4", new Double(1234567.1234D)); - Map m2 = (Map) serializationRoundTrip(m1); + Map m2 = serializationRoundTrip(m1); compareContexts(m1, m2); } @@ -71,13 +76,12 @@ public class XStreamExecutionContextStringSerializerTests { o1.setObj(o2); m1.put("co", o1); - Map m2 = (Map) serializationRoundTrip(m1); + Map m2 = serializationRoundTrip(m1); compareContexts(m1, m2); } @Test (expected=IllegalArgumentException.class) - @SuppressWarnings("unchecked") public void testNullSerialization() throws Exception { serializer.serialize(null, null); } @@ -89,15 +93,14 @@ public class XStreamExecutionContextStringSerializerTests { } } - @SuppressWarnings("unchecked") - private Object serializationRoundTrip(Object m1) throws IOException { + private Map serializationRoundTrip(Map m1) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); serializer.serialize(m1, out); String s = out.toString(); ByteArrayInputStream in = new ByteArrayInputStream(s.getBytes()); - Object m2 = serializer.deserialize(in); + Map m2 = serializer.deserialize(in); return m2; } @@ -184,15 +187,4 @@ public class XStreamExecutionContextStringSerializerTests { } } - public static class PropertiesArrayContainer { - private Properties[] props; - - public Properties[] getProps() { - return props; - } - - public void setProps(Properties[] props) { - this.props = props; - } - } } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/MapJobRepositoryFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/MapJobRepositoryFactoryBeanTests.java index 015fd2860..3508491a1 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/MapJobRepositoryFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/MapJobRepositoryFactoryBeanTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.repository.support; import org.junit.Test; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/SimpleJobRepositoryIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/SimpleJobRepositoryIntegrationTests.java index 42d67efff..4d51700c5 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/SimpleJobRepositoryIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/SimpleJobRepositoryIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.repository.support; import static org.junit.Assert.assertEquals; @@ -131,6 +146,7 @@ public class SimpleJobRepositoryIntegrationTests { @Transactional @Test public void testSaveExecutionContext() throws Exception { + @SuppressWarnings("serial") ExecutionContext ctx = new ExecutionContext() { { putLong("crashedPosition", 7); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/SimpleJobRepositoryProxyTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/SimpleJobRepositoryProxyTests.java index 2e4f9b4c8..93487bd92 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/SimpleJobRepositoryProxyTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/SimpleJobRepositoryProxyTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.repository.support; import static org.junit.Assert.assertFalse; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/SimpleJobRepositoryTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/SimpleJobRepositoryTests.java index a3bd419af..a22f47c7b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/SimpleJobRepositoryTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/SimpleJobRepositoryTests.java @@ -138,7 +138,7 @@ public class SimpleJobRepositoryTests { public void testUpdateValidJobExecution() throws Exception { JobExecution jobExecution = new JobExecution(new JobInstance(1L, job.getName()), 1L, jobParameters, null); - // new execution - call update on job dao + // new execution - call update on job DAO jobExecutionDao.updateJobExecution(jobExecution); jobRepository.update(jobExecution); assertNotNull(jobExecution.getLastUpdated()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/resource/Foo.java b/spring-batch-core/src/test/java/org/springframework/batch/core/resource/Foo.java index 6f6efec71..bb5e71904 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/resource/Foo.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/resource/Foo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.resource; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/resource/FooRowMapper.java b/spring-batch-core/src/test/java/org/springframework/batch/core/resource/FooRowMapper.java index 983f22135..f1f3692a1 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/resource/FooRowMapper.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/resource/FooRowMapper.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.resource; import java.sql.ResultSet; @@ -6,11 +21,10 @@ import java.sql.SQLException; import org.springframework.jdbc.core.RowMapper; -@SuppressWarnings("rawtypes") -public class FooRowMapper implements RowMapper { +public class FooRowMapper implements RowMapper { @Override - public Object mapRow(ResultSet rs, int rowNum) throws SQLException { + public Foo mapRow(ResultSet rs, int rowNum) throws SQLException { Foo foo = new Foo(); foo.setId(rs.getInt(1)); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/resource/JdbcCursorItemReaderPreparedStatementIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/resource/JdbcCursorItemReaderPreparedStatementIntegrationTests.java index 3dd4507db..d0364e921 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/resource/JdbcCursorItemReaderPreparedStatementIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/resource/JdbcCursorItemReaderPreparedStatementIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.resource; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/AsyncJobScopeIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/AsyncJobScopeIntegrationTests.java index 7c56d4d88..4c71b1d95 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/AsyncJobScopeIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/AsyncJobScopeIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import static org.junit.Assert.assertEquals; @@ -44,6 +59,7 @@ public class AsyncJobScopeIntegrationTests implements BeanFactoryAware { private int beanCount; + @Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { this.beanFactory = (ListableBeanFactory) beanFactory; } @@ -79,6 +95,7 @@ public class AsyncJobScopeIntegrationTests implements BeanFactoryAware { final String value = "foo" + i; final Long id = 123L + i; FutureTask task = new FutureTask(new Callable() { + @Override public String call() throws Exception { JobExecution jobExecution = new JobExecution(id); ExecutionContext executionContext = jobExecution.getExecutionContext(); @@ -118,6 +135,7 @@ public class AsyncJobScopeIntegrationTests implements BeanFactoryAware { for (int i = 0; i < 12; i++) { final String value = "foo" + i; FutureTask task = new FutureTask(new Callable() { + @Override public String call() throws Exception { ExecutionContext executionContext = jobExecution.getExecutionContext(); executionContext.put("foo", value); @@ -135,10 +153,8 @@ public class AsyncJobScopeIntegrationTests implements BeanFactoryAware { taskExecutor.execute(task); } - int i = 0; for (FutureTask task : tasks) { assertEquals("foo", task.get()); - i++; } // Don't close the outer scope until all tasks are finished. This should diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/AsyncStepScopeIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/AsyncStepScopeIntegrationTests.java index 2fa1ca891..650e926c7 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/AsyncStepScopeIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/AsyncStepScopeIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/Collaborator.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/Collaborator.java index 4b99b102d..547dc8208 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/Collaborator.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/Collaborator.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import java.util.List; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeDestructionCallbackIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeDestructionCallbackIntegrationTests.java index 79af85f9f..0ac735099 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeDestructionCallbackIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeDestructionCallbackIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeIntegrationTests.java index 085d6f198..d33f5f9fc 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeNestedIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeNestedIntegrationTests.java index 1ca9c8465..bd44d4b72 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeNestedIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeNestedIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopePlaceholderIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopePlaceholderIntegrationTests.java index 0df49e8c4..d227cd03d 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopePlaceholderIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopePlaceholderIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import static org.junit.Assert.assertEquals; @@ -60,6 +75,7 @@ public class JobScopePlaceholderIntegrationTests implements BeanFactoryAware { private int beanCount; + @Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { this.beanFactory = (ListableBeanFactory) beanFactory; } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeProxyTargetClassIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeProxyTargetClassIntegrationTests.java index 2f23d70d8..80cdb21a9 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeProxyTargetClassIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeProxyTargetClassIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import static org.junit.Assert.assertEquals; @@ -32,6 +47,7 @@ public class JobScopeProxyTargetClassIntegrationTests implements BeanFactoryAwar private int beanCount; + @Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { this.beanFactory = (ListableBeanFactory) beanFactory; } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeStartupIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeStartupIntegrationTests.java index e096de058..5105567af 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeStartupIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeStartupIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import org.junit.Test; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeTests.java index f62598154..01c15acc2 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobScopeTests.java @@ -61,8 +61,9 @@ public class JobScopeTests { final String foo = "bar"; JobSynchronizationManager.release(); try { - scope.get("foo", new ObjectFactory() { - public Object getObject() throws BeansException { + scope.get("foo", new ObjectFactory() { + @Override + public String getObject() throws BeansException { return foo; } }); @@ -77,8 +78,9 @@ public class JobScopeTests { @Test public void testGetWithNothingAlreadyThere() { final String foo = "bar"; - Object value = scope.get("foo", new ObjectFactory() { - public Object getObject() throws BeansException { + Object value = scope.get("foo", new ObjectFactory() { + @Override + public String getObject() throws BeansException { return foo; } }); @@ -89,8 +91,9 @@ public class JobScopeTests { @Test public void testGetWithSomethingAlreadyThere() { context.setAttribute("foo", "bar"); - Object value = scope.get("foo", new ObjectFactory() { - public Object getObject() throws BeansException { + Object value = scope.get("foo", new ObjectFactory() { + @Override + public String getObject() throws BeansException { return null; } }); @@ -109,6 +112,7 @@ public class JobScopeTests { final List list = new ArrayList(); context.setAttribute("foo", "bar"); scope.registerDestructionCallback("foo", new Runnable() { + @Override public void run() { list.add("foo"); } @@ -125,11 +129,13 @@ public class JobScopeTests { final List list = new ArrayList(); context.setAttribute("foo", "bar"); scope.registerDestructionCallback("foo", new Runnable() { + @Override public void run() { list.add("foo"); } }); scope.registerDestructionCallback("foo", new Runnable() { + @Override public void run() { list.add("bar"); } @@ -156,6 +162,7 @@ public class JobScopeTests { } @Test + @SuppressWarnings("resource") public void testName() throws Exception { scope.setName("foo"); StaticApplicationContext beanFactory = new StaticApplicationContext(); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobStartupRunner.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobStartupRunner.java index 30fb1c6fd..0d500b0e7 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobStartupRunner.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/JobStartupRunner.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import org.springframework.batch.core.Job; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeClassIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeClassIntegrationTests.java index a007ae5a1..9493b0eb2 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeClassIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeClassIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeDestructionCallbackIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeDestructionCallbackIntegrationTests.java index d1739cba9..c58471a65 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeDestructionCallbackIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeDestructionCallbackIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeIntegrationTests.java index 30468194a..8c214ea5c 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeNestedIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeNestedIntegrationTests.java index 8aa13fea7..8dc450ad7 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeNestedIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeNestedIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopePerformanceTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopePerformanceTests.java index 2002eadbc..a26eb88ce 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopePerformanceTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopePerformanceTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import org.apache.commons.logging.Log; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopePlaceholderIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopePlaceholderIntegrationTests.java index 79a919ff8..e7d58c5f5 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopePlaceholderIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopePlaceholderIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeProxyTargetClassIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeProxyTargetClassIntegrationTests.java index a3e0944fb..59baf61f6 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeProxyTargetClassIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeProxyTargetClassIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeProxyTargetClassOverrideIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeProxyTargetClassOverrideIntegrationTests.java index af02a72f4..6ec36b377 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeProxyTargetClassOverrideIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeProxyTargetClassOverrideIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeStartupIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeStartupIntegrationTests.java index fab5e2a69..bf8188322 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeStartupIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeStartupIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import org.junit.Test; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeTests.java index 4bd8f8de7..7e7a4c9a8 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeTests.java @@ -40,7 +40,6 @@ import org.springframework.context.support.StaticApplicationContext; * @author Dave Syer * */ -@SuppressWarnings("rawtypes") public class StepScopeTests { private StepScope scope = new StepScope(); @@ -65,7 +64,7 @@ public class StepScopeTests { final String foo = "bar"; StepSynchronizationManager.close(); try { - scope.get("foo", new ObjectFactory() { + scope.get("foo", new ObjectFactory() { @Override public Object getObject() throws BeansException { return foo; @@ -82,7 +81,7 @@ public class StepScopeTests { @Test public void testGetWithNothingAlreadyThere() { final String foo = "bar"; - Object value = scope.get("foo", new ObjectFactory() { + Object value = scope.get("foo", new ObjectFactory() { @Override public Object getObject() throws BeansException { return foo; @@ -95,7 +94,7 @@ public class StepScopeTests { @Test public void testGetWithSomethingAlreadyThere() { context.setAttribute("foo", "bar"); - Object value = scope.get("foo", new ObjectFactory() { + Object value = scope.get("foo", new ObjectFactory() { @Override public Object getObject() throws BeansException { return null; @@ -109,7 +108,7 @@ public class StepScopeTests { public void testGetWithSomethingAlreadyInParentContext() { context.setAttribute("foo", "bar"); StepContext context = StepSynchronizationManager.register(new StepExecution("bar", new JobExecution(0L))); - Object value = scope.get("foo", new ObjectFactory() { + Object value = scope.get("foo", new ObjectFactory() { @Override public Object getObject() throws BeansException { return "spam"; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepStartupRunner.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepStartupRunner.java index 87876c6c7..dafd61160 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepStartupRunner.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepStartupRunner.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import org.springframework.batch.core.JobExecution; @@ -13,6 +28,7 @@ public class StepStartupRunner implements InitializingBean { this.step = step; } + @Override public void afterPropertiesSet() throws Exception { StepExecution stepExecution = new StepExecution("step", new JobExecution(1L), 0L); step.execute(stepExecution); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestAdvice.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestAdvice.java index e434c363b..1c976a70d 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestAdvice.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestAdvice.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import java.util.ArrayList; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestCollaborator.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestCollaborator.java index 3cf7c5759..d292674ed 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestCollaborator.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestCollaborator.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import java.io.Serializable; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestDisposableCollaborator.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestDisposableCollaborator.java index b801e1337..3b8e8f43c 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestDisposableCollaborator.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestDisposableCollaborator.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import org.springframework.beans.factory.DisposableBean; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestJob.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestJob.java index f28b374bd..cafe4fbb3 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestJob.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestJob.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import org.springframework.batch.core.Job; @@ -25,6 +40,7 @@ public class TestJob implements Job { context = null; } + @Override public void execute(JobExecution stepExecution) { context = JobSynchronizationManager.getContext(); setContextFromCollaborator(); @@ -43,18 +59,22 @@ public class TestJob implements Job { } } + @Override public String getName() { return "foo"; } + @Override public boolean isRestartable() { return false; } + @Override public JobParametersIncrementer getJobParametersIncrementer() { return null; } + @Override public JobParametersValidator getJobParametersValidator() { return null; } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestStep.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestStep.java index 0062d8828..f34c5b424 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestStep.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestStep.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope; import org.springframework.batch.core.JobInterruptedException; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/JobContextTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/JobContextTests.java index febe38cc7..a1c103ea7 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/JobContextTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/JobContextTests.java @@ -46,8 +46,8 @@ public class JobContextTests { @Before public void setUp() { - jobExecution = new JobExecution(1l); - JobInstance jobInstance = new JobInstance(2l, "job"); + jobExecution = new JobExecution(1L); + JobInstance jobInstance = new JobInstance(2L, "job"); jobExecution.setJobInstance(jobInstance); context = new JobContext(jobExecution); list = new ArrayList(); @@ -167,7 +167,7 @@ public class JobContextTests { public void testJobParameters() throws Exception { JobParameters jobParameters = new JobParametersBuilder().addString("foo", "bar").toJobParameters(); JobInstance jobInstance = new JobInstance(0L, "foo"); - jobExecution = new JobExecution(5l, jobParameters); + jobExecution = new JobExecution(5L, jobParameters); jobExecution.setJobInstance(jobInstance); context = new JobContext(jobExecution); assertEquals("bar", context.getJobParameters().get("foo")); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/JobSynchronizationManagerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/JobSynchronizationManagerTests.java index e67f396c3..de5a90342 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/JobSynchronizationManagerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/JobSynchronizationManagerTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.scope.context; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/NonAbstractStepTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/NonAbstractStepTests.java index 468e630ca..a961db678 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/NonAbstractStepTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/NonAbstractStepTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/RestartInPriorStepTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/RestartInPriorStepTests.java index e9b5889ae..ba038ba38 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/RestartInPriorStepTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/RestartInPriorStepTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/StepLocatorStepFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/StepLocatorStepFactoryBeanTests.java index 0e5b74734..9aef315fb 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/StepLocatorStepFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/StepLocatorStepFactoryBeanTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/RegisterMultiListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/RegisterMultiListenerTests.java index 7f4b454cb..8eeabbe47 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/RegisterMultiListenerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/RegisterMultiListenerTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step.builder; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/StepBuilderTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/StepBuilderTests.java index a5ebfca8a..616e47df0 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/StepBuilderTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/StepBuilderTests.java @@ -35,7 +35,7 @@ public class StepBuilderTests { @Test public void test() throws Exception { - JobRepository jobRepository = new MapJobRepositoryFactoryBean().getJobRepository(); + JobRepository jobRepository = new MapJobRepositoryFactoryBean().getObject(); StepExecution execution = jobRepository.createJobExecution("foo", new JobParameters()).createStepExecution( "step"); jobRepository.add(execution); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/AlmostStatefulRetryChunkTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/AlmostStatefulRetryChunkTests.java index 26b62fb17..af392af9c 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/AlmostStatefulRetryChunkTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/AlmostStatefulRetryChunkTests.java @@ -129,7 +129,7 @@ public class AlmostStatefulRetryChunkTests { } /** - * @param chunk + * @param items * @throws Exception */ private void doWrite(List items) throws Exception { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/BatchRetryTemplateTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/BatchRetryTemplateTests.java index 31a8e34d6..16428c52a 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/BatchRetryTemplateTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/BatchRetryTemplateTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step.item; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ChunkMonitorTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ChunkMonitorTests.java index 137ed0cfb..9e273e101 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ChunkMonitorTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ChunkMonitorTests.java @@ -33,9 +33,6 @@ import org.springframework.batch.item.UnexpectedInputException; */ public class ChunkMonitorTests { - /** - * - */ private static final int CHUNK_SIZE = 5; private ChunkMonitor monitor = new ChunkMonitor(); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ChunkOrientedTaskletTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ChunkOrientedTaskletTests.java index 0e5c3e6ca..6d11b128b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ChunkOrientedTaskletTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ChunkOrientedTaskletTests.java @@ -46,7 +46,7 @@ public class ChunkOrientedTaskletTests { return chunk; } @Override - public void postProcess(StepContribution contribution, Chunk chunk) {}; + public void postProcess(StepContribution contribution, Chunk chunk) {} }, new ChunkProcessor() { @Override public void process(StepContribution contribution, Chunk chunk) { @@ -69,7 +69,7 @@ public class ChunkOrientedTaskletTests { throw new RuntimeException("Foo!"); } @Override - public void postProcess(StepContribution contribution, Chunk chunk) {}; + public void postProcess(StepContribution contribution, Chunk chunk) {} }, new ChunkProcessor() { @Override public void process(StepContribution contribution, Chunk chunk) { @@ -100,7 +100,7 @@ public class ChunkOrientedTaskletTests { return chunk; } @Override - public void postProcess(StepContribution contribution, Chunk chunk) {}; + public void postProcess(StepContribution contribution, Chunk chunk) {} }, new ChunkProcessor() { @Override public void process(StepContribution contribution, Chunk chunk) { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FatalRuntimeException.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FatalRuntimeException.java index 730732142..8f71f504f 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FatalRuntimeException.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FatalRuntimeException.java @@ -1,9 +1,25 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step.item; /** * @author Dan Garrette * @since 2.0.2 */ +@SuppressWarnings("serial") public class FatalRuntimeException extends SkippableRuntimeException { public FatalRuntimeException(String message) { super(message); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FatalSkippableException.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FatalSkippableException.java index d43a2b69e..fc7bf1b42 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FatalSkippableException.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FatalSkippableException.java @@ -1,9 +1,25 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step.item; /** * @author Dan Garrette * @since 2.0.2 */ +@SuppressWarnings("serial") public class FatalSkippableException extends SkippableException { public FatalSkippableException(String message) { super(message); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantChunkProcessorTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantChunkProcessorTests.java index b4e7d7b66..251931183 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantChunkProcessorTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantChunkProcessorTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step.item; import static org.junit.Assert.assertEquals; @@ -294,8 +309,7 @@ public class FaultTolerantChunkProcessorTests { processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy()); processAndExpectPlannedRuntimeException(chunk);// Process foo, fail - processor.process(contribution, chunk); - ;// Process foo + processor.process(contribution, chunk);// Process foo processAndExpectPlannedRuntimeException(chunk);// Process fail assertEquals("[foo, fail, fail]", writeError.toString()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantChunkProviderTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantChunkProviderTests.java index ecb09a6f7..42aa0a2a2 100755 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantChunkProviderTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantChunkProviderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step.item; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantExceptionClassesTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantExceptionClassesTests.java index 12760b2be..e21df4b57 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantExceptionClassesTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantExceptionClassesTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step.item; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanNonBufferingTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanNonBufferingTests.java index b379f6eb8..d412dee6c 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanNonBufferingTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanNonBufferingTests.java @@ -1,7 +1,21 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step.item; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -79,7 +93,7 @@ public class FaultTolerantStepFactoryBeanNonBufferingTests { skipListener.onSkipInWrite("4", exception); factory.setListeners(new SkipListener[] { skipListener }); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); StepExecution stepExecution = new StepExecution(step.getName(), jobExecution); step.execute(stepExecution); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanRetryTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanRetryTests.java index 68c9f2acd..e55441ef5 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanRetryTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanRetryTests.java @@ -125,6 +125,7 @@ public class FaultTolerantStepFactoryBeanRetryTests { assertTrue(Step.class.isAssignableFrom(factory.getObjectType())); } + @SuppressWarnings("cast") @Test public void testDefaultValue() throws Exception { assertTrue(factory.getObject() instanceof Step); @@ -172,7 +173,7 @@ public class FaultTolerantStepFactoryBeanRetryTests { factory.setItemReader(reader); factory.setItemProcessor(processor); factory.setItemWriter(failingWriter); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); StepExecution stepExecution = new StepExecution(step.getName(), jobExecution); @@ -180,7 +181,7 @@ public class FaultTolerantStepFactoryBeanRetryTests { step.execute(stepExecution); /* * Each chunk tried up to RETRY_LIMIT, then the scan processes each item - * once, identfiying the skip as it goes + * once, identifying the skip as it goes */ assertEquals((RETRY_LIMIT +1) * ITEM_LIST.size(), processed.size()); } @@ -219,7 +220,7 @@ public class FaultTolerantStepFactoryBeanRetryTests { factory.setItemReader(reader); factory.setItemProcessor(processor); factory.setItemWriter(failingWriter); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); StepExecution stepExecution = new StepExecution(step.getName(), jobExecution); @@ -229,7 +230,7 @@ public class FaultTolerantStepFactoryBeanRetryTests { .getExitStatus().getExitCode()); /* * Each chunk tried up to RETRY_LIMIT, then the scan processes each item - * once, identfiying the skip as it goes + * once, identifying the skip as it goes */ assertEquals((RETRY_LIMIT +1) * ITEM_LIST.size(), processed.size()); } @@ -266,7 +267,7 @@ public class FaultTolerantStepFactoryBeanRetryTests { factory.setItemReader(reader); factory.setItemProcessor(processor); factory.setItemWriter(failingWriter); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); StepExecution stepExecution = new StepExecution(step.getName(), jobExecution); @@ -303,7 +304,7 @@ public class FaultTolerantStepFactoryBeanRetryTests { factory.setItemReader(provider); factory.setRetryLimit(10); factory.setSkippableExceptionClasses(getExceptionMap()); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); StepExecution stepExecution = new StepExecution(step.getName(), jobExecution); @@ -362,7 +363,7 @@ public class FaultTolerantStepFactoryBeanRetryTests { } }); factory.setRetryLimit(0); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); fail = true; StepExecution stepExecution = new StepExecution(step.getName(), @@ -405,7 +406,7 @@ public class FaultTolerantStepFactoryBeanRetryTests { }; factory.setItemReader(provider); factory.setRetryLimit(10); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); StepExecution stepExecution = new StepExecution(step.getName(), jobExecution); @@ -575,7 +576,7 @@ public class FaultTolerantStepFactoryBeanRetryTests { }; factory.setItemReader(provider); factory.setItemWriter(itemWriter); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); StepExecution stepExecution = new StepExecution(step.getName(), jobExecution); @@ -630,7 +631,7 @@ public class FaultTolerantStepFactoryBeanRetryTests { }; factory.setItemReader(provider); factory.setItemWriter(itemWriter); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); StepExecution stepExecution = new StepExecution(step.getName(), jobExecution); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanRollbackTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanRollbackTests.java index 57ae11bd3..9b0a94033 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanRollbackTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanRollbackTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step.item; import org.apache.commons.logging.Log; @@ -112,7 +127,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { @Test public void testBeforeChunkListenerException() throws Exception{ factory.setListeners(new StepListener []{new ExceptionThrowingChunkListener(1)}); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(FAILED, stepExecution.getStatus()); assertEquals(FAILED.toString(), stepExecution.getExitStatus().getExitCode()); @@ -125,7 +140,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { @Test public void testAfterChunkListenerException() throws Exception{ factory.setListeners(new StepListener []{new ExceptionThrowingChunkListener(2)}); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(FAILED, stepExecution.getStatus()); assertEquals(FAILED.toString(), stepExecution.getExitStatus().getExitCode()); @@ -173,7 +188,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { reader.setFailures("2", "3"); reader.setExceptionType(SkippableException.class); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); @@ -196,7 +211,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { // But this one is explicit in the tx-attrs so it should be skipped factory.setNoRollbackExceptionClasses(getExceptionList(SkippableException.class)); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); @@ -215,7 +230,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { processor.setFailures("1", "3"); processor.setExceptionType(SkippableException.class); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); @@ -233,7 +248,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { processor.setFailures("1", "3"); processor.setExceptionType(SkippableRuntimeException.class); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); @@ -265,7 +280,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { processor.setFailures("2"); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); stepExecution = jobExecution.createStepExecution(factory.getName()); repository.add(stepExecution); @@ -289,7 +304,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { factory.setNoRollbackExceptionClasses(getExceptionList(SkippableException.class)); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); @@ -317,7 +332,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { writer.setFailures("2", "3"); writer.setExceptionType(SkippableException.class); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); @@ -333,7 +348,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { writer.setFailures("2", "3"); writer.setExceptionType(AssertionError.class); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.FAILED, stepExecution.getStatus()); @@ -349,7 +364,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { writer.setFailures("2", "3"); writer.setExceptionType(SkippableRuntimeException.class); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); @@ -369,7 +384,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { factory.setNoRollbackExceptionClasses(getExceptionList(SkippableRuntimeException.class)); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); @@ -390,7 +405,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { factory.setNoRollbackExceptionClasses(getExceptionList(SkippableException.class)); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); @@ -405,7 +420,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { processor.setFailures("4"); factory.setCommitInterval(30); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); @@ -421,7 +436,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { processor.setFailures("2", "4"); factory.setCommitInterval(30); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); @@ -438,7 +453,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { factory.setCommitInterval(30); factory.setProcessorTransactional(false); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); @@ -455,7 +470,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { processor.setFilter(true); factory.setCommitInterval(30); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); @@ -471,7 +486,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { writer.setFailures("4"); factory.setCommitInterval(30); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); @@ -493,7 +508,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { factory.setCommitInterval(30); factory.setProcessorTransactional(false); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); @@ -512,7 +527,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { factory.setSkipLimit(10); factory.setIsReaderTransactionalQueue(true); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); @@ -529,7 +544,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { factory.setSkipLimit(10); factory.setTaskExecutor(new SimpleAsyncTaskExecutor()); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); @@ -544,7 +559,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { writer.setFailures("2", "4"); factory.setCommitInterval(30); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); @@ -566,7 +581,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests { factory.setCommitInterval(30); factory.setProcessorTransactional(false); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanTests.java index db552ee47..509e389d5 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step.item; import org.aopalliance.intercept.MethodInterceptor; @@ -132,7 +147,7 @@ public class FaultTolerantStepFactoryBeanTests { // nothing is skippable factory.setSkippableExceptionClasses(getExceptionMap(NonExistentException.class)); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.FAILED, stepExecution.getStatus()); @@ -154,7 +169,7 @@ public class FaultTolerantStepFactoryBeanTests { reader.setItems("1", "2", "3", "4", "5"); writer.setFailures("1"); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.FAILED, stepExecution.getStatus()); @@ -172,7 +187,7 @@ public class FaultTolerantStepFactoryBeanTests { public void testReadSkip() throws Exception { reader.setFailures("2"); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); @@ -224,7 +239,7 @@ public class FaultTolerantStepFactoryBeanTests { reader.setFailures("2"); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); @@ -252,7 +267,7 @@ public class FaultTolerantStepFactoryBeanTests { writer.setFailures("2"); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); @@ -275,7 +290,7 @@ public class FaultTolerantStepFactoryBeanTests { map.put(ItemStreamException.class, true); factory.setSkippableExceptionClasses(map); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); @@ -305,7 +320,7 @@ public class FaultTolerantStepFactoryBeanTests { processor.setFailures("4"); writer.setFailures("4"); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); @@ -333,7 +348,7 @@ public class FaultTolerantStepFactoryBeanTests { processor.setFilter(true); ItemProcessListenerStub listenerStub = new ItemProcessListenerStub(); factory.setListeners(new StepListener[] { listenerStub }); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); @@ -360,7 +375,7 @@ public class FaultTolerantStepFactoryBeanTests { public void testNullWriter() throws Exception { factory.setItemWriter(null); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); @@ -387,7 +402,7 @@ public class FaultTolerantStepFactoryBeanTests { public void testWriteSkip() throws Exception { writer.setFailures("4"); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); @@ -430,7 +445,7 @@ public class FaultTolerantStepFactoryBeanTests { } }); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); String message = stepExecution.getFailureExceptions().get(0).getCause().getMessage(); @@ -449,7 +464,7 @@ public class FaultTolerantStepFactoryBeanTests { factory.setSkipLimit(1); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); @@ -480,7 +495,7 @@ public class FaultTolerantStepFactoryBeanTests { factory.setSkipLimit(3); factory.setSkippableExceptionClasses(getExceptionMap(Exception.class)); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.FAILED, stepExecution.getStatus()); @@ -520,7 +535,7 @@ public class FaultTolerantStepFactoryBeanTests { factory.setCommitInterval(2); factory.setSkipLimit(2); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); @@ -554,7 +569,7 @@ public class FaultTolerantStepFactoryBeanTests { } }); factory.setSkippableExceptionClasses(getExceptionMap(Exception.class)); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.FAILED, stepExecution.getStatus()); @@ -589,7 +604,7 @@ public class FaultTolerantStepFactoryBeanTests { } }); factory.setSkippableExceptionClasses(getExceptionMap(Exception.class)); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.FAILED, stepExecution.getStatus()); @@ -613,7 +628,7 @@ public class FaultTolerantStepFactoryBeanTests { factory.setSkipLimit(4); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(4, stepExecution.getSkipCount()); @@ -644,7 +659,7 @@ public class FaultTolerantStepFactoryBeanTests { factory.setSkipLimit(4); factory.setCommitInterval(3); // includes all expected skips - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(4, stepExecution.getSkipCount()); @@ -667,7 +682,7 @@ public class FaultTolerantStepFactoryBeanTests { factory.setSkippableExceptionClasses(getExceptionMap(Exception.class)); factory.setSkipLimit(1); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); @@ -692,7 +707,7 @@ public class FaultTolerantStepFactoryBeanTests { factory.setSkipLimit(3); factory.setSkippableExceptionClasses(getExceptionMap(Exception.class)); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.FAILED, stepExecution.getStatus()); @@ -717,7 +732,7 @@ public class FaultTolerantStepFactoryBeanTests { writer.setFailures("4"); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(1, stepExecution.getSkipCount()); @@ -815,7 +830,7 @@ public class FaultTolerantStepFactoryBeanTests { factory.setItemWriter(new TestItemListenerWriter()); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); @@ -853,7 +868,7 @@ public class FaultTolerantStepFactoryBeanTests { factory.setItemReader(reader); factory.setTaskExecutor(new ConcurrentTaskExecutor()); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); @@ -912,7 +927,7 @@ public class FaultTolerantStepFactoryBeanTests { factory.setItemReader(reader); factory.setStreams(new ItemStream[] { stream, reader }); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); @@ -964,7 +979,7 @@ public class FaultTolerantStepFactoryBeanTests { factory.setItemReader((ItemReader) advised); factory.setStreams(new ItemStream[] { (ItemStream) advised }); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); @@ -1094,8 +1109,7 @@ public class FaultTolerantStepFactoryBeanTests { return getSkipPolicy(factory); } - @SuppressWarnings("rawtypes") - private SkipPolicy getSkipPolicy(FactoryBean factory) throws Exception { + private SkipPolicy getSkipPolicy(FactoryBean factory) throws Exception { Object step = factory.getObject(); Object tasklet = ReflectionTestUtils.getField(step, "tasklet"); Object chunkProvider = ReflectionTestUtils.getField(tasklet, "chunkProvider"); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanUnexpectedRollbackTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanUnexpectedRollbackTests.java index cb55f5c40..cc70dad0a 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanUnexpectedRollbackTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanUnexpectedRollbackTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step.item; import org.apache.commons.logging.Log; @@ -80,7 +95,7 @@ public class FaultTolerantStepFactoryBeanUnexpectedRollbackTests { StepExecution stepExecution = jobExecution.createStepExecution(factory.getName()); repository.add(stepExecution); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(stepExecution); assertEquals(BatchStatus.FAILED, stepExecution.getStatus()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/RepeatOperationsStepFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/RepeatOperationsStepFactoryBeanTests.java index 904621e1f..1cefddb27 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/RepeatOperationsStepFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/RepeatOperationsStepFactoryBeanTests.java @@ -59,6 +59,7 @@ public class RepeatOperationsStepFactoryBeanTests extends TestCase { assertTrue(Step.class.isAssignableFrom(factory.getObjectType())); } + @SuppressWarnings("cast") public void testDefaultValue() throws Exception { assertTrue(factory.getObject() instanceof Step); } @@ -80,7 +81,7 @@ public class RepeatOperationsStepFactoryBeanTests extends TestCase { } }); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); step.execute(new StepExecution(step.getName(), jobExecution)); assertEquals(1, list.size()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleChunkProcessorTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleChunkProcessorTests.java index 1155d9a74..48dde30aa 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleChunkProcessorTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleChunkProcessorTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step.item; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleChunkProviderTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleChunkProviderTests.java index 2080514de..9be3be56e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleChunkProviderTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleChunkProviderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step.item; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleStepFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleStepFactoryBeanTests.java index b78d6b48b..b272df36f 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleStepFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleStepFactoryBeanTests.java @@ -153,7 +153,7 @@ public class SimpleStepFactoryBeanTests { } } }); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); job.setSteps(Collections.singletonList(step)); @@ -417,7 +417,7 @@ public class SimpleStepFactoryBeanTests { factory.setItemWriter(itemWriter); factory.setItemProcessor(itemWriter); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); job.setSteps(Collections.singletonList(step)); @@ -462,7 +462,7 @@ public class SimpleStepFactoryBeanTests { factory.setListeners(new StepListener[] { itemWriter }); factory.setItemWriter(itemWriter); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); job.setSteps(Collections.singletonList(step)); @@ -488,7 +488,7 @@ public class SimpleStepFactoryBeanTests { } }); - Step step = (Step) factory.getObject(); + Step step = factory.getObject(); job.setSteps(Collections.singletonList(step)); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkippableException.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkippableException.java index fb4e1290d..13cefffbc 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkippableException.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkippableException.java @@ -19,6 +19,7 @@ package org.springframework.batch.core.step.item; * @author Dan Garrette * @since 2.0.1 */ +@SuppressWarnings("serial") public class SkippableException extends Exception { public SkippableException(String message) { super(message); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkippableRuntimeException.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkippableRuntimeException.java index 2ece29799..388165ff2 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkippableRuntimeException.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkippableRuntimeException.java @@ -19,6 +19,7 @@ package org.springframework.batch.core.step.item; * @author Dan Garrette * @since 2.0.1 */ +@SuppressWarnings("serial") public class SkippableRuntimeException extends RuntimeException { public SkippableRuntimeException(String message) { super(message); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/TaskletStepExceptionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/TaskletStepExceptionTests.java index 06ef11134..82f454dad 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/TaskletStepExceptionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/TaskletStepExceptionTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step.item; import static org.junit.Assert.assertEquals; @@ -554,6 +569,7 @@ public class TaskletStepExceptionTests { } } + @SuppressWarnings("serial") private static class FailingRollbackTransactionManager extends ResourcelessTransactionManager { @Override diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/ConfigurableSystemProcessExitCodeMapperTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/ConfigurableSystemProcessExitCodeMapperTests.java index 52d212dee..7080c69d8 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/ConfigurableSystemProcessExitCodeMapperTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/ConfigurableSystemProcessExitCodeMapperTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step.tasklet; import static org.junit.Assert.assertSame; @@ -23,6 +38,7 @@ public class ConfigurableSystemProcessExitCodeMapperTests { */ @Test public void testMapping() { + @SuppressWarnings("serial") Map mappings = new HashMap() { { put(0, ExitStatus.COMPLETED); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/SimpleSystemProcessExitCodeMapperTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/SimpleSystemProcessExitCodeMapperTests.java index e6562bedf..15727b17a 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/SimpleSystemProcessExitCodeMapperTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/SimpleSystemProcessExitCodeMapperTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step.tasklet; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/SystemCommandTaskletIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/SystemCommandTaskletIntegrationTests.java index bc861564b..607d315b1 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/SystemCommandTaskletIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/SystemCommandTaskletIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step.tasklet; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletStepTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletStepTests.java index 70bbe524d..9acacd849 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletStepTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletStepTests.java @@ -795,7 +795,7 @@ public class TaskletStepTests { /** * Execution context must not be left empty even if job failed before - * commiting first chunk - otherwise ItemStreams won't recognize it is + * committing first chunk - otherwise ItemStreams won't recognize it is * restart scenario on next run. */ @Test diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletSupport.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletSupport.java index 6aa0da2f9..8ee468ab0 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletSupport.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletSupport.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.core.step.tasklet; import org.springframework.batch.core.StepContribution; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TestingChunkOrientedTasklet.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TestingChunkOrientedTasklet.java index ad002b7be..f2c4a252b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TestingChunkOrientedTasklet.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TestingChunkOrientedTasklet.java @@ -35,9 +35,6 @@ import org.springframework.batch.repeat.support.RepeatTemplate; */ public class TestingChunkOrientedTasklet extends ChunkOrientedTasklet { - /** - * - */ private static final RepeatTemplate repeatTemplate = new RepeatTemplate(); static { diff --git a/spring-batch-core/src/test/java/test/jdbc/datasource/DataSourceInitializer.java b/spring-batch-core/src/test/java/test/jdbc/datasource/DataSourceInitializer.java index c7d04860b..103104c4b 100644 --- a/spring-batch-core/src/test/java/test/jdbc/datasource/DataSourceInitializer.java +++ b/spring-batch-core/src/test/java/test/jdbc/datasource/DataSourceInitializer.java @@ -92,17 +92,17 @@ public class DataSourceInitializer implements InitializingBean { } } - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({ "unchecked" }) private void doExecuteScript(final Resource scriptResource) { if (scriptResource == null || !scriptResource.exists()) { throw new IllegalArgumentException("Script resource is null or does not exist"); } TransactionTemplate transactionTemplate = new TransactionTemplate(new DataSourceTransactionManager(dataSource)); - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String[] scripts; try { diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementLateBindingParserTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementLateBindingParserTests-context.xml index 0833bbaf8..eed6e751c 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementLateBindingParserTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementLateBindingParserTests-context.xml @@ -21,12 +21,12 @@ - - + + - + \ No newline at end of file diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentRetryableLateBindingStepFactoryBeanParserTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentRetryableLateBindingStepFactoryBeanParserTests-context.xml index 56a235ebf..39cf785be 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentRetryableLateBindingStepFactoryBeanParserTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentRetryableLateBindingStepFactoryBeanParserTests-context.xml @@ -23,12 +23,12 @@ - - + + - + \ No newline at end of file diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentStepFactoryBeanParserTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentStepFactoryBeanParserTests-context.xml index de7f503af..07a2bbe87 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentStepFactoryBeanParserTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentStepFactoryBeanParserTests-context.xml @@ -5,7 +5,7 @@ - + diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/AsyncPlaceholderTargetSourceTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/AsyncPlaceholderTargetSourceTests-context.xml deleted file mode 100644 index 939c63553..000000000 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/AsyncPlaceholderTargetSourceTests-context.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/MultipleContextPlaceholderTargetSourceTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/MultipleContextPlaceholderTargetSourceTests-context.xml deleted file mode 100644 index 27c79296c..000000000 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/MultipleContextPlaceholderTargetSourceTests-context.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %{attributes[foo]} - - - - - - - - - - %{attributes[foo]} - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceCustomEditorTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceCustomEditorTests-context.xml deleted file mode 100644 index d32ab9bf2..000000000 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceCustomEditorTests-context.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceErrorTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceErrorTests-context.xml deleted file mode 100644 index f3e809972..000000000 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceErrorTests-context.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceTests-context.xml deleted file mode 100644 index fc2094af5..000000000 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceTests-context.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %{foo} - foo-%{integer} - bar-%{integer} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/SimplePlaceholderTargetSourceTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/SimplePlaceholderTargetSourceTests-context.xml deleted file mode 100644 index 593bb3c30..000000000 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/SimplePlaceholderTargetSourceTests-context.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-infrastructure-tests/src/main/java/org/springframework/batch/container/jms/BatchMessageListenerContainer.java b/spring-batch-infrastructure-tests/src/main/java/org/springframework/batch/container/jms/BatchMessageListenerContainer.java index a41b14f34..e5ce10916 100644 --- a/spring-batch-infrastructure-tests/src/main/java/org/springframework/batch/container/jms/BatchMessageListenerContainer.java +++ b/spring-batch-infrastructure-tests/src/main/java/org/springframework/batch/container/jms/BatchMessageListenerContainer.java @@ -64,6 +64,7 @@ public class BatchMessageListenerContainer extends DefaultMessageListenerContain private Advice[] advices = new Advice[0]; private ContainerDelegate delegate = new ContainerDelegate() { + @Override public boolean receiveAndExecute(Object invoker, Session session, MessageConsumer consumer) throws JMSException { return BatchMessageListenerContainer.super.receiveAndExecute(invoker, session, consumer); } @@ -85,6 +86,7 @@ public class BatchMessageListenerContainer extends DefaultMessageListenerContain * * @see org.springframework.jms.listener.AbstractJmsListeningContainer#afterPropertiesSet() */ + @Override public void afterPropertiesSet() { super.afterPropertiesSet(); initializeProxy(); @@ -96,6 +98,7 @@ public class BatchMessageListenerContainer extends DefaultMessageListenerContain * * @see org.springframework.jms.listener.AbstractMessageListenerContainer#handleListenerException(java.lang.Throwable) */ + @Override protected void handleListenerException(Throwable ex) { if (!isSessionTransacted()) { // Log the exceptions in base class if not transactional anyway @@ -120,6 +123,7 @@ public class BatchMessageListenerContainer extends DefaultMessageListenerContain * @see org.springframework.jms.listener.AbstractPollingMessageListenerContainer#receiveAndExecute(Object, * javax.jms.Session, javax.jms.MessageConsumer) */ + @Override protected boolean receiveAndExecute(final Object invoker, final Session session, final MessageConsumer consumer) throws JMSException { return proxy.receiveAndExecute(invoker, session, consumer); diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/config/DatasourceTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/config/DatasourceTests.java index 3dfe865c3..e4c05d45b 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/config/DatasourceTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/config/DatasourceTests.java @@ -55,7 +55,7 @@ public class DatasourceTests { public void testTemplate() throws Exception { System.err.println(System.getProperty("java.class.path")); jdbcTemplate.execute("delete from T_BARS"); - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(0, count); jdbcTemplate.update("INSERT into T_BARS (id,name,foo_date) values (?,?,null)", 0, "foo"); diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/container/jms/BatchMessageListenerContainerIntegrationTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/container/jms/BatchMessageListenerContainerIntegrationTests.java index 1c9daf5f2..c4c937fda 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/container/jms/BatchMessageListenerContainerIntegrationTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/container/jms/BatchMessageListenerContainerIntegrationTests.java @@ -86,6 +86,7 @@ public class BatchMessageListenerContainerIntegrationTests { @Test public void testSendAndReceive() throws Exception { container.setMessageListener(new MessageListener() { + @Override public void onMessage(Message msg) { try { processed.add(((TextMessage) msg).getText()); @@ -109,6 +110,7 @@ public class BatchMessageListenerContainerIntegrationTests { @Test public void testFailureAndRepresent() throws Exception { container.setMessageListener(new MessageListener() { + @Override public void onMessage(Message msg) { try { processed.add(((TextMessage) msg).getText()); @@ -132,9 +134,11 @@ public class BatchMessageListenerContainerIntegrationTests { final RetryTemplate retryTemplate = new RetryTemplate(); retryTemplate.setRetryPolicy(new NeverRetryPolicy()); container.setMessageListener(new MessageListener() { + @Override public void onMessage(final Message msg) { try { RetryCallback callback = new RetryCallback() { + @Override public Message doWithRetry(RetryContext context) throws Exception { try { processed.add(((TextMessage) msg).getText()); @@ -146,6 +150,7 @@ public class BatchMessageListenerContainerIntegrationTests { } }; RecoveryCallback recoveryCallback = new RecoveryCallback() { + @Override public Message recover(RetryContext context) { try { recovered.add(((TextMessage) msg).getText()); diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/container/jms/BatchMessageListenerContainerTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/container/jms/BatchMessageListenerContainerTests.java index fca1abde8..c6e61bcb9 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/container/jms/BatchMessageListenerContainerTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/container/jms/BatchMessageListenerContainerTests.java @@ -51,6 +51,7 @@ public class BatchMessageListenerContainerTests { container = getContainer(template); container.setMessageListener(new MessageListener() { + @Override public void onMessage(Message arg0) { } }); @@ -135,8 +136,10 @@ public class BatchMessageListenerContainerTests { // Yuck: we need to turn these method in base class to no-ops because the invoker is a private class // we can't create for test purposes... BatchMessageListenerContainer container = new BatchMessageListenerContainer() { + @Override protected void messageReceived(Object invoker, Session session) { } + @Override protected void noMessageReceived(Object invoker, Session session) { } }; @@ -153,6 +156,7 @@ public class BatchMessageListenerContainerTests { throws JMSException, IllegalAccessException { container.setAcceptMessagesWhileStopping(true); container.setMessageListener(new MessageListener() { + @Override public void onMessage(Message arg0) { if (t instanceof RuntimeException) throw (RuntimeException) t; diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderAsyncTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderAsyncTests.java index cd5396539..675e3207e 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderAsyncTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderAsyncTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import static org.junit.Assert.assertEquals; @@ -34,6 +49,7 @@ import com.ibatis.sqlmap.client.SqlMapClientBuilder; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "JdbcPagingItemReaderCommonTests-context.xml") +@SuppressWarnings("deprecation") public class IbatisPagingItemReaderAsyncTests { /** @@ -56,7 +72,7 @@ public class IbatisPagingItemReaderAsyncTests { @Before public void init() { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); - maxId = jdbcTemplate.queryForInt("SELECT MAX(ID) from T_FOOS"); + maxId = jdbcTemplate.queryForObject("SELECT MAX(ID) from T_FOOS", Integer.class); for (int i = ITEM_COUNT; i > maxId; i--) { jdbcTemplate.update("INSERT into T_FOOS (ID,NAME,VALUE) values (?, ?, ?)", i, "foo" + i, i); } @@ -93,7 +109,7 @@ public class IbatisPagingItemReaderAsyncTests { * @throws InterruptedException * @throws ExecutionException */ - private void doTest() throws Exception, InterruptedException, ExecutionException { + private void doTest() throws Exception, InterruptedException, ExecutionException { final IbatisPagingItemReader reader = getItemReader(); CompletionService> completionService = new ExecutorCompletionService>(Executors .newFixedThreadPool(THREAD_COUNT)); @@ -131,7 +147,7 @@ public class IbatisPagingItemReaderAsyncTests { } private IbatisPagingItemReader getItemReader() throws Exception { - SqlMapClient sqlMapClient = SqlMapClientBuilder.buildSqlMapClient(new ClassPathResource("ibatis-config.xml", getClass()).getInputStream()); + SqlMapClient sqlMapClient = createSqlMapClient(); IbatisPagingItemReader reader = new IbatisPagingItemReader(); if ("postgres".equals(System.getProperty("ENVIRONMENT"))) { 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 2371a21f2..db09bdfb5 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 @@ -84,7 +84,7 @@ public class JdbcPagingItemReaderAsyncTests { @Before public void init() { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); - maxId = jdbcTemplate.queryForInt("SELECT MAX(ID) from T_FOOS"); + maxId = jdbcTemplate.queryForObject("SELECT MAX(ID) from T_FOOS", Integer.class); for (int i = ITEM_COUNT; i > maxId; i--) { jdbcTemplate.update("INSERT into T_FOOS (ID,NAME,VALUE) values (?, ?, ?)", i, "foo" + i, i); } @@ -126,6 +126,7 @@ public class JdbcPagingItemReaderAsyncTests { .newFixedThreadPool(THREAD_COUNT)); for (int i = 0; i < THREAD_COUNT; i++) { completionService.submit(new Callable>() { + @Override public List call() throws Exception { List list = new ArrayList(); Foo next = null; @@ -166,8 +167,9 @@ public class JdbcPagingItemReaderAsyncTests { Map sortKeys = new LinkedHashMap(); sortKeys.put("VALUE", Order.ASCENDING); factory.setSortKeys(sortKeys); - reader.setQueryProvider((PagingQueryProvider) factory.getObject()); + reader.setQueryProvider(factory.getObject()); reader.setRowMapper(new ParameterizedRowMapper() { + @Override public Foo mapRow(ResultSet rs, int i) throws SQLException { Foo foo = new Foo(); foo.setId(rs.getInt(1)); diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/JdbcPagingQueryIntegrationTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/JdbcPagingQueryIntegrationTests.java index b4ad62590..fc158cd36 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/JdbcPagingQueryIntegrationTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/JdbcPagingQueryIntegrationTests.java @@ -132,7 +132,6 @@ public class JdbcPagingQueryIntegrationTests { queryProvider.setSelectClause("select NAME, CODE, sum(VALUE)"); queryProvider.setGroupClause("NAME, CODE"); - int pages = 3; int count = 0; int total = 5; @@ -176,7 +175,7 @@ public class JdbcPagingQueryIntegrationTests { PagingQueryProvider queryProvider = getPagingQueryProvider(); - int minId = jdbcTemplate.queryForInt("SELECT MIN(VALUE) FROM T_FOOS"); + int minId = jdbcTemplate.queryForObject("SELECT MIN(VALUE) FROM T_FOOS", Integer.class); String query = queryProvider.generateJumpToItemQuery(pageSize, pageSize); List> list = jdbcTemplate.queryForList(query); @@ -200,7 +199,7 @@ public class JdbcPagingQueryIntegrationTests { Map sortKeys = new LinkedHashMap(); sortKeys.put("VALUE", Order.ASCENDING); factory.setSortKeys(sortKeys); - return (PagingQueryProvider) factory.getObject(); + return factory.getObject(); } 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 83c95a6b5..8c9be0fb8 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 @@ -71,7 +71,7 @@ public class JdbcPagingRestartIntegrationTests { @Before public void init() { jdbcTemplate = new JdbcTemplate(dataSource); - maxId = jdbcTemplate.queryForInt("SELECT MAX(ID) from T_FOOS"); + maxId = jdbcTemplate.queryForObject("SELECT MAX(ID) from T_FOOS", Integer.class); for (int i = itemCount; i > maxId; i--) { jdbcTemplate.update("INSERT into T_FOOS (ID,NAME,VALUE) values (?, ?, ?)", i, "foo" + i, i); } @@ -155,8 +155,9 @@ public class JdbcPagingRestartIntegrationTests { Map sortKeys = new LinkedHashMap(); sortKeys.put("VALUE", Order.ASCENDING); factory.setSortKeys(sortKeys); - reader.setQueryProvider((PagingQueryProvider) factory.getObject()); + reader.setQueryProvider(factory.getObject()); reader.setRowMapper(new ParameterizedRowMapper() { + @Override public Foo mapRow(ResultSet rs, int i) throws SQLException { Foo foo = new Foo(); foo.setId(rs.getInt(1)); diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderAsyncTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderAsyncTests.java index d8afb943b..b700fcb52 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderAsyncTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderAsyncTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import static org.junit.Assert.assertEquals; @@ -59,7 +74,7 @@ public class JpaPagingItemReaderAsyncTests { @Before public void init() { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); - maxId = jdbcTemplate.queryForInt("SELECT MAX(ID) from T_FOOS"); + maxId = jdbcTemplate.queryForObject("SELECT MAX(ID) from T_FOOS", Integer.class); for (int i = ITEM_COUNT; i > maxId; i--) { jdbcTemplate.update("INSERT into T_FOOS (ID,NAME,VALUE) values (?, ?, ?)", i, "foo" + i, i); } @@ -101,6 +116,7 @@ public class JpaPagingItemReaderAsyncTests { .newFixedThreadPool(THREAD_COUNT)); for (int i = 0; i < THREAD_COUNT; i++) { completionService.submit(new Callable>() { + @Override public List call() throws Exception { List list = new ArrayList(); Foo next = null; diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/sample/Foo.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/sample/Foo.java index 9688f920a..92a7a0c66 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/sample/Foo.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/sample/Foo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.sample; import javax.persistence.Entity; @@ -47,6 +62,7 @@ public class Foo { this.id = id; } + @Override public String toString() { return "Foo[id=" +id +",name=" + name + ",value=" + value + "]"; } diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/AbstractStaxEventReaderItemReaderTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/AbstractStaxEventReaderItemReaderTests.java index 60694c7dc..a2cc41c5a 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/AbstractStaxEventReaderItemReaderTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/AbstractStaxEventReaderItemReaderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/AbstractStaxEventWriterItemWriterTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/AbstractStaxEventWriterItemWriterTests.java index 53a098120..0f6b153eb 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/AbstractStaxEventWriterItemWriterTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/AbstractStaxEventWriterItemWriterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml; import java.io.File; @@ -41,6 +56,7 @@ public abstract class AbstractStaxEventWriterItemWriterTests { protected Resource expected = new ClassPathResource("expected-output.xml", getClass()); + @SuppressWarnings("serial") protected List objects = new ArrayList() { { add(new Trade("isin1", 1, new BigDecimal(1.0), "customer1")); @@ -52,13 +68,15 @@ public abstract class AbstractStaxEventWriterItemWriterTests { /** * Write list of domain objects and check the output file. */ + @SuppressWarnings("resource") @Test public void testWrite() throws Exception { StopWatch stopWatch = new StopWatch(getClass().getSimpleName()); stopWatch.start(); for (int i = 0; i < MAX_WRITE; i++) { - new TransactionTemplate(new ResourcelessTransactionManager()).execute(new TransactionCallback() { - public Object doInTransaction(TransactionStatus status) { + new TransactionTemplate(new ResourcelessTransactionManager()).execute(new TransactionCallback() { + @Override + public Void doInTransaction(TransactionStatus status) { try { writer.write(objects); } diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/CastorMarshallingTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/CastorMarshallingTests.java index e801d0282..5350ba9cd 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/CastorMarshallingTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/CastorMarshallingTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml; import org.springframework.core.io.ClassPathResource; @@ -6,6 +21,7 @@ import org.springframework.oxm.castor.CastorMarshaller; public class CastorMarshallingTests extends AbstractStaxEventWriterItemWriterTests { + @Override protected Marshaller getMarshaller() throws Exception { CastorMarshaller marshaller = new CastorMarshaller(); diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/CastorUnmarshallingTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/CastorUnmarshallingTests.java index ba002f1e6..6c131599b 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/CastorUnmarshallingTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/CastorUnmarshallingTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml; import org.springframework.core.io.ClassPathResource; @@ -6,6 +21,7 @@ import org.springframework.oxm.castor.CastorMarshaller; public class CastorUnmarshallingTests extends AbstractStaxEventReaderItemReaderTests { + @Override protected Unmarshaller getUnmarshaller() throws Exception { CastorMarshaller unmarshaller = new CastorMarshaller(); unmarshaller.setMappingLocation(new ClassPathResource("mapping-castor.xml", getClass())); diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/Jaxb2MarshallingTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/Jaxb2MarshallingTests.java index 7b37bb439..00e3d5296 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/Jaxb2MarshallingTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/Jaxb2MarshallingTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml; import static org.junit.Assert.assertTrue; @@ -17,6 +32,7 @@ import org.springframework.oxm.jaxb.Jaxb2Marshaller; public class Jaxb2MarshallingTests extends AbstractStaxEventWriterItemWriterTests { + @Override protected Marshaller getMarshaller() throws Exception { Jaxb2Marshaller marshaller = new Jaxb2Marshaller(); diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/Jaxb2NamespaceMarshallingTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/Jaxb2NamespaceMarshallingTests.java index acba0ff7a..ad6fd40d6 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/Jaxb2NamespaceMarshallingTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/Jaxb2NamespaceMarshallingTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml; import static org.junit.Assert.assertTrue; @@ -47,6 +62,7 @@ public class Jaxb2NamespaceMarshallingTests { private Resource expected = new ClassPathResource("expected-qualified-output.xml", getClass()); + @SuppressWarnings("serial") private List objects = new ArrayList() { { add(new QualifiedTrade("isin1", 1, new BigDecimal(1.0), "customer1")); @@ -58,13 +74,15 @@ public class Jaxb2NamespaceMarshallingTests { /** * Write list of domain objects and check the output file. */ + @SuppressWarnings("resource") @Test public void testWrite() throws Exception { StopWatch stopWatch = new StopWatch(getClass().getSimpleName()); stopWatch.start(); for (int i = 0; i < MAX_WRITE; i++) { - new TransactionTemplate(new ResourcelessTransactionManager()).execute(new TransactionCallback() { - public Object doInTransaction(TransactionStatus status) { + new TransactionTemplate(new ResourcelessTransactionManager()).execute(new TransactionCallback() { + @Override + public Void doInTransaction(TransactionStatus status) { try { writer.write(objects); } diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/Jaxb2NamespaceUnmarshallingTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/Jaxb2NamespaceUnmarshallingTests.java index 420009be9..4f7a68acb 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/Jaxb2NamespaceUnmarshallingTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/Jaxb2NamespaceUnmarshallingTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/Jaxb2UnmarshallingTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/Jaxb2UnmarshallingTests.java index 6e4f772e3..8fa89afb8 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/Jaxb2UnmarshallingTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/Jaxb2UnmarshallingTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml; import org.springframework.batch.item.xml.domain.Trade; @@ -6,6 +21,7 @@ import org.springframework.oxm.jaxb.Jaxb2Marshaller; public class Jaxb2UnmarshallingTests extends AbstractStaxEventReaderItemReaderTests { + @Override protected Unmarshaller getUnmarshaller() throws Exception { reader.setFragmentRootElementName("trade"); diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/XStreamMarshallingTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/XStreamMarshallingTests.java index 2d58d12bc..5957f0162 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/XStreamMarshallingTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/XStreamMarshallingTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml; import org.springframework.batch.item.xml.domain.Trade; @@ -9,6 +24,7 @@ import java.util.Collections; public class XStreamMarshallingTests extends AbstractStaxEventWriterItemWriterTests { + @Override protected Marshaller getMarshaller() throws Exception { XStreamMarshaller marshaller = new XStreamMarshaller(); // marshaller.addAlias("trade", Trade.class); diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/XStreamUnmarshallingTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/XStreamUnmarshallingTests.java index 731cbe200..9e311d7a6 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/XStreamUnmarshallingTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/XStreamUnmarshallingTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml; import java.math.BigDecimal; @@ -10,6 +25,7 @@ import org.springframework.oxm.xstream.XStreamMarshaller; public class XStreamUnmarshallingTests extends AbstractStaxEventReaderItemReaderTests { + @Override protected Unmarshaller getUnmarshaller() throws Exception { XStreamMarshaller unmarshaller = new XStreamMarshaller(); Map> aliasesMap = new HashMap>(); diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/domain/QualifiedTrade.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/domain/QualifiedTrade.java index d014bf74a..e8eef6cee 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/domain/QualifiedTrade.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/domain/QualifiedTrade.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml.domain; import java.math.BigDecimal; @@ -70,6 +85,7 @@ public class QualifiedTrade { return customer; } + @Override public String toString() { return "Trade: [isin=" + this.isin + ",quantity=" + this.quantity + ",price=" + this.price + ",customer=" + this.customer + "]"; diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/domain/Trade.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/domain/Trade.java index 286f1c76e..76fe50062 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/domain/Trade.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/domain/Trade.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml.domain; import java.math.BigDecimal; @@ -61,6 +76,7 @@ public class Trade { return customer; } + @Override public String toString() { return "Trade: [isin=" + this.isin + ",quantity=" + this.quantity + ",price=" + this.price + ",customer=" + this.customer + "]"; diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/jms/ExternalRetryInBatchTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/jms/ExternalRetryInBatchTests.java index 4db6913aa..6f8ee72c6 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/jms/ExternalRetryInBatchTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/jms/ExternalRetryInBatchTests.java @@ -82,6 +82,7 @@ public class ExternalRetryInBatchTests { jmsTemplate.convertAndSend("queue", "foo"); jmsTemplate.convertAndSend("queue", "bar"); provider = new ItemReader() { + @Override public String read() { String text = (String) jmsTemplate.receiveAndConvert("queue"); list.add(text); @@ -98,7 +99,7 @@ public class ExternalRetryInBatchTests { } private void assertInitialState() { - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(0, count); } @@ -119,12 +120,14 @@ public class ExternalRetryInBatchTests { // *internal* retry policy. for (int i = 0; i < 4; i++) { try { - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { - public Object doInTransaction(TransactionStatus status) { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + @Override + public Void doInTransaction(TransactionStatus status) { try { repeatTemplate.iterate(new RepeatCallback() { + @Override public RepeatStatus doInIteration(RepeatContext context) throws Exception { final String item = provider.read(); @@ -134,6 +137,7 @@ public class ExternalRetryInBatchTests { } RetryCallback callback = new RetryCallback() { + @Override public String doWithRetry(RetryContext context) throws Exception { // No need for transaction here: the whole batch will roll // back. When it comes back for recovery this code is not @@ -146,6 +150,7 @@ public class ExternalRetryInBatchTests { }; RecoveryCallback recoveryCallback = new RecoveryCallback() { + @Override public String recover(RetryContext context) { // aggressive commit on a recovery RepeatSynchronizationManager.setCompleteOnly(); @@ -188,7 +193,7 @@ public class ExternalRetryInBatchTests { assertEquals(2, recovered.size()); // The database portion committed once... - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(0, count); // ... and so did the message session. diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/repeat/jms/AsynchronousTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/repeat/jms/AsynchronousTests.java index 686ec0cb7..85dfc0b73 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/repeat/jms/AsynchronousTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/repeat/jms/AsynchronousTests.java @@ -98,7 +98,7 @@ public class AsynchronousTests { private volatile List list = new ArrayList(); private void assertInitialState() { - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(0, count); } @@ -107,7 +107,8 @@ public class AsynchronousTests { assertInitialState(); - container.setMessageListener(new SessionAwareMessageListener() { + container.setMessageListener(new SessionAwareMessageListener() { + @Override public void onMessage(Message message, Session session) throws JMSException { list.add(message.toString()); String text = ((TextMessage) message).getText(); @@ -129,7 +130,7 @@ public class AsynchronousTests { String foo = (String) jmsTemplate.receiveAndConvert("queue"); assertEquals(null, foo); - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(2, count); } @@ -142,7 +143,8 @@ public class AsynchronousTests { // Prevent us from being overwhelmed after rollback container.setRecoveryInterval(500); - container.setMessageListener(new SessionAwareMessageListener() { + container.setMessageListener(new SessionAwareMessageListener() { + @Override public void onMessage(Message message, Session session) throws JMSException { list.add(message.toString()); final String text = ((TextMessage) message).getText(); @@ -175,7 +177,7 @@ public class AsynchronousTests { msgs.add(text); } - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(0, count); assertTrue("Foo not on queue", msgs.contains("foo")); diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/repeat/jms/SynchronousTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/repeat/jms/SynchronousTests.java index 821c94006..f2098db7d 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/repeat/jms/SynchronousTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/repeat/jms/SynchronousTests.java @@ -66,6 +66,7 @@ public class SynchronousTests implements ApplicationContextAware { private ApplicationContext applicationContext; + @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; } @@ -89,7 +90,7 @@ public class SynchronousTests implements ApplicationContextAware { } private void assertInitialState() { - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(0, count); } @@ -102,6 +103,7 @@ public class SynchronousTests implements ApplicationContextAware { assertInitialState(); repeatTemplate.iterate(new RepeatCallback() { + @Override public RepeatStatus doInIteration(RepeatContext context) throws Exception { String text = (String) jmsTemplate.receiveAndConvert("queue"); list.add(text); @@ -110,7 +112,7 @@ public class SynchronousTests implements ApplicationContextAware { } }); - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(2, count); String text = (String) jmsTemplate.receiveAndConvert("queue"); @@ -123,9 +125,11 @@ public class SynchronousTests implements ApplicationContextAware { assertInitialState(); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { - public Object doInTransaction(org.springframework.transaction.TransactionStatus status) { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + @Override + public Void doInTransaction(org.springframework.transaction.TransactionStatus status) { repeatTemplate.iterate(new RepeatCallback() { + @Override public RepeatStatus doInIteration(RepeatContext context) throws Exception { String text = (String) jmsTemplate.receiveAndConvert("queue"); list.add(text); @@ -147,7 +151,7 @@ public class SynchronousTests implements ApplicationContextAware { } // The database portion rolled back... - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(0, count); // ... and so did the message session. The rollback should have restored @@ -167,10 +171,12 @@ public class SynchronousTests implements ApplicationContextAware { assertInitialState(); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { - public Object doInTransaction(org.springframework.transaction.TransactionStatus status) { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + @Override + public Void doInTransaction(org.springframework.transaction.TransactionStatus status) { repeatTemplate.iterate(new RepeatCallback() { + @Override public RepeatStatus doInIteration(RepeatContext context) throws Exception { String text = (String) txJmsTemplate.receiveAndConvert("queue"); list.add(text); @@ -181,8 +187,9 @@ public class SynchronousTests implements ApplicationContextAware { // Simulate a message system failure before the main transaction // commits... - txJmsTemplate.execute(new SessionCallback() { - public Object doInJms(Session session) throws JMSException { + txJmsTemplate.execute(new SessionCallback() { + @Override + public Void doInJms(Session session) throws JMSException { try { assertTrue("Not a SessionProxy - wrong spring version?", session instanceof SessionProxy); ((SessionProxy) session).getTargetSession().rollback(); @@ -210,7 +217,7 @@ public class SynchronousTests implements ApplicationContextAware { } // The database portion committed... - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(2, count); // ...but the JMS session rolled back, so the message is still there diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplateBulkAsynchronousTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplateBulkAsynchronousTests.java index 897d0ebac..7c243d455 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplateBulkAsynchronousTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplateBulkAsynchronousTests.java @@ -88,6 +88,7 @@ public class TaskExecutorRepeatTemplateBulkAsynchronousTests { private volatile AtomicInteger count = new AtomicInteger(0); + @Override public RepeatStatus doInIteration(RepeatContext context) throws Exception { int position = count.incrementAndGet(); @@ -240,6 +241,7 @@ public class TaskExecutorRepeatTemplateBulkAsynchronousTests { private volatile AtomicInteger count = new AtomicInteger(0); + @Override public RepeatStatus doInIteration(RepeatContext context) throws Exception { int position = count.incrementAndGet(); diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/retry/jms/ExternalRetryTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/retry/jms/ExternalRetryTests.java index 42eece149..73c21fdf3 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/retry/jms/ExternalRetryTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/retry/jms/ExternalRetryTests.java @@ -72,6 +72,7 @@ public class ExternalRetryTests { jdbcTemplate.execute("delete from T_BARS"); jmsTemplate.convertAndSend("queue", "foo"); provider = new ItemReader() { + @Override public String read() { String text = (String) jmsTemplate.receiveAndConvert("queue"); list.add(text); @@ -82,7 +83,7 @@ public class ExternalRetryTests { } private void assertInitialState() { - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(0, count); } @@ -100,6 +101,7 @@ public class ExternalRetryTests { assertInitialState(); final ItemWriter writer = new ItemWriter() { + @Override public void write(final List texts) { for (Object text : texts) { @@ -116,11 +118,13 @@ public class ExternalRetryTests { }; try { - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + @Override public Object doInTransaction(TransactionStatus status) { try { final Object item = provider.read(); RetryCallback callback = new RetryCallback() { + @Override public Object doWithRetry(RetryContext context) throws Exception { writer.write(Collections.singletonList(item)); return null; @@ -144,11 +148,13 @@ public class ExternalRetryTests { } - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + @Override public Object doInTransaction(TransactionStatus status) { try { final String item = provider.read(); RetryCallback callback = new RetryCallback() { + @Override public Object doWithRetry(RetryContext context) throws Exception { writer.write(Collections.singletonList(item)); return null; @@ -165,7 +171,7 @@ public class ExternalRetryTests { List msgs = getMessages(); // The database portion committed once... - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(1, count); // ... and so did the message session. @@ -182,6 +188,7 @@ public class ExternalRetryTests { final String item = provider.read(); final RetryCallback callback = new RetryCallback() { + @Override public String doWithRetry(RetryContext context) throws Exception { jdbcTemplate.update("INSERT into T_BARS (id,name,foo_date) values (?,?,null)", list.size(), item); throw new RuntimeException("Rollback!"); @@ -189,6 +196,7 @@ public class ExternalRetryTests { }; final RecoveryCallback recoveryCallback = new RecoveryCallback() { + @Override public String recover(RetryContext context) { recovered.add(item); return item; @@ -199,8 +207,9 @@ public class ExternalRetryTests { for (int i = 0; i < 4; i++) { try { - result = (String) new TransactionTemplate(transactionManager).execute(new TransactionCallback() { - public Object doInTransaction(TransactionStatus status) { + result = new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + @Override + public String doInTransaction(TransactionStatus status) { try { return retryTemplate.execute(callback, recoveryCallback, new DefaultRetryState(item)); } @@ -230,7 +239,7 @@ public class ExternalRetryTests { assertEquals(1, recovered.size()); // The database portion committed once... - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(0, count); // ... and so did the message session. diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/retry/jms/SynchronousTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/retry/jms/SynchronousTests.java index 73afa89b4..a6cba292a 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/retry/jms/SynchronousTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/retry/jms/SynchronousTests.java @@ -98,7 +98,7 @@ public class SynchronousTests { } private void assertInitialState() { - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(0, count); } @@ -125,12 +125,14 @@ public class SynchronousTests { assertNotNull(text); retryTemplate.execute(new RetryCallback() { + @Override public String doWithRetry(RetryContext status) throws Exception { TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager); transactionTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_NESTED); - return (String) transactionTemplate.execute(new TransactionCallback() { - public Object doInTransaction(TransactionStatus status) { + return transactionTemplate.execute(new TransactionCallback() { + @Override + public String doInTransaction(TransactionStatus status) { list.add(text); System.err.println("Inserting: [" + list.size() + "," + text + "]"); @@ -151,7 +153,7 @@ public class SynchronousTests { List msgs = getMessages(); // The database portion committed once... - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(1, count); // ... and so did the message session. @@ -172,15 +174,17 @@ public class SynchronousTests { jmsTemplate.setDefaultDestinationName("queue"); provider.setJmsTemplate(jmsTemplate); - final Object item = provider.read(); + final String item = (String) provider.read(); retryTemplate.execute(new RetryCallback() { + @Override public String doWithRetry(RetryContext context) throws Exception { TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager); transactionTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_NESTED); - return (String) transactionTemplate.execute(new TransactionCallback() { - public Object doInTransaction(TransactionStatus status) { + return transactionTemplate.execute(new TransactionCallback() { + @Override + public String doInTransaction(TransactionStatus status) { list.add(item); System.err.println("Inserting: [" + list.size() + "," + item + "]"); @@ -202,7 +206,7 @@ public class SynchronousTests { List msgs = getMessages(); // The database portion committed once... - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(1, count); // ... and so did the message session. @@ -229,19 +233,22 @@ public class SynchronousTests { TransactionTemplate outerTxTemplate = new TransactionTemplate(transactionManager); outerTxTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRES_NEW); - outerTxTemplate.execute(new TransactionCallback() { - public Object doInTransaction(TransactionStatus outerStatus) { + outerTxTemplate.execute(new TransactionCallback() { + @Override + public Void doInTransaction(TransactionStatus outerStatus) { final String text = (String) jmsTemplate.receiveAndConvert("queue"); try { retryTemplate.execute(new RetryCallback() { + @Override public String doWithRetry(RetryContext status) throws Exception { TransactionTemplate nestedTxTemplate = new TransactionTemplate(transactionManager); nestedTxTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_NESTED); - return (String) nestedTxTemplate.execute(new TransactionCallback() { - public Object doInTransaction(TransactionStatus nestedStatus) { + return nestedTxTemplate.execute(new TransactionCallback() { + @Override + public String doInTransaction(TransactionStatus nestedStatus) { list.add(text); System.err.println("Inserting: [" + list.size() + "," + text + "]"); @@ -258,7 +265,7 @@ public class SynchronousTests { } // The nested database transaction has committed... - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(1, count); // force rollback... @@ -268,12 +275,12 @@ public class SynchronousTests { } }); - // Verify the state after stransactional processing is complete + // Verify the state after transactional processing is complete List msgs = getMessages(); // The database portion rolled back... - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(0, count); // ... and so did the message session. @@ -291,13 +298,15 @@ public class SynchronousTests { assertInitialState(); retryTemplate.execute(new RetryCallback() { + @Override public String doWithRetry(RetryContext status) throws Exception { // use REQUIRES_NEW so that the retry executes in its own transaction TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager); transactionTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRES_NEW); - return (String) transactionTemplate.execute(new TransactionCallback() { - public Object doInTransaction(TransactionStatus status) { + return transactionTemplate.execute(new TransactionCallback() { + @Override + public String doInTransaction(TransactionStatus status) { // The receive is inside the retry and the // transaction... @@ -315,12 +324,12 @@ public class SynchronousTests { } }); - // Verify the state after stransactional processing is complete + // Verify the state after transactional processing is complete List msgs = getMessages(); // The database portion committed once... - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(1, count); // ... and so did the message session. @@ -339,13 +348,15 @@ public class SynchronousTests { try { retryTemplate.execute(new RetryCallback() { + @Override public String doWithRetry(RetryContext status) throws Exception { // use REQUIRES_NEW so that the retry executes in its own transaction TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager); transactionTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRES_NEW); - return (String) transactionTemplate.execute(new TransactionCallback() { - public Object doInTransaction(TransactionStatus status) { + return transactionTemplate.execute(new TransactionCallback() { + @Override + public String doInTransaction(TransactionStatus status) { // The receive is inside the retry and the // transaction... @@ -377,7 +388,7 @@ public class SynchronousTests { List msgs = getMessages(); // The database portion rolled back... - int count = jdbcTemplate.queryForInt("select count(*) from T_BARS"); + int count = jdbcTemplate.queryForObject("select count(*) from T_BARS", Integer.class); assertEquals(0, count); // ... and so did the message session. diff --git a/spring-batch-infrastructure-tests/src/test/java/test/jdbc/datasource/DataSourceInitializer.java b/spring-batch-infrastructure-tests/src/test/java/test/jdbc/datasource/DataSourceInitializer.java index db1f9ad85..eb78cbbd4 100644 --- a/spring-batch-infrastructure-tests/src/test/java/test/jdbc/datasource/DataSourceInitializer.java +++ b/spring-batch-infrastructure-tests/src/test/java/test/jdbc/datasource/DataSourceInitializer.java @@ -56,6 +56,7 @@ public class DataSourceInitializer implements InitializingBean, DisposableBean { this.initialize = initialize; } + @Override public void destroy() throws Exception { if (!initialized) { return; @@ -76,6 +77,7 @@ public class DataSourceInitializer implements InitializingBean, DisposableBean { } } + @Override public void afterPropertiesSet() throws Exception { Assert.notNull(dataSource); logger.info("Initializing with scripts: " + Arrays.asList(initScripts)); @@ -115,9 +117,10 @@ public class DataSourceInitializer implements InitializingBean, DisposableBean { final String script = scripts[i].trim(); TransactionTemplate transactionTemplate = new TransactionTemplate(new DataSourceTransactionManager( dataSource)); - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { - public Object doInTransaction(TransactionStatus status) { + @Override + public Void doInTransaction(TransactionStatus status) { if (StringUtils.hasText(script)) { try { jdbcTemplate.execute(script); diff --git a/spring-batch-infrastructure/.springBeans b/spring-batch-infrastructure/.springBeans index 5f547405d..de3e57ab6 100644 --- a/spring-batch-infrastructure/.springBeans +++ b/spring-batch-infrastructure/.springBeans @@ -1,26 +1,25 @@ - - - 1 - - - - - - - src/test/resources/org/springframework/batch/item/database/data-source-context.xml - src/test/resources/org/springframework/batch/item/file/mapping/bean-wrapper.xml - src/test/resources/org/springframework/batch/item/adapter/delegating-item-processor.xml - src/test/resources/org/springframework/batch/item/adapter/delegating-item-provider.xml - src/test/resources/org/springframework/batch/item/adapter/delegating-item-writer.xml - src/test/resources/org/springframework/batch/item/database/JdbcPagingItemReaderCommonTests-context.xml - src/test/resources/org/springframework/batch/item/database/JdbcPagingItemReaderConfigTests-context.xml - src/test/resources/org/springframework/batch/item/database/JdbcPagingItemReaderParameterTests-context.xml - src/test/resources/org/springframework/batch/item/database/JpaPagingItemReaderCommonTests-context.xml - src/test/resources/org/springframework/batch/item/database/JpaPagingItemReaderParameterTests-context.xml - src/test/resources/org/springframework/batch/item/adapter/pe-delegating-item-writer.xml - src/test/resources/org/springframework/batch/retry/interceptor/retry-transaction-test.xml - src/test/resources/org/springframework/batch/item/database/stored-procedure-context.xml - - - - + + + 1 + + + + + + + src/test/resources/org/springframework/batch/item/database/data-source-context.xml + src/test/resources/org/springframework/batch/item/file/mapping/bean-wrapper.xml + src/test/resources/org/springframework/batch/item/adapter/delegating-item-processor.xml + src/test/resources/org/springframework/batch/item/adapter/delegating-item-provider.xml + src/test/resources/org/springframework/batch/item/adapter/delegating-item-writer.xml + src/test/resources/org/springframework/batch/item/database/JdbcPagingItemReaderCommonTests-context.xml + src/test/resources/org/springframework/batch/item/database/JdbcPagingItemReaderConfigTests-context.xml + src/test/resources/org/springframework/batch/item/database/JdbcPagingItemReaderParameterTests-context.xml + src/test/resources/org/springframework/batch/item/database/JpaPagingItemReaderCommonTests-context.xml + src/test/resources/org/springframework/batch/item/database/JpaPagingItemReaderParameterTests-context.xml + src/test/resources/org/springframework/batch/item/adapter/pe-delegating-item-writer.xml + src/test/resources/org/springframework/batch/item/database/stored-procedure-context.xml + + + + diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionContext.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionContext.java index 3b40126f8..a0ea43a5f 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionContext.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionContext.java @@ -163,7 +163,7 @@ public class ExecutionContext implements Serializable { * * @param key The key to get a value for * @param defaultString Default to return if key is not represented - * @return The String value if key is repreesnted, specified + * @return The String value if key is represented, specified * default otherwise */ public String getString(String key, String defaultString) { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemReader.java index 4d04769bc..f03d25294 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemReader.java @@ -23,7 +23,7 @@ package org.springframework.batch.item; * for each batch, with each call to {@link #read()} returning a different value * and finally returning null when all input data is exhausted.
    * - * Implementations need *not* be thread safe and clients of a {@link ItemReader} + * Implementations need not be thread-safe and clients of a {@link ItemReader} * need to be aware that this is the case.
    * * A richer interface (e.g. with a look ahead or peek) is not feasible because diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemReaderException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemReaderException.java index 70ff3d2b3..a72699783 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemReaderException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemReaderException.java @@ -21,6 +21,7 @@ package org.springframework.batch.item; * * @author Ben Hale */ +@SuppressWarnings("serial") public abstract class ItemReaderException extends RuntimeException { /** diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemStreamException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemStreamException.java index 508f389a1..ca8461435 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemStreamException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemStreamException.java @@ -21,6 +21,7 @@ package org.springframework.batch.item; * @author Dave Syer * @author Lucas Ward */ +@SuppressWarnings("serial") public class ItemStreamException extends RuntimeException { /** diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemWriterException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemWriterException.java index 3025dca1f..69ba23dad 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemWriterException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemWriterException.java @@ -21,6 +21,7 @@ package org.springframework.batch.item; * * @author Ben Hale */ +@SuppressWarnings("serial") public abstract class ItemWriterException extends RuntimeException { /** diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/NonTransientResourceException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/NonTransientResourceException.java index 31f73dc88..f96f54e06 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/NonTransientResourceException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/NonTransientResourceException.java @@ -21,6 +21,7 @@ package org.springframework.batch.item; * * @author Dave Syer */ +@SuppressWarnings("serial") public class NonTransientResourceException extends ItemReaderException { /** diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ParseException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ParseException.java index a537a2b56..4f027b4f4 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ParseException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ParseException.java @@ -16,11 +16,12 @@ package org.springframework.batch.item; /** - * Exception indicating that an error has been encountered parsing io, typically from a file. + * Exception indicating that an error has been encountered parsing IO, typically from a file. * * @author Lucas Ward * @author Ben Hale */ +@SuppressWarnings("serial") public class ParseException extends ItemReaderException { /** diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ReaderNotOpenException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ReaderNotOpenException.java index 8f1db5a32..a590fa805 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ReaderNotOpenException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ReaderNotOpenException.java @@ -20,6 +20,7 @@ package org.springframework.batch.item; * * @author Ben Hale */ +@SuppressWarnings("serial") public class ReaderNotOpenException extends ItemReaderException { /** diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ResourceAware.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ResourceAware.java index b1762d670..77b82a6d0 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ResourceAware.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ResourceAware.java @@ -1,3 +1,18 @@ +/* + * Copyright 2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item; import org.springframework.core.io.Resource; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/UnexpectedInputException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/UnexpectedInputException.java index fe3588c2c..44907ba2b 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/UnexpectedInputException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/UnexpectedInputException.java @@ -23,6 +23,7 @@ package org.springframework.batch.item; * @author Dave Syer * @author Ben Hale */ +@SuppressWarnings("serial") public class UnexpectedInputException extends ItemReaderException { /** diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/WriteFailedException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/WriteFailedException.java index 4d46b6aee..6588d84fa 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/WriteFailedException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/WriteFailedException.java @@ -22,6 +22,7 @@ package org.springframework.batch.item; * @author Lucas Ward * @author Ben Hale */ +@SuppressWarnings("serial") public class WriteFailedException extends ItemWriterException { /** diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/WriterNotOpenException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/WriterNotOpenException.java index 5bbe60d0b..065990678 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/WriterNotOpenException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/WriterNotOpenException.java @@ -17,10 +17,11 @@ package org.springframework.batch.item; /** * Exception indicating that an {@link ItemWriter} needed to be opened before being - * written to.. + * written to. * * @author Lucas Ward */ +@SuppressWarnings("serial") public class WriterNotOpenException extends ItemWriterException { /** diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/adapter/AbstractMethodInvokingDelegator.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/adapter/AbstractMethodInvokingDelegator.java index 516d70e65..70f01cdb0 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/adapter/AbstractMethodInvokingDelegator.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/adapter/AbstractMethodInvokingDelegator.java @@ -218,6 +218,7 @@ public abstract class AbstractMethodInvokingDelegator implements Initializing * * @author Robert Kasanicky */ + @SuppressWarnings("serial") public static class InvocationTargetThrowableWrapper extends RuntimeException { public InvocationTargetThrowableWrapper(Throwable cause) { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/AbstractPaginatedDataItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/AbstractPaginatedDataItemReader.java index 6d75321d2..f071446e7 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/AbstractPaginatedDataItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/AbstractPaginatedDataItemReader.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.data; import java.util.Iterator; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/MongoItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/MongoItemReader.java index 00231a53f..41a770ce2 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/MongoItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/MongoItemReader.java @@ -60,7 +60,7 @@ import com.mongodb.util.JSON; *

    * The implementation is thread-safe between calls to * {@link #open(ExecutionContext)}, but remember to use saveState=false - * if used in a multi-threaded client (no restart available. + * if used in a multi-threaded client (no restart available). *

    * * @@ -127,7 +127,7 @@ public class MongoItemReader extends AbstractPaginatedDataItemReader imple * JSON defining the fields to be returned from the matching documents * by MongoDB. * - * @param fields JSON string that identifies the fields to sorty by. + * @param fields JSON string that identifies the fields to sort by. */ public void setFields(String fields) { this.fields = fields; @@ -183,6 +183,7 @@ public class MongoItemReader extends AbstractPaginatedDataItemReader imple * * @see InitializingBean#afterPropertiesSet() */ + @Override public void afterPropertiesSet() throws Exception { Assert.state(template != null, "An implementation of MongoOperations is required."); Assert.state(type != null, "A type to convert the input into is required."); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/MongoItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/MongoItemWriter.java index 73e3b3dd5..636ce5822 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/MongoItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/MongoItemWriter.java @@ -37,7 +37,7 @@ import org.springframework.util.StringUtils; *

    * *

    - * This writer is thread safe once all properties are set (normal singleton behavior) so it can be used in multiple + * This writer is thread-safe once all properties are set (normal singleton behavior) so it can be used in multiple * concurrent transactions. *

    * @@ -91,13 +91,14 @@ public class MongoItemWriter implements ItemWriter, InitializingBean { * * @see org.springframework.batch.item.ItemWriter#write(List) */ + @Override public void write(List items) throws Exception { if(!transactionActive()) { doWrite(items); return; } - List bufferedItems = getCurrentBuffer(); + List bufferedItems = getCurrentBuffer(); bufferedItems.addAll(items); } @@ -140,14 +141,15 @@ public class MongoItemWriter implements ItemWriter, InitializingBean { return TransactionSynchronizationManager.isActualTransactionActive(); } - private List getCurrentBuffer() { + @SuppressWarnings("unchecked") + private List getCurrentBuffer() { if(!TransactionSynchronizationManager.hasResource(bufferKey)) { - TransactionSynchronizationManager.bindResource(bufferKey, new ArrayList()); + TransactionSynchronizationManager.bindResource(bufferKey, new ArrayList()); TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void beforeCommit(boolean readOnly) { - List items = (List) TransactionSynchronizationManager.getResource(bufferKey); + List items = (List) TransactionSynchronizationManager.getResource(bufferKey); if(!CollectionUtils.isEmpty(items)) { if(!readOnly) { @@ -165,9 +167,10 @@ public class MongoItemWriter implements ItemWriter, InitializingBean { }); } - return (List) TransactionSynchronizationManager.getResource(bufferKey); + return (List) TransactionSynchronizationManager.getResource(bufferKey); } + @Override public void afterPropertiesSet() throws Exception { Assert.state(template != null, "A MongoOperations implementation is required."); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/Neo4jItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/Neo4jItemReader.java index eec6be17d..5f6ed7342 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/Neo4jItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/Neo4jItemReader.java @@ -75,11 +75,11 @@ InitializingBean { private String whereStatement; private String orderByStatement; - private Class targetType; + private Class targetType; private Map parameterValues; - private ResultConverter resultConverter; + private ResultConverter, T> resultConverter; public Neo4jItemReader() { setName(ClassUtils.getShortName(Neo4jItemReader.class)); @@ -119,7 +119,7 @@ InitializingBean { } /** - * An optional where fragement of the cypher query. WHERE is + * An optional where fragment of the cypher query. WHERE is * prepended to the statement provided and should not * be included. * @@ -156,7 +156,7 @@ InitializingBean { * * @param targetType the type of object to return. */ - public void setTargetType(Class targetType) { + public void setTargetType(Class targetType) { this.targetType = targetType; } @@ -166,12 +166,11 @@ InitializingBean { * * @param resultConverter the converter to use. */ - public void setResultConverter(ResultConverter resultConverter) { + public void setResultConverter(ResultConverter, T> resultConverter) { this.resultConverter = resultConverter; } @Override - @SuppressWarnings({"unchecked", "rawtypes"}) protected Iterator doPageRead() { Result> queryResults = template.query( generateLimitCypherQuery(), parameterValues); @@ -185,7 +184,7 @@ InitializingBean { } } else { - return new ArrayList().iterator(); + return new ArrayList().iterator(); } } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/Neo4jItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/Neo4jItemWriter.java index 47e5b6b04..e64f1288e 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/Neo4jItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/Neo4jItemWriter.java @@ -33,7 +33,7 @@ import org.springframework.util.CollectionUtils; *

    * *

    - * This writer is thread safe once all properties are set (normal singleton + * This writer is thread-safe once all properties are set (normal singleton * behavior) so it can be used in multiple concurrent transactions. *

    * @@ -67,6 +67,7 @@ public class Neo4jItemWriter implements ItemWriter, InitializingBean { * * @see InitializingBean#afterPropertiesSet() */ + @Override public void afterPropertiesSet() throws Exception { Assert.state(template != null, "A Neo4JOperations implementation is required"); } @@ -76,6 +77,7 @@ public class Neo4jItemWriter implements ItemWriter, InitializingBean { * * @see org.springframework.batch.item.ItemWriter#write(java.util.List) */ + @Override public void write(List items) throws Exception { if(!CollectionUtils.isEmpty(items)) { doWrite(items); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/RepositoryItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/RepositoryItemReader.java index c7168becb..f206a65aa 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/RepositoryItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/RepositoryItemReader.java @@ -54,19 +54,18 @@ import org.springframework.util.MethodInvoker; *

    * *

    - * This implementation is thread safe between calls to {@link #open(ExecutionContext)}, but remember to use + * This implementation is thread-safe between calls to {@link #open(ExecutionContext)}, but remember to use * saveState=false if used in a multi-threaded client (no restart available). *

    * * @author Michael Minella * @since 2.2 */ -@SuppressWarnings("rawtypes") public class RepositoryItemReader extends AbstractItemCountingItemStreamItemReader implements InitializingBean { protected Log logger = LogFactory.getLog(getClass()); - private PagingAndSortingRepository repository; + private PagingAndSortingRepository repository; private Sort sort; @@ -76,7 +75,7 @@ public class RepositoryItemReader extends AbstractItemCountingItemStreamItemR private volatile int current = 0; - private List arguments; + private List arguments; private volatile List results; @@ -93,7 +92,7 @@ public class RepositoryItemReader extends AbstractItemCountingItemStreamItemR * * @param arguments list of method arguments to be passed to the repository */ - public void setArguments(List arguments) { + public void setArguments(List arguments) { this.arguments = arguments; } @@ -119,7 +118,7 @@ public class RepositoryItemReader extends AbstractItemCountingItemStreamItemR * * @param repository underlying repository for input to be read from. */ - public void setRepository(PagingAndSortingRepository repository) { + public void setRepository(PagingAndSortingRepository repository) { this.repository = repository; } @@ -195,7 +194,7 @@ public class RepositoryItemReader extends AbstractItemCountingItemStreamItemR MethodInvoker invoker = createMethodInvoker(repository, methodName); - List parameters = new ArrayList(); + List parameters = new ArrayList(); if(arguments != null && arguments.size() > 0) { parameters.addAll(arguments); @@ -205,7 +204,7 @@ public class RepositoryItemReader extends AbstractItemCountingItemStreamItemR invoker.setArguments(parameters.toArray()); - Page curPage = (Page) doInvoke(invoker); + Page curPage = (Page) doInvoke(invoker); return curPage.getContent(); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/RepositoryItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/RepositoryItemWriter.java index 6da207ca3..706fecc97 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/RepositoryItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/RepositoryItemWriter.java @@ -50,12 +50,11 @@ import org.springframework.util.MethodInvoker; * @author Michael Minella * @since 2.2 */ -@SuppressWarnings("rawtypes") -public class RepositoryItemWriter implements ItemWriter, InitializingBean { +public class RepositoryItemWriter implements ItemWriter, InitializingBean { protected static final Log logger = LogFactory.getLog(RepositoryItemWriter.class); - private CrudRepository repository; + private CrudRepository repository; private String methodName; @@ -75,7 +74,7 @@ public class RepositoryItemWriter implements ItemWriter, InitializingBean { * * @param repository the Spring Data repository to be set */ - public void setRepository(CrudRepository repository) { + public void setRepository(CrudRepository repository) { this.repository = repository; } @@ -85,7 +84,7 @@ public class RepositoryItemWriter implements ItemWriter, InitializingBean { * @see org.springframework.batch.item.ItemWriter#write(java.util.List) */ @Override - public void write(List items) throws Exception { + public void write(List items) throws Exception { if(!CollectionUtils.isEmpty(items)) { doWrite(items); } @@ -97,14 +96,14 @@ public class RepositoryItemWriter implements ItemWriter, InitializingBean { * * @param items the list of items to be persisted. */ - protected void doWrite(List items) throws Exception { + protected void doWrite(List items) throws Exception { if (logger.isDebugEnabled()) { logger.debug("Writing to the repository with " + items.size() + " items."); } MethodInvoker invoker = createMethodInvoker(repository, methodName); - for (Object object : items) { + for (T object : items) { invoker.setArguments(new Object [] {object}); doInvoke(invoker); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/AbstractCursorItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/AbstractCursorItemReader.java index 24bb64e7f..836013a67 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/AbstractCursorItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/AbstractCursorItemReader.java @@ -142,7 +142,7 @@ implements InitializingBean { /** * Assert that mandatory properties are set. * - * @throws IllegalArgumentException if either data source or sql properties + * @throws IllegalArgumentException if either data source or SQL properties * not set. */ @Override diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernateItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernateItemWriter.java index 01b80c2e9..1bb15ecdd 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernateItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernateItemWriter.java @@ -35,7 +35,7 @@ import org.springframework.util.Assert; * default (see {@link #setClearSession(boolean) clearSession} property).
    *
    * - * The writer is thread safe once properties are set (normal singleton behavior) + * The writer is thread-safe once properties are set (normal singleton behavior) * if a {@link CurrentSessionContext} that uses only one session per thread is * used. * diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernatePagingItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernatePagingItemReader.java index 68a4f6057..5fac72b50 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernatePagingItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernatePagingItemReader.java @@ -23,7 +23,6 @@ import org.hibernate.SessionFactory; import org.hibernate.StatelessSession; import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.item.ItemReader; -import org.springframework.batch.item.ItemStream; import org.springframework.batch.item.database.orm.HibernateQueryProvider; import org.springframework.beans.factory.InitializingBean; import org.springframework.util.Assert; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/IbatisBatchItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/IbatisBatchItemWriter.java index 1afeac70b..e2bff3bfa 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/IbatisBatchItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/IbatisBatchItemWriter.java @@ -50,7 +50,7 @@ import com.ibatis.sqlmap.engine.execution.BatchResult; * * It is expected that {@link #write(List)} is called inside a transaction.
    * - * The writer is thread safe after its properties are set (normal singleton + * The writer is thread-safe after its properties are set (normal singleton * behavior), so it can be used to write in multiple concurrent transactions.
    * * Note: This reader was refactored as part of Spring Batch 3.0 to use the iBatis diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JdbcBatchItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JdbcBatchItemWriter.java index d455430e0..95f0252a1 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JdbcBatchItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JdbcBatchItemWriter.java @@ -51,7 +51,7 @@ import org.springframework.util.Assert; * * It is expected that {@link #write(List)} is called inside a transaction.
    * - * The writer is thread safe after its properties are set (normal singleton + * The writer is thread-safe after its properties are set (normal singleton * behavior), so it can be used to write in multiple concurrent transactions. * * @author Dave Syer @@ -158,8 +158,8 @@ public class JdbcBatchItemWriter implements ItemWriter, InitializingBean { /* (non-Javadoc) * @see org.springframework.batch.item.ItemWriter#write(java.util.List) */ + @SuppressWarnings("unchecked") @Override - @SuppressWarnings({"unchecked", "rawtypes"}) public void write(final List items) throws Exception { if (!items.isEmpty()) { @@ -183,9 +183,9 @@ public class JdbcBatchItemWriter implements ItemWriter, InitializingBean { } } else { - updateCounts = (int[]) namedParameterJdbcTemplate.getJdbcOperations().execute(sql, new PreparedStatementCallback() { + updateCounts = namedParameterJdbcTemplate.getJdbcOperations().execute(sql, new PreparedStatementCallback() { @Override - public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException { + public int[] doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException { for (T item : items) { itemPreparedStatementSetter.setValues(item, ps); ps.addBatch(); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JdbcCursorItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JdbcCursorItemReader.java index 1404bdd78..6138f0608 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JdbcCursorItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JdbcCursorItemReader.java @@ -50,7 +50,6 @@ import org.springframework.util.ClassUtils; * @author Robert Kasanicky * @author Thomas Risberg */ -@SuppressWarnings("rawtypes") public class JdbcCursorItemReader extends AbstractCursorItemReader { PreparedStatement preparedStatement; @@ -59,7 +58,7 @@ public class JdbcCursorItemReader extends AbstractCursorItemReader { String sql; - RowMapper rowMapper; + RowMapper rowMapper; public JdbcCursorItemReader() { super(); @@ -71,7 +70,7 @@ public class JdbcCursorItemReader extends AbstractCursorItemReader { * * @param rowMapper */ - public void setRowMapper(RowMapper rowMapper) { + public void setRowMapper(RowMapper rowMapper) { this.rowMapper = rowMapper; } @@ -99,7 +98,7 @@ public class JdbcCursorItemReader extends AbstractCursorItemReader { /** * Assert that mandatory properties are set. * - * @throws IllegalArgumentException if either data source or sql properties + * @throws IllegalArgumentException if either data source or SQL properties * not set. */ @Override @@ -136,9 +135,8 @@ public class JdbcCursorItemReader extends AbstractCursorItemReader { @Override - @SuppressWarnings("unchecked") protected T readCursor(ResultSet rs, int currentRow) throws SQLException { - return (T) rowMapper.mapRow(rs, currentRow); + return rowMapper.mapRow(rs, currentRow); } /** 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 3ba6c8089..2317b7e7d 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 @@ -86,8 +86,7 @@ public class JdbcPagingItemReader extends AbstractPagingItemReader impleme private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - @SuppressWarnings("rawtypes") - private RowMapper rowMapper; + private RowMapper rowMapper; private String firstPageSql; @@ -139,8 +138,7 @@ public class JdbcPagingItemReader extends AbstractPagingItemReader impleme * {@link org.springframework.jdbc.core.simple.ParameterizedRowMapper} * implementation */ - @SuppressWarnings("rawtypes") - public void setRowMapper(RowMapper rowMapper) { + public void setRowMapper(RowMapper rowMapper) { this.rowMapper = rowMapper; } @@ -263,34 +261,25 @@ public class JdbcPagingItemReader extends AbstractPagingItemReader impleme } @Override - @SuppressWarnings({"unchecked", "rawtypes"}) protected void doJumpToPage(int itemIndex) { /* * Normally this would be false (the startAfterValue is enough * information to restart from. */ + // TODO: this is dead code, startAfterValues is never null - see #open(ExecutionContext) if (startAfterValues == null && getPage() > 0) { - String jumpToItemSql; - jumpToItemSql = queryProvider.generateJumpToItemQuery(itemIndex, getPageSize()); + String jumpToItemSql = queryProvider.generateJumpToItemQuery(itemIndex, getPageSize()); if (logger.isDebugEnabled()) { logger.debug("SQL used for jumping: [" + jumpToItemSql + "]"); } - - RowMapper startMapper = new RowMapper() { - @Override - public Object mapRow(ResultSet rs, int i) throws SQLException { - return rs.getObject(1); - } - }; + if (this.queryProvider.isUsingNamedParameters()) { - startAfterValues = (Map) namedParameterJdbcTemplate.queryForObject(jumpToItemSql, - getParameterMap(parameterValues, startAfterValues), startMapper); + startAfterValues = namedParameterJdbcTemplate.queryForMap(jumpToItemSql, getParameterMap(parameterValues, null)); } else { - startAfterValues = (Map) getJdbcTemplate().queryForObject(jumpToItemSql, - getParameterList(parameterValues, startAfterValues).toArray(), startMapper); + startAfterValues = getJdbcTemplate().queryForMap(jumpToItemSql, getParameterList(parameterValues, null).toArray()); } } } @@ -336,10 +325,9 @@ public class JdbcPagingItemReader extends AbstractPagingItemReader impleme return parameterList; } - @SuppressWarnings("rawtypes") - private class PagingRowMapper implements RowMapper { + private class PagingRowMapper implements RowMapper { @Override - public Object mapRow(ResultSet rs, int rowNum) throws SQLException { + public T mapRow(ResultSet rs, int rowNum) throws SQLException { startAfterValues = new LinkedHashMap(); for (Map.Entry sortKey : queryProvider.getSortKeys().entrySet()) { startAfterValues.put(sortKey.getKey(), rs.getObject(sortKey.getKey())); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JpaItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JpaItemWriter.java index cafe2dd7b..2f81aa482 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JpaItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JpaItemWriter.java @@ -40,7 +40,7 @@ import org.springframework.util.Assert; * {@link javax.persistence.EntityManagerFactory} that is capable of * participating in Spring managed transactions. * - * The writer is thread safe after its properties are set (normal singleton + * The writer is thread-safe after its properties are set (normal singleton * behaviour), so it can be used to write in multiple concurrent transactions. * * @author Thomas Risberg diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/StoredProcedureItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/StoredProcedureItemReader.java index e63387c64..aa8abfdb9 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/StoredProcedureItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/StoredProcedureItemReader.java @@ -55,7 +55,6 @@ import org.springframework.util.ClassUtils; * * @author Thomas Risberg */ -@SuppressWarnings("rawtypes") public class StoredProcedureItemReader extends AbstractCursorItemReader { private CallableStatement callableStatement; @@ -66,7 +65,7 @@ public class StoredProcedureItemReader extends AbstractCursorItemReader { private String callString; - private RowMapper rowMapper; + private RowMapper rowMapper; private SqlParameter[] parameters = new SqlParameter[0]; @@ -84,7 +83,7 @@ public class StoredProcedureItemReader extends AbstractCursorItemReader { * * @param rowMapper */ - public void setRowMapper(RowMapper rowMapper) { + public void setRowMapper(RowMapper rowMapper) { this.rowMapper = rowMapper; } @@ -140,7 +139,7 @@ public class StoredProcedureItemReader extends AbstractCursorItemReader { /** * Assert that mandatory properties are set. * - * @throws IllegalArgumentException if either data source or sql properties + * @throws IllegalArgumentException if either data source or SQL properties * not set. */ @Override @@ -227,9 +226,8 @@ public class StoredProcedureItemReader extends AbstractCursorItemReader { } @Override - @SuppressWarnings("unchecked") protected T readCursor(ResultSet rs, int currentRow) throws SQLException { - return (T) rowMapper.mapRow(rs, currentRow); + return rowMapper.mapRow(rs, currentRow); } /** diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/AbstractSqlPagingQueryProvider.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/AbstractSqlPagingQueryProvider.java index c1b89b1d2..eb090fd5a 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/AbstractSqlPagingQueryProvider.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/AbstractSqlPagingQueryProvider.java @@ -147,7 +147,7 @@ public abstract class AbstractSqlPagingQueryProvider implements PagingQueryProvi } /** - * A Map of sort columns as the key and boolean for ascending/descending (assending = true). + * A Map of sort columns as the key and boolean for ascending/descending (ascending = true). * * @return sortKey key to use to sort and limit page content */ diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/SqlPagingQueryProviderFactoryBean.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/SqlPagingQueryProviderFactoryBean.java index 4a1b06668..32c66a656 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/SqlPagingQueryProviderFactoryBean.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/SqlPagingQueryProviderFactoryBean.java @@ -49,8 +49,7 @@ import org.springframework.util.StringUtils; * @author Dave Syer * @author Michael Minella */ -@SuppressWarnings("rawtypes") -public class SqlPagingQueryProviderFactoryBean implements FactoryBean { +public class SqlPagingQueryProviderFactoryBean implements FactoryBean { private DataSource dataSource; @@ -148,7 +147,7 @@ public class SqlPagingQueryProviderFactoryBean implements FactoryBean { * @see FactoryBean#getObject() */ @Override - public Object getObject() throws Exception { + public PagingQueryProvider getObject() throws Exception { DatabaseType type; try { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/SqlPagingQueryUtils.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/SqlPagingQueryUtils.java index 6803e98cd..761a01f29 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/SqlPagingQueryUtils.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/SqlPagingQueryUtils.java @@ -40,7 +40,7 @@ public class SqlPagingQueryUtils { * * @param provider {@link AbstractSqlPagingQueryProvider} providing the * implementation specifics - * @param remainingPageQuery is this query for the ramining pages (true) as + * @param remainingPageQuery is this query for the remaining pages (true) as * opposed to the first page (false) * @param limitClause the implementation specific limit clause to be used * @return the generated query @@ -63,7 +63,7 @@ public class SqlPagingQueryUtils { * * @param provider {@link AbstractSqlPagingQueryProvider} providing the * implementation specifics - * @param remainingPageQuery is this query for the ramining pages (true) as + * @param remainingPageQuery is this query for the remaining pages (true) as * opposed to the first page (false) * @param limitClause the implementation specific limit clause to be used * @return the generated query @@ -91,7 +91,7 @@ public class SqlPagingQueryUtils { * * @param provider {@link AbstractSqlPagingQueryProvider} providing the * implementation specifics - * @param remainingPageQuery is this query for the ramining pages (true) as + * @param remainingPageQuery is this query for the remaining pages (true) as * opposed to the first page (false) * @param topClause the implementation specific top clause to be used * @return the generated query @@ -113,7 +113,7 @@ public class SqlPagingQueryUtils { * * @param provider {@link AbstractSqlPagingQueryProvider} providing the * implementation specifics - * @param remainingPageQuery is this query for the ramining pages (true) as + * @param remainingPageQuery is this query for the remaining pages (true) as * opposed to the first page (false) * @param topClause the implementation specific top clause to be used * @return the generated query diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/SqlServerPagingQueryProvider.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/SqlServerPagingQueryProvider.java index f3cbec586..ec1090c46 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/SqlServerPagingQueryProvider.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/SqlServerPagingQueryProvider.java @@ -19,7 +19,7 @@ package org.springframework.batch.item.database.support; import org.springframework.util.StringUtils; /** - * Sql Server implementation of a + * SQL Server implementation of a * {@link org.springframework.batch.item.database.PagingQueryProvider} using * database specific features. * diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileItemWriter.java index 1546fabbd..a0eca4936 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileItemWriter.java @@ -49,7 +49,7 @@ import org.springframework.util.ClassUtils; * * Uses buffered writer to improve performance.
    * - * The implementation is *not* thread-safe. + * The implementation is not thread-safe. * * @author Waseem Malik * @author Tomas Slanina diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileParseException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileParseException.java index 1533e9515..1b0e7af50 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileParseException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileParseException.java @@ -27,6 +27,7 @@ import org.springframework.batch.item.ParseException; * @author Lucas Ward * @author Ben Hale */ +@SuppressWarnings("serial") public class FlatFileParseException extends ParseException { private String input; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/LineMapper.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/LineMapper.java index 3c7a39d1e..a69521846 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/LineMapper.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/LineMapper.java @@ -42,7 +42,7 @@ public interface LineMapper { * @param line to be mapped * @param lineNumber of the current line * @return mapped object of type T - * @throws Exception if error occured while parsing. + * @throws Exception if error occurred while parsing. */ T mapLine(String line, int lineNumber) throws Exception; } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/NonTransientFlatFileException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/NonTransientFlatFileException.java index 7175f43d8..f15431a9b 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/NonTransientFlatFileException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/NonTransientFlatFileException.java @@ -22,6 +22,7 @@ import org.springframework.batch.item.NonTransientResourceException; * * @author Dave Syer */ +@SuppressWarnings("serial") public class NonTransientFlatFileException extends NonTransientResourceException { private String input; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/ResourcesItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/ResourcesItemReader.java index f8dcbd7e9..31902124e 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/ResourcesItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/ResourcesItemReader.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file; import java.util.Arrays; @@ -19,7 +34,7 @@ import org.springframework.core.io.support.ResourceArrayPropertyEditor; *
    *
    * - * Thread safe between calls to {@link #open(ExecutionContext)}. The + * Thread-safe between calls to {@link #open(ExecutionContext)}. The * {@link ExecutionContext} is not accurate in a multi-threaded environment, so * do not rely on that data for restart (i.e. always open with a fresh context). * diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapper.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapper.java index 0525cd392..ad0474b24 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapper.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapper.java @@ -247,7 +247,6 @@ public class BeanWrapperFieldSetMapper extends DefaultPropertyEditorRegistrar * @param properties * @return */ - @SuppressWarnings({ "unchecked", "rawtypes" }) private Properties getBeanProperties(Object bean, Properties properties) { Class cls = bean.getClass(); @@ -259,6 +258,7 @@ public class BeanWrapperFieldSetMapper extends DefaultPropertyEditorRegistrar } Map matches = new HashMap(propertiesMatched.get(distanceKey)); + @SuppressWarnings({ "unchecked", "rawtypes" }) Set keys = new HashSet(properties.keySet()); for (String key : keys) { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/JsonLineMapper.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/JsonLineMapper.java index 05d427a01..4273adc4f 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/JsonLineMapper.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/JsonLineMapper.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file.mapping; import java.util.Map; @@ -7,7 +22,7 @@ import org.codehaus.jackson.map.MappingJsonFactory; import org.springframework.batch.item.file.LineMapper; /** - * Interpret a line as a Json object and parse it up to a Map. The line should be a standard Json object, starting with + * Interpret a line as a JSON object and parse it up to a Map. The line should be a standard JSON object, starting with * "{" and ending with "}" and composed of name:value pairs separated by commas. Whitespace is ignored, * e.g. * @@ -15,7 +30,7 @@ import org.springframework.batch.item.file.LineMapper; * { "foo" : "bar", "value" : 123 } * * - * The values can also be Json objects (which are converted to maps): + * The values can also be JSON objects (which are converted to maps): * *
      * { "foo": "bar", "map": { "one": 1, "two": 2}}
    diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/separator/DefaultRecordSeparatorPolicy.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/separator/DefaultRecordSeparatorPolicy.java
    index 92d6b0745..e8315813b 100644
    --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/separator/DefaultRecordSeparatorPolicy.java
    +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/separator/DefaultRecordSeparatorPolicy.java
    @@ -113,7 +113,7 @@ public class DefaultRecordSeparatorPolicy extends SimpleRecordSeparatorPolicy {
     	 * contains an unterminated quote, indicating that the record is continuing
     	 * onto the next line.
     	 * 
    -	 * @param result
    +	 * @param line
     	 * @return
     	 */
     	private boolean isQuoteUnterminated(String line) {
    @@ -125,7 +125,7 @@ public class DefaultRecordSeparatorPolicy extends SimpleRecordSeparatorPolicy {
     	 * with the continuation marker, indicating that the record is continuing
     	 * onto the next line.
     	 * 
    -	 * @param result
    +	 * @param line
     	 * @return
     	 */
     	private boolean isContinued(String line) {
    diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/AbstractLineTokenizer.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/AbstractLineTokenizer.java
    index 5f58642c7..35bcee76d 100644
    --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/AbstractLineTokenizer.java
    +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/AbstractLineTokenizer.java
    @@ -97,7 +97,7 @@ public abstract class AbstractLineTokenizer implements LineTokenizer {
     	 * Yields the tokens resulting from the splitting of the supplied
     	 * line.
     	 * 
    -	 * @param line the line to be tokenised (can be null)
    +	 * @param line the line to be tokenized (can be null)
     	 * 
     	 * @return the resulting tokens
     	 */
    @@ -115,7 +115,7 @@ public abstract class AbstractLineTokenizer implements LineTokenizer {
     			adjustTokenCountIfNecessary( tokens );
     		}
     		
    -		String[] values = (String[]) tokens.toArray(new String[tokens.size()]);
    +		String[] values = tokens.toArray(new String[tokens.size()]);
     
     		if (names.length == 0) {
     			return fieldSetFactory.create(values);
    diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/Alignment.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/Alignment.java
    index 2230b7bf8..a55e292e0 100644
    --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/Alignment.java
    +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/Alignment.java
    @@ -40,7 +40,7 @@ public enum Alignment {
     		this.label = label;
     	}
     
    -    public Comparable getCode() {
    +    public Comparable getCode() {
             return code;
         }
     
    diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/ConversionException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/ConversionException.java
    index 904d48bb1..0951af744 100644
    --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/ConversionException.java
    +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/ConversionException.java
    @@ -19,6 +19,7 @@ package org.springframework.batch.item.file.transform;
      * @author Dave Syer
      *
      */
    +@SuppressWarnings("serial")
     public class ConversionException extends RuntimeException {
     
     	/**
    diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/DefaultFieldSet.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/DefaultFieldSet.java
    index be753f181..abd10785a 100644
    --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/DefaultFieldSet.java
    +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/DefaultFieldSet.java
    @@ -108,7 +108,7 @@ public class DefaultFieldSet implements FieldSet {
     			throw new IllegalArgumentException("Field names must be same length as values: names="
     					+ Arrays.asList(names) + ", values=" + Arrays.asList(tokens));
     		}
    -		this.tokens = (String[]) tokens.clone();
    +		this.tokens = tokens.clone();
     		this.names = Arrays.asList(names);
     		setNumberFormat(NumberFormat.getInstance(Locale.US));
     	}
    @@ -437,7 +437,7 @@ public class DefaultFieldSet implements FieldSet {
     	 */
         @Override
     	public double readDouble(int index) {
    -		return (Double) parseNumber(readAndTrim(index)).doubleValue();
    +		return parseNumber(readAndTrim(index)).doubleValue();
     	}
     
     	/*
    @@ -740,7 +740,7 @@ public class DefaultFieldSet implements FieldSet {
     		for (int i = 0; i < tokens.length; i++) {
     			String value = readAndTrim(i);
     			if (value != null) {
    -				props.setProperty((String) names.get(i), value);
    +				props.setProperty(names.get(i), value);
     			}
     		}
     		return props;
    diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/DefaultFieldSetFactory.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/DefaultFieldSetFactory.java
    index d1a01cea5..9419c47ae 100644
    --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/DefaultFieldSetFactory.java
    +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/DefaultFieldSetFactory.java
    @@ -1,3 +1,18 @@
    +/*
    + * Copyright 2009-2012 the original author or authors.
    + *
    + * Licensed under the Apache License, Version 2.0 (the "License");
    + * you may not use this file except in compliance with the License.
    + * You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
     package org.springframework.batch.item.file.transform;
     
     import java.text.DateFormat;
    diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/DelimitedLineTokenizer.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/DelimitedLineTokenizer.java
    index 084822f0e..622b8f847 100644
    --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/DelimitedLineTokenizer.java
    +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/DelimitedLineTokenizer.java
    @@ -226,10 +226,10 @@ public class DelimitedLineTokenizer extends AbstractLineTokenizer {
     	/**
     	 * Is the supplied character the delimiter character?
     	 *
    -	 * @param c the character to be checked
    +	 * @param chars the characters to be checked
     	 * @return true if the supplied character is the delimiter
     	 * character
    -	 * @see DelimitedLineTokenizer#DelimitedLineTokenizer(char)
    +	 * @see DelimitedLineTokenizer#DelimitedLineTokenizer(String)
     	 */
     	private boolean isDelimiter(char[] chars, int i, String token, int endIndexLastDelimiter) {
     		boolean result = false;
    diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/FieldSet.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/FieldSet.java
    index 30fa3c07b..d724e36eb 100644
    --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/FieldSet.java
    +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/FieldSet.java
    @@ -195,7 +195,7 @@ public interface FieldSet {
     	 * using the supplied defaultValue if the field value is
     	 * blank.
     	 * 
    -	 * @param index the field index..
    +	 * @param index the field index.
     	 * @throws IndexOutOfBoundsException if the index is out of bounds.
     	 */
     	int readInt(int index, int defaultValue);
    @@ -233,7 +233,7 @@ public interface FieldSet {
     	 * using the supplied defaultValue if the field value is
     	 * blank.
     	 * 
    -	 * @param index the field index..
    +	 * @param index the field index.
     	 * @throws IndexOutOfBoundsException if the index is out of bounds.
     	 */
     	long readLong(int index, long defaultValue);
    diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/FieldSetFactory.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/FieldSetFactory.java
    index 27f6c318a..4c61ca32c 100644
    --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/FieldSetFactory.java
    +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/FieldSetFactory.java
    @@ -1,5 +1,17 @@
    -/**
    - * 
    +/*
    + * Copyright 2009-2010 the original author or authors.
    + *
    + * Licensed under the Apache License, Version 2.0 (the "License");
    + * you may not use this file except in compliance with the License.
    + * You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
      */
     package org.springframework.batch.item.file.transform;
     
    diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/FixedLengthTokenizer.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/FixedLengthTokenizer.java
    index 4da782ee4..7ad7600cc 100644
    --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/FixedLengthTokenizer.java
    +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/FixedLengthTokenizer.java
    @@ -90,7 +90,7 @@ public class FixedLengthTokenizer extends AbstractLineTokenizer {
     	 * Yields the tokens resulting from the splitting of the supplied
     	 * line.
     	 * 
    -	 * @param line the line to be tokenised (can be null)
    +	 * @param line the line to be tokenized (can be null)
     	 * 
     	 * @return the resulting tokens (empty if the line is null)
     	 * @throws IncorrectLineLengthException if line length is greater than or
    diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/FlatFileFormatException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/FlatFileFormatException.java
    index a8e3e3661..c4a31c6b8 100644
    --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/FlatFileFormatException.java
    +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/FlatFileFormatException.java
    @@ -18,12 +18,13 @@ package org.springframework.batch.item.file.transform;
     
     
     /**
    - * Exception indicating that some type of error has occured while
    + * Exception indicating that some type of error has occurred while
      * attempting to parse a line of input into tokens.
      * 
      * @author Lucas Ward
      *
      */
    +@SuppressWarnings("serial")
     public class FlatFileFormatException extends RuntimeException {
     
     	/**
    diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/IncorrectLineLengthException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/IncorrectLineLengthException.java
    index baff68f3e..b7af28ecd 100644
    --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/IncorrectLineLengthException.java
    +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/IncorrectLineLengthException.java
    @@ -22,6 +22,7 @@ package org.springframework.batch.item.file.transform;
      * @author Lucas Ward
      * @since 1.1
      */
    +@SuppressWarnings("serial")
     public class IncorrectLineLengthException extends FlatFileFormatException {
     
     	private int actualLength;
    diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/IncorrectTokenCountException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/IncorrectTokenCountException.java
    index f7cf3abd6..b8e7d0f5c 100644
    --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/IncorrectTokenCountException.java
    +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/IncorrectTokenCountException.java
    @@ -22,6 +22,7 @@ package org.springframework.batch.item.file.transform;
      * @author Lucas Ward
      * @since 1.1
      */
    +@SuppressWarnings("serial")
     public class IncorrectTokenCountException extends FlatFileFormatException {
     
     	private int actualCount;
    diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/PatternMatchingCompositeLineTokenizer.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/PatternMatchingCompositeLineTokenizer.java
    index e12fac113..3c25fa575 100644
    --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/PatternMatchingCompositeLineTokenizer.java
    +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/PatternMatchingCompositeLineTokenizer.java
    @@ -24,7 +24,7 @@ import org.springframework.util.Assert;
     
     /**
      * A {@link LineTokenizer} implementation that stores a mapping of String
    - * patterns to delegate {@link LineTokenizer}s. Each line tokenizied will be
    + * patterns to delegate {@link LineTokenizer}s. Each line tokenized will be
      * checked to see if it matches a pattern. If the line matches a key in the map
      * of delegates, then the corresponding delegate {@link LineTokenizer} will be
      * used. Patterns are sorted starting with the most specific, and the first
    diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/JmsItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/JmsItemReader.java
    index 77b33c7a6..ced399ff4 100644
    --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/JmsItemReader.java
    +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/JmsItemReader.java
    @@ -32,7 +32,7 @@ import org.springframework.util.Assert;
      * {@link #read()}.
    *
    * - * The implementation is thread safe after its properties are set (normal + * The implementation is thread-safe after its properties are set (normal * singleton behavior). * * @author Dave Syer @@ -47,7 +47,7 @@ public class JmsItemReader implements ItemReader, InitializingBean { protected JmsOperations jmsTemplate; /** - * Setter for jms template. + * Setter for JMS template. * * @param jmsTemplate a {@link JmsOperations} instance */ diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/JmsItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/JmsItemWriter.java index db3308d60..1407d42c3 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/JmsItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/JmsItemWriter.java @@ -31,7 +31,7 @@ import org.springframework.util.Assert; * {@link #write(List)}.
    *
    * - * The implementation is thread safe after its properties are set (normal + * The implementation is thread-safe after its properties are set (normal * singleton behavior). * * @author Dave Syer @@ -61,7 +61,7 @@ public class JmsItemWriter implements ItemWriter { } /** - * Send the items one-by-one to the default destination of the jms template. + * Send the items one-by-one to the default destination of the JMS template. * * @see org.springframework.batch.item.ItemWriter#write(java.util.List) */ diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/SimpleMailMessageItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/SimpleMailMessageItemWriter.java index 0aa0d08a8..7acc699ed 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/SimpleMailMessageItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/SimpleMailMessageItemWriter.java @@ -101,7 +101,6 @@ public class SimpleMailMessageItemWriter implements ItemWriter failedMessages = e.getFailedMessages(); for (Entry entry : failedMessages.entrySet()) { mailErrorHandler.handle((SimpleMailMessage) entry.getKey(), entry.getValue()); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/javamail/MimeMessageItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/javamail/MimeMessageItemWriter.java index 6c8b72e72..d0ad79804 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/javamail/MimeMessageItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/javamail/MimeMessageItemWriter.java @@ -105,7 +105,6 @@ public class MimeMessageItemWriter implements ItemWriter { mailSender.send(items.toArray(new MimeMessage[items.size()])); } catch (MailSendException e) { - @SuppressWarnings("unchecked") Map failedMessages = e.getFailedMessages(); for (Entry entry : failedMessages.entrySet()) { mailErrorHandler.handle(new MimeMailMessage((MimeMessage)entry.getKey()), entry.getValue()); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AbstractItemCountingItemStreamItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AbstractItemCountingItemStreamItemReader.java index 95233fedb..8274779fd 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AbstractItemCountingItemStreamItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AbstractItemCountingItemStreamItemReader.java @@ -29,7 +29,7 @@ import org.springframework.util.Assert; * item count in the {@link ExecutionContext} (therefore requires item ordering * to be preserved between runs). * - * Subclasses are inherently *not* thread-safe. + * Subclasses are inherently not thread-safe. * * @author Robert Kasanicky */ diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/SingleItemPeekableItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/SingleItemPeekableItemReader.java index c01e1933b..f83e09399 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/SingleItemPeekableItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/SingleItemPeekableItemReader.java @@ -34,7 +34,7 @@ import org.springframework.batch.item.UnexpectedInputException; *

    * *

    - * Intentionally not thread safe: it wouldn't be possible to honour the peek in + * Intentionally not thread-safe: it wouldn't be possible to honour the peek in * multiple threads because only one of the threads that peeked would get that * item in the next call to read. *

    diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/util/FileUtils.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/util/FileUtils.java index 77679f88c..abd244b38 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/util/FileUtils.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/util/FileUtils.java @@ -116,7 +116,7 @@ public final class FileUtils { return file.createNewFile() && file.exists(); } catch (IOException e) { - // On some filesystems you can get an exception here even though the + // On some file systems you can get an exception here even though the // files was successfully created if (file.exists()) { return true; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/validator/ValidationException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/validator/ValidationException.java index d58fe913b..8d2b7c680 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/validator/ValidationException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/validator/ValidationException.java @@ -23,6 +23,7 @@ import org.springframework.batch.item.ItemReaderException; * * @author Ben Hale */ +@SuppressWarnings("serial") public class ValidationException extends ItemReaderException { /** diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemReader.java index 964ea286b..dd8ea8170 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemReader.java @@ -50,7 +50,7 @@ import org.springframework.util.StringUtils; * wrapped with StartDocument and EndDocument events so that the fragments can be further processed like standalone XML * documents. * - * The implementation is *not* thread-safe. + * The implementation is not thread-safe. * * @author Robert Kasanicky */ diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemWriter.java index da23b65f3..adeba52fe 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemWriter.java @@ -66,7 +66,7 @@ import org.springframework.util.StringUtils; * This item writer also provides restart, statistics and transaction features * by implementing corresponding interfaces. * - * The implementation is *not* thread-safe. + * The implementation is not thread-safe. * * @author Peter Zozom * @author Robert Kasanicky @@ -154,7 +154,7 @@ ResourceAwareItemWriterItemStream, InitializingBean { private boolean restarted = false; // List holding the QName of elements that were opened in the header callback, but not closed - private List unclosedHeaderCallbackElements = Collections.EMPTY_LIST; + private List unclosedHeaderCallbackElements = Collections.emptyList(); public StaxEventItemWriter() { setExecutionContextName(ClassUtils.getShortName(StaxEventItemWriter.class)); @@ -417,7 +417,6 @@ ResourceAwareItemWriterItemStream, InitializingBean { /** * Helper method for opening output source at given file position */ - @SuppressWarnings("resource") private void open(long position) { File file; @@ -525,7 +524,7 @@ ResourceAwareItemWriterItemStream, InitializingBean { } /** - * Subclasses can override to customize the stax result. + * Subclasses can override to customize the STAX result. * @return a result for writing to * @throws Exception */ diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxUtils.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxUtils.java index 2d039f9b5..5813d0604 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxUtils.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxUtils.java @@ -36,12 +36,11 @@ import org.springframework.util.ClassUtils; * The returned object determines whether the environment has Spring OXM as included in the Spring 3.x series of relies * or whether it has Spring OXM from Spring WS 1.5x and factories a StaxSource instance appropriately. *

    - * As the only class state maintained is to cache java reflection metadata, which is thread safe, this class is thread-safe. + * As the only class state maintained is to cache java reflection metadata, which is thread-safe, this class is thread-safe. * * @author Josh Long * */ -@SuppressWarnings("restriction") public abstract class StaxUtils { private static final Log logger = LogFactory.getLog(StaxUtils.class); @@ -61,8 +60,7 @@ public abstract class StaxUtils { private static Method staxUtilsSourceMethodOnSpring30, staxUtilsResultMethodOnSpring30; - @SuppressWarnings("rawtypes") - private static Constructor staxSourceClassCtorOnSpringWs15, staxResultClassCtorOnSpringWs15; + private static Constructor staxSourceClassCtorOnSpringWs15, staxResultClassCtorOnSpringWs15; static { try { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/item/ItemProcessorAdapter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/item/ItemProcessorAdapter.java index 873b29ede..83111155e 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/item/ItemProcessorAdapter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/item/ItemProcessorAdapter.java @@ -1,11 +1,25 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.jsr.item; import javax.batch.api.chunk.ItemProcessor; import org.springframework.util.Assert; -@SuppressWarnings("rawtypes") -public class ItemProcessorAdapter implements org.springframework.batch.item.ItemProcessor { +public class ItemProcessorAdapter implements org.springframework.batch.item.ItemProcessor { private ItemProcessor delegate; @@ -14,8 +28,9 @@ public class ItemProcessorAdapter implements org.springframework.batch.item.Item this.delegate = processor; } + @SuppressWarnings("unchecked") @Override - public Object process(Object item) throws Exception { - return delegate.processItem(item); + public O process(I item) throws Exception { + return (O) delegate.processItem(item); } } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/item/ItemReaderAdapter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/item/ItemReaderAdapter.java index 27c407333..f59ea2fd5 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/item/ItemReaderAdapter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/item/ItemReaderAdapter.java @@ -29,8 +29,7 @@ import org.springframework.util.ClassUtils; * @author Michael Minella * @since 3.0 */ -@SuppressWarnings("rawtypes") -public class ItemReaderAdapter extends CheckpointSupport implements org.springframework.batch.item.ItemReader { +public class ItemReaderAdapter extends CheckpointSupport implements org.springframework.batch.item.ItemReader { private static final String CHECKPOINT_KEY = "reader.checkpoint"; @@ -49,9 +48,10 @@ public class ItemReaderAdapter extends CheckpointSupport implements org.springfr /* (non-Javadoc) * @see org.springframework.batch.item.ItemReader#read() */ + @SuppressWarnings("unchecked") @Override - public Object read() throws Exception { - return delegate.readItem(); + public T read() throws Exception { + return (T) delegate.readItem(); } /* (non-Javadoc) diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/item/ItemWriterAdapter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/item/ItemWriterAdapter.java index 1e976e8d6..696a01306 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/item/ItemWriterAdapter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/item/ItemWriterAdapter.java @@ -30,8 +30,7 @@ import org.springframework.util.ClassUtils; * @author Michael Minella * @since 3.0 */ -@SuppressWarnings("rawtypes") -public class ItemWriterAdapter extends CheckpointSupport implements org.springframework.batch.item.ItemWriter { +public class ItemWriterAdapter extends CheckpointSupport implements org.springframework.batch.item.ItemWriter { private static final String CHECKPOINT_KEY = "writer.checkpoint"; @@ -50,10 +49,10 @@ public class ItemWriterAdapter extends CheckpointSupport implements org.springfr /* (non-Javadoc) * @see org.springframework.batch.item.ItemWriter#write(java.util.List) */ - @Override @SuppressWarnings("unchecked") - public void write(List items) throws Exception { - delegate.writeItems(items); + @Override + public void write(List items) throws Exception { + delegate.writeItems((List) items); } /* (non-Javadoc) diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/RepeatException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/RepeatException.java index ff148168b..0e6e9a5aa 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/RepeatException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/RepeatException.java @@ -18,6 +18,7 @@ package org.springframework.batch.repeat; import org.springframework.core.NestedRuntimeException; +@SuppressWarnings("serial") public class RepeatException extends NestedRuntimeException { public RepeatException(String msg) { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/context/RepeatContextSupport.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/context/RepeatContextSupport.java index 5125a8c10..0ed3d563d 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/context/RepeatContextSupport.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/context/RepeatContextSupport.java @@ -180,7 +180,7 @@ public class RepeatContextSupport extends SynchronizedAttributeAccessor implemen return; } - throw (RuntimeException) errors.get(0); + throw errors.get(0); } } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/interceptor/RepeatOperationsInterceptor.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/interceptor/RepeatOperationsInterceptor.java index c6de1aead..50b099195 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/interceptor/RepeatOperationsInterceptor.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/interceptor/RepeatOperationsInterceptor.java @@ -144,6 +144,7 @@ public class RepeatOperationsInterceptor implements MethodInterceptor { * @author Dave Syer * */ + @SuppressWarnings("serial") private static class RepeatOperationsInterceptorException extends RepeatException { /** * @param message diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/CompositeCompletionPolicy.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/CompositeCompletionPolicy.java index 4ce9b680d..a14e85cff 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/CompositeCompletionPolicy.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/CompositeCompletionPolicy.java @@ -27,7 +27,7 @@ import org.springframework.batch.repeat.context.RepeatContextSupport; /** * Composite policy that loops through a list of delegate policies and answers - * calls by a concensus. + * calls by a consensus. * * @author Dave Syer * diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/TimeoutTerminationPolicy.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/TimeoutTerminationPolicy.java index 830c8a973..f6e2ce72c 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/TimeoutTerminationPolicy.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/TimeoutTerminationPolicy.java @@ -35,7 +35,7 @@ import org.springframework.batch.repeat.context.RepeatContextSupport; public class TimeoutTerminationPolicy extends CompletionPolicySupport { /** - * Default timeout value in millisecs (the value equivalent to 30 seconds). + * Default timeout value in milliseconds (the value equivalent to 30 seconds). */ public static final long DEFAULT_TIMEOUT = 30000L; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/RepeatTemplate.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/RepeatTemplate.java index 5412304a9..cd330e821 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/RepeatTemplate.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/RepeatTemplate.java @@ -90,7 +90,7 @@ public class RepeatTemplate implements RepeatOperations { public void registerListener(RepeatListener listener) { List list = new ArrayList(Arrays.asList(listeners)); list.add(listener); - listeners = (RepeatListener[]) list.toArray(new RepeatListener[list.size()]); + listeners = list.toArray(new RepeatListener[list.size()]); } /** @@ -159,7 +159,7 @@ public class RepeatTemplate implements RepeatOperations { * * @param callback the callback to process each element of the loop. * - * @return the aggregate of {@link ContinuationPolicy#canContinue(Object)} + * @return the aggregate of {@link RepeatTemplate#canContinue(RepeatStatus)} * for all the results from the callback. * */ @@ -248,7 +248,7 @@ public class RepeatTemplate implements RepeatOperations { try { if (!deferred.isEmpty()) { - Throwable throwable = (Throwable) deferred.iterator().next(); + Throwable throwable = deferred.iterator().next(); logger.debug("Handling fatal exception explicitly (rethrowing first of " + deferred.size() + "): " + throwable.getClass().getName() + ": " + throwable.getMessage()); rethrow(throwable); @@ -389,7 +389,7 @@ public class RepeatTemplate implements RepeatOperations { * @return true if the value is {@link RepeatStatus#CONTINUABLE}. */ protected final boolean canContinue(RepeatStatus value) { - return ((RepeatStatus) value).isContinuable(); + return value.isContinuable(); } private boolean isMarkedComplete(RepeatContext context) { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java index 927eceb61..7e44514cd 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java @@ -34,12 +34,12 @@ import org.springframework.util.Assert; * or for the whole batch by making the execute method transactional (but only * then if the task executor is synchronous).
    * - * This class is thread safe if its collaborators are thread safe (interceptors, + * This class is thread-safe if its collaborators are thread-safe (interceptors, * terminationPolicy, callback). Normally this will be the case, but clients * need to be aware that if the task executor is asynchronous, then the other * collaborators should be also. In particular the {@link RepeatCallback} that - * is wrapped in the execute method must be thread safe - often it is based on - * some form of data source, which itself should be both thread safe and + * is wrapped in the execute method must be thread-safe - often it is based on + * some form of data source, which itself should be both thread-safe and * transactional (multiple threads could be accessing it at any given time, and * each thread would have its own transaction).
    * diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/DefaultPropertyEditorRegistrar.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/DefaultPropertyEditorRegistrar.java index 8ec345cf4..6af96a98b 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/DefaultPropertyEditorRegistrar.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/DefaultPropertyEditorRegistrar.java @@ -29,7 +29,7 @@ import org.springframework.util.ClassUtils; * A re-usable {@link PropertyEditorRegistrar} that can be used wherever one * needs to register custom {@link PropertyEditor} instances with a * {@link PropertyEditorRegistry} (like a bean wrapper, or a type converter). It - * is not thread safe, but useful where one is confident that binding or + * is not thread safe, but useful where one is confident that binding or * initialisation can only be single threaded (e.g in a standalone application * with no threads). * diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/MethodInvokerUtils.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/MethodInvokerUtils.java index fac868f40..55811f802 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/MethodInvokerUtils.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/MethodInvokerUtils.java @@ -52,7 +52,7 @@ public class MethodInvokerUtils { Method method = ClassUtils.getMethodIfAvailable(object.getClass(), methodName, paramTypes); if (method == null) { String errorMsg = "no method found with name [" + methodName + "] on class [" - + object.getClass().getSimpleName() + "] compatable with the signature [" + + object.getClass().getSimpleName() + "] compatible with the signature [" + getParamTypesString(paramTypes) + "]."; Assert.isTrue(!paramsRequired, errorMsg); // if no method was found for the given parameters, and the @@ -124,7 +124,7 @@ public class MethodInvokerUtils { Class[] paramTypes = method.getParameterTypes(); if (paramTypes.length > 0) { String errorMsg = "The method [" + method.getName() + "] on target class [" - + targetClass.getSimpleName() + "] is incompatable with the signature [" + + targetClass.getSimpleName() + "] is incompatible with the signature [" + getParamTypesString(expectedParamTypes) + "] expected for the annotation [" + annotationType.getSimpleName() + "]."; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/PropertiesConverter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/PropertiesConverter.java index d2b7b13f3..d3843e946 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/PropertiesConverter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/PropertiesConverter.java @@ -49,7 +49,7 @@ public final class PropertiesConverter { // prevents the class from being instantiated private PropertiesConverter() { - }; + } /** * Parse a String to a Properties object. If string is null, an empty diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/FlushFailedException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/FlushFailedException.java index 5d2c93099..e57635828 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/FlushFailedException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/FlushFailedException.java @@ -22,6 +22,7 @@ package org.springframework.batch.support.transaction; * @author Lucas Ward * @author Ben Hale */ +@SuppressWarnings("serial") public class FlushFailedException extends RuntimeException { /** diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/ResourcelessTransactionManager.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/ResourcelessTransactionManager.java index 9c7278442..edd005244 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/ResourcelessTransactionManager.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/ResourcelessTransactionManager.java @@ -24,6 +24,7 @@ import org.springframework.transaction.support.AbstractPlatformTransactionManage import org.springframework.transaction.support.DefaultTransactionStatus; import org.springframework.transaction.support.TransactionSynchronizationManager; +@SuppressWarnings("serial") public class ResourcelessTransactionManager extends AbstractPlatformTransactionManager { @Override diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/TransactionAwareProxyFactory.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/TransactionAwareProxyFactory.java index 7b18d6ad5..f4d1f8b56 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/TransactionAwareProxyFactory.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/TransactionAwareProxyFactory.java @@ -159,11 +159,11 @@ public class TransactionAwareProxyFactory { } public static Map createTransactionalMap() { - return (Map) new TransactionAwareProxyFactory>(new ConcurrentHashMap()).createInstance(); + return new TransactionAwareProxyFactory>(new ConcurrentHashMap()).createInstance(); } public static Map createTransactionalMap(Map map) { - return (Map) new TransactionAwareProxyFactory>(new ConcurrentHashMap(map)).createInstance(); + return new TransactionAwareProxyFactory>(new ConcurrentHashMap(map)).createInstance(); } public static ConcurrentMap createAppendOnlyTransactionalMap() { @@ -171,27 +171,27 @@ public class TransactionAwareProxyFactory { } public static Set createAppendOnlyTransactionalSet() { - return (Set) new TransactionAwareProxyFactory>(new CopyOnWriteArraySet(), true).createInstance(); + return new TransactionAwareProxyFactory>(new CopyOnWriteArraySet(), true).createInstance(); } public static Set createTransactionalSet() { - return (Set) new TransactionAwareProxyFactory>(new CopyOnWriteArraySet()).createInstance(); + return new TransactionAwareProxyFactory>(new CopyOnWriteArraySet()).createInstance(); } public static Set createTransactionalSet(Set set) { - return (Set) new TransactionAwareProxyFactory>(new CopyOnWriteArraySet(set)).createInstance(); + return new TransactionAwareProxyFactory>(new CopyOnWriteArraySet(set)).createInstance(); } public static List createAppendOnlyTransactionalList() { - return (List) new TransactionAwareProxyFactory>(new CopyOnWriteArrayList(), true).createInstance(); + return new TransactionAwareProxyFactory>(new CopyOnWriteArrayList(), true).createInstance(); } public static List createTransactionalList() { - return (List) new TransactionAwareProxyFactory>(new CopyOnWriteArrayList()).createInstance(); + return new TransactionAwareProxyFactory>(new CopyOnWriteArrayList()).createInstance(); } public static List createTransactionalList(List list) { - return (List) new TransactionAwareProxyFactory>(new CopyOnWriteArrayList(list)).createInstance(); + return new TransactionAwareProxyFactory>(new CopyOnWriteArrayList(list)).createInstance(); } private class TargetSynchronization extends TransactionSynchronizationAdapter { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/AbstractItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/AbstractItemReaderTests.java index e53a5cc36..d7058ec04 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/AbstractItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/AbstractItemReaderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/AbstractItemStreamItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/AbstractItemStreamItemReaderTests.java index dac63a0da..bcf1cdf62 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/AbstractItemStreamItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/AbstractItemStreamItemReaderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item; import static org.junit.Assert.*; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/ExecutionContextTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/ExecutionContextTests.java index f6a9f0a33..735c2e69b 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/ExecutionContextTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/ExecutionContextTests.java @@ -189,6 +189,7 @@ public class ExecutionContextTests { /** * Value object for testing serialization */ + @SuppressWarnings("serial") private static class TestSerializable implements Serializable { int value; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/AbstractDelegatorTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/AbstractDelegatorTests.java index 3951989cf..ad448123f 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/AbstractDelegatorTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/AbstractDelegatorTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.adapter; import static org.junit.Assert.assertEquals; @@ -94,7 +109,7 @@ public class AbstractDelegatorTests { final int FOO_VALUE = 12345; delegator.invokeDelegateMethodWithArguments(new Object[] { FOO_NAME, FOO_VALUE }); - Foo foo = (Foo) fooService.getProcessedFooNameValuePairs().get(0); + Foo foo = fooService.getProcessedFooNameValuePairs().get(0); assertEquals(FOO_NAME, foo.getName()); assertEquals(FOO_VALUE, foo.getValue()); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/HippyMethodInvokerTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/HippyMethodInvokerTests.java index ccdadd2f6..84ecd612f 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/HippyMethodInvokerTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/HippyMethodInvokerTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.adapter; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/ItemProcessorAdapterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/ItemProcessorAdapterTests.java index be3379c22..750aeb6e6 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/ItemProcessorAdapterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/ItemProcessorAdapterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.adapter; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/ItemReaderAdapterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/ItemReaderAdapterTests.java index b512d6e5a..189c95645 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/ItemReaderAdapterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/ItemReaderAdapterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.adapter; import static org.junit.Assert.*; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/ItemWriterAdapterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/ItemWriterAdapterTests.java index ccc68398e..7a8df4c94 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/ItemWriterAdapterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/ItemWriterAdapterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.adapter; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/PropertyExtractingDelegatingItemProccessorIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/PropertyExtractingDelegatingItemProccessorIntegrationTests.java index 8551ef018..83e8696a7 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/PropertyExtractingDelegatingItemProccessorIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/PropertyExtractingDelegatingItemProccessorIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.adapter; import static org.junit.Assert.*; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/GemfireItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/GemfireItemWriterTests.java index 657b64833..dfc1999ec 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/GemfireItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/GemfireItemWriterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.data; import static org.junit.Assert.fail; @@ -15,10 +30,10 @@ import org.springframework.batch.item.SpELItemKeyMapper; import org.springframework.data.gemfire.GemfireTemplate; import org.springframework.core.convert.converter.Converter; -@SuppressWarnings({ "rawtypes", "serial", "unchecked" }) +@SuppressWarnings("serial") public class GemfireItemWriterTests { - private GemfireItemWriter writer; + private GemfireItemWriter writer; @Mock private GemfireTemplate template; @@ -27,7 +42,7 @@ public class GemfireItemWriterTests { @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); - writer = new GemfireItemWriter(); + writer = new GemfireItemWriter(); writer.setTemplate(template); writer.setItemKeyMapper(new SpELItemKeyMapper("bar.val")); writer.afterPropertiesSet(); @@ -35,7 +50,7 @@ public class GemfireItemWriterTests { @Test public void testAfterPropertiesSet() throws Exception { - writer = new GemfireItemWriter(); + writer = new GemfireItemWriter(); try { writer.afterPropertiesSet(); @@ -50,7 +65,7 @@ public class GemfireItemWriterTests { } catch (IllegalArgumentException iae) { } - writer.setItemKeyMapper(new SpELItemKeyMapper("foo")); + writer.setItemKeyMapper(new SpELItemKeyMapper("foo")); writer.afterPropertiesSet(); } @@ -92,7 +107,7 @@ public class GemfireItemWriterTests { add(new Foo(new Bar("val2"))); } }; - writer = new GemfireItemWriter(); + writer = new GemfireItemWriter(); writer.setTemplate(template); writer.setItemKeyMapper(new Converter() { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/MongoItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/MongoItemReaderTests.java index 9552d44bf..7373b538b 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/MongoItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/MongoItemReaderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.data; import static org.junit.Assert.assertEquals; @@ -22,7 +37,7 @@ import org.springframework.data.mongodb.core.query.Query; public class MongoItemReaderTests { - private MongoItemReader reader; + private MongoItemReader reader; @Mock private MongoOperations template; private Map sortOptions; @@ -30,7 +45,7 @@ public class MongoItemReaderTests { @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); - reader = new MongoItemReader(); + reader = new MongoItemReader(); sortOptions = new HashMap(); sortOptions.put("name", Sort.Direction.DESC); @@ -45,7 +60,7 @@ public class MongoItemReaderTests { @Test public void testAfterPropertiesSet() throws Exception{ - reader = new MongoItemReader(); + reader = new MongoItemReader(); try { reader.afterPropertiesSet(); @@ -161,9 +176,10 @@ public class MongoItemReaderTests { assertEquals("{ $natural : 1}", query.getHint()); } + @SuppressWarnings("serial") @Test public void testQueryWithParameters() { - reader.setParameterValues(new ArrayList(){{ + reader.setParameterValues(new ArrayList(){{ add("foo"); }}); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/MongoItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/MongoItemWriterTests.java index 8267547d8..3a0032c71 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/MongoItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/MongoItemWriterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.data; import static org.junit.Assert.assertEquals; @@ -6,12 +21,8 @@ import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; import static org.mockito.Mockito.doAnswer; -import java.io.IOException; -import java.nio.ByteBuffer; -import java.nio.channels.FileChannel; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -23,17 +34,16 @@ import org.mockito.MockitoAnnotations; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.springframework.batch.support.transaction.ResourcelessTransactionManager; -import org.springframework.batch.support.transaction.TransactionAwareBufferedWriter; import org.springframework.data.mongodb.core.MongoOperations; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.support.TransactionCallback; import org.springframework.transaction.support.TransactionTemplate; -@SuppressWarnings({"rawtypes", "serial", "unchecked"}) +@SuppressWarnings("serial") public class MongoItemWriterTests { - private MongoItemWriter writer; + private MongoItemWriter writer; @Mock private MongoOperations template; private PlatformTransactionManager transactionManager = new ResourcelessTransactionManager(); @@ -41,14 +51,14 @@ public class MongoItemWriterTests { @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); - writer = new MongoItemWriter(); + writer = new MongoItemWriter(); writer.setTemplate(template); writer.afterPropertiesSet(); } @Test public void testAfterPropertiesSet() throws Exception { - writer = new MongoItemWriter(); + writer = new MongoItemWriter(); try { writer.afterPropertiesSet(); @@ -102,10 +112,10 @@ public class MongoItemWriterTests { add(new Object()); }}; - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write(items); } catch (Exception e) { @@ -129,10 +139,10 @@ public class MongoItemWriterTests { writer.setCollection("collection"); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write(items); } catch (Exception e) { @@ -157,10 +167,10 @@ public class MongoItemWriterTests { writer.setCollection("collection"); try { - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write(items); } catch (Exception ignore) { @@ -195,10 +205,10 @@ public class MongoItemWriterTests { try { TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager); transactionTemplate.setReadOnly(true); - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write(items); } catch (Exception ignore) { @@ -248,6 +258,7 @@ public class MongoItemWriterTests { @Test public void testResourceKeyCollision() throws Exception { final int limit = 5000; + @SuppressWarnings("unchecked") final MongoItemWriter[] writers = new MongoItemWriter[limit]; final String[] results = new String[limit]; for(int i = 0; i< limit; i++) { @@ -271,9 +282,9 @@ public class MongoItemWriterTests { writers[i].setTemplate(mongoOperations); } - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { for(int i=0; i< limit; i++) { writers[i].write(Collections.singletonList(String.valueOf(i))); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/Neo4jItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/Neo4jItemReaderTests.java index 17eb52d9b..74eda24e0 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/Neo4jItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/Neo4jItemReaderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.data; import static org.junit.Assert.assertEquals; @@ -23,17 +38,17 @@ import org.springframework.data.neo4j.template.Neo4jOperations; public class Neo4jItemReaderTests { - private Neo4jItemReader reader; + private Neo4jItemReader reader; @Mock private Neo4jOperations template; @Mock - private Result result; + private Result> result; @Mock - private EndResult endResult; + private EndResult endResult; @Before public void setUp() throws Exception { - reader = new Neo4jItemReader(); + reader = new Neo4jItemReader(); MockitoAnnotations.initMocks(this); @@ -48,7 +63,7 @@ public class Neo4jItemReaderTests { @Test public void testAfterPropertiesSet() throws Exception { - reader = new Neo4jItemReader(); + reader = new Neo4jItemReader(); try { reader.afterPropertiesSet(); @@ -108,6 +123,7 @@ public class Neo4jItemReaderTests { reader.afterPropertiesSet(); } + @SuppressWarnings("unchecked") @Test public void testNullResults() { ArgumentCaptor query = ArgumentCaptor.forClass(String.class); @@ -118,28 +134,30 @@ public class Neo4jItemReaderTests { assertEquals("START n=node(*) RETURN * ORDER BY n.age SKIP 0 LIMIT 50", query.getValue()); } + @SuppressWarnings("unchecked") @Test public void testNoResults() { ArgumentCaptor query = ArgumentCaptor.forClass(String.class); when(template.query(query.capture(), (Map) isNull())).thenReturn(result); when(result.to(String.class)).thenReturn(endResult); - when(endResult.iterator()).thenReturn(new ArrayList().iterator()); + when(endResult.iterator()).thenReturn(new ArrayList().iterator()); assertFalse(reader.doPageRead().hasNext()); assertEquals("START n=node(*) RETURN * ORDER BY n.age SKIP 0 LIMIT 50", query.getValue()); } + @SuppressWarnings({ "unchecked", "serial" }) @Test public void testResultsWithConverter() { - ResultConverter converter = new DefaultConverter(); + ResultConverter, String> converter = new DefaultConverter, String>(); reader.setResultConverter(converter); ArgumentCaptor query = ArgumentCaptor.forClass(String.class); when(template.query(query.capture(), (Map) isNull())).thenReturn(result); when(result.to(String.class, converter)).thenReturn(endResult); - when(endResult.iterator()).thenReturn(new ArrayList(){{ + when(endResult.iterator()).thenReturn(new ArrayList(){{ add(new String()); }}.iterator()); @@ -147,6 +165,7 @@ public class Neo4jItemReaderTests { assertEquals("START n=node(*) RETURN * ORDER BY n.age SKIP 0 LIMIT 50", query.getValue()); } + @SuppressWarnings("serial") @Test public void testResultsWithMatchAndWhere() throws Exception { reader.setMatchStatement("n -- m"); @@ -155,7 +174,7 @@ public class Neo4jItemReaderTests { reader.afterPropertiesSet(); when(template.query("START n=node(*) MATCH n -- m WHERE has(n.name) RETURN m ORDER BY n.age SKIP 0 LIMIT 50", null)).thenReturn(result); when(result.to(String.class)).thenReturn(endResult); - when(endResult.iterator()).thenReturn(new ArrayList(){{ + when(endResult.iterator()).thenReturn(new ArrayList(){{ add(new String()); }}.iterator()); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/Neo4jItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/Neo4jItemWriterTests.java index 40ba364d6..bb3b20f22 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/Neo4jItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/Neo4jItemWriterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.data; import static org.junit.Assert.assertEquals; @@ -14,24 +29,23 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.springframework.data.neo4j.template.Neo4jOperations; -@SuppressWarnings("rawtypes") public class Neo4jItemWriterTests { - private Neo4jItemWriter writer; + private Neo4jItemWriter writer; @Mock private Neo4jOperations template; @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); - writer = new Neo4jItemWriter(); + writer = new Neo4jItemWriter(); writer.setTemplate(template); } @Test public void testAfterPropertiesSet() throws Exception{ - writer = new Neo4jItemWriter(); + writer = new Neo4jItemWriter(); try { writer.afterPropertiesSet(); @@ -56,7 +70,7 @@ public class Neo4jItemWriterTests { @Test public void testWriteNoItems() throws Exception { - writer.write(new ArrayList()); + writer.write(new ArrayList()); verifyZeroInteractions(template); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/RepositoryItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/RepositoryItemReaderTests.java index 2469ae4ea..dcdb34c1f 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/RepositoryItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/RepositoryItemReaderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.data; import static org.junit.Assert.assertEquals; @@ -24,12 +39,11 @@ import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort.Direction; import org.springframework.data.repository.PagingAndSortingRepository; -@SuppressWarnings("rawtypes") public class RepositoryItemReaderTests { - private RepositoryItemReader reader; + private RepositoryItemReader reader; @Mock - private PagingAndSortingRepository repository; + private PagingAndSortingRepository repository; private Map sorts; @Before @@ -37,7 +51,7 @@ public class RepositoryItemReaderTests { MockitoAnnotations.initMocks(this); sorts = new HashMap(); sorts.put("id", Direction.ASC); - reader = new RepositoryItemReader(); + reader = new RepositoryItemReader(); reader.setRepository(repository); reader.setPageSize(1); reader.setSort(sorts); @@ -47,13 +61,13 @@ public class RepositoryItemReaderTests { @Test public void testAfterPropertiesSet() throws Exception { try { - new RepositoryItemReader().afterPropertiesSet(); + new RepositoryItemReader().afterPropertiesSet(); fail(); } catch (IllegalStateException e) { } try { - reader = new RepositoryItemReader(); + reader = new RepositoryItemReader(); reader.setRepository(repository); reader.afterPropertiesSet(); fail(); @@ -61,7 +75,7 @@ public class RepositoryItemReaderTests { } try { - reader = new RepositoryItemReader(); + reader = new RepositoryItemReader(); reader.setRepository(repository); reader.setPageSize(-1); reader.afterPropertiesSet(); @@ -70,7 +84,7 @@ public class RepositoryItemReaderTests { } try { - reader = new RepositoryItemReader(); + reader = new RepositoryItemReader(); reader.setRepository(repository); reader.setPageSize(1); reader.afterPropertiesSet(); @@ -78,7 +92,7 @@ public class RepositoryItemReaderTests { } catch (IllegalStateException iae) { } - reader = new RepositoryItemReader(); + reader = new RepositoryItemReader(); reader.setRepository(repository); reader.setPageSize(1); reader.setSort(sorts); @@ -86,11 +100,10 @@ public class RepositoryItemReaderTests { } @Test - @SuppressWarnings("unchecked") public void testDoReadFirstReadNoResults() throws Exception { ArgumentCaptor pageRequestContainer = ArgumentCaptor.forClass(PageRequest.class); - when(repository.findAll(pageRequestContainer.capture())).thenReturn(new PageImpl(new ArrayList())); + when(repository.findAll(pageRequestContainer.capture())).thenReturn(new PageImpl(new ArrayList())); assertNull(reader.doRead()); @@ -102,12 +115,12 @@ public class RepositoryItemReaderTests { } @Test - @SuppressWarnings({"serial", "unchecked"}) + @SuppressWarnings("serial") public void testDoReadFirstReadResults() throws Exception { ArgumentCaptor pageRequestContainer = ArgumentCaptor.forClass(PageRequest.class); final Object result = new Object(); - when(repository.findAll(pageRequestContainer.capture())).thenReturn(new PageImpl(new ArrayList(){{ + when(repository.findAll(pageRequestContainer.capture())).thenReturn(new PageImpl(new ArrayList(){{ add(result); }})); @@ -121,13 +134,13 @@ public class RepositoryItemReaderTests { } @Test - @SuppressWarnings({"serial", "unchecked"}) + @SuppressWarnings("serial") public void testDoReadFirstReadSecondPage() throws Exception { ArgumentCaptor pageRequestContainer = ArgumentCaptor.forClass(PageRequest.class); final Object result = new Object(); - when(repository.findAll(pageRequestContainer.capture())).thenReturn(new PageImpl(new ArrayList(){{ + when(repository.findAll(pageRequestContainer.capture())).thenReturn(new PageImpl(new ArrayList(){{ add(new Object()); - }})).thenReturn(new PageImpl(new ArrayList(){{ + }})).thenReturn(new PageImpl(new ArrayList(){{ add(result); }})); @@ -142,15 +155,15 @@ public class RepositoryItemReaderTests { } @Test - @SuppressWarnings({"serial", "unchecked"}) + @SuppressWarnings("serial") public void testDoReadFirstReadExhausted() throws Exception { ArgumentCaptor pageRequestContainer = ArgumentCaptor.forClass(PageRequest.class); final Object result = new Object(); - when(repository.findAll(pageRequestContainer.capture())).thenReturn(new PageImpl(new ArrayList(){{ + when(repository.findAll(pageRequestContainer.capture())).thenReturn(new PageImpl(new ArrayList(){{ add(new Object()); - }})).thenReturn(new PageImpl(new ArrayList(){{ + }})).thenReturn(new PageImpl(new ArrayList(){{ add(result); - }})).thenReturn(new PageImpl(new ArrayList())); + }})).thenReturn(new PageImpl(new ArrayList())); assertFalse(reader.doRead() == result); assertEquals(result, reader.doRead()); @@ -164,11 +177,11 @@ public class RepositoryItemReaderTests { } @Test - @SuppressWarnings({"serial", "unchecked"}) + @SuppressWarnings("serial") public void testJumpToItem() throws Exception { reader.setPageSize(100); ArgumentCaptor pageRequestContainer = ArgumentCaptor.forClass(PageRequest.class); - when(repository.findAll(pageRequestContainer.capture())).thenReturn(new PageImpl(new ArrayList(){{ + when(repository.findAll(pageRequestContainer.capture())).thenReturn(new PageImpl(new ArrayList(){{ add(new Object()); }})); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/RepositoryItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/RepositoryItemWriterTests.java index c291533e7..aacea66ee 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/RepositoryItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/RepositoryItemWriterTests.java @@ -1,10 +1,27 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.data; import static org.junit.Assert.fail; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; +import java.io.Serializable; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import org.junit.Before; @@ -13,18 +30,17 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.springframework.data.repository.CrudRepository; -@SuppressWarnings("rawtypes") public class RepositoryItemWriterTests { @Mock - private CrudRepository repository; + private CrudRepository repository; - private RepositoryItemWriter writer; + private RepositoryItemWriter writer; @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); - writer = new RepositoryItemWriter(); + writer = new RepositoryItemWriter(); writer.setMethodName("save"); writer.setRepository(repository); } @@ -46,17 +62,14 @@ public class RepositoryItemWriterTests { public void testWriteNoItems() throws Exception { writer.write(null); - writer.write(new ArrayList()); + writer.write(new ArrayList()); verifyZeroInteractions(repository); } @Test - @SuppressWarnings({"serial", "unchecked"}) public void testWriteItems() throws Exception { - List items = new ArrayList() {{ - add("foo"); - }}; + List items = Collections.singletonList("foo"); writer.write(items); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractDataSourceItemReaderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractDataSourceItemReaderIntegrationTests.java index 94bbab6eb..241b1dc3c 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractDataSourceItemReaderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractDataSourceItemReaderIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import static org.junit.Assert.assertEquals; @@ -289,12 +304,11 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests { assertEquals(5, foo5.getValue()); } - //set transaction to false and make sure the tests work @Test public void testTransacted() throws Exception { if (reader instanceof JpaPagingItemReader) { - ((JpaPagingItemReader)reader).setTransacted(false); + ((JpaPagingItemReader)reader).setTransacted(false); this.testNormalProcessing(); }//end if } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractDatabaseItemStreamItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractDatabaseItemStreamItemReaderTests.java index 95fa9e37a..23fcd75e4 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractDatabaseItemStreamItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractDatabaseItemStreamItemReaderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractGenericDataSourceItemReaderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractGenericDataSourceItemReaderIntegrationTests.java index 0be966f3f..97e493873 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractGenericDataSourceItemReaderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractGenericDataSourceItemReaderIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractHibernateCursorItemReaderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractHibernateCursorItemReaderIntegrationTests.java index e3f6147af..b647b2564 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractHibernateCursorItemReaderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractHibernateCursorItemReaderIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import org.hibernate.SessionFactory; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractJdbcItemReaderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractJdbcItemReaderIntegrationTests.java index 3e9847f74..f81a3aa9c 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractJdbcItemReaderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractJdbcItemReaderIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractJdbcPagingItemReaderParameterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractJdbcPagingItemReaderParameterTests.java new file mode 100644 index 000000000..b68aaf721 --- /dev/null +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractJdbcPagingItemReaderParameterTests.java @@ -0,0 +1,34 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.batch.item.database; + +import java.util.Collections; + +import org.junit.Test; + +/** + * @author Jimmy Praet + */ +public abstract class AbstractJdbcPagingItemReaderParameterTests extends AbstractPagingItemReaderParameterTests { + + @Override + @Test + public void testReadAfterJumpSecondPage() throws Exception { + executionContext.put(getName() + ".start.after", Collections.singletonMap("ID", 4)); + super.testReadAfterJumpSecondPage(); + } + +} diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractPagingItemReaderParameterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractPagingItemReaderParameterTests.java index d934daf91..356327fa5 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractPagingItemReaderParameterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractPagingItemReaderParameterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import javax.sql.DataSource; @@ -38,6 +53,9 @@ public abstract class AbstractPagingItemReaderParameterTests { ((ItemStream)tested).open(executionContext); + Foo foo2 = tested.read(); + Assert.assertEquals(2, foo2.getValue()); + Foo foo3 = tested.read(); Assert.assertEquals(3, foo3.getValue()); @@ -52,11 +70,14 @@ public abstract class AbstractPagingItemReaderParameterTests { } @Test - public void testReadAfterJump() throws Exception { + public void testReadAfterJumpFirstPage() throws Exception { - executionContext.putInt(tested.getClass().getSimpleName()+".read.count", 2); + executionContext.putInt(getName()+".read.count", 2); ((ItemStream)tested).open(executionContext); + Foo foo4 = tested.read(); + Assert.assertEquals(4, foo4.getValue()); + Foo foo5 = tested.read(); Assert.assertEquals(5, foo5.getValue()); @@ -64,5 +85,22 @@ public abstract class AbstractPagingItemReaderParameterTests { Assert.assertNull(o); } + @Test + public void testReadAfterJumpSecondPage() throws Exception { + + executionContext.putInt(getName()+".read.count", 3); + ((ItemStream)tested).open(executionContext); + + Foo foo5 = tested.read(); + Assert.assertEquals(5, foo5.getValue()); + + Object o = tested.read(); + Assert.assertNull(o); + } + + protected String getName() { + return tested.getClass().getSimpleName(); + } + protected abstract AbstractPagingItemReader getItemReader() throws Exception; } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/CompositeKeyFooDao.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/CompositeKeyFooDao.java index cf119f63a..fe74c0b3c 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/CompositeKeyFooDao.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/CompositeKeyFooDao.java @@ -44,9 +44,9 @@ public class CompositeKeyFooDao extends JdbcDaoSupport implements FooDao { Map keys = (Map)key; Object[] args = keys.values().toArray(); - RowMapper fooMapper = new RowMapper(){ + RowMapper fooMapper = new RowMapper(){ @Override - public Object mapRow(ResultSet rs, int rowNum) throws SQLException { + public Foo mapRow(ResultSet rs, int rowNum) throws SQLException { Foo foo = new Foo(); foo.setId(rs.getInt(1)); foo.setName(rs.getString(2)); @@ -55,7 +55,7 @@ public class CompositeKeyFooDao extends JdbcDaoSupport implements FooDao { } }; - return (Foo)getJdbcTemplate().query("SELECT ID, NAME, VALUE from T_FOOS where ID = ? and VALUE = ?", + return getJdbcTemplate().query("SELECT ID, NAME, VALUE from T_FOOS where ID = ? and VALUE = ?", args, fooMapper).get(0); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/ExtendedConnectionDataSourceProxyTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/ExtendedConnectionDataSourceProxyTests.java index 0094d0d03..3ecbb97d1 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/ExtendedConnectionDataSourceProxyTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/ExtendedConnectionDataSourceProxyTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import static org.mockito.Mockito.mock; @@ -113,7 +128,6 @@ public class ExtendedConnectionDataSourceProxyTests { } @Test - @SuppressWarnings({"unchecked", "rawtypes"}) public void testSupressOfCloseWithJdbcTemplate() throws Exception { Connection con = mock(Connection.class); @@ -181,21 +195,21 @@ public class ExtendedConnectionDataSourceProxyTests { Connection connection = DataSourceUtils.getConnection(csds); csds.startCloseSuppression(connection); - tt.execute(new TransactionCallback() { + tt.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { template.queryForList("select baz from bar"); template.queryForList("select foo from bar"); return null; } }); - tt.execute(new TransactionCallback() { + tt.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { template.queryForList("select ham from foo"); - tt2.execute(new TransactionCallback() { + tt2.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { template.queryForList("select 1 from eggs"); return null; } @@ -204,9 +218,9 @@ public class ExtendedConnectionDataSourceProxyTests { return null; } }); - tt.execute(new TransactionCallback() { + tt.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { template.queryForList("select spam from ham"); return null; } @@ -335,6 +349,7 @@ public class ExtendedConnectionDataSourceProxyTests { /** * Added due to JDK 7. */ + @SuppressWarnings("unused") public Logger getParentLogger() throws SQLFeatureNotSupportedException { throw new SQLFeatureNotSupportedException(); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/FooRowMapper.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/FooRowMapper.java index 503055661..7703f3e8f 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/FooRowMapper.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/FooRowMapper.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import java.sql.ResultSet; @@ -7,10 +22,10 @@ import org.springframework.batch.item.sample.Foo; import org.springframework.jdbc.core.RowMapper; -public class FooRowMapper implements RowMapper { +public class FooRowMapper implements RowMapper { @Override - public Object mapRow(ResultSet rs, int rowNum) throws SQLException { + public Foo mapRow(ResultSet rs, int rowNum) throws SQLException { Foo foo = new Foo(); foo.setId(rs.getInt(1)); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderCommonTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderCommonTests.java index 33d05e8cf..6b6f88672 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderCommonTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderCommonTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import org.hibernate.SessionFactory; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderIntegrationTests.java index 9857b3d7f..8edbf58fd 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import static org.junit.Assert.fail; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderNamedQueryIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderNamedQueryIntegrationTests.java index 18f466c4a..90c1c14c5 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderNamedQueryIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderNamedQueryIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; /** diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderNativeQueryIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderNativeQueryIntegrationTests.java index a1b450a49..e259ee6f5 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderNativeQueryIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderNativeQueryIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import org.springframework.batch.item.database.orm.HibernateNativeQueryProvider; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderParametersIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderParametersIntegrationTests.java index ae8c6284b..3f54a5f5c 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderParametersIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderParametersIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import java.util.Collections; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderStatefulIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderStatefulIntegrationTests.java index f0caa6df0..7d970912b 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderStatefulIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderStatefulIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import static org.mockito.Mockito.mock; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderStatefulNamedQueryIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderStatefulNamedQueryIntegrationTests.java index cafc8c347..69c12b46a 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderStatefulNamedQueryIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderStatefulNamedQueryIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; /** diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorProjectionItemReaderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorProjectionItemReaderIntegrationTests.java index 6f975f7eb..915787676 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorProjectionItemReaderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorProjectionItemReaderIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateItemWriterTests.java index 2725ac435..2ca30deca 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateItemWriterTests.java @@ -79,12 +79,14 @@ public class HibernateItemWriterTests { * * @throws Exception */ + @SuppressWarnings("deprecation") @Test public void testAfterPropertiesSetWithDelegate() throws Exception { writer.setHibernateTemplate(ht); writer.afterPropertiesSet(); } + @SuppressWarnings("deprecation") @Test public void testWriteAndFlushSunnyDayHibernate3() throws Exception { writer.setHibernateTemplate(ht); @@ -99,6 +101,7 @@ public class HibernateItemWriterTests { } + @SuppressWarnings("deprecation") @Test public void testWriteAndFlushWithFailureHibernate3() throws Exception { writer.setHibernateTemplate(ht); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernatePagingItemReaderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernatePagingItemReaderIntegrationTests.java index c3b815688..95622656e 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernatePagingItemReaderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernatePagingItemReaderIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import org.hibernate.SessionFactory; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisBatchItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisBatchItemWriterTests.java index 54a337493..abd8beb27 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisBatchItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisBatchItemWriterTests.java @@ -38,6 +38,7 @@ import com.ibatis.sqlmap.engine.execution.BatchResult; * @author Thomas Risberg * @author Will Schipp */ +@SuppressWarnings("deprecation") public class IbatisBatchItemWriterTests { private IbatisBatchItemWriter writer = new IbatisBatchItemWriter(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderAsyncTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderAsyncTests.java index 7dda13cef..6c267cd84 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderAsyncTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderAsyncTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import static org.junit.Assert.assertEquals; @@ -34,6 +49,7 @@ import com.ibatis.sqlmap.client.SqlMapClientBuilder; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "JdbcPagingItemReaderCommonTests-context.xml") +@SuppressWarnings("deprecation") public class IbatisPagingItemReaderAsyncTests { /** @@ -56,7 +72,7 @@ public class IbatisPagingItemReaderAsyncTests { @Before public void init() { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); - maxId = jdbcTemplate.queryForInt("SELECT MAX(ID) from T_FOOS"); + maxId = jdbcTemplate.queryForObject("SELECT MAX(ID) from T_FOOS", Integer.class); for (int i = maxId + 1; i <= ITEM_COUNT; i++) { jdbcTemplate.update("INSERT into T_FOOS (ID,NAME,VALUE) values (?, ?, ?)", i, "foo" + i, i); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderCommonTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderCommonTests.java index 6d5ea1c68..e3cbca6cd 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderCommonTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderCommonTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import org.junit.runner.RunWith; @@ -11,6 +26,7 @@ import com.ibatis.sqlmap.client.SqlMapClient; import com.ibatis.sqlmap.client.SqlMapClientBuilder; @RunWith(JUnit4.class) +@SuppressWarnings("deprecation") public class IbatisPagingItemReaderCommonTests extends AbstractDatabaseItemStreamItemReaderTests { @Override diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderParameterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderParameterTests.java index 7642ad750..a7a9dacd2 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderParameterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderParameterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import java.util.Collections; @@ -21,8 +36,8 @@ public class IbatisPagingItemReaderParameterTests extends AbstractPagingItemRead SqlMapClient sqlMapClient = createSqlMapClient(); IbatisPagingItemReader reader = new IbatisPagingItemReader(); - reader.setQueryId("getPagedFoos3AndUp"); - reader.setParameterValues(Collections.singletonMap("limit", 3)); + reader.setQueryId("getPagedFoosLimitAndUp"); + reader.setParameterValues(Collections.singletonMap("limit", 2)); reader.setSqlMapClient(sqlMapClient); reader.setDataSource(dataSource); reader.setSaveState(true); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterClassicTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterClassicTests.java index bbb47d23a..fbde94643 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterClassicTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterClassicTests.java @@ -54,7 +54,7 @@ public class JdbcBatchItemWriterClassicTests { ps = mock(PreparedStatement.class); jdbcTemplate = new JdbcTemplate() { @Override - public Object execute(String sql, PreparedStatementCallback action) throws DataAccessException { + public T execute(String sql, PreparedStatementCallback action) throws DataAccessException { list.add(sql); try { return action.doInPreparedStatement(ps); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterNamedParameterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterNamedParameterTests.java index 7163a631b..4bba3f834 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterNamedParameterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterNamedParameterTests.java @@ -42,10 +42,9 @@ import org.springframework.jdbc.core.namedparam.SqlParameterSource; * @author Will Schipp * @author Michael Minella */ -@SuppressWarnings({"rawtypes", "serial", "unchecked"}) public class JdbcBatchItemWriterNamedParameterTests { - private JdbcBatchItemWriter writer = new JdbcBatchItemWriter(); + private JdbcBatchItemWriter writer = new JdbcBatchItemWriter(); private NamedParameterJdbcOperations namedParameterJdbcOperations; @@ -124,27 +123,33 @@ public class JdbcBatchItemWriterNamedParameterTests { @Test public void testWriteAndFlush() throws Exception { - writer.setItemSqlParameterSourceProvider(null); + when(namedParameterJdbcOperations.batchUpdate(eq(sql), + eqSqlParameterSourceArray(new SqlParameterSource[] {new BeanPropertySqlParameterSource(new Foo("bar"))}))) + .thenReturn(new int[] {1}); + writer.write(Collections.singletonList(new Foo("bar"))); + } + + @SuppressWarnings({ "rawtypes", "serial", "unchecked" }) + @Test + public void testWriteAndFlushMap() throws Exception { + JdbcBatchItemWriter> mapWriter = new JdbcBatchItemWriter>(); + + mapWriter.setSql(sql); + mapWriter.setJdbcTemplate(namedParameterJdbcOperations); + mapWriter.afterPropertiesSet(); + ArgumentCaptor captor = ArgumentCaptor.forClass(Map[].class); when(namedParameterJdbcOperations.batchUpdate(eq(sql), captor.capture())) .thenReturn(new int[] {1}); - writer.write(Collections.singletonList(new HashMap() {{put("foo", "bar");}})); + mapWriter.write(Collections.singletonList(new HashMap() {{put("foo", "bar");}})); assertEquals(1, captor.getValue().length); Map results = captor.getValue()[0]; assertEquals("bar", results.get("foo")); } - @Test - public void testWriteAndFlushMap() throws Exception { - when(namedParameterJdbcOperations.batchUpdate(eq(sql), - eqSqlParameterSourceArray(new SqlParameterSource[] {new BeanPropertySqlParameterSource(new Foo("bar"))}))) - .thenReturn(new int[] {1}); - writer.write(Collections.singletonList(new Foo("bar"))); - } - @Test public void testWriteAndFlushWithEmptyUpdate() throws Exception { when(namedParameterJdbcOperations.batchUpdate(eq(sql), diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcCursorItemReaderCommonTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcCursorItemReaderCommonTests.java index beff99fb9..04670fe60 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcCursorItemReaderCommonTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcCursorItemReaderCommonTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import org.junit.Test; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcCursorItemReaderConfigTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcCursorItemReaderConfigTests.java index 014f92414..a0dfc7bf2 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcCursorItemReaderConfigTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcCursorItemReaderConfigTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import static org.mockito.Mockito.mock; @@ -44,9 +59,9 @@ public class JdbcCursorItemReaderConfigTests { reader.setSql("select foo from bar"); final ExecutionContext ec = new ExecutionContext(); tt.execute( - new TransactionCallback() { + new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { reader.open(ec); reader.close(); return null; @@ -75,9 +90,9 @@ public class JdbcCursorItemReaderConfigTests { reader.setSql("select foo from bar"); final ExecutionContext ec = new ExecutionContext(); tt.execute( - new TransactionCallback() { + new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { reader.open(ec); reader.close(); return null; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcCursorItemReaderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcCursorItemReaderIntegrationTests.java index 7db814b48..e658be9bc 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcCursorItemReaderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcCursorItemReaderIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import org.junit.runner.RunWith; 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 c1b9ad4a7..57197f77e 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 @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import static org.junit.Assert.assertEquals; @@ -64,7 +79,7 @@ public class JdbcPagingItemReaderAsyncTests { @Before public void init() { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); - maxId = jdbcTemplate.queryForInt("SELECT MAX(ID) from T_FOOS"); + maxId = jdbcTemplate.queryForObject("SELECT MAX(ID) from T_FOOS", Integer.class); for (int i = maxId + 1; i <= ITEM_COUNT; i++) { jdbcTemplate.update("INSERT into T_FOOS (ID,NAME,VALUE) values (?, ?, ?)", i, "foo" + i, i); } 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 8f6bcbcd6..7f9a09de3 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 @@ -21,12 +21,14 @@ import java.util.Collections; import java.util.LinkedHashMap; 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.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.util.ReflectionTestUtils; /** * @author Dave Syer @@ -36,12 +38,22 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "/org/springframework/batch/item/database/JdbcPagingItemReaderParameterTests-context.xml") -public class JdbcPagingItemReaderClassicParameterTests extends AbstractPagingItemReaderParameterTests { +public class JdbcPagingItemReaderClassicParameterTests extends AbstractJdbcPagingItemReaderParameterTests { + // force jumpToItemQuery in JdbcPagingItemReader.doJumpToPage(int) + private static boolean forceJumpToItemQuery = false; + @Override protected AbstractPagingItemReader getItemReader() throws Exception { - - JdbcPagingItemReader reader = new JdbcPagingItemReader(); + JdbcPagingItemReader reader = new JdbcPagingItemReader() { + @Override + protected void doJumpToPage(int itemIndex) { + if (forceJumpToItemQuery) { + ReflectionTestUtils.setField(this, "startAfterValues", null); + } + super.doJumpToPage(itemIndex); + } + }; reader.setDataSource(dataSource); HsqlPagingQueryProvider queryProvider = new HsqlPagingQueryProvider(); queryProvider.setSelectClause("select ID, NAME, VALUE"); @@ -50,7 +62,7 @@ public class JdbcPagingItemReaderClassicParameterTests extends AbstractPagingIte Map sortKeys = new LinkedHashMap(); sortKeys.put("ID", Order.ASCENDING); queryProvider.setSortKeys(sortKeys); - reader.setParameterValues(Collections.singletonMap("limit", 3)); + reader.setParameterValues(Collections.singletonMap("limit", 2)); reader.setQueryProvider(queryProvider); reader.setRowMapper( new ParameterizedRowMapper() { @@ -71,5 +83,20 @@ public class JdbcPagingItemReaderClassicParameterTests extends AbstractPagingIte return reader; } + + @Test + public void testReadAfterJumpSecondPageWithJumpToItemQuery() throws Exception { + try { + forceJumpToItemQuery = true; + super.testReadAfterJumpSecondPage(); + } finally { + forceJumpToItemQuery = false; + } + } + + @Override + protected String getName() { + return "JdbcPagingItemReader"; + } } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderConfigTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderConfigTests.java index 432cac21d..368db8fdf 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderConfigTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderConfigTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import static org.junit.Assert.assertEquals; 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 a78fa9956..6f19cf044 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 @@ -21,12 +21,14 @@ import java.util.Collections; import java.util.LinkedHashMap; 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.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.util.ReflectionTestUtils; /** * @author Dave Syer @@ -35,12 +37,22 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "/org/springframework/batch/item/database/JdbcPagingItemReaderParameterTests-context.xml") -public class JdbcPagingItemReaderNamedParameterTests extends AbstractPagingItemReaderParameterTests { +public class JdbcPagingItemReaderNamedParameterTests extends AbstractJdbcPagingItemReaderParameterTests { + + // force jumpToItemQuery in JdbcPagingItemReader.doJumpToPage(int) + private static boolean forceJumpToItemQuery = false; @Override protected AbstractPagingItemReader getItemReader() throws Exception { - - JdbcPagingItemReader reader = new JdbcPagingItemReader(); + JdbcPagingItemReader reader = new JdbcPagingItemReader() { + @Override + protected void doJumpToPage(int itemIndex) { + if (forceJumpToItemQuery) { + ReflectionTestUtils.setField(this, "startAfterValues", null); + } + super.doJumpToPage(itemIndex); + } + }; reader.setDataSource(dataSource); HsqlPagingQueryProvider queryProvider = new HsqlPagingQueryProvider(); queryProvider.setSelectClause("select ID, NAME, VALUE"); @@ -49,7 +61,7 @@ public class JdbcPagingItemReaderNamedParameterTests extends AbstractPagingItemR Map sortKeys = new LinkedHashMap(); sortKeys.put("ID", Order.ASCENDING); queryProvider.setSortKeys(sortKeys); - reader.setParameterValues(Collections.singletonMap("limit", 3)); + reader.setParameterValues(Collections.singletonMap("limit", 2)); reader.setQueryProvider(queryProvider); reader.setRowMapper( new ParameterizedRowMapper() { @@ -68,7 +80,22 @@ public class JdbcPagingItemReaderNamedParameterTests extends AbstractPagingItemR reader.setSaveState(true); return reader; - + } + + @Test + public void testReadAfterJumpSecondPageWithJumpToItemQuery() throws Exception { + try { + forceJumpToItemQuery = true; + super.testReadAfterJumpSecondPage(); + } finally { + forceJumpToItemQuery = false; + } + } + + @Override + protected String getName() { + return "JdbcPagingItemReader"; + } } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderAsyncTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderAsyncTests.java index 73af883fa..cae8714c0 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderAsyncTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderAsyncTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import static org.junit.Assert.assertEquals; @@ -57,7 +72,7 @@ public class JpaPagingItemReaderAsyncTests { @Before public void init() { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); - maxId = jdbcTemplate.queryForInt("SELECT MAX(ID) from T_FOOS"); + maxId = jdbcTemplate.queryForObject("SELECT MAX(ID) from T_FOOS", Integer.class); for (int i = maxId + 1; i <= ITEM_COUNT; i++) { jdbcTemplate.update("INSERT into T_FOOS (ID,NAME,VALUE) values (?, ?, ?)", i, "foo" + i, i); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderCommonTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderCommonTests.java index 547aaaa5c..fe892c7a7 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderCommonTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderCommonTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import javax.persistence.EntityManagerFactory; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderIntegrationTests.java index eb7ade626..0e8b056b5 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import java.util.Collections; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderNativeQueryIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderNativeQueryIntegrationTests.java index cf01a2b96..9049bb1a6 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderNativeQueryIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderNativeQueryIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import java.util.Collections; @@ -35,7 +50,7 @@ public class JpaPagingItemReaderNativeQueryIntegrationTests extends AbstractPagi queryProvider.setEntityClass(Foo.class); queryProvider.afterPropertiesSet(); - reader.setParameterValues(Collections.singletonMap("limit", 3)); + reader.setParameterValues(Collections.singletonMap("limit", 2)); reader.setEntityManagerFactory(entityManagerFactory); reader.setPageSize(3); reader.setQueryProvider(queryProvider); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderParameterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderParameterTests.java index ab407cbaa..eb428c236 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderParameterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderParameterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import java.util.Collections; @@ -24,7 +39,7 @@ public class JpaPagingItemReaderParameterTests extends AbstractPagingItemReaderP JpaPagingItemReader reader = new JpaPagingItemReader(); reader.setQueryString(jpqlQuery); - reader.setParameterValues(Collections.singletonMap("limit", 3)); + reader.setParameterValues(Collections.singletonMap("limit", 2)); reader.setEntityManagerFactory(entityManagerFactory); reader.setPageSize(3); reader.afterPropertiesSet(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/SingleKeyFooDao.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/SingleKeyFooDao.java index 0004a8a67..acba233d8 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/SingleKeyFooDao.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/SingleKeyFooDao.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import java.sql.ResultSet; @@ -12,9 +27,9 @@ public class SingleKeyFooDao extends JdbcDaoSupport implements FooDao { @Override public Foo getFoo(Object key){ - RowMapper fooMapper = new RowMapper(){ + RowMapper fooMapper = new RowMapper(){ @Override - public Object mapRow(ResultSet rs, int rowNum) throws SQLException { + public Foo mapRow(ResultSet rs, int rowNum) throws SQLException { Foo foo = new Foo(); foo.setId(rs.getInt(1)); foo.setName(rs.getString(2)); @@ -23,7 +38,7 @@ public class SingleKeyFooDao extends JdbcDaoSupport implements FooDao { } }; - return (Foo)getJdbcTemplate().query("SELECT ID, NAME, VALUE from T_FOOS where ID = ?", + return getJdbcTemplate().query("SELECT ID, NAME, VALUE from T_FOOS where ID = ?", new Object[] {key}, fooMapper).get(0); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/StoredProcedureItemReaderCommonTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/StoredProcedureItemReaderCommonTests.java index 0c1c226ad..92776b7ab 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/StoredProcedureItemReaderCommonTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/StoredProcedureItemReaderCommonTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import java.sql.PreparedStatement; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/StoredProcedureItemReaderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/StoredProcedureItemReaderIntegrationTests.java index 880c0d3bb..c00264f9b 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/StoredProcedureItemReaderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/StoredProcedureItemReaderIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import org.junit.runner.RunWith; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/StoredprocedureItemReaderConfigTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/StoredprocedureItemReaderConfigTests.java index 210f35f55..ec92461fc 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/StoredprocedureItemReaderConfigTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/StoredprocedureItemReaderConfigTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database; import static org.mockito.Mockito.mock; @@ -54,9 +69,9 @@ public class StoredprocedureItemReaderConfigTests { reader.setProcedureName("foo_bar"); final ExecutionContext ec = new ExecutionContext(); tt.execute( - new TransactionCallback() { + new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { reader.open(ec); reader.close(); return null; @@ -89,9 +104,9 @@ public class StoredprocedureItemReaderConfigTests { reader.setProcedureName("foo_bar"); final ExecutionContext ec = new ExecutionContext(); tt.execute( - new TransactionCallback() { + new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { reader.open(ec); reader.close(); return null; @@ -135,9 +150,9 @@ public class StoredprocedureItemReaderConfigTests { reader.setRefCursorPosition(3); final ExecutionContext ec = new ExecutionContext(); tt.execute( - new TransactionCallback() { + new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { reader.open(ec); reader.close(); return null; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/support/ColumnMapExecutionContextRowMapperTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/support/ColumnMapExecutionContextRowMapperTests.java index 2f8681437..1166b386c 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/support/ColumnMapExecutionContextRowMapperTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/support/ColumnMapExecutionContextRowMapperTests.java @@ -1,11 +1,21 @@ -/** - * +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.springframework.batch.item.database.support; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - import java.sql.PreparedStatement; import java.util.HashMap; import java.util.LinkedHashMap; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/support/SqlPagingQueryProviderFactoryBeanTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/support/SqlPagingQueryProviderFactoryBeanTests.java index bd24154e1..19325a964 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/support/SqlPagingQueryProviderFactoryBeanTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/support/SqlPagingQueryProviderFactoryBeanTests.java @@ -19,9 +19,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - import java.util.LinkedHashMap; import java.util.Map; @@ -55,7 +52,7 @@ public class SqlPagingQueryProviderFactoryBeanTests { @Test public void testFactory() throws Exception { - PagingQueryProvider provider = (PagingQueryProvider) factory.getObject(); + PagingQueryProvider provider = factory.getObject(); assertNotNull(provider); } @@ -72,28 +69,28 @@ public class SqlPagingQueryProviderFactoryBeanTests { @Test(expected=IllegalArgumentException.class) public void testNoDataSource() throws Exception { factory.setDataSource(null); - PagingQueryProvider provider = (PagingQueryProvider) factory.getObject(); + PagingQueryProvider provider = factory.getObject(); assertNotNull(provider); } @Test(expected=IllegalArgumentException.class) public void testNoSortKey() throws Exception { factory.setSortKeys(null); - PagingQueryProvider provider = (PagingQueryProvider) factory.getObject(); + PagingQueryProvider provider = factory.getObject(); assertNotNull(provider); } @Test public void testWhereClause() throws Exception { factory.setWhereClause("x=y"); - PagingQueryProvider provider = (PagingQueryProvider) factory.getObject(); + PagingQueryProvider provider = factory.getObject(); String query = provider.generateFirstPageQuery(100); assertTrue("Wrong query: "+query, query.contains("x=y")); } @Test public void testAscending() throws Exception { - PagingQueryProvider provider = (PagingQueryProvider) factory.getObject(); + PagingQueryProvider provider = factory.getObject(); String query = provider.generateFirstPageQuery(100); assertTrue("Wrong query: "+query, query.contains("ASC")); } @@ -101,14 +98,14 @@ public class SqlPagingQueryProviderFactoryBeanTests { @Test(expected=IllegalArgumentException.class) public void testWrongDatabaseType() throws Exception { factory.setDatabaseType("NoSuchDb"); - PagingQueryProvider provider = (PagingQueryProvider) factory.getObject(); + PagingQueryProvider provider = factory.getObject(); assertNotNull(provider); } @Test(expected=IllegalArgumentException.class) public void testMissingMetaData() throws Exception { factory.setDataSource(DatabaseTypeTestUtils.getMockDataSource(new MetaDataAccessException("foo"))); - PagingQueryProvider provider = (PagingQueryProvider) factory.getObject(); + PagingQueryProvider provider = factory.getObject(); assertNotNull(provider); } @@ -116,7 +113,7 @@ public class SqlPagingQueryProviderFactoryBeanTests { public void testAllDatabaseTypes() throws Exception { for (DatabaseType type : DatabaseType.values()) { factory.setDatabaseType(type.name()); - PagingQueryProvider provider = (PagingQueryProvider) factory.getObject(); + PagingQueryProvider provider = factory.getObject(); assertNotNull(provider); } } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/support/SqliteMaxValueIncrementerTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/support/SqliteMaxValueIncrementerTests.java index 6086f1100..1d61774ec 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/support/SqliteMaxValueIncrementerTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/support/SqliteMaxValueIncrementerTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.database.support; import static org.junit.Assert.assertEquals; @@ -44,6 +59,6 @@ public class SqliteMaxValueIncrementerTests { assertEquals(1, mvi.getNextKey()); assertEquals(2, mvi.getNextKey()); assertEquals(3, mvi.getNextKey()); - assertEquals(1, template.queryForInt("select count(*) from max_value")); + assertEquals(1, template.queryForObject("select count(*) from max_value", Integer.class).intValue()); } } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/AbstractMultiResourceItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/AbstractMultiResourceItemWriterTests.java index b122fc137..0d9254337 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/AbstractMultiResourceItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/AbstractMultiResourceItemWriterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file; import java.io.BufferedReader; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/DefaultBufferedReaderFactoryTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/DefaultBufferedReaderFactoryTests.java index c24942147..25918ad52 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/DefaultBufferedReaderFactoryTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/DefaultBufferedReaderFactoryTests.java @@ -31,6 +31,7 @@ public class DefaultBufferedReaderFactoryTests { @Test public void testCreate() throws Exception { DefaultBufferedReaderFactory factory = new DefaultBufferedReaderFactory(); + @SuppressWarnings("resource") BufferedReader reader = factory.create(new ByteArrayResource("a\nb\nc".getBytes()), "UTF-8"); assertEquals("a", reader.readLine()); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemReaderCommonTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemReaderCommonTests.java index 00afeb397..28fc4b60d 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemReaderCommonTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemReaderCommonTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file; import org.springframework.batch.item.AbstractItemStreamItemReaderTests; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemReaderTests.java index 7c8bd5b94..a875dd940 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemReaderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemWriterTests.java index 4e9c0a764..315689ac3 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemWriterTests.java @@ -355,9 +355,9 @@ public class FlatFileItemWriterTests { PlatformTransactionManager transactionManager = new ResourcelessTransactionManager(); writer.open(executionContext); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write(Collections.singletonList(TEST_STRING)); assertEquals(expectedInTransaction, readLine()); @@ -388,9 +388,9 @@ public class FlatFileItemWriterTests { PlatformTransactionManager transactionManager = new ResourcelessTransactionManager(); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { // write some lines writer.write(Arrays.asList(new String[] { "testLine1", "testLine2", "testLine3" })); @@ -411,9 +411,9 @@ public class FlatFileItemWriterTests { // init with correct data writer.open(executionContext); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { // write more lines writer.write(Arrays.asList(new String[] { "testLine6", "testLine7", "testLine8" })); @@ -468,9 +468,9 @@ public class FlatFileItemWriterTests { PlatformTransactionManager transactionManager = new ResourcelessTransactionManager(); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { // write some lines writer.write(Arrays.asList(new String[] { "téstLine1", "téstLine2", "téstLine3" })); @@ -491,9 +491,9 @@ public class FlatFileItemWriterTests { // init with correct data writer.open(executionContext); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { // write more lines writer.write(Arrays.asList(new String[] { "téstLine6", "téstLine7", "téstLine8" })); @@ -808,6 +808,7 @@ public class FlatFileItemWriterTests { return item; } }); + @SuppressWarnings("serial") List items = new ArrayList() { { add("1"); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderFlatFileTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderFlatFileTests.java index 46769d2b0..a793ca1e2 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderFlatFileTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderFlatFileTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file; import java.util.Comparator; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderIntegrationTests.java index 05f98fb29..9fb6d2962 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file; import static org.junit.Assert.assertEquals; @@ -229,8 +244,8 @@ public class MultiResourceItemReaderIntegrationTests { */ @Override public int compare(Resource o1, Resource o2) { - Resource r1 = (Resource) o1; - Resource r2 = (Resource) o2; + Resource r1 = o1; + Resource r2 = o2; return -r1.getDescription().compareTo(r2.getDescription()); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderResourceAwareTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderResourceAwareTests.java index 4e85bc437..b247c558b 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderResourceAwareTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderResourceAwareTests.java @@ -1,19 +1,26 @@ +/* + * Copyright 2012-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file; import org.junit.Before; import org.junit.Test; import org.springframework.batch.item.ExecutionContext; -import org.springframework.batch.item.ItemStreamException; import org.springframework.batch.item.ResourceAware; -import org.springframework.batch.item.file.mapping.PassThroughLineMapper; -import org.springframework.core.io.AbstractResource; import org.springframework.core.io.ByteArrayResource; -import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.Resource; -import org.springframework.test.util.ReflectionTestUtils; - -import java.io.IOException; -import java.io.InputStream; import java.util.Comparator; import static org.junit.Assert.*; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderXmlTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderXmlTests.java index 0aa09ba1e..cbc4dbbc5 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderXmlTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderXmlTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file; import java.io.IOException; @@ -54,8 +69,7 @@ public class MultiResourceItemReaderXmlTests extends AbstractItemStreamItemReade } @Override - @SuppressWarnings("rawtypes") - public boolean supports(Class clazz) { + public boolean supports(Class clazz) { return true; } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemWriterFlatFileTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemWriterFlatFileTests.java index d5c87c00f..81b563192 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemWriterFlatFileTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemWriterFlatFileTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file; import static org.junit.Assert.assertEquals; @@ -27,7 +42,7 @@ public class MultiResourceItemWriterFlatFileTests extends AbstractMultiResourceI * @author dsyer * */ - private final class WriterCallback implements TransactionCallback { + private final class WriterCallback implements TransactionCallback { private List list; public WriterCallback(List list) { @@ -36,7 +51,7 @@ public class MultiResourceItemWriterFlatFileTests extends AbstractMultiResourceI } @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { tested.write(list); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemWriterXmlTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemWriterXmlTests.java index af2ed8cfc..e4615a55a 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemWriterXmlTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemWriterXmlTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -59,8 +74,7 @@ public class MultiResourceItemWriterXmlTests extends AbstractMultiResourceItemWr } @Override - @SuppressWarnings("rawtypes") - public boolean supports(Class clazz) { + public boolean supports(Class clazz) { return true; } } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/ResourcesItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/ResourcesItemReaderTests.java index a4b95067a..64ac76145 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/ResourcesItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/ResourcesItemReaderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file; import static org.junit.Assert.*; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/SimpleBinaryBufferedReaderFactoryTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/SimpleBinaryBufferedReaderFactoryTests.java index e4daecc05..2d59cdbd1 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/SimpleBinaryBufferedReaderFactoryTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/SimpleBinaryBufferedReaderFactoryTests.java @@ -31,6 +31,7 @@ public class SimpleBinaryBufferedReaderFactoryTests { @Test public void testCreate() throws Exception { SimpleBinaryBufferedReaderFactory factory = new SimpleBinaryBufferedReaderFactory(); + @SuppressWarnings("resource") BufferedReader reader = factory.create(new ByteArrayResource("a\nb".getBytes()), "UTF-8"); assertEquals("a", reader.readLine()); assertEquals("b", reader.readLine()); @@ -41,6 +42,7 @@ public class SimpleBinaryBufferedReaderFactoryTests { public void testCreateWithLineEnding() throws Exception { SimpleBinaryBufferedReaderFactory factory = new SimpleBinaryBufferedReaderFactory(); factory.setLineEnding("||"); + @SuppressWarnings("resource") BufferedReader reader = factory.create(new ByteArrayResource("a||b".getBytes()), "UTF-8"); assertEquals("a", reader.readLine()); assertEquals("b", reader.readLine()); @@ -51,6 +53,7 @@ public class SimpleBinaryBufferedReaderFactoryTests { public void testMarkResetWithLineEnding() throws Exception { SimpleBinaryBufferedReaderFactory factory = new SimpleBinaryBufferedReaderFactory(); factory.setLineEnding("||"); + @SuppressWarnings("resource") BufferedReader reader = factory.create(new ByteArrayResource("a||b||c".getBytes()), "UTF-8"); assertEquals("a", reader.readLine()); reader.mark(1024); @@ -65,6 +68,7 @@ public class SimpleBinaryBufferedReaderFactoryTests { public void testCreateWithLineEndingAtEnd() throws Exception { SimpleBinaryBufferedReaderFactory factory = new SimpleBinaryBufferedReaderFactory(); factory.setLineEnding("||"); + @SuppressWarnings("resource") BufferedReader reader = factory.create(new ByteArrayResource("a||".getBytes()), "UTF-8"); assertEquals("a", reader.readLine()); assertEquals(null, reader.readLine()); @@ -74,6 +78,7 @@ public class SimpleBinaryBufferedReaderFactoryTests { public void testCreateWithFalseLineEnding() throws Exception { SimpleBinaryBufferedReaderFactory factory = new SimpleBinaryBufferedReaderFactory(); factory.setLineEnding("||"); + @SuppressWarnings("resource") BufferedReader reader = factory.create(new ByteArrayResource("a|b||".getBytes()), "UTF-8"); assertEquals("a|b", reader.readLine()); assertEquals(null, reader.readLine()); @@ -83,6 +88,7 @@ public class SimpleBinaryBufferedReaderFactoryTests { public void testCreateWithIncompleteLineEnding() throws Exception { SimpleBinaryBufferedReaderFactory factory = new SimpleBinaryBufferedReaderFactory(); factory.setLineEnding("||"); + @SuppressWarnings("resource") BufferedReader reader = factory.create(new ByteArrayResource("a||b|".getBytes()), "UTF-8"); assertEquals("a", reader.readLine()); assertEquals("b|", reader.readLine()); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/SimpleResourceSuffixCreatorTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/SimpleResourceSuffixCreatorTests.java index 8818d6f4c..84d137d39 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/SimpleResourceSuffixCreatorTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/SimpleResourceSuffixCreatorTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file; import static org.junit.Assert.*; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapperTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapperTests.java index f0e94bb1a..25ab8271b 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapperTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapperTests.java @@ -102,6 +102,7 @@ public class BeanWrapperFieldSetMapperTests { @Test public void testMapperWithSingleton() throws Exception { BeanWrapperFieldSetMapper mapper = new BeanWrapperFieldSetMapper(); + @SuppressWarnings("resource") StaticApplicationContext context = new StaticApplicationContext(); mapper.setBeanFactory(context); context.getBeanFactory().registerSingleton("bean", new TestObject()); @@ -118,6 +119,7 @@ public class BeanWrapperFieldSetMapperTests { @Test public void testPropertyNameMatching() throws Exception { BeanWrapperFieldSetMapper mapper = new BeanWrapperFieldSetMapper(); + @SuppressWarnings("resource") StaticApplicationContext context = new StaticApplicationContext(); mapper.setBeanFactory(context); mapper.setDistanceLimit(2); @@ -133,7 +135,7 @@ public class BeanWrapperFieldSetMapperTests { } @Test - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "resource"}) public void testMapperWithPrototype() throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext("bean-wrapper.xml", getClass()); @@ -157,6 +159,7 @@ public class BeanWrapperFieldSetMapperTests { testNestedB.setTestObjectC(new TestNestedC()); BeanWrapperFieldSetMapper mapper = new BeanWrapperFieldSetMapper(); + @SuppressWarnings("resource") StaticApplicationContext context = new StaticApplicationContext(); mapper.setBeanFactory(context); context.getBeanFactory().registerSingleton("bean", testNestedA); @@ -179,6 +182,7 @@ public class BeanWrapperFieldSetMapperTests { TestNestedA testNestedA = new TestNestedA(); BeanWrapperFieldSetMapper mapper = new BeanWrapperFieldSetMapper(); + @SuppressWarnings("resource") StaticApplicationContext context = new StaticApplicationContext(); mapper.setBeanFactory(context); mapper.setDistanceLimit(2); @@ -188,7 +192,7 @@ public class BeanWrapperFieldSetMapperTests { FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "1" }, new String[] { "VALUE_A", "VALUE_B" }); - TestNestedA result = (TestNestedA) mapper.mapFieldSet(fieldSet); + TestNestedA result = mapper.mapFieldSet(fieldSet); assertEquals("This is some dummy string", result.getValueA()); assertEquals(1, result.getValueB()); @@ -199,6 +203,7 @@ public class BeanWrapperFieldSetMapperTests { TestNestedC testNestedC = new TestNestedC(); BeanWrapperFieldSetMapper mapper = new BeanWrapperFieldSetMapper(); + @SuppressWarnings("resource") StaticApplicationContext context = new StaticApplicationContext(); mapper.setBeanFactory(context); context.getBeanFactory().registerSingleton("bean", testNestedC); @@ -221,6 +226,7 @@ public class BeanWrapperFieldSetMapperTests { testNestedB.setTestObjectC(new TestNestedC()); BeanWrapperFieldSetMapper mapper = new BeanWrapperFieldSetMapper(); + @SuppressWarnings("resource") StaticApplicationContext context = new StaticApplicationContext(); mapper.setBeanFactory(context); context.getBeanFactory().registerSingleton("bean", testNestedA); @@ -243,6 +249,7 @@ public class BeanWrapperFieldSetMapperTests { testNestedA.setTestObjectB(testNestedB); BeanWrapperFieldSetMapper mapper = new BeanWrapperFieldSetMapper(); + @SuppressWarnings("resource") StaticApplicationContext context = new StaticApplicationContext(); mapper.setBeanFactory(context); context.getBeanFactory().registerSingleton("bean", testNestedA); @@ -266,6 +273,7 @@ public class BeanWrapperFieldSetMapperTests { testNestedA.setTestObjectB(testNestedB); BeanWrapperFieldSetMapper mapper = new BeanWrapperFieldSetMapper(); + @SuppressWarnings("resource") StaticApplicationContext context = new StaticApplicationContext(); mapper.setBeanFactory(context); context.getBeanFactory().registerSingleton("bean", testNestedA); @@ -306,6 +314,7 @@ public class BeanWrapperFieldSetMapperTests { nestedList.setNestedC(nestedC); BeanWrapperFieldSetMapper mapper = new BeanWrapperFieldSetMapper(); + @SuppressWarnings("resource") StaticApplicationContext context = new StaticApplicationContext(); mapper.setBeanFactory(context); context.getBeanFactory().registerSingleton("bean", nestedList); @@ -333,6 +342,7 @@ public class BeanWrapperFieldSetMapperTests { ReflectionTestUtils.setField(binder, "autoGrowNestedPaths", true); } }; + @SuppressWarnings("resource") StaticApplicationContext context = new StaticApplicationContext(); mapper.setBeanFactory(context); context.getBeanFactory().registerSingleton("bean", nestedList); @@ -356,7 +366,7 @@ public class BeanWrapperFieldSetMapperTests { mapper.setTargetType(TestObject.class); FieldSet fieldSet = new DefaultFieldSet(new String[] { "00009" }, new String[] { "varLong" }); - TestObject bean = (TestObject) mapper.mapFieldSet(fieldSet); + TestObject bean = mapper.mapFieldSet(fieldSet); // since Spring 2.5.5 this is OK (before that BATCH-261) assertEquals(9, bean.getVarLong()); } @@ -371,7 +381,7 @@ public class BeanWrapperFieldSetMapperTests { mapper.setCustomEditors(Collections.singletonMap(Long.TYPE, new CustomNumberEditor(Long.class, NumberFormat .getNumberInstance(), true))); - TestObject bean = (TestObject) mapper.mapFieldSet(fieldSet); + TestObject bean = mapper.mapFieldSet(fieldSet); assertEquals(9, bean.getVarLong()); } @@ -386,7 +396,7 @@ public class BeanWrapperFieldSetMapperTests { mapper.setCustomEditors(Collections.singletonMap(Long.TYPE, new CustomNumberEditor(Long.class, NumberFormat .getNumberInstance(), true))); - TestObject bean = (TestObject) mapper.mapFieldSet(fieldSet); + TestObject bean = mapper.mapFieldSet(fieldSet); assertEquals(9, bean.getVarLong()); assertEquals(78, bean.getVarInt()); @@ -406,7 +416,7 @@ public class BeanWrapperFieldSetMapperTests { editors.put(Float.TYPE, new CustomNumberEditor(Float.class, NumberFormat.getInstance(Locale.UK), true)); mapper.setCustomEditors(editors); - TestObject bean = (TestObject) mapper.mapFieldSet(fieldSet); + TestObject bean = mapper.mapFieldSet(fieldSet); assertEquals(9876.1, bean.getVarDouble(), 0.01); assertEquals(7890.1, bean.getVarFloat(), 0.01); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/DefaultLineMapperTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/DefaultLineMapperTests.java index 4cb6e9299..e61d66dad 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/DefaultLineMapperTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/DefaultLineMapperTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file.mapping; import static org.mockito.Mockito.mock; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/JsonLineMapperTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/JsonLineMapperTests.java index 2c4ac6e69..30cc51c2e 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/JsonLineMapperTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/JsonLineMapperTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file.mapping; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/PassThroughLineMapperTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/PassThroughLineMapperTests.java index 5e88bb64a..1d8d7c177 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/PassThroughLineMapperTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/PassThroughLineMapperTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file.mapping; import static org.junit.Assert.*; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/separator/JsonRecordSeparatorPolicyTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/separator/JsonRecordSeparatorPolicyTests.java index 9ec34e591..ffb193a74 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/separator/JsonRecordSeparatorPolicyTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/separator/JsonRecordSeparatorPolicyTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file.separator; import static org.junit.Assert.*; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/CommonLineTokenizerTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/CommonLineTokenizerTests.java index 5528a0c56..2510464b9 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/CommonLineTokenizerTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/CommonLineTokenizerTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file.transform; import java.util.List; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/Name.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/Name.java index 4a37322d3..b0cd6a397 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/Name.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/Name.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file.transform; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/PassThroughLineAggregatorTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/PassThroughLineAggregatorTests.java index ed0a28921..7d7cac469 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/PassThroughLineAggregatorTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/PassThroughLineAggregatorTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file.transform; import junit.framework.TestCase; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/RangeArrayPropertyEditorTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/RangeArrayPropertyEditorTests.java index cd7f88097..b4ef518ad 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/RangeArrayPropertyEditorTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/RangeArrayPropertyEditorTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.file.transform; import junit.framework.TestCase; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/sample/Foo.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/sample/Foo.java index 9cc25fe58..79383d306 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/sample/Foo.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/sample/Foo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.sample; import javax.persistence.Entity; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/sample/FooService.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/sample/FooService.java index bf8c19528..023a3ab88 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/sample/FooService.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/sample/FooService.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.sample; import java.util.ArrayList; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/CompositeItemProcessorTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/CompositeItemProcessorTests.java index 7dcfa6010..05afe9a9d 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/CompositeItemProcessorTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/CompositeItemProcessorTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.support; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/CompositeItemStreamTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/CompositeItemStreamTests.java index 53ad92105..bc222a525 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/CompositeItemStreamTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/CompositeItemStreamTests.java @@ -22,7 +22,6 @@ import junit.framework.TestCase; import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.item.ItemStream; -import org.springframework.batch.item.ItemStreamException; import org.springframework.batch.item.ItemStreamSupport; import org.springframework.batch.item.support.CompositeItemStream; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/CompositeItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/CompositeItemWriterTests.java index dc418e01a..ff89af68e 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/CompositeItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/CompositeItemWriterTests.java @@ -1,8 +1,21 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.support; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - import java.util.ArrayList; import java.util.Collections; import java.util.List; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/TransactionAwareListItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/TransactionAwareListItemReaderTests.java index 24a299cb0..d7e658e0a 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/TransactionAwareListItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/TransactionAwareListItemReaderTests.java @@ -51,9 +51,9 @@ public class TransactionAwareListItemReaderTests extends TestCase { PlatformTransactionManager transactionManager = new ResourcelessTransactionManager(); final List taken = new ArrayList(); try { - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { taken.add(reader.read()); return null; } @@ -78,9 +78,9 @@ public class TransactionAwareListItemReaderTests extends TestCase { public void testTransactionalExhausted() throws Exception { PlatformTransactionManager transactionManager = new ResourcelessTransactionManager(); final List taken = new ArrayList(); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { Object next = reader.read(); while (next != null) { taken.add(next); @@ -97,9 +97,9 @@ public class TransactionAwareListItemReaderTests extends TestCase { PlatformTransactionManager transactionManager = new ResourcelessTransactionManager(); final List taken = new ArrayList(); try { - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { taken.add(reader.read()); throw new RuntimeException("Rollback!"); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/util/ExecutionContextUserSupportTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/util/ExecutionContextUserSupportTests.java index 5d7ae29af..628ba9808 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/util/ExecutionContextUserSupportTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/util/ExecutionContextUserSupportTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.util; import org.springframework.batch.item.util.ExecutionContextUserSupport; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/util/FileUtilsTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/util/FileUtilsTests.java index b4091f0c7..1d8bbe67c 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/util/FileUtilsTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/util/FileUtilsTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.util; import java.io.BufferedWriter; @@ -136,6 +151,7 @@ public class FileUtilsTests { @Test public void testBadFile(){ + @SuppressWarnings("serial") File file = new File("new file"){ @Override public boolean createNewFile() throws IOException { @@ -155,6 +171,7 @@ public class FileUtilsTests { @Test public void testCouldntCreateFile(){ + @SuppressWarnings("serial") File file = new File("new file"){ @Override diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/validator/SpringValidatorTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/validator/SpringValidatorTests.java index bc09b5440..4430c0424 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/validator/SpringValidatorTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/validator/SpringValidatorTests.java @@ -112,8 +112,7 @@ public class SpringValidatorTests { public static final TestBean REJECT_MULTI_VALUE = new TestBean("foo", "bar"); @Override - @SuppressWarnings({ "rawtypes", "unchecked" }) - public boolean supports(Class clazz) { + public boolean supports(Class clazz) { return clazz.isAssignableFrom(TestBean.class); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/validator/ValidatingItemProcessorTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/validator/ValidatingItemProcessorTests.java index 9b1d0e4b6..0a1ea4ff4 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/validator/ValidatingItemProcessorTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/validator/ValidatingItemProcessorTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.validator; import static org.mockito.Mockito.mock; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/EventHelper.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/EventHelper.java index f1b9a55bd..212f7eb0b 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/EventHelper.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/EventHelper.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml; import javax.xml.stream.events.EndElement; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemReaderCommonTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemReaderCommonTests.java index dbd49d35e..6f8670c2d 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemReaderCommonTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemReaderCommonTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml; import static org.junit.Assert.assertTrue; @@ -48,8 +63,7 @@ public class StaxEventItemReaderCommonTests extends AbstractItemStreamItemReader } @Override - @SuppressWarnings("rawtypes") - public boolean supports(Class clazz) { + public boolean supports(Class clazz) { return true; } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemReaderTests.java index 1ac80b4d6..f066e97f2 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemReaderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml; import static org.junit.Assert.assertEquals; @@ -576,8 +591,7 @@ public class StaxEventItemReaderTests { } @Override - @SuppressWarnings("rawtypes") - public boolean supports(Class clazz) { + public boolean supports(Class clazz) { return true; } @@ -634,8 +648,7 @@ public class StaxEventItemReaderTests { } @Override - @SuppressWarnings("rawtypes") - public boolean supports(Class clazz) { + public boolean supports(Class clazz) { return true; } @@ -676,7 +689,7 @@ public class StaxEventItemReaderTests { } catch (Exception e) { - throw new RuntimeException("Error occured in FragmentDeserializer", e); + throw new RuntimeException("Error occurred in FragmentDeserializer", e); } return fragmentContent; } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemWriterTests.java index 52845b423..2cf6be56d 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemWriterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml; import static org.junit.Assert.assertEquals; @@ -13,7 +28,6 @@ import java.util.Collections; import java.util.List; import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.namespace.QName; import javax.xml.stream.XMLEventFactory; import javax.xml.stream.XMLEventWriter; import javax.xml.stream.XMLStreamException; @@ -163,15 +177,14 @@ public class StaxEventItemWriterTests { } @Test - @SuppressWarnings({"unchecked", "rawtypes"}) public void testTransactionalRestart() throws Exception { writer.open(executionContext); PlatformTransactionManager transactionManager = new ResourcelessTransactionManager(); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { // write item writer.write(items); @@ -189,9 +202,9 @@ public class StaxEventItemWriterTests { // create new writer from saved restart data and continue writing writer = createItemWriter(); writer.open(executionContext); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write(items); } @@ -230,9 +243,9 @@ public class StaxEventItemWriterTests { PlatformTransactionManager transactionManager = new ResourcelessTransactionManager(); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { // write item writer.write(itemsMultiByte); @@ -251,9 +264,9 @@ public class StaxEventItemWriterTests { writer = createItemWriter(); writer.setEncoding(encoding); writer.open(executionContext); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write(itemsMultiByte); } @@ -275,16 +288,15 @@ public class StaxEventItemWriterTests { } @Test - @SuppressWarnings({"unchecked", "rawtypes"}) public void testTransactionalRestartFailOnFirstWrite() throws Exception { PlatformTransactionManager transactionManager = new ResourcelessTransactionManager(); writer.open(executionContext); try { - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write(items); } @@ -304,9 +316,9 @@ public class StaxEventItemWriterTests { // create new writer from saved restart data and continue writing writer = createItemWriter(); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { writer.open(executionContext); try { writer.write(items); @@ -944,8 +956,7 @@ public class StaxEventItemWriterTests { } @Override - @SuppressWarnings("rawtypes") - public boolean supports(Class clazz) { + public boolean supports(Class clazz) { return true; } } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/TransactionalStaxEventItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/TransactionalStaxEventItemWriterTests.java index abc632f0b..3a744eb43 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/TransactionalStaxEventItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/TransactionalStaxEventItemWriterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml; import static org.junit.Assert.assertEquals; @@ -71,9 +86,9 @@ public class TransactionalStaxEventItemWriterTests { @Test public void testWriteAndFlush() throws Exception { writer.open(executionContext); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write(items); } @@ -111,9 +126,9 @@ public class TransactionalStaxEventItemWriterTests { }); writer.open(executionContext); try { - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write(items); } @@ -130,9 +145,9 @@ public class TransactionalStaxEventItemWriterTests { } writer.close(); writer.open(executionContext); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write(items); } @@ -170,9 +185,9 @@ public class TransactionalStaxEventItemWriterTests { }); writer.open(executionContext); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write(items); } @@ -186,9 +201,9 @@ public class TransactionalStaxEventItemWriterTests { writer.close(); writer.open(executionContext); try { - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write(items); } @@ -231,8 +246,7 @@ public class TransactionalStaxEventItemWriterTests { } @Override - @SuppressWarnings("rawtypes") - public boolean supports(Class clazz) { + public boolean supports(Class clazz) { return true; } } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/stax/DefaultFragmentEventReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/stax/DefaultFragmentEventReaderTests.java index 39193e9a8..8e1717ae2 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/stax/DefaultFragmentEventReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/stax/DefaultFragmentEventReaderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml.stax; import java.util.NoSuchElementException; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/stax/NoStartEndDocumentWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/stax/NoStartEndDocumentWriterTests.java index 1de835ede..23f80f252 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/stax/NoStartEndDocumentWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/stax/NoStartEndDocumentWriterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml.stax; import javax.xml.stream.XMLEventFactory; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/stax/UnclosedElementCollectingEventWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/stax/UnclosedElementCollectingEventWriterTests.java index d85c7dc7f..3e896d2db 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/stax/UnclosedElementCollectingEventWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/stax/UnclosedElementCollectingEventWriterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml.stax; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/stax/UnopenedElementClosingEventWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/stax/UnopenedElementClosingEventWriterTests.java index 5d36a7182..b44d5a1a8 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/stax/UnopenedElementClosingEventWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/stax/UnopenedElementClosingEventWriterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.item.xml.stax; import static org.mockito.Mockito.mock; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/jsr/item/ItemProcessorAdapterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/jsr/item/ItemProcessorAdapterTests.java index 70b44bfbb..66eeb5ff6 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/jsr/item/ItemProcessorAdapterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/jsr/item/ItemProcessorAdapterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.jsr.item; import static org.junit.Assert.assertEquals; @@ -12,7 +27,7 @@ import org.mockito.MockitoAnnotations; public class ItemProcessorAdapterTests { - private ItemProcessorAdapter adapter; + private ItemProcessorAdapter adapter; @Mock private ItemProcessor delegate; @@ -20,12 +35,12 @@ public class ItemProcessorAdapterTests { public void setUp() throws Exception { MockitoAnnotations.initMocks(this); - adapter = new ItemProcessorAdapter(delegate); + adapter = new ItemProcessorAdapter(delegate); } @Test(expected=IllegalArgumentException.class) public void testCreateWithNull() { - adapter = new ItemProcessorAdapter(null); + adapter = new ItemProcessorAdapter(null); } @Test diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/jsr/item/ItemReaderAdapterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/jsr/item/ItemReaderAdapterTests.java index cf934c059..b9d613655 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/jsr/item/ItemReaderAdapterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/jsr/item/ItemReaderAdapterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.jsr.item; import static org.junit.Assert.assertEquals; @@ -20,7 +35,7 @@ import org.springframework.batch.item.ItemStreamException; public class ItemReaderAdapterTests { - private ItemReaderAdapter adapter; + private ItemReaderAdapter adapter; @Mock private ItemReader delegate; @Mock @@ -30,12 +45,12 @@ public class ItemReaderAdapterTests { public void setUp() throws Exception { MockitoAnnotations.initMocks(this); - adapter = new ItemReaderAdapter(delegate); + adapter = new ItemReaderAdapter(delegate); } @Test(expected=IllegalArgumentException.class) public void testCreateWithNull() { - adapter = new ItemReaderAdapter(null); + adapter = new ItemReaderAdapter(null); } @Test @@ -96,7 +111,7 @@ public class ItemReaderAdapterTests { @Test @SuppressWarnings("serial") public void testCheckpointChange() throws Exception { - ItemReaderAdapter adapter = new ItemReaderAdapter(new ItemReader() { + ItemReaderAdapter adapter = new ItemReaderAdapter(new ItemReader() { private CheckpointContainer container = null; private List items = new ArrayList() {{ diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/jsr/item/ItemWriterAdapterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/jsr/item/ItemWriterAdapterTests.java index 8f53fb74a..66df674a0 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/jsr/item/ItemWriterAdapterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/jsr/item/ItemWriterAdapterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.jsr.item; import static org.junit.Assert.assertEquals; @@ -20,7 +35,7 @@ import org.springframework.batch.item.ItemStreamException; public class ItemWriterAdapterTests { - private ItemWriterAdapter adapter; + private ItemWriterAdapter adapter; @Mock private ItemWriter delegate; @Mock @@ -30,12 +45,12 @@ public class ItemWriterAdapterTests { public void setUp() throws Exception { MockitoAnnotations.initMocks(this); - adapter = new ItemWriterAdapter(delegate); + adapter = new ItemWriterAdapter(delegate); } @Test(expected=IllegalArgumentException.class) public void testCreateWithNull() { - adapter = new ItemWriterAdapter(null); + adapter = new ItemWriterAdapter(null); } @Test @@ -101,7 +116,7 @@ public class ItemWriterAdapterTests { @Test public void testCheckpointChange() throws Exception { - ItemWriterAdapter adapter = new ItemWriterAdapter(new ItemWriter() { + ItemWriterAdapter adapter = new ItemWriterAdapter(new ItemWriter() { private CheckpointContainer container = null; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/context/SynchronizedAttributeAccessorTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/context/SynchronizedAttributeAccessorTests.java index ef08153ef..0fcb753e6 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/context/SynchronizedAttributeAccessorTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/context/SynchronizedAttributeAccessorTests.java @@ -76,6 +76,7 @@ public class SynchronizedAttributeAccessorTests extends TestCase { } public void testEqualsSupport() { + @SuppressWarnings("serial") AttributeAccessorSupport another = new AttributeAccessorSupport() { }; accessor.setAttribute("foo", "bar"); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/exception/SimpleLimitExceptionHandlerTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/exception/SimpleLimitExceptionHandlerTests.java index fe5219280..956ce3893 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/exception/SimpleLimitExceptionHandlerTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/exception/SimpleLimitExceptionHandlerTests.java @@ -194,6 +194,7 @@ public class SimpleLimitExceptionHandlerTests { handler.setLimit(EXCEPTION_LIMIT); handler.afterPropertiesSet(); + @SuppressWarnings("serial") List throwables = new ArrayList() { { for (int i = 0; i < (EXCEPTION_LIMIT); i++) { @@ -230,6 +231,7 @@ public class SimpleLimitExceptionHandlerTests { handler.setLimit(EXCEPTION_LIMIT); handler.afterPropertiesSet(); + @SuppressWarnings("serial") List throwables = new ArrayList() { { for (int i = 0; i < (EXCEPTION_LIMIT); i++) { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/policy/CountingCompletionPolicyTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/policy/CountingCompletionPolicyTests.java index 44a9699ee..41a36b3c4 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/policy/CountingCompletionPolicyTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/policy/CountingCompletionPolicyTests.java @@ -29,7 +29,7 @@ public class CountingCompletionPolicyTests extends TestCase { @Override protected int getCount(RepeatContext context) { return 1; - }; + } }; RepeatContext context = policy.start(null); assertTrue(policy.isComplete(context)); @@ -40,7 +40,7 @@ public class CountingCompletionPolicyTests extends TestCase { @Override protected int getCount(RepeatContext context) { return 1; - }; + } }; policy.setMaxCount(10); RepeatContext context = policy.start(null); @@ -52,7 +52,7 @@ public class CountingCompletionPolicyTests extends TestCase { @Override protected int getCount(RepeatContext context) { return 1; - }; + } }; policy.setMaxCount(10); RepeatContext context = policy.start(null); @@ -66,7 +66,7 @@ public class CountingCompletionPolicyTests extends TestCase { @Override protected int getCount(RepeatContext context) { return count; - }; + } @Override protected int doUpdate(RepeatContext context) { @@ -89,7 +89,7 @@ public class CountingCompletionPolicyTests extends TestCase { @Override protected int getCount(RepeatContext context) { return count; - }; + } @Override protected int doUpdate(RepeatContext context) { @@ -121,7 +121,7 @@ public class CountingCompletionPolicyTests extends TestCase { @Override protected int getCount(RepeatContext context) { return count; - }; + } @Override protected int doUpdate(RepeatContext context) { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/ChunkedRepeatTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/ChunkedRepeatTests.java index a014e5091..4b09a1760 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/ChunkedRepeatTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/ChunkedRepeatTests.java @@ -150,7 +150,6 @@ public class ChunkedRepeatTests extends AbstractTradeBatchTests { count++; } } - ; final Chunker chunker = new Chunker(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/ResultHolderResultQueueTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/ResultHolderResultQueueTests.java index 921e2b151..c531b24f6 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/ResultHolderResultQueueTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/ResultHolderResultQueueTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.repeat.support; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/SimpleRepeatTemplateTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/SimpleRepeatTemplateTests.java index 6d0e04fe5..46d91d6fd 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/SimpleRepeatTemplateTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/SimpleRepeatTemplateTests.java @@ -437,6 +437,7 @@ public class SimpleRepeatTemplateTests extends AbstractTradeBatchTests { @Test public void testExceptionUnwrapping() { + @SuppressWarnings("serial") class TestException extends Exception { TestException(String msg) { super(msg); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/AnnotationMethodResolverTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/AnnotationMethodResolverTests.java index 2bbeab744..6baeeb098 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/AnnotationMethodResolverTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/AnnotationMethodResolverTests.java @@ -74,7 +74,6 @@ public class AnnotationMethodResolverTests { } - @SuppressWarnings("unused") private static class MultipleAnnotationTestBean { @TestAnnotation diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/DatabaseTypeTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/DatabaseTypeTests.java index cb88196b3..df9e1a955 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/DatabaseTypeTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/DatabaseTypeTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.support; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/ConcurrentTransactionAwareProxyTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/ConcurrentTransactionAwareProxyTests.java index 485b271f7..992e4b066 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/ConcurrentTransactionAwareProxyTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/ConcurrentTransactionAwareProxyTests.java @@ -125,9 +125,9 @@ public class ConcurrentTransactionAwareProxyTests { @Test public void testTransactionalContains() throws Exception { final Map> map = TransactionAwareProxyFactory.createAppendOnlyTransactionalMap(); - boolean result = (Boolean) new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + boolean result = new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Boolean doInTransaction(TransactionStatus status) { return map.containsKey("foo"); } }); @@ -230,9 +230,9 @@ public class ConcurrentTransactionAwareProxyTests { private String saveInSetAndAssert(final Set set, final String value) { - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { set.add(value); return null; } @@ -246,9 +246,9 @@ public class ConcurrentTransactionAwareProxyTests { private String saveInListAndAssert(final List list, final String value) { - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { list.add(value); return null; } @@ -263,9 +263,9 @@ public class ConcurrentTransactionAwareProxyTests { private Map saveInMapAndAssert(final Map> map, final Long id, final String value) { - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { if (!map.containsKey(id)) { map.put(id, new HashMap()); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/ResourcelessTransactionManagerTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/ResourcelessTransactionManagerTests.java index d9ebdbb55..83a3bb3e5 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/ResourcelessTransactionManagerTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/ResourcelessTransactionManagerTests.java @@ -37,9 +37,9 @@ public class ResourcelessTransactionManagerTests { @Test public void testCommit() throws Exception { - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCompletion(int status) { @@ -57,9 +57,9 @@ public class ResourcelessTransactionManagerTests { public void testCommitTwice() throws Exception { testCommit(); txStatus = -1; - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCompletion(int status) { @@ -76,9 +76,9 @@ public class ResourcelessTransactionManagerTests { @Test public void testCommitNested() throws Exception { final TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager); - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCompletion(int status) { @@ -87,9 +87,9 @@ public class ResourcelessTransactionManagerTests { count++; } }); - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { assertEquals(0, count); count++; return null; @@ -109,9 +109,9 @@ public class ResourcelessTransactionManagerTests { count = 0; txStatus = -1; final TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager); - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCompletion(int status) { @@ -120,9 +120,9 @@ public class ResourcelessTransactionManagerTests { count++; } }); - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { assertEquals(0, count); count++; return null; @@ -139,9 +139,9 @@ public class ResourcelessTransactionManagerTests { @Test public void testRollback() throws Exception { try { - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCompletion(int status) { @@ -164,9 +164,9 @@ public class ResourcelessTransactionManagerTests { public void testRollbackNestedInner() throws Exception { final TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager); try { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCompletion(int status) { @@ -175,9 +175,9 @@ public class ResourcelessTransactionManagerTests { count++; } }); - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { assertEquals(0, count); count++; throw new RuntimeException("Rollback!"); @@ -200,9 +200,9 @@ public class ResourcelessTransactionManagerTests { public void testRollbackNestedOuter() throws Exception { final TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager); try { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCompletion(int status) { @@ -211,9 +211,9 @@ public class ResourcelessTransactionManagerTests { count++; } }); - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { assertEquals(0, count); count++; return null; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/TransactionAwareBufferedWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/TransactionAwareBufferedWriterTests.java index 91fa63a73..634cd79c3 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/TransactionAwareBufferedWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/TransactionAwareBufferedWriterTests.java @@ -29,8 +29,6 @@ import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; -import javax.validation.constraints.AssertTrue; - import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -143,13 +141,12 @@ public class TransactionAwareBufferedWriterTests { } @Test - @SuppressWarnings({"unchecked", "rawtypes"}) public void testFlushInTransaction() throws Exception { when(fileChannel.write((ByteBuffer)anyObject())).thenReturn(3); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write("foo"); writer.flush(); @@ -166,14 +163,13 @@ public class TransactionAwareBufferedWriterTests { } @Test - @SuppressWarnings({"unchecked", "rawtypes"}) public void testFlushInTransactionForceSync() throws Exception { writer.setForceSync(true); when(fileChannel.write((ByteBuffer)anyObject())).thenReturn(3); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write("foo"); writer.flush(); @@ -190,14 +186,13 @@ public class TransactionAwareBufferedWriterTests { } @Test - @SuppressWarnings({"unchecked", "rawtypes"}) public void testWriteWithCommit() throws Exception { ArgumentCaptor bb = ArgumentCaptor.forClass(ByteBuffer.class); when(fileChannel.write(bb.capture())).thenReturn(3); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write("foo"); } @@ -213,14 +208,13 @@ public class TransactionAwareBufferedWriterTests { } @Test - @SuppressWarnings({"unchecked", "rawtypes"}) public void testBufferSizeInTransaction() throws Exception { ArgumentCaptor bb = ArgumentCaptor.forClass(ByteBuffer.class); when(fileChannel.write(bb.capture())).thenReturn(3); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write("foo"); } @@ -236,15 +230,14 @@ public class TransactionAwareBufferedWriterTests { } @Test - @SuppressWarnings({"unchecked", "rawtypes"}) // BATCH-1959 public void testBufferSizeInTransactionWithMultiByteCharacterUTF8() throws Exception { ArgumentCaptor bb = ArgumentCaptor.forClass(ByteBuffer.class); when(fileChannel.write(bb.capture())).thenReturn(5); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write("fóó"); } @@ -260,7 +253,6 @@ public class TransactionAwareBufferedWriterTests { } @Test - @SuppressWarnings({"unchecked", "rawtypes"}) // BATCH-1959 public void testBufferSizeInTransactionWithMultiByteCharacterUTF16BE() throws Exception { writer.setEncoding("UTF-16BE"); @@ -268,9 +260,9 @@ public class TransactionAwareBufferedWriterTests { ArgumentCaptor bb = ArgumentCaptor.forClass(ByteBuffer.class); when(fileChannel.write(bb.capture())).thenReturn(6); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write("fóó"); } @@ -286,12 +278,11 @@ public class TransactionAwareBufferedWriterTests { } @Test - @SuppressWarnings({"unchecked", "rawtypes"}) public void testWriteWithRollback() throws Exception { try { - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write("foo"); } @@ -318,7 +309,6 @@ public class TransactionAwareBufferedWriterTests { } @Test - @SuppressWarnings({"unchecked", "rawtypes"}) public void testExceptionOnFlush() throws Exception { writer = new TransactionAwareBufferedWriter(fileChannel, new Runnable() { @Override @@ -327,9 +317,9 @@ public class TransactionAwareBufferedWriterTests { }); try { - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { writer.write("foo"); } @@ -348,13 +338,13 @@ public class TransactionAwareBufferedWriterTests { // BATCH-2018 @Test - @SuppressWarnings({"unchecked", "rawtypes"}) public void testResourceKeyCollision() throws Exception { final int limit = 5000; final TransactionAwareBufferedWriter[] writers = new TransactionAwareBufferedWriter[limit]; final String[] results = new String[limit]; for(int i = 0; i< limit; i++) { final int index = i; + @SuppressWarnings("resource") FileChannel fileChannel = mock(FileChannel.class); when(fileChannel.write(any(ByteBuffer.class))).thenAnswer(new Answer() { @Override @@ -373,9 +363,9 @@ public class TransactionAwareBufferedWriterTests { writers[i] = new TransactionAwareBufferedWriter(fileChannel, null); } - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { try { for(int i=0; i< limit; i++) { writers[i].write(String.valueOf(i)); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/TransactionAwareListFactoryTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/TransactionAwareListFactoryTests.java index f65562b6a..657e5311d 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/TransactionAwareListFactoryTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/TransactionAwareListFactoryTests.java @@ -65,9 +65,9 @@ public class TransactionAwareListFactoryTests { @Test public void testTransactionalAdd() throws Exception { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testAdd(); return null; } @@ -77,9 +77,9 @@ public class TransactionAwareListFactoryTests { @Test public void testTransactionalRemove() throws Exception { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testRemove(); return null; } @@ -89,9 +89,9 @@ public class TransactionAwareListFactoryTests { @Test public void testTransactionalClear() throws Exception { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testClear(); return null; } @@ -102,9 +102,9 @@ public class TransactionAwareListFactoryTests { @Test public void testTransactionalAddWithRollback() throws Exception { try { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testAdd(); throw new RuntimeException("Rollback!"); } @@ -120,9 +120,9 @@ public class TransactionAwareListFactoryTests { @Test public void testTransactionalRemoveWithRollback() throws Exception { try { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testRemove(); throw new RuntimeException("Rollback!"); } @@ -138,9 +138,9 @@ public class TransactionAwareListFactoryTests { @Test public void testTransactionalClearWithRollback() throws Exception { try { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testClear(); throw new RuntimeException("Rollback!"); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/TransactionAwareMapFactoryTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/TransactionAwareMapFactoryTests.java index 789953de4..57acadc6c 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/TransactionAwareMapFactoryTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/TransactionAwareMapFactoryTests.java @@ -72,9 +72,9 @@ public class TransactionAwareMapFactoryTests extends TestCase { } public void testTransactionalAdd() throws Exception { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testAdd(); return null; } @@ -83,9 +83,9 @@ public class TransactionAwareMapFactoryTests extends TestCase { } public void testTransactionalEmpty() throws Exception { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testEmpty(); return null; } @@ -94,9 +94,9 @@ public class TransactionAwareMapFactoryTests extends TestCase { } public void testTransactionalValues() throws Exception { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testValues(); return null; } @@ -105,9 +105,9 @@ public class TransactionAwareMapFactoryTests extends TestCase { } public void testTransactionalRemove() throws Exception { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testRemove(); return null; } @@ -116,9 +116,9 @@ public class TransactionAwareMapFactoryTests extends TestCase { } public void testTransactionalClear() throws Exception { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testClear(); return null; } @@ -128,9 +128,9 @@ public class TransactionAwareMapFactoryTests extends TestCase { public void testTransactionalAddWithRollback() throws Exception { try { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testAdd(); throw new RuntimeException("Rollback!"); } @@ -145,9 +145,9 @@ public class TransactionAwareMapFactoryTests extends TestCase { public void testTransactionalRemoveWithRollback() throws Exception { try { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testRemove(); throw new RuntimeException("Rollback!"); } @@ -162,9 +162,9 @@ public class TransactionAwareMapFactoryTests extends TestCase { public void testTransactionalClearWithRollback() throws Exception { try { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testClear(); throw new RuntimeException("Rollback!"); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/TransactionAwareSetFactoryTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/TransactionAwareSetFactoryTests.java index 515a332fd..c7366fc9b 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/TransactionAwareSetFactoryTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/TransactionAwareSetFactoryTests.java @@ -66,9 +66,9 @@ public class TransactionAwareSetFactoryTests { @Test public void testTransactionalAdd() throws Exception { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testAdd(); return null; } @@ -78,9 +78,9 @@ public class TransactionAwareSetFactoryTests { @Test public void testTransactionalRemove() throws Exception { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testRemove(); return null; } @@ -90,9 +90,9 @@ public class TransactionAwareSetFactoryTests { @Test public void testTransactionalClear() throws Exception { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testClear(); return null; } @@ -103,9 +103,9 @@ public class TransactionAwareSetFactoryTests { @Test public void testTransactionalAddWithRollback() throws Exception { try { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testAdd(); throw new RuntimeException("Rollback!"); } @@ -121,9 +121,9 @@ public class TransactionAwareSetFactoryTests { @Test public void testTransactionalRemoveWithRollback() throws Exception { try { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testRemove(); throw new RuntimeException("Rollback!"); } @@ -139,9 +139,9 @@ public class TransactionAwareSetFactoryTests { @Test public void testTransactionalClearWithRollback() throws Exception { try { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { testClear(); throw new RuntimeException("Rollback!"); } diff --git a/spring-batch-infrastructure/src/test/java/test/jdbc/datasource/DataSourceInitializer.java b/spring-batch-infrastructure/src/test/java/test/jdbc/datasource/DataSourceInitializer.java index a13153ba6..8fbe4f4f1 100644 --- a/spring-batch-infrastructure/src/test/java/test/jdbc/datasource/DataSourceInitializer.java +++ b/spring-batch-infrastructure/src/test/java/test/jdbc/datasource/DataSourceInitializer.java @@ -71,6 +71,7 @@ public class DataSourceInitializer implements InitializingBean, DisposableBean { * * @param args */ + @SuppressWarnings("resource") public static void main(String... args) { new ClassPathXmlApplicationContext(ClassUtils.addResourcePathToPackagePath(DataSourceInitializer.class, DataSourceInitializer.class.getSimpleName() + "-context.xml")); @@ -136,11 +137,11 @@ public class DataSourceInitializer implements InitializingBean, DisposableBean { final JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); TransactionTemplate transactionTemplate = new TransactionTemplate(new DataSourceTransactionManager(dataSource)); - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override @SuppressWarnings("unchecked") - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { String[] scripts; try { scripts = StringUtils.delimitedListToStringArray(stripComments(IOUtils.readLines(scriptResource diff --git a/spring-batch-infrastructure/src/test/java/test/jdbc/datasource/DerbyDataSourceFactoryBean.java b/spring-batch-infrastructure/src/test/java/test/jdbc/datasource/DerbyDataSourceFactoryBean.java index b9cfd1a3e..6199364b1 100644 --- a/spring-batch-infrastructure/src/test/java/test/jdbc/datasource/DerbyDataSourceFactoryBean.java +++ b/spring-batch-infrastructure/src/test/java/test/jdbc/datasource/DerbyDataSourceFactoryBean.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package test.jdbc.datasource; import java.io.File; @@ -9,7 +24,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.derby.jdbc.EmbeddedDataSource; import org.springframework.beans.factory.config.AbstractFactoryBean; -public class DerbyDataSourceFactoryBean extends AbstractFactoryBean { +public class DerbyDataSourceFactoryBean extends AbstractFactoryBean { private static Log logger = LogFactory.getLog(DerbyDataSourceFactoryBean.class); @@ -20,7 +35,7 @@ public class DerbyDataSourceFactoryBean extends AbstractFactoryBean { } @Override - protected Object createInstance() throws Exception { + protected DataSource createInstance() throws Exception { File directory = new File(dataDirectory); System.setProperty("derby.system.home", directory.getCanonicalPath()); System.setProperty("derby.storage.fileSyncTransactionLog", "true"); diff --git a/spring-batch-infrastructure/src/test/java/test/jdbc/datasource/DerbyShutdownBean.java b/spring-batch-infrastructure/src/test/java/test/jdbc/datasource/DerbyShutdownBean.java index 0c551f820..1dcf0833e 100644 --- a/spring-batch-infrastructure/src/test/java/test/jdbc/datasource/DerbyShutdownBean.java +++ b/spring-batch-infrastructure/src/test/java/test/jdbc/datasource/DerbyShutdownBean.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package test.jdbc.datasource; import java.sql.SQLException; diff --git a/spring-batch-infrastructure/src/test/java/test/jdbc/proc/derby/TestProcedures.java b/spring-batch-infrastructure/src/test/java/test/jdbc/proc/derby/TestProcedures.java index e3832d246..06a5a7443 100644 --- a/spring-batch-infrastructure/src/test/java/test/jdbc/proc/derby/TestProcedures.java +++ b/spring-batch-infrastructure/src/test/java/test/jdbc/proc/derby/TestProcedures.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package test.jdbc.proc.derby; import java.sql.*; diff --git a/spring-batch-infrastructure/src/test/resources/org/springframework/batch/item/database/ibatis-foo.xml b/spring-batch-infrastructure/src/test/resources/org/springframework/batch/item/database/ibatis-foo.xml index d418da081..7540d29a3 100644 --- a/spring-batch-infrastructure/src/test/resources/org/springframework/batch/item/database/ibatis-foo.xml +++ b/spring-batch-infrastructure/src/test/resources/org/springframework/batch/item/database/ibatis-foo.xml @@ -26,11 +26,11 @@ select LIMIT #_skiprows# #_pagesize# ID, NAME, VALUE from T_FOOS order by ID - select LIMIT #_skiprows# #_pagesize# ID, NAME, VALUE from T_FOOS where VALUE >= #limit# order by ID - select ID, NAME, VALUE from T_FOOS where VALUE >= #limit# diff --git a/spring-batch-infrastructure/src/test/resources/org/springframework/batch/retry/interceptor/retry-transaction-test.xml b/spring-batch-infrastructure/src/test/resources/org/springframework/batch/retry/interceptor/retry-transaction-test.xml deleted file mode 100644 index 3cad105f4..000000000 --- a/spring-batch-infrastructure/src/test/resources/org/springframework/batch/retry/interceptor/retry-transaction-test.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/spring-batch-samples/.springBeans b/spring-batch-samples/.springBeans new file mode 100644 index 000000000..f5fbf33b3 --- /dev/null +++ b/spring-batch-samples/.springBeans @@ -0,0 +1,486 @@ + + + 1 + + + + + + + src/main/resources/jobs/multilineJob.xml + src/main/resources/jobs/multilineOrderJob.xml + src/main/resources/jobs/tradeJob.xml + src/main/resources/jobs/restartSample.xml + src/main/resources/data-source-context.xml + src/main/resources/jobs/beanWrapperMapperSampleJob.xml + src/main/resources/jobs/adhocLoopJob.xml + src/main/resources/jobs/infiniteLoopJob.xml + src/main/resources/jobs/footballJob.xml + src/main/resources/jobs/delegatingJob.xml + src/main/resources/jobs/parallelJob.xml + src/main/resources/jobs/retrySample.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/adhoc-job-launcher-context.xml + src/main/resources/quartz-job-launcher-context.xml + src/main/resources/jobs/skipSampleJob.xml + src/main/resources/jobs/multilineOrderInputTokenizers.xml + src/main/resources/jobs/multilineOrderOutputAggregators.xml + src/main/resources/jobs/compositeItemWriterSampleJob.xml + src/main/resources/hibernate-context.xml + src/main/resources/staging-test-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + src/main/resources/jobs/headerFooterSample.xml + src/main/resources/jobs/customerFilterJob.xml + src/main/resources/skipSample-job-launcher-context.xml + src/main/resources/jobs/ioSampleJob.xml + src/main/resources/jobs/iosample/delimited.xml + src/main/resources/jobs/iosample/fixedLength.xml + src/main/resources/jobs/iosample/jdbcCursor.xml + src/main/resources/jobs/iosample/multiLine.xml + src/main/resources/jobs/iosample/multiRecordType.xml + src/main/resources/jobs/iosample/multiResource.xml + src/main/resources/jobs/iosample/xml.xml + src/main/resources/jobs/iosample/hibernate.xml + src/main/resources/jobs/hibernateJob.xml + src/main/resources/jobs/iosample/jpa.xml + src/main/resources/jobs/iosample/ibatis.xml + src/test/resources/org/springframework/batch/sample/domain/trade/internal/JdbcCustomerDebitDaoTests-context.xml + src/main/resources/jobs/loopFlowSample.xml + src/test/resources/org/springframework/batch/sample/common/StagingItemReaderTests-context.xml + src/test/resources/org/springframework/batch/sample/common/StagingItemWriterTests-context.xml + src/main/resources/jobs/multilineOrderValidator.xml + src/main/resources/jobs/restartFileSampleJob.xml + src/main/resources/jobs/taskletJob.xml + src/main/resources/org/springframework/batch/sample/football-job-context.xml + src/main/resources/jobs/groovyJob.xml + src/main/resources/jobs/iosample/jdbcPaging.xml + src/main/resources/jobs/partitionJdbcJob.xml + src/main/resources/jobs/jobStepSample.xml + src/main/resources/jobs/partitionFileJob.xml + src/test/resources/org/springframework/batch/sample/common/ColumnRangePartitionerTests-context.xml + src/test/resources/job-runner-context.xml + src/test/resources/org/springframework/batch/sample/JobStepFunctionalTests-context.xml + src/main/resources/jobs/mailJob.xml + src/main/resources/META-INF/spring/jobs/amqp/amqp-example-job-beans.xml + src/main/resources/jobs/amqp-example-job.xml + src/main/resources/META-INF/spring/jobs/amqp/amqp-example-job.xml + src/main/resources/META-INF/spring/config-beans.xml + src/main/resources/META-INF/spring/jobs/messaging/rabbitmq-beans.xml + src/main/resources/jobs/iosample/repository.xml + java:org.springframework.batch.sample.config.DataSourceConfiguration + java:org.springframework.batch.sample.config.JobRunnerConfiguration + java:org.springframework.batch.sample.config.RetrySampleConfiguration + + + + + true + false + + src/main/resources/data-source-context.xml + + + + + + + true + false + + src/main/resources/jobs/beanWrapperMapperSampleJob.xml + src/main/resources/data-source-context.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/jobs/delegatingJob.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/jobs/footballJob.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + + + + + + + true + false + + src/main/resources/jobs/infiniteLoopJob.xml + src/main/resources/data-source-context.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/jobs/multilineJob.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/jobs/parallelJob.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/jobs/restartSample.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + + + + + + + true + false + + src/main/resources/jobs/retrySample.xml + src/main/resources/data-source-context.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/jobs/tradeJob.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/quartz-job-launcher-context.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + src/main/resources/jobs/compositeItemWriterSampleJob.xml + + + + + + + true + false + + src/main/resources/jobs/adhocLoopJob.xml + src/main/resources/data-source-context.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/staging-test-context.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + src/main/resources/simple-job-launcher-context.xml + + + + + + + true + false + + src/main/resources/adhoc-job-launcher-context.xml + src/main/resources/data-source-context.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/jobs/headerFooterSample.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + src/main/resources/simple-job-launcher-context.xml + + + + + + + true + false + + src/main/resources/jobs/customerFilterJob.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/data-source-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + src/main/resources/hibernate-context.xml + src/main/resources/jobs/hibernateJob.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/jobs/skipSampleJob.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + src/main/resources/skipSample-job-launcher-context.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/jobs/ioSampleJob.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/hibernate-context.xml + src/main/resources/jobs/iosample/hibernate.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/jobs/iosample/jdbcCursor.xml + src/main/resources/jobs/ioSampleJob.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + src/main/resources/simple-job-launcher-context.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/jobs/iosample/multiLine.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + src/main/resources/simple-job-launcher-context.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/jobs/iosample/multiRecordType.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + src/main/resources/simple-job-launcher-context.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/jobs/iosample/jpa.xml + src/main/resources/jobs/ioSampleJob.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + src/main/resources/simple-job-launcher-context.xml + + + + + + + true + false + + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + src/main/resources/jobs/iosample/ibatis.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/simple-job-launcher-context.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/jobs/multilineOrderJob.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + src/main/resources/jobs/multilineOrderInputTokenizers.xml + src/main/resources/jobs/multilineOrderOutputAggregators.xml + src/main/resources/jobs/multilineOrderValidator.xml + + + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/jobs/restartFileSampleJob.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + + + + + + diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/ColumnRangePartitioner.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/ColumnRangePartitioner.java index 595174f2f..7cafd7627 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/ColumnRangePartitioner.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/ColumnRangePartitioner.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.common; import java.util.HashMap; @@ -61,10 +76,10 @@ public class ColumnRangePartitioner implements Partitioner { * * @see Partitioner#partition(int) */ + @Override public Map partition(int gridSize) { int min = jdbcTemplate.queryForObject("SELECT MIN(" + column + ") from " + table, Integer.class); int max = jdbcTemplate.queryForObject("SELECT MAX(" + column + ") from " + table, Integer.class); - int targetSize = (max - min) / gridSize + 1; Map result = new HashMap(); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/InfiniteLoopReader.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/InfiniteLoopReader.java index 552d57b15..2517208af 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/InfiniteLoopReader.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/InfiniteLoopReader.java @@ -26,6 +26,8 @@ import org.springframework.batch.item.ItemReader; * */ public class InfiniteLoopReader implements ItemReader { + + @Override public Object read() throws Exception { return new Object(); } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/InfiniteLoopWriter.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/InfiniteLoopWriter.java index bad7de40f..bc1ad0ab6 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/InfiniteLoopWriter.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/InfiniteLoopWriter.java @@ -50,6 +50,7 @@ public class InfiniteLoopWriter extends StepExecutionListenerSupport implements super(); } + @Override public void write(List items) throws Exception { try { Thread.sleep(500); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/OutputFileNameListener.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/OutputFileNameListener.java new file mode 100644 index 000000000..c58a3412b --- /dev/null +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/OutputFileNameListener.java @@ -0,0 +1,20 @@ +/* + * Copyright 2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.batch.sample.common; + +public class OutputFileNameListener { + +} diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/ProcessIndicatorItemWrapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/ProcessIndicatorItemWrapper.java index d1b0c4ea1..e34f61c59 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/ProcessIndicatorItemWrapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/ProcessIndicatorItemWrapper.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.common; /** diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemListener.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemListener.java new file mode 100644 index 000000000..eda9e4d7b --- /dev/null +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemListener.java @@ -0,0 +1,56 @@ +/* + * Copyright 2006-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.batch.sample.common; + +import javax.sql.DataSource; + +import org.springframework.batch.core.listener.StepListenerSupport; +import org.springframework.batch.item.ItemReader; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.dao.OptimisticLockingFailureException; +import org.springframework.jdbc.core.JdbcOperations; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.util.Assert; + +/** + * Thread-safe database {@link ItemReader} implementing the process indicator + * pattern. + */ +public class StagingItemListener extends StepListenerSupport implements InitializingBean { + + private JdbcOperations jdbcTemplate; + + public void setDataSource(DataSource dataSource) { + jdbcTemplate = new JdbcTemplate(dataSource); + } + + @Override + public final void afterPropertiesSet() throws Exception { + Assert.notNull(jdbcTemplate, "You must provide a DataSource."); + } + + @Override + public void afterRead(Long id) { + int count = jdbcTemplate.update("UPDATE BATCH_STAGING SET PROCESSED=? WHERE ID=? AND PROCESSED=?", + StagingItemWriter.DONE, id, StagingItemWriter.NEW); + if (count != 1) { + throw new OptimisticLockingFailureException("The staging record with ID=" + id + + " was updated concurrently when trying to mark as complete (updated " + count + " records."); + } + } + +} diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemProcessor.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemProcessor.java index 3bf84b234..dd1fe484e 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemProcessor.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemProcessor.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.common; import javax.sql.DataSource; @@ -33,6 +48,7 @@ public class StagingItemProcessor implements ItemProcessor implements ItemProcessor wrapper) throws Exception { int count = jdbcTemplate.update("UPDATE BATCH_STAGING SET PROCESSED=? WHERE ID=? AND PROCESSED=?", diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/data/CustomerCreditRepository.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/data/CustomerCreditRepository.java index fea3a65e9..cc8f1c852 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/data/CustomerCreditRepository.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/data/CustomerCreditRepository.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.data; import java.math.BigDecimal; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/Game.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/Game.java index f4cf63891..0cf1efa1c 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/Game.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/Game.java @@ -18,6 +18,7 @@ package org.springframework.batch.sample.domain.football; import java.io.Serializable; +@SuppressWarnings("serial") public class Game implements Serializable { private String id; @@ -217,6 +218,7 @@ public class Game implements Serializable { } + @Override public String toString() { return "Game: ID=" + id + " " + team + " vs. " + opponent + diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/Player.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/Player.java index b97c26cf5..fbc6bd95e 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/Player.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/Player.java @@ -18,6 +18,7 @@ package org.springframework.batch.sample.domain.football; import java.io.Serializable; +@SuppressWarnings("serial") public class Player implements Serializable { private String id; @@ -27,6 +28,7 @@ public class Player implements Serializable { private int birthYear; private int debutYear; + @Override public String toString() { return "PLAYER:id=" + id + ",Last Name=" + lastName + diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/FootballExceptionHandler.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/FootballExceptionHandler.java new file mode 100644 index 000000000..9a8131c77 --- /dev/null +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/FootballExceptionHandler.java @@ -0,0 +1,41 @@ +/* + * Copyright 2006-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.batch.sample.domain.football.internal; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.batch.repeat.RepeatContext; +import org.springframework.batch.repeat.exception.ExceptionHandler; + +public class FootballExceptionHandler implements ExceptionHandler { + + private static final Log logger = LogFactory + .getLog(FootballExceptionHandler.class); + + @Override + public void handleException(RepeatContext context, Throwable throwable) + throws Throwable { + + if (!(throwable instanceof NumberFormatException)) { + throw throwable; + } else { + logger.error("Number Format Exception!", throwable); + } + + } + +} diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/GameFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/GameFieldSetMapper.java index 3121b50fe..9b48e2ecb 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/GameFieldSetMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/GameFieldSetMapper.java @@ -22,6 +22,7 @@ import org.springframework.batch.sample.domain.football.Game; public class GameFieldSetMapper implements FieldSetMapper { + @Override public Game mapFieldSet(FieldSet fs) { if(fs == null){ diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDao.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDao.java index 6074bde1f..37e916ea8 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDao.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDao.java @@ -29,6 +29,7 @@ public class JdbcGameDao extends JdbcDaoSupport implements ItemWriter { private SimpleJdbcInsert insertGame; + @Override protected void initDao() throws Exception { super.initDao(); insertGame = new SimpleJdbcInsert(getDataSource()).withTableName("GAMES").usingColumns("player_id", "year_no", @@ -36,6 +37,7 @@ public class JdbcGameDao extends JdbcDaoSupport implements ItemWriter { "rushes", "rush_yards", "receptions", "receptions_yards", "total_td"); } + @Override public void write(List games) { for (Game game : games) { diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerDao.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerDao.java index b406ed006..5519f8f20 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerDao.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerDao.java @@ -36,7 +36,8 @@ public class JdbcPlayerDao implements PlayerDao { private NamedParameterJdbcOperations namedParameterJdbcTemplate; - public void savePlayer(Player player) { + @Override + public void savePlayer(Player player) { namedParameterJdbcTemplate.update(INSERT_PLAYER, new BeanPropertySqlParameterSource(player)); } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerSummaryDao.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerSummaryDao.java index f3ca7b1ad..9339c246e 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerSummaryDao.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerSummaryDao.java @@ -35,6 +35,7 @@ public class JdbcPlayerSummaryDao implements ItemWriter { private NamedParameterJdbcOperations namedParameterJdbcTemplate; + @Override public void write(List summaries) { for (PlayerSummary summary : summaries) { diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerFieldSetMapper.java index 7fdadf1e2..6c5bdbd0e 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerFieldSetMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerFieldSetMapper.java @@ -22,6 +22,7 @@ import org.springframework.batch.sample.domain.football.Player; public class PlayerFieldSetMapper implements FieldSetMapper { + @Override public Player mapFieldSet(FieldSet fs) { if(fs == null){ diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerItemWriter.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerItemWriter.java index 57945a217..3911b9112 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerItemWriter.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerItemWriter.java @@ -26,6 +26,7 @@ public class PlayerItemWriter implements ItemWriter { private PlayerDao playerDao; + @Override public void write(List players) throws Exception { for (Player player : players) { playerDao.savePlayer(player); 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 fea712fd0..5a5778f40 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 @@ -32,6 +32,7 @@ public class PlayerSummaryMapper implements ParameterizedRowMapper { /* (non-Javadoc) * @see org.springframework.jdbc.core.RowMapper#mapRow(java.sql.ResultSet, int) */ - public Object mapRow(ResultSet rs, int rowNum) throws SQLException { + @Override + public PlayerSummary mapRow(ResultSet rs, int rowNum) throws SQLException { PlayerSummary summary = new PlayerSummary(); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/TestMailErrorHandler.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/TestMailErrorHandler.java index c8ae95d4f..5e1db742f 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/TestMailErrorHandler.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/TestMailErrorHandler.java @@ -39,6 +39,7 @@ public class TestMailErrorHandler implements MailErrorHandler { private List failedMessages = new ArrayList(); + @Override public void handle(MailMessage failedMessage, Exception ex) { this.failedMessages.add(failedMessage); LOGGER.error("Mail message failed: " + failedMessage, ex); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/TestMailSender.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/TestMailSender.java index 27cdcf4a7..badef2cb3 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/TestMailSender.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/TestMailSender.java @@ -43,14 +43,16 @@ public class TestMailSender implements MailSender { received.clear(); } + @Override public void send(SimpleMailMessage simpleMessage) throws MailException { - throw new UnsupportedOperationException("Not implememted. Use send(SimpleMailMessage[])."); + throw new UnsupportedOperationException("Not implemented. Use send(SimpleMailMessage[])."); } public void setSubjectsToFail(List subjectsToFail) { this.subjectsToFail = subjectsToFail; } + @Override public void send(SimpleMailMessage[] simpleMessages) throws MailException { Map failedMessages = new LinkedHashMap(); for (SimpleMailMessage simpleMessage : simpleMessages) { diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/UserMailItemProcessor.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/UserMailItemProcessor.java index 38c6b4215..04d59daa7 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/UserMailItemProcessor.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/UserMailItemProcessor.java @@ -33,7 +33,8 @@ public class UserMailItemProcessor implements /** * @see org.springframework.batch.item.ItemProcessor#process(java.lang.Object) */ - public SimpleMailMessage process( User user ) throws Exception { + @Override + public SimpleMailMessage process( User user ) throws Exception { SimpleMailMessage message = new SimpleMailMessage(); message.setTo( user.getEmail() ); message.setFrom( "communications@thecompany.com" ); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItemFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItemFieldSetMapper.java index 24997b8ef..5ba36eca2 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItemFieldSetMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItemFieldSetMapper.java @@ -70,6 +70,7 @@ public class AggregateItemFieldSetMapper implements FieldSetMapper implements FieldSetMapper mapFieldSet(FieldSet fieldSet) throws BindException { if (fieldSet.readString(0).equals(begin)) { diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItemReader.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItemReader.java index 722833e7f..46c950614 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItemReader.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItemReader.java @@ -32,8 +32,8 @@ import org.springframework.batch.item.ItemReader; * {@link AggregateItem} which responds true to its query methods * is*().

    * - * This class is thread safe (it can be used concurrently by multiple threads) - * as long as the {@link ItemReader} is also thread safe. + * This class is thread-safe (it can be used concurrently by multiple threads) + * as long as the {@link ItemReader} is also thread-safe. * * @see AggregateItem#isHeader() * @see AggregateItem#isFooter() @@ -52,6 +52,7 @@ public class AggregateItemReader implements ItemReader> { * * @see org.springframework.batch.item.ItemReader#read() */ + @Override public List read() throws Exception { ResultHolder holder = new ResultHolder(); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/OrderItemReader.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/OrderItemReader.java index d0345e7b2..1146ed07f 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/OrderItemReader.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/OrderItemReader.java @@ -59,6 +59,7 @@ public class OrderItemReader implements ItemReader { * @throws Exception * @see org.springframework.batch.item.ItemReader#read() */ + @Override public Order read() throws Exception { recordFinished = false; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/OrderLineAggregator.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/OrderLineAggregator.java index 262d92498..c7e8b085f 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/OrderLineAggregator.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/OrderLineAggregator.java @@ -34,6 +34,7 @@ public class OrderLineAggregator implements LineAggregator { private Map> aggregators; + @Override public String aggregate(Order order) { StringBuilder result = new StringBuilder(); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/AddressFieldExtractor.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/AddressFieldExtractor.java index e100431f8..6718df735 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/AddressFieldExtractor.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/AddressFieldExtractor.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.order.internal.extractor; import org.springframework.batch.item.file.transform.FieldExtractor; @@ -10,6 +25,7 @@ import org.springframework.batch.sample.domain.order.Order; */ public class AddressFieldExtractor implements FieldExtractor { + @Override public Object[] extract(Order order) { Address address = order.getBillingAddress(); return new Object[] { "ADDRESS:", address.getAddrLine1(), address.getCity(), address.getZipCode() }; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/BillingInfoFieldExtractor.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/BillingInfoFieldExtractor.java index 411442532..8a9773de0 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/BillingInfoFieldExtractor.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/BillingInfoFieldExtractor.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.order.internal.extractor; import org.springframework.batch.item.file.transform.FieldExtractor; @@ -10,6 +25,7 @@ import org.springframework.batch.sample.domain.order.Order; */ public class BillingInfoFieldExtractor implements FieldExtractor { + @Override public Object[] extract(Order order) { BillingInfo billingInfo = order.getBilling(); return new Object[] { "BILLING:", billingInfo.getPaymentId(), billingInfo.getPaymentDesc() }; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/CustomerFieldExtractor.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/CustomerFieldExtractor.java index 7c06489c4..d1e1464f9 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/CustomerFieldExtractor.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/CustomerFieldExtractor.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.order.internal.extractor; import org.springframework.batch.item.file.transform.FieldExtractor; @@ -10,6 +25,7 @@ import org.springframework.batch.sample.domain.order.Order; */ public class CustomerFieldExtractor implements FieldExtractor { + @Override public Object[] extract(Order order) { Customer customer = order.getCustomer(); return new Object[] { "CUSTOMER:", customer.getRegistrationId(), emptyIfNull(customer.getFirstName()), diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/FooterFieldExtractor.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/FooterFieldExtractor.java index f8295e29d..ac82867b5 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/FooterFieldExtractor.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/FooterFieldExtractor.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.order.internal.extractor; import org.springframework.batch.item.file.transform.FieldExtractor; @@ -9,6 +24,7 @@ import org.springframework.batch.sample.domain.order.Order; */ public class FooterFieldExtractor implements FieldExtractor { + @Override public Object[] extract(Order order) { return new Object[] { "END_ORDER:", order.getTotalPrice() }; } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/HeaderFieldExtractor.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/HeaderFieldExtractor.java index 629f2d7f2..6059beb01 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/HeaderFieldExtractor.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/HeaderFieldExtractor.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.order.internal.extractor; import java.text.SimpleDateFormat; @@ -12,6 +27,7 @@ import org.springframework.batch.sample.domain.order.Order; public class HeaderFieldExtractor implements FieldExtractor { private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); + @Override public Object[] extract(Order order) { return new Object[] { "BEGIN_ORDER:", order.getOrderId(), dateFormat.format(order.getOrderDate()) }; } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/LineItemFieldExtractor.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/LineItemFieldExtractor.java index 3fa8cf67d..faeecfd84 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/LineItemFieldExtractor.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/LineItemFieldExtractor.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.order.internal.extractor; import org.springframework.batch.item.file.transform.FieldExtractor; @@ -9,6 +24,7 @@ import org.springframework.batch.sample.domain.order.LineItem; */ public class LineItemFieldExtractor implements FieldExtractor { + @Override public Object[] extract(LineItem item) { return new Object[] { "ITEM:", item.getItemId(), item.getPrice() }; } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/AddressFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/AddressFieldSetMapper.java index 4ff9079d9..308b91430 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/AddressFieldSetMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/AddressFieldSetMapper.java @@ -30,6 +30,7 @@ public class AddressFieldSetMapper implements FieldSetMapper
    { public static final String STATE_COLUMN = "STATE"; public static final String COUNTRY_COLUMN = "COUNTRY"; + @Override public Address mapFieldSet(FieldSet fieldSet) { Address address = new Address(); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/BillingFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/BillingFieldSetMapper.java index 3c28a35d8..283ad4b9b 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/BillingFieldSetMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/BillingFieldSetMapper.java @@ -25,6 +25,7 @@ public class BillingFieldSetMapper implements FieldSetMapper { public static final String PAYMENT_TYPE_ID_COLUMN = "PAYMENT_TYPE_ID"; public static final String PAYMENT_DESC_COLUMN = "PAYMENT_DESC"; + @Override public BillingInfo mapFieldSet(FieldSet fieldSet) { BillingInfo info = new BillingInfo(); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/CustomerFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/CustomerFieldSetMapper.java index 1d7f3c077..0f5bd2f36 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/CustomerFieldSetMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/CustomerFieldSetMapper.java @@ -32,6 +32,7 @@ public class CustomerFieldSetMapper implements FieldSetMapper { public static final String REG_ID_COLUMN = "REG_ID"; public static final String VIP_COLUMN = "VIP"; + @Override public Customer mapFieldSet(FieldSet fieldSet) { Customer customer = new Customer(); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/HeaderFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/HeaderFieldSetMapper.java index 168b68d65..6e43ebb83 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/HeaderFieldSetMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/HeaderFieldSetMapper.java @@ -25,6 +25,7 @@ public class HeaderFieldSetMapper implements FieldSetMapper { public static final String ORDER_ID_COLUMN = "ORDER_ID"; public static final String ORDER_DATE_COLUMN = "ORDER_DATE"; + @Override public Order mapFieldSet(FieldSet fieldSet) { Order order = new Order(); order.setOrderId(fieldSet.readLong(ORDER_ID_COLUMN)); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/OrderItemFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/OrderItemFieldSetMapper.java index 86a3d3d8f..af7a1bc57 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/OrderItemFieldSetMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/OrderItemFieldSetMapper.java @@ -31,6 +31,7 @@ public class OrderItemFieldSetMapper implements FieldSetMapper { public static final String PRICE_COLUMN = "PRICE"; public static final String ITEM_ID_COLUMN = "ITEM_ID"; + @Override public LineItem mapFieldSet(FieldSet fieldSet) { LineItem item = new LineItem(); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/ShippingFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/ShippingFieldSetMapper.java index 6bc319bfe..e06d300c6 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/ShippingFieldSetMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/mapper/ShippingFieldSetMapper.java @@ -26,6 +26,7 @@ public class ShippingFieldSetMapper implements FieldSetMapper { public static final String SHIPPING_TYPE_ID_COLUMN = "SHIPPING_TYPE_ID"; public static final String SHIPPER_ID_COLUMN = "SHIPPER_ID"; + @Override public ShippingInfo mapFieldSet(FieldSet fieldSet) { ShippingInfo info = new ShippingInfo(); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/validator/OrderValidator.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/validator/OrderValidator.java index 8e7c8c31c..5b66d519b 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/validator/OrderValidator.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/validator/OrderValidator.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.order.internal.validator; import java.math.BigDecimal; @@ -123,11 +138,11 @@ public class OrderValidator implements Validator { //calculate total price - //discount coeficient = (100.00 - discountPerc) / 100.00 + //discount coefficient = (100.00 - discountPerc) / 100.00 BigDecimal coef = BD_100.subtract(lineItem.getDiscountPerc()) .divide(BD_100, 4, BigDecimal.ROUND_HALF_UP); - //discountedPrice = (price * coef) - discountAmount + //discountedPrice = (price * coefficient) - discountAmount //at least one of discountPerc and discountAmount is 0 - this is validated by ValidateDiscountsFunction BigDecimal discountedPrice = lineItem.getPrice().multiply(coef) .subtract(lineItem.getDiscountAmount()); @@ -253,13 +268,13 @@ public class OrderValidator implements Validator { errors.rejectValue("customer.lastName", "error.customer.lastname"); } - if(customer.isRegistered() && (customer.getRegistrationId() < 0 || customer.getRegistrationId() >= 99999999l)) { + if(customer.isRegistered() && (customer.getRegistrationId() < 0 || customer.getRegistrationId() >= 99999999L)) { errors.rejectValue("customer.registrationId", "error.customer.registrationid"); } } protected void validateOrder(Order item, Errors errors) { - if(item.getOrderId() < 0 || item.getOrderId() > 9999999999l) { + if(item.getOrderId() < 0 || item.getOrderId() > 9999999999L) { errors.rejectValue("orderId", "error.order.id"); } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/person/internal/PersonWriter.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/person/internal/PersonWriter.java index 6fe2aa67e..ca767611b 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/person/internal/PersonWriter.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/person/internal/PersonWriter.java @@ -25,9 +25,9 @@ import org.springframework.batch.sample.domain.person.Person; public class PersonWriter implements ItemWriter { private static Log log = LogFactory.getLog(PersonWriter.class); - - @Override - public void write(List data) { + + @Override + public void write(List data) { log.debug("Processing: " + data); } } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CompositeCustomerUpdateLineTokenizer.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CompositeCustomerUpdateLineTokenizer.java index 3f10b7281..9ce362374 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CompositeCustomerUpdateLineTokenizer.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CompositeCustomerUpdateLineTokenizer.java @@ -39,6 +39,7 @@ public class CompositeCustomerUpdateLineTokenizer extends StepExecutionListenerS /* (non-Javadoc) * @see org.springframework.batch.item.file.transform.LineTokenizer#tokenize(java.lang.String) */ + @Override public FieldSet tokenize(String line) { if(line.charAt(0) == 'F'){ diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerCredit.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerCredit.java index 589ad581b..e967b7823 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerCredit.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerCredit.java @@ -42,6 +42,7 @@ public class CustomerCredit { this.credit = credit; } + @Override public String toString() { return "CustomerCredit [id=" + id + ",name=" + name + ", credit=" + credit + "]"; } @@ -78,10 +79,12 @@ public class CustomerCredit { return newCredit; } + @Override public boolean equals(Object o) { return (o instanceof CustomerCredit) && ((CustomerCredit) o).id == id; } + @Override public int hashCode() { return id; } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerDebit.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerDebit.java index 0d25ba44b..49f42835d 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerDebit.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerDebit.java @@ -47,7 +47,8 @@ public class CustomerDebit { this.name = name; } - public String toString() { + @Override + public String toString() { return "CustomerDebit [name=" + name + ", debit=" + debit + "]"; } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerUpdate.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerUpdate.java index 22e510667..4fac394cf 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerUpdate.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerUpdate.java @@ -20,7 +20,7 @@ import java.math.BigDecimal; /** * Immutable Value Object representing an update to the customer as stored in the database. - * This object has the customer name, credit ammount, and the operation to be performed + * This object has the customer name, credit amount, and the operation to be performed * on them. In the case of an add, a new customer will be entered with the appropriate * credit. In the case of an update, the customer's credit is considered an absolute update. * Deletes are currently not supported, but can still be read in from a file. diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerUpdateFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerUpdateFieldSetMapper.java index e8f9b85c7..bd1f7c2e5 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerUpdateFieldSetMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerUpdateFieldSetMapper.java @@ -29,6 +29,7 @@ import org.springframework.batch.item.file.transform.FieldSet; */ public class CustomerUpdateFieldSetMapper implements FieldSetMapper { + @Override public CustomerUpdate mapFieldSet(FieldSet fs) { if (fs == null) { diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerUpdateProcessor.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerUpdateProcessor.java index 74f5737ce..81a6b7cda 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerUpdateProcessor.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerUpdateProcessor.java @@ -29,6 +29,7 @@ public class CustomerUpdateProcessor implements ItemProcessor { private CustomerDao customerDao; + @Override public void write(List items) throws Exception { for(CustomerUpdate customerUpdate : items){ if(customerUpdate.getOperation() == CustomerOperation.ADD){ diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/Trade.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/Trade.java index bd9cb06a6..5db844c14 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/Trade.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/Trade.java @@ -24,6 +24,7 @@ import java.math.BigDecimal; * @author Rob Harrop * @author Dave Syer */ +@SuppressWarnings("serial") public class Trade implements Serializable { private String isin = ""; private long quantity = 0; @@ -97,7 +98,8 @@ public class Trade implements Serializable { return customer; } - public String toString() { + @Override + public String toString() { return "Trade: [isin=" + this.isin + ",quantity=" + this.quantity + ",price=" + this.price + ",customer=" + this.customer + "]"; } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditItemWriter.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditItemWriter.java new file mode 100644 index 000000000..7b399f4b7 --- /dev/null +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditItemWriter.java @@ -0,0 +1,49 @@ +/* + * Copyright 2006-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.batch.sample.domain.trade.internal; + +import java.util.List; + +import org.springframework.batch.item.ItemWriter; +import org.springframework.batch.sample.domain.trade.CustomerCredit; +import org.springframework.batch.sample.domain.trade.CustomerCreditDao; + +/** + * Delegates actual writing to a custom DAO. + * + * @author Robert Kasanicky + */ +public class CustomerCreditItemWriter implements ItemWriter { + + private CustomerCreditDao customerCreditDao; + + /** + * Public setter for the {@link CustomerCreditDao}. + * @param customerCreditDao the {@link CustomerCreditDao} to set + */ + public void setCustomerCreditDao(CustomerCreditDao customerCreditDao) { + this.customerCreditDao = customerCreditDao; + } + + @Override + public void write(List customerCredits) throws Exception { + for (CustomerCredit customerCredit : customerCredits) { + customerCreditDao.writeCredit(customerCredit); + } + } + +} diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditRowMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditRowMapper.java index 17cc4a44f..a88a70594 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditRowMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditRowMapper.java @@ -22,13 +22,14 @@ import java.sql.SQLException; import org.springframework.batch.sample.domain.trade.CustomerCredit; import org.springframework.jdbc.core.RowMapper; -public class CustomerCreditRowMapper implements RowMapper { +public class CustomerCreditRowMapper implements RowMapper { public static final String ID_COLUMN = "id"; public static final String NAME_COLUMN = "name"; public static final String CREDIT_COLUMN = "credit"; - public Object mapRow(ResultSet rs, int rowNum) throws SQLException { + @Override + public CustomerCredit mapRow(ResultSet rs, int rowNum) throws SQLException { CustomerCredit customerCredit = new CustomerCredit(); customerCredit.setId(rs.getInt(ID_COLUMN)); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/CustomerDebitRowMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/CustomerDebitRowMapper.java new file mode 100644 index 000000000..6de2abb42 --- /dev/null +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/CustomerDebitRowMapper.java @@ -0,0 +1,41 @@ +/* + * Copyright 2006-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.batch.sample.domain.trade.internal; + +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.springframework.batch.sample.domain.trade.CustomerDebit; +import org.springframework.jdbc.core.RowMapper; + + +public class CustomerDebitRowMapper implements RowMapper { + + public static final String CUSTOMER_COLUMN = "customer"; + public static final String PRICE_COLUMN = "price"; + + @Override + public CustomerDebit mapRow(ResultSet rs, int ignoredRowNumber) + throws SQLException { + CustomerDebit customerDebit = new CustomerDebit(); + + customerDebit.setName(rs.getString(CUSTOMER_COLUMN)); + customerDebit.setDebit(rs.getBigDecimal(PRICE_COLUMN)); + + return customerDebit; + } +} diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/CustomerUpdateWriter.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/CustomerUpdateWriter.java index 7b6ebac72..8bc43275a 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/CustomerUpdateWriter.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/CustomerUpdateWriter.java @@ -33,6 +33,7 @@ public class CustomerUpdateWriter implements ItemWriter { private CustomerDebitDao dao; + @Override public void write(List trades) { for (Trade trade : trades) { CustomerDebit customerDebit = new CustomerDebit(); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/FlatFileCustomerCreditDao.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/FlatFileCustomerCreditDao.java index a94303f06..e5faaf31c 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/FlatFileCustomerCreditDao.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/FlatFileCustomerCreditDao.java @@ -40,6 +40,7 @@ public class FlatFileCustomerCreditDao implements CustomerCreditDao, private volatile boolean opened = false; + @Override public void writeCredit(CustomerCredit customerCredit) throws Exception { if (!opened) { @@ -78,6 +79,7 @@ public class FlatFileCustomerCreditDao implements CustomerCreditDao, * * @see org.springframework.beans.factory.DisposableBean#destroy() */ + @Override public void destroy() throws Exception { close(); } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/GeneratingTradeItemReader.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/GeneratingTradeItemReader.java index 6a52c826a..50ac979b0 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/GeneratingTradeItemReader.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/GeneratingTradeItemReader.java @@ -32,6 +32,7 @@ public class GeneratingTradeItemReader implements ItemReader { private int counter = 0; + @Override public Trade read() throws Exception { if (counter < limit) { counter++; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/HibernateAwareCustomerCreditItemWriter.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/HibernateAwareCustomerCreditItemWriter.java index 4e11588e3..a5ec927ef 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/HibernateAwareCustomerCreditItemWriter.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/HibernateAwareCustomerCreditItemWriter.java @@ -38,6 +38,7 @@ public class HibernateAwareCustomerCreditItemWriter implements ItemWriter items) throws Exception { for (CustomerCredit credit : items) { dao.writeCredit(credit); @@ -61,6 +62,7 @@ public class HibernateAwareCustomerCreditItemWriter implements ItemWriter customers = (List) getJdbcTemplate().query(GET_CUSTOMER_BY_NAME, new Object[]{name}, + List customers = getJdbcTemplate().query(GET_CUSTOMER_BY_NAME, new Object[]{name}, - new RowMapper(){ + new RowMapper(){ - public Object mapRow(ResultSet rs, int rowNum) throws SQLException { + @Override + public CustomerCredit mapRow(ResultSet rs, int rowNum) throws SQLException { CustomerCredit customer = new CustomerCredit(); customer.setName(rs.getString("NAME")); customer.setId(rs.getInt("ID")); @@ -69,11 +70,13 @@ public class JdbcCustomerDao extends JdbcDaoSupport implements CustomerDao{ } + @Override public void insertCustomer(String name, BigDecimal credit) { getJdbcTemplate().update(INSERT_CUSTOMER, new Object[]{incrementer.nextIntValue(), name, credit}); } + @Override public void updateCustomer(String name, BigDecimal credit) { getJdbcTemplate().update(UPDATE_CUSTOMER, new Object[]{credit, name}); } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcCustomerDebitDao.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcCustomerDebitDao.java index efda0ab1b..9557080da 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcCustomerDebitDao.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcCustomerDebitDao.java @@ -36,7 +36,8 @@ public class JdbcCustomerDebitDao implements CustomerDebitDao { private JdbcOperations jdbcTemplate; - public void write(CustomerDebit customerDebit) { + @Override + public void write(CustomerDebit customerDebit) { jdbcTemplate.update(UPDATE_CREDIT, customerDebit.getDebit(), customerDebit.getName()); } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcTradeDao.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcTradeDao.java index 3b68f97b5..0dcdda148 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcTradeDao.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcTradeDao.java @@ -40,19 +40,20 @@ public class JdbcTradeDao implements TradeDao { private static final String INSERT_TRADE_RECORD = "INSERT INTO TRADE (id, version, isin, quantity, price, customer) VALUES (?, 0, ?, ? ,?, ?)"; /** - * handles the processing of sql query + * handles the processing of SQL query */ private JdbcOperations jdbcTemplate; /** - * database is not expected to be setup for autoincrement + * database is not expected to be setup for auto increment */ private DataFieldMaxValueIncrementer incrementer; /** * @see TradeDao */ - public void writeTrade(Trade trade) { + @Override + public void writeTrade(Trade trade) { Long id = incrementer.nextLongValue(); log.debug("Processing: " + trade); jdbcTemplate.update(INSERT_TRADE_RECORD, diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeFieldSetMapper.java index a506f43f4..aaa493715 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeFieldSetMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeFieldSetMapper.java @@ -29,7 +29,8 @@ public class TradeFieldSetMapper implements FieldSetMapper { public static final int PRICE_COLUMN = 2; public static final int CUSTOMER_COLUMN = 3; - public Trade mapFieldSet(FieldSet fieldSet) { + @Override + public Trade mapFieldSet(FieldSet fieldSet) { Trade trade = new Trade(); trade.setIsin(fieldSet.readString(ISIN_COLUMN)); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeProcessor.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeProcessor.java index 23fcad4c2..f643c2316 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeProcessor.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeProcessor.java @@ -40,6 +40,7 @@ public class TradeProcessor implements ItemProcessor { this.failure = failure; } + @Override public Trade process(Trade item) throws Exception { if ((failedItem == null && index++ == failure) || (failedItem != null && failedItem.equals(item))) { failedItem = item; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeRowMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeRowMapper.java index b2451ada6..973924fd5 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeRowMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeRowMapper.java @@ -22,7 +22,7 @@ import java.sql.SQLException; import org.springframework.batch.sample.domain.trade.Trade; import org.springframework.jdbc.core.RowMapper; -public class TradeRowMapper implements RowMapper { +public class TradeRowMapper implements RowMapper { public static final int ISIN_COLUMN = 1; public static final int QUANTITY_COLUMN = 2; @@ -31,7 +31,8 @@ public class TradeRowMapper implements RowMapper { public static final int ID_COLUMN = 5; public static final int VERSION_COLUMN = 6; - public Object mapRow(ResultSet rs, int rowNum) throws SQLException { + @Override + public Trade mapRow(ResultSet rs, int rowNum) throws SQLException { Trade trade = new Trade(rs.getLong(ID_COLUMN)); trade.setIsin(rs.getString(ISIN_COLUMN)); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeWriter.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeWriter.java index 4a83bf59a..effef0380 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeWriter.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeWriter.java @@ -47,6 +47,7 @@ public class TradeWriter extends ItemStreamSupport implements ItemWriter private BigDecimal totalPrice = BigDecimal.ZERO; + @Override public void write(List trades) { for (Trade trade : trades) { diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/jmx/JobExecutionNotificationPublisher.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/jmx/JobExecutionNotificationPublisher.java index 1922194b2..d9d548e39 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/jmx/JobExecutionNotificationPublisher.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/jmx/JobExecutionNotificationPublisher.java @@ -31,7 +31,7 @@ import org.springframework.jmx.export.notification.NotificationPublisherAware; * @author Dave Syer * @since 1.0 */ -public class JobExecutionNotificationPublisher implements ApplicationListener, NotificationPublisherAware { +public class JobExecutionNotificationPublisher implements ApplicationListener, NotificationPublisherAware { private static final Log LOG = LogFactory.getLog(JobExecutionNotificationPublisher.class); private NotificationPublisher notificationPublisher; @@ -43,6 +43,7 @@ public class JobExecutionNotificationPublisher implements ApplicationListener, N * * @see org.springframework.jmx.export.notification.NotificationPublisherAware#setNotificationPublisher(org.springframework.jmx.export.notification.NotificationPublisher) */ + @Override public void setNotificationPublisher(NotificationPublisher notificationPublisher) { this.notificationPublisher = notificationPublisher; } @@ -54,12 +55,11 @@ public class JobExecutionNotificationPublisher implements ApplicationListener, N * * @see ApplicationListener#onApplicationEvent(ApplicationEvent) */ - public void onApplicationEvent(ApplicationEvent applicationEvent) { - if (applicationEvent instanceof SimpleMessageApplicationEvent) { - String message = applicationEvent.toString(); - LOG.info(message); - publish(message); - } + @Override + public void onApplicationEvent(SimpleMessageApplicationEvent applicationEvent) { + String message = applicationEvent.toString(); + LOG.info(message); + publish(message); } /** diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/jmx/SimpleMessageApplicationEvent.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/jmx/SimpleMessageApplicationEvent.java index 45f81e20e..2e76d4bb4 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/jmx/SimpleMessageApplicationEvent.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/jmx/SimpleMessageApplicationEvent.java @@ -22,6 +22,7 @@ import org.springframework.context.ApplicationEvent; * @author Dave Syer * */ +@SuppressWarnings("serial") public class SimpleMessageApplicationEvent extends ApplicationEvent { private String message; @@ -34,6 +35,7 @@ public class SimpleMessageApplicationEvent extends ApplicationEvent { /* (non-Javadoc) * @see java.util.EventObject#toString() */ + @Override public String toString() { return "message=["+message+"], " + super.toString(); } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/jmx/StepExecutionApplicationEventAdvice.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/jmx/StepExecutionApplicationEventAdvice.java index 0dc8fb7f5..6e8d1e04c 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/jmx/StepExecutionApplicationEventAdvice.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/jmx/StepExecutionApplicationEventAdvice.java @@ -35,6 +35,7 @@ public class StepExecutionApplicationEventAdvice implements ApplicationEventPubl * (non-Javadoc) * @see org.springframework.context.ApplicationEventPublisherAware#setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) */ + @Override public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) { this.applicationEventPublisher = applicationEventPublisher; } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/launch/DefaultJobLoader.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/launch/DefaultJobLoader.java index d1e6d2e44..d4ca18fab 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/launch/DefaultJobLoader.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/launch/DefaultJobLoader.java @@ -38,6 +38,7 @@ public class DefaultJobLoader implements JobLoader, ApplicationContextAware { private Map configurations = new HashMap(); + @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; } @@ -46,6 +47,7 @@ public class DefaultJobLoader implements JobLoader, ApplicationContextAware { this.registry = registry; } + @Override public Map getConfigurations() { Map result = new HashMap(configurations); for (String jobName : registry.getJobNames()) { @@ -63,6 +65,8 @@ public class DefaultJobLoader implements JobLoader, ApplicationContextAware { return result; } + @Override + @SuppressWarnings("resource") public void loadResource(String path) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] { path }, applicationContext); @@ -72,6 +76,7 @@ public class DefaultJobLoader implements JobLoader, ApplicationContextAware { } } + @Override public Object getJobConfiguration(String name) { try { return registry.getJob(name); @@ -81,6 +86,7 @@ public class DefaultJobLoader implements JobLoader, ApplicationContextAware { } } + @Override public Object getProperty(String path) { int index = PropertyAccessorUtils.getFirstNestedPropertySeparatorIndex(path); BeanWrapperImpl wrapper = createBeanWrapper(path, index); @@ -88,6 +94,7 @@ public class DefaultJobLoader implements JobLoader, ApplicationContextAware { return wrapper.getPropertyValue(key); } + @Override public void setProperty(String path, String value) { int index = PropertyAccessorUtils.getFirstNestedPropertySeparatorIndex(path); BeanWrapperImpl wrapper = createBeanWrapper(path, index); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/loop/GeneratingTradeResettingListener.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/loop/GeneratingTradeResettingListener.java index 741b8a257..48a65654d 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/loop/GeneratingTradeResettingListener.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/loop/GeneratingTradeResettingListener.java @@ -33,6 +33,7 @@ public class GeneratingTradeResettingListener extends StepExecutionListenerSuppo private GeneratingTradeItemReader reader; + @Override public ExitStatus afterStep(StepExecution stepExecution) { this.reader.resetCounter(); return null; @@ -42,6 +43,7 @@ public class GeneratingTradeResettingListener extends StepExecutionListenerSuppo this.reader = reader; } + @Override public void afterPropertiesSet() throws Exception { Assert.notNull(this.reader, "The 'reader' must be set."); } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/loop/LimitDecider.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/loop/LimitDecider.java index 7a4e7c29a..8f289bafb 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/loop/LimitDecider.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/loop/LimitDecider.java @@ -33,6 +33,7 @@ public class LimitDecider implements JobExecutionDecider { private int limit = 1; + @Override public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) { if (++count >= limit) { return new FlowExecutionStatus("COMPLETED"); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/quartz/JobLauncherDetails.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/quartz/JobLauncherDetails.java index 0e3b00cc4..71de3d117 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/quartz/JobLauncherDetails.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/quartz/JobLauncherDetails.java @@ -62,6 +62,7 @@ public class JobLauncherDetails extends QuartzJobBean { this.jobLauncher = jobLauncher; } + @Override @SuppressWarnings("unchecked") protected void executeInternal(JobExecutionContext context) { Map jobDataMap = context.getMergedJobDataMap(); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/rabbitmq/amqp/AmqpMessageProducer.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/rabbitmq/amqp/AmqpMessageProducer.java index cc8dd7b22..7a990f7a0 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/rabbitmq/amqp/AmqpMessageProducer.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/rabbitmq/amqp/AmqpMessageProducer.java @@ -1,3 +1,18 @@ +/* + * Copyright 2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.rabbitmq.amqp; import org.springframework.amqp.core.AmqpTemplate; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/rabbitmq/processor/MessageProcessor.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/rabbitmq/processor/MessageProcessor.java index e527a2973..780fb58cf 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/rabbitmq/processor/MessageProcessor.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/rabbitmq/processor/MessageProcessor.java @@ -1,3 +1,18 @@ +/* + * Copyright 2012-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.rabbitmq.processor; import org.springframework.batch.item.ItemProcessor; @@ -11,7 +26,8 @@ import java.util.Date; */ public class MessageProcessor implements ItemProcessor { - public String process(String message) throws Exception { + @Override + public String process(String message) throws Exception { return "Message: \"" + message + "\" processed on: " + new Date(); } } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/DummyItemWriter.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/DummyItemWriter.java index 0dfa29bbd..91ec3ec87 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/DummyItemWriter.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/DummyItemWriter.java @@ -25,6 +25,7 @@ import org.springframework.batch.item.ItemWriter; */ public class DummyItemWriter implements ItemWriter { + @Override public void write(List item) throws Exception { // NO-OP Thread.sleep(500); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/ExceptionThrowingItemReaderProxy.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/ExceptionThrowingItemReaderProxy.java index 1384091c3..4c75d0654 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/ExceptionThrowingItemReaderProxy.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/ExceptionThrowingItemReaderProxy.java @@ -43,6 +43,7 @@ public class ExceptionThrowingItemReaderProxy implements ItemReader { this.throwExceptionOnRecordNumber = throwExceptionOnRecordNumber; } + @Override public T read() throws Exception { counter++; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/HeaderCopyCallback.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/HeaderCopyCallback.java index 2826ee06c..84c2b699f 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/HeaderCopyCallback.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/HeaderCopyCallback.java @@ -31,11 +31,13 @@ import org.springframework.util.Assert; public class HeaderCopyCallback implements LineCallbackHandler, FlatFileHeaderCallback { private String header = ""; + @Override public void handleLine(String line) { Assert.notNull(line); this.header = line; } + @Override public void writeHeader(Writer writer) throws IOException { writer.write("header from input: " + header); } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/RetrySampleItemWriter.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/RetrySampleItemWriter.java index 9be637b70..5832c4d7b 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/RetrySampleItemWriter.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/RetrySampleItemWriter.java @@ -30,6 +30,7 @@ public class RetrySampleItemWriter implements ItemWriter { private int counter = 0; + @Override public void write(List items) throws Exception { int current = counter; counter += items.size(); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/SummaryFooterCallback.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/SummaryFooterCallback.java index 9cfc152a2..c3b9344b8 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/SummaryFooterCallback.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/support/SummaryFooterCallback.java @@ -30,6 +30,7 @@ public class SummaryFooterCallback extends StepExecutionListenerSupport implemen private StepExecution stepExecution; + @Override public void writeFooter(Writer writer) throws IOException { writer.write("footer - number of items written: " + stepExecution.getWriteCount()); } diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/AMQPJobFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/AMQPJobFunctionalTests.java index 335871e54..59d16461f 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/AMQPJobFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/AMQPJobFunctionalTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample; import static org.junit.Assert.assertTrue; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/CompositeItemWriterSampleFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/CompositeItemWriterSampleFunctionalTests.java index 62de3bb52..2b6c8b498 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/CompositeItemWriterSampleFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/CompositeItemWriterSampleFunctionalTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample; import static org.junit.Assert.assertEquals; @@ -57,6 +72,7 @@ public class CompositeItemWriterSampleFunctionalTests { } private void checkOutputTable(int before) { + @SuppressWarnings("serial") final List trades = new ArrayList() { { add(new Trade("UK21341EAH41", 211, new BigDecimal("31.11"), "customer1")); @@ -88,7 +104,7 @@ public class CompositeItemWriterSampleFunctionalTests { } private void checkOutputFile(String fileName) throws IOException { - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "resource" }) List outputLines = IOUtils.readLines(new FileInputStream(fileName)); String output = ""; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/DelegatingJobFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/DelegatingJobFunctionalTests.java index d03ca853c..a80882159 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/DelegatingJobFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/DelegatingJobFunctionalTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2007-2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/FootballJobFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/FootballJobFunctionalTests.java index 37d7761bc..22d94ee96 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/FootballJobFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/FootballJobFunctionalTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2007-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample; import static org.junit.Assert.assertTrue; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/HeaderFooterSampleFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/HeaderFooterSampleFunctionalTests.java index 35c3652c0..c3388c332 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/HeaderFooterSampleFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/HeaderFooterSampleFunctionalTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample; import static org.junit.Assert.assertTrue; @@ -50,6 +65,9 @@ public class HeaderFooterSampleFunctionalTests { // footer contains the item count int itemCount = lineCount - 1; // minus 1 due to header line assertTrue(outputReader.readLine().contains(String.valueOf(itemCount))); + + inputReader.close(); + outputReader.close(); } } 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 a7a13515b..085d8755e 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 @@ -1,3 +1,18 @@ +/* + * Copyright 2007-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample; import static org.junit.Assert.assertEquals; @@ -101,12 +116,11 @@ public class HibernateFailureJobFunctionalTests { /** * All customers have the same credit */ - @SuppressWarnings("unchecked") protected void validatePreConditions() throws Exception { ensureState(); - creditsBeforeUpdate = (List) new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + creditsBeforeUpdate = new TransactionTemplate(transactionManager).execute(new TransactionCallback>() { @Override - public Object doInTransaction(TransactionStatus status) { + public List doInTransaction(TransactionStatus status) { return jdbcTemplate.query(ALL_CUSTOMERS, new ParameterizedRowMapper() { @Override public BigDecimal mapRow(ResultSet rs, int rowNum) throws SQLException { @@ -122,10 +136,11 @@ public class HibernateFailureJobFunctionalTests { * customer table and reading the expected defaults. */ private void ensureState(){ - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback(){ + @Override - public Object doInTransaction(TransactionStatus status) { - jdbcTemplate.update(DELETE_CUSTOMERS); + public Void doInTransaction(TransactionStatus status) { + jdbcTemplate.update(DELETE_CUSTOMERS); for (String customer : customers) { jdbcTemplate.update(customer); } @@ -140,9 +155,9 @@ public class HibernateFailureJobFunctionalTests { protected void validatePostConditions() throws Exception { final List matches = new ArrayList(); - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback() { @Override - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { jdbcTemplate.query(ALL_CUSTOMERS, new RowCallbackHandler() { private int i = 0; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/JobOperatorFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/JobOperatorFunctionalTests.java index 6ce05f26e..4c3d24f02 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/JobOperatorFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/JobOperatorFunctionalTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/RetrySampleConfigurationTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/RetrySampleConfigurationTests.java index 58a26ff37..8ca4f81b5 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/RetrySampleConfigurationTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/RetrySampleConfigurationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/RetrySampleFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/RetrySampleFunctionalTests.java index bc0da463e..6dac84cc0 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/RetrySampleFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/RetrySampleFunctionalTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/SkipSampleFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/SkipSampleFunctionalTests.java index 5ba3c2f6a..456c24256 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/SkipSampleFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/SkipSampleFunctionalTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample; import static org.junit.Assert.assertEquals; @@ -172,7 +187,7 @@ public class SkipSampleFunctionalTests { // Step2: 7 input records, 1 skipped on process, 1 on write => 5 written // to output // System.err.println(jdbcTemplate.queryForList("SELECT * FROM TRADE")); - assertEquals(5, jdbcTemplate.queryForInt("SELECT COUNT(*) from TRADE where VERSION=?", 1)); + assertEquals(5, jdbcTemplate.queryForObject("SELECT COUNT(*) from TRADE where VERSION=?", Integer.class, 1).intValue()); // 1 record skipped in processing second step assertEquals(1, SkipCheckingListener.getProcessSkips()); @@ -200,7 +215,7 @@ public class SkipSampleFunctionalTests { assertEquals(5, JdbcTestUtils.countRowsInTable((JdbcTemplate) jdbcTemplate, "TRADE")); // Step2: 5 input records => 5 written to output - assertEquals(5, jdbcTemplate.queryForInt("SELECT COUNT(*) from TRADE where VERSION=?", 1)); + assertEquals(5, jdbcTemplate.queryForObject("SELECT COUNT(*) from TRADE where VERSION=?", Integer.class, 1).intValue()); // Neither step contained skips assertEquals(0, JdbcTestUtils.countRowsInTable((JdbcTemplate) jdbcTemplate, "ERROR_LOG")); diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/TestSuite.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/TestSuite.java new file mode 100644 index 000000000..c5667b88b --- /dev/null +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/TestSuite.java @@ -0,0 +1,33 @@ +/* + * Copyright 2006-2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.batch.sample; + +import org.junit.Ignore; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * Temporary test suite to find bug in build. + * + */ +@Ignore +@RunWith(Suite.class) +@SuiteClasses({SkipSampleFunctionalTests.class, CustomerFilterJobFunctionalTests.class}) +public class TestSuite { + +} diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/ColumnRangePartitionerTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/ColumnRangePartitionerTests.java index 7cb7ceb4c..cdfa5b52f 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/ColumnRangePartitionerTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/ColumnRangePartitionerTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.common; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/ErrorLogTasklet.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/ErrorLogTasklet.java index 0f2e65908..f6e1490e2 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/ErrorLogTasklet.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/ErrorLogTasklet.java @@ -1,9 +1,22 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.common; 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.StepContribution; import org.springframework.batch.core.StepExecution; @@ -25,6 +38,7 @@ public class ErrorLogTasklet implements Tasklet, StepExecutionListener { private StepExecution stepExecution; private String stepName; + @Override public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { Assert.notNull(this.stepName, "Step name not set. Either this class was not registered as a listener " + "or the key 'stepName' was not found in the Job's ExecutionContext."); diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/ExceptionThrowingItemReaderProxyTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/ExceptionThrowingItemReaderProxyTests.java index 48e4644d4..bc74a2eb1 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/ExceptionThrowingItemReaderProxyTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/ExceptionThrowingItemReaderProxyTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.common; import static org.junit.Assert.assertEquals; @@ -23,6 +38,7 @@ public class ExceptionThrowingItemReaderProxyTests { RepeatSynchronizationManager.clear(); } + @SuppressWarnings("serial") @Test public void testProcess() throws Exception { diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/OutputFileListenerTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/OutputFileListenerTests.java index 57122f661..c5fa2fbf6 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/OutputFileListenerTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/OutputFileListenerTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.common; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/SkipCheckingDecider.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/SkipCheckingDecider.java index 5be4bfa0e..b00875444 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/SkipCheckingDecider.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/SkipCheckingDecider.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.common; import org.springframework.batch.core.ExitStatus; @@ -7,6 +22,7 @@ import org.springframework.batch.core.job.flow.FlowExecutionStatus; import org.springframework.batch.core.job.flow.JobExecutionDecider; public class SkipCheckingDecider implements JobExecutionDecider { + @Override public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) { if (!stepExecution.getExitStatus().getExitCode().equals( @@ -17,4 +33,4 @@ public class SkipCheckingDecider implements JobExecutionDecider { return new FlowExecutionStatus(ExitStatus.COMPLETED.getExitCode()); } } -} \ No newline at end of file +} diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/SkipCheckingListener.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/SkipCheckingListener.java index 9c92010f9..33a810d9b 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/SkipCheckingListener.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/SkipCheckingListener.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.common; import org.apache.commons.logging.Log; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/StagingItemReaderTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/StagingItemReaderTests.java index 9ecb446ea..91b52f09b 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/StagingItemReaderTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/StagingItemReaderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.common; import static org.junit.Assert.assertEquals; @@ -89,13 +104,14 @@ public class StagingItemReaderTests { public void testUpdateProcessIndicatorAfterCommit() throws Exception { TransactionTemplate txTemplate = new TransactionTemplate(transactionManager); txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); - txTemplate.execute(new TransactionCallback() { - public Object doInTransaction(TransactionStatus transactionStatus) { + txTemplate.execute(new TransactionCallback() { + @Override + public Void doInTransaction(TransactionStatus transactionStatus) { try { testReaderWithProcessorUpdatesProcessIndicator(); } catch (Exception e) { - fail("Unxpected Exception: " + e); + fail("Unexpected Exception: " + e); } return null; } @@ -112,8 +128,9 @@ public class StagingItemReaderTests { TransactionTemplate txTemplate = new TransactionTemplate(transactionManager); txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); - final Long idToUse = (Long) txTemplate.execute(new TransactionCallback() { - public Object doInTransaction(TransactionStatus transactionStatus) { + final Long idToUse = txTemplate.execute(new TransactionCallback() { + @Override + public Long doInTransaction(TransactionStatus transactionStatus) { long id = jdbcTemplate.queryForObject("SELECT MIN(ID) from BATCH_STAGING where JOB_ID=?", Long.class, jobId); String before = jdbcTemplate.queryForObject("SELECT PROCESSED from BATCH_STAGING where ID=?", diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/StagingItemWriterTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/StagingItemWriterTests.java index c0317a59b..9cc958b10 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/StagingItemWriterTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/StagingItemWriterTests.java @@ -60,7 +60,6 @@ public class StagingItemWriterTests { public void testProcessInsertsNewItem() throws Exception { int before = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STAGING", Integer.class); writer.write(Collections.singletonList("FOO")); - int after = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STAGING", Integer.class); assertEquals(before + 1, after); } diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/multiline/AggregateItemFieldSetMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/multiline/AggregateItemFieldSetMapperTests.java index a393b7413..bf893198c 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/multiline/AggregateItemFieldSetMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/multiline/AggregateItemFieldSetMapperTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.multiline; import static org.junit.Assert.assertEquals; @@ -51,6 +66,7 @@ public class AggregateItemFieldSetMapperTests { @Test public void testDelegate() throws Exception { mapper.setDelegate(new FieldSetMapper() { + @Override public String mapFieldSet(FieldSet fs) { return "foo"; } diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/multiline/AggregateItemReaderTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/multiline/AggregateItemReaderTests.java index 75f686484..db3a84e13 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/multiline/AggregateItemReaderTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/multiline/AggregateItemReaderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.multiline; import static org.junit.Assert.*; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/AddressFieldSetMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/AddressFieldSetMapperTests.java index ebcd406ad..f8239bdbb 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/AddressFieldSetMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/AddressFieldSetMapperTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.order; import org.springframework.batch.item.file.mapping.FieldSetMapper; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/BillingFieldSetMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/BillingFieldSetMapperTests.java index ffcd63e8a..0f3f611f9 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/BillingFieldSetMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/BillingFieldSetMapperTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.order; import org.springframework.batch.item.file.mapping.FieldSetMapper; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/CustomerFieldSetMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/CustomerFieldSetMapperTests.java index 657e6533d..08bc62325 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/CustomerFieldSetMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/CustomerFieldSetMapperTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.order; import org.springframework.batch.item.file.mapping.FieldSetMapper; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/HeaderFieldSetMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/HeaderFieldSetMapperTests.java index ee5e7d0fa..7a6ba866f 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/HeaderFieldSetMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/HeaderFieldSetMapperTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.order; import java.util.Calendar; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/OrderItemFieldSetMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/OrderItemFieldSetMapperTests.java index 323c1a505..f5dc1b8f6 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/OrderItemFieldSetMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/OrderItemFieldSetMapperTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.order; import java.math.BigDecimal; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/OrderItemReaderTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/OrderItemReaderTests.java index 175c83942..b0ee1e75b 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/OrderItemReaderTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/OrderItemReaderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.order; import static org.junit.Assert.assertEquals; @@ -22,7 +37,7 @@ public class OrderItemReaderTests { @Before @SuppressWarnings("unchecked") public void setUp() { - input = (ItemReader
    ) mock(ItemReader.class); + input = mock(ItemReader.class); provider = new OrderItemReader(); provider.setFieldSetReader(input); @@ -62,6 +77,7 @@ public class OrderItemReaderTests { ShippingInfo shippingInfo = new ShippingInfo(); LineItem item = new LineItem(); + @SuppressWarnings("rawtypes") FieldSetMapper mapper = mock(FieldSetMapper.class); when(mapper.mapFieldSet(headerFS)).thenReturn(order); when(mapper.mapFieldSet(customerFS)).thenReturn(customer); diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/ShippingFieldSetMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/ShippingFieldSetMapperTests.java index 51319b78b..bee01ff26 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/ShippingFieldSetMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/ShippingFieldSetMapperTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.order; import org.springframework.batch.item.file.mapping.FieldSetMapper; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/internal/validator/OrderValidatorTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/internal/validator/OrderValidatorTests.java index 3d63d14bc..cd86e858a 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/internal/validator/OrderValidatorTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/internal/validator/OrderValidatorTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.order.internal.validator; import static org.junit.Assert.assertEquals; @@ -53,7 +68,7 @@ public class OrderValidatorTests { public void testValidOrder() { Order order = new Order(); order.setOrderId(-5); - order.setOrderDate(new Date(new Date().getTime() + 1000000000l)); + order.setOrderDate(new Date(new Date().getTime() + 1000000000L)); order.setTotalLines(10); order.setLineItems(new ArrayList()); @@ -83,7 +98,7 @@ public class OrderValidatorTests { assertEquals("error.order.lines.badcount", errors.getFieldError("totalLines").getCode()); order = new Order(); - order.setOrderId(5l); + order.setOrderId(5L); order.setOrderDate(new Date(new Date().getTime() - 1000)); order.setTotalLines(1); items = new ArrayList(); @@ -144,7 +159,7 @@ public class OrderValidatorTests { customer.setRegistered(true); customer.setBusinessCustomer(true); customer.setCompanyName("Acme Inc"); - customer.setRegistrationId(5l); + customer.setRegistrationId(5L); order.setCustomer(customer); errors = new BeanPropertyBindingResult(order, "validOrder"); @@ -157,7 +172,7 @@ public class OrderValidatorTests { customer.setBusinessCustomer(false); customer.setFirstName("John"); customer.setLastName("Doe"); - customer.setRegistrationId(5l); + customer.setRegistrationId(5L); order.setCustomer(customer); errors = new BeanPropertyBindingResult(order, "validOrder"); diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/CompositeCustomerUpdateLineTokenizerTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/CompositeCustomerUpdateLineTokenizerTests.java index 772ac18b3..c1bf929d4 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/CompositeCustomerUpdateLineTokenizerTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/CompositeCustomerUpdateLineTokenizerTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.trade; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/CustomerUpdateProcessorTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/CustomerUpdateProcessorTests.java index bb90cd70a..ead7733bc 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/CustomerUpdateProcessorTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/CustomerUpdateProcessorTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.trade; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/TradeTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/TradeTests.java index d677efbdc..4b1db3be3 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/TradeTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/TradeTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.trade; import java.math.BigDecimal; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditIncreaseProcessorTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditIncreaseProcessorTests.java index 44cf465c0..2d3f86e2b 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditIncreaseProcessorTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditIncreaseProcessorTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.trade.internal; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditRowMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditRowMapperTests.java index 84720f25a..f407c32e0 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditRowMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditRowMapperTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.trade.internal; import static org.mockito.Mockito.when; @@ -10,13 +25,14 @@ import org.springframework.batch.sample.domain.trade.CustomerCredit; import org.springframework.batch.sample.support.AbstractRowMapperTests; import org.springframework.jdbc.core.RowMapper; -public class CustomerCreditRowMapperTests extends AbstractRowMapperTests { +public class CustomerCreditRowMapperTests extends AbstractRowMapperTests { + private static final int ID = 12; private static final String CUSTOMER = "Jozef Mak"; private static final BigDecimal CREDIT = new BigDecimal("0.1"); @Override - protected Object expectedDomainObject() { + protected CustomerCredit expectedDomainObject() { CustomerCredit credit = new CustomerCredit(); credit.setId(ID); credit.setCredit(CREDIT); @@ -25,7 +41,7 @@ public class CustomerCreditRowMapperTests extends AbstractRowMapperTests { } @Override - protected RowMapper rowMapper() { + protected RowMapper rowMapper() { return new CustomerCreditRowMapper(); } diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditUpdateProcessorTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditUpdateProcessorTests.java index e2b365b40..510164ef0 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditUpdateProcessorTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditUpdateProcessorTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.trade.internal; import static org.mockito.Mockito.mock; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/CustomerUpdateProcessorTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/CustomerUpdateProcessorTests.java index 1d975aa83..02295347c 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/CustomerUpdateProcessorTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/CustomerUpdateProcessorTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.trade.internal; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/GeneratingItemReaderTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/GeneratingItemReaderTests.java index 489b5a79a..475dfb9f5 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/GeneratingItemReaderTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/GeneratingItemReaderTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.trade.internal; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/ItemTrackingTradeItemWriter.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/ItemTrackingTradeItemWriter.java index c3218d09a..c85532dde 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/ItemTrackingTradeItemWriter.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/ItemTrackingTradeItemWriter.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.trade.internal; import java.io.IOException; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/TradeFieldSetMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/TradeFieldSetMapperTests.java index e57c2a9d4..39f39e154 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/TradeFieldSetMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/TradeFieldSetMapperTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.trade.internal; import java.math.BigDecimal; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/TradeProcessorTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/TradeProcessorTests.java index cf96179e3..608f81be2 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/TradeProcessorTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/TradeProcessorTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.trade.internal; import static org.mockito.Mockito.mock; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/TradeRowMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/TradeRowMapperTests.java index 99c540277..bfcb3de11 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/TradeRowMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/TradeRowMapperTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.domain.trade.internal; import static org.mockito.Mockito.when; @@ -10,14 +25,15 @@ import org.springframework.batch.sample.domain.trade.Trade; import org.springframework.batch.sample.support.AbstractRowMapperTests; import org.springframework.jdbc.core.RowMapper; -public class TradeRowMapperTests extends AbstractRowMapperTests { +public class TradeRowMapperTests extends AbstractRowMapperTests { + private static final String ISIN = "jsgk342"; private static final long QUANTITY = 0; private static final BigDecimal PRICE = new BigDecimal("1.1"); private static final String CUSTOMER = "Martin Hrancok"; @Override - protected Object expectedDomainObject() { + protected Trade expectedDomainObject() { Trade trade = new Trade(); trade.setIsin(ISIN); trade.setQuantity(QUANTITY); @@ -28,7 +44,7 @@ public class TradeRowMapperTests extends AbstractRowMapperTests { } @Override - protected RowMapper rowMapper() { + protected RowMapper rowMapper() { return new TradeRowMapper(); } diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/AbstractIoSampleTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/AbstractIoSampleTests.java index 09239912b..e849bf2bf 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/AbstractIoSampleTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/AbstractIoSampleTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.iosample; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/HibernateFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/HibernateFunctionalTests.java index 2d3a3e4be..f5624374d 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/HibernateFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/HibernateFunctionalTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.iosample; import org.junit.runner.RunWith; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/IbatisFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/IbatisFunctionalTests.java index 8a69722bd..ef9be7f9c 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/IbatisFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/IbatisFunctionalTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.iosample; import org.junit.runner.RunWith; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/JpaFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/JpaFunctionalTests.java index e454e02e0..23d73a460 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/JpaFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/JpaFunctionalTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.iosample; import org.junit.runner.RunWith; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/RepositoryFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/RepositoryFunctionalTests.java index 4bf4f3216..56599ecb2 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/RepositoryFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/RepositoryFunctionalTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.iosample; import org.junit.runner.RunWith; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/TwoJobInstancesDelimitedFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/TwoJobInstancesDelimitedFunctionalTests.java index b32483a1f..2a820ac3d 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/TwoJobInstancesDelimitedFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/TwoJobInstancesDelimitedFunctionalTests.java @@ -103,4 +103,4 @@ public class TwoJobInstancesDelimitedFunctionalTests { return new JobParametersBuilder().addLong("timestamp", new Date().getTime()).addString("inputFile", fileName) .addString("outputFile", "file:./target/test-outputs/delimitedOutput.csv").toJobParameters(); } -} \ No newline at end of file +} diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/TwoJobInstancesPagingFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/TwoJobInstancesPagingFunctionalTests.java index c62d86a57..5b84f18f3 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/TwoJobInstancesPagingFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/TwoJobInstancesPagingFunctionalTests.java @@ -75,4 +75,4 @@ public class TwoJobInstancesPagingFunctionalTests { return new JobParametersBuilder().addLong("timestamp", new Date().getTime()).addDouble("credit", amount) .toJobParameters(); } -} \ No newline at end of file +} diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/internal/TradeCustomerItemWriter.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/internal/TradeCustomerItemWriter.java new file mode 100644 index 000000000..91d8cdf0d --- /dev/null +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/internal/TradeCustomerItemWriter.java @@ -0,0 +1,46 @@ +/* + * Copyright 2006-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.batch.sample.iosample.internal; + +import java.math.BigDecimal; +import java.util.List; + +import org.springframework.batch.item.ItemWriter; +import org.springframework.batch.sample.domain.trade.CustomerCredit; +import org.springframework.batch.sample.domain.trade.Trade; +import org.springframework.batch.sample.domain.trade.TradeDao; + +/** + * @author Dan Garrette + * @since 2.0 + */ +public class TradeCustomerItemWriter implements ItemWriter { + private TradeDao dao; + private int count; + + @Override + public void write(List items) throws Exception { + for (CustomerCredit c : items) { + Trade t = new Trade("ISIN" + count++, 100, new BigDecimal("1.50"), c.getName()); + this.dao.writeTrade(t); + } + } + + public void setDao(TradeDao dao) { + this.dao = dao; + } +} diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/quartz/JobLauncherDetailsTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/quartz/JobLauncherDetailsTests.java index bd58bc32c..c26f23b00 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/quartz/JobLauncherDetailsTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/quartz/JobLauncherDetailsTests.java @@ -153,6 +153,7 @@ public class JobLauncherDetailsTests { assertEquals(0, parameters.getParameters().size()); } + @SuppressWarnings("serial") private final class StubJobExecutionContext extends JobExecutionContext { private StubJobExecutionContext() { super(mock(Scheduler.class), firedBundle, mock(Job.class)); diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/support/AbstractFieldSetMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/support/AbstractFieldSetMapperTests.java index 6d6fdc9d0..d975359a1 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/support/AbstractFieldSetMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/support/AbstractFieldSetMapperTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.support; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/support/AbstractRowMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/support/AbstractRowMapperTests.java index 79594c363..d4e84ba2f 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/support/AbstractRowMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/support/AbstractRowMapperTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.support; import static org.mockito.Mockito.mock; @@ -13,8 +28,9 @@ import org.springframework.jdbc.core.RowMapper; * Encapsulates logic for testing custom {@link RowMapper} implementations. * * @author Robert Kasanicky + * @param the item type */ -public abstract class AbstractRowMapperTests { +public abstract class AbstractRowMapperTests { // row number should be irrelevant private static final int IGNORED_ROW_NUMBER = 0; @@ -26,12 +42,12 @@ public abstract class AbstractRowMapperTests { * @return Expected result of mapping the mock ResultSet by the * mapper being tested. */ - abstract protected Object expectedDomainObject(); + abstract protected T expectedDomainObject(); /** * @return RowMapper implementation that is being tested. */ - abstract protected RowMapper rowMapper(); + abstract protected RowMapper rowMapper(); /* * Define the behaviour of mock ResultSet. diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/support/RetrySampleItemWriterTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/support/RetrySampleItemWriterTests.java index 6b12d76cd..fe68a7ee6 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/support/RetrySampleItemWriterTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/support/RetrySampleItemWriterTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.sample.support; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-test/.springBeans b/spring-batch-test/.springBeans index 4f4cc5522..2f255ff8a 100644 --- a/spring-batch-test/.springBeans +++ b/spring-batch-test/.springBeans @@ -1,44 +1,52 @@ - - - 1 - - - - - - - src/test/resources/data-source-context.xml - src/test/resources/simple-job-launcher-context.xml - src/test/resources/org/springframework/batch/sample/config/common-context.xml - src/test/resources/jobs/sampleFlowJob.xml - src/test/resources/jobs/sampleSimpleJob.xml - src/test/resources/jobs/sample-steps.xml - src/test/resources/job-runner-context.xml - src/test/resources/org/springframework/batch/test/StepScopeTestExecutionListenerIntegrationTests-context.xml - - - - - true - false - - src/test/resources/data-source-context.xml - src/test/resources/org/springframework/batch/sample/config/common-context.xml - src/test/resources/simple-job-launcher-context.xml - src/test/resources/jobs/sampleSimpleJob.xml - src/test/resources/jobs/sample-steps.xml - - - - - true - false - - src/test/resources/data-source-context.xml - src/test/resources/jobs/sampleFlowJob.xml - src/test/resources/org/springframework/batch/sample/config/common-context.xml - src/test/resources/simple-job-launcher-context.xml - - - - + + + 1 + + + + + + + src/test/resources/data-source-context.xml + src/test/resources/simple-job-launcher-context.xml + src/test/resources/org/springframework/batch/sample/config/common-context.xml + src/test/resources/jobs/sampleFlowJob.xml + src/test/resources/jobs/sampleSimpleJob.xml + src/test/resources/jobs/sample-steps.xml + src/test/resources/job-runner-context.xml + src/test/resources/org/springframework/batch/test/StepScopeTestExecutionListenerIntegrationTests-context.xml + src/test/resources/org/springframework/batch/test/JobScopeTestExecutionListenerIntegrationTests-context.xml + src/test/resources/org/springframework/batch/test/JobScopeTestExecutionListenerTests-context.xml + src/test/resources/org/springframework/batch/test/StepScopeTestExecutionListenerTests-context.xml + java:org.springframework.batch.test.StepScopeAnnotatedListenerIntegrationTests$TestConfig + + + + + true + false + + src/test/resources/data-source-context.xml + src/test/resources/org/springframework/batch/sample/config/common-context.xml + src/test/resources/simple-job-launcher-context.xml + src/test/resources/jobs/sampleSimpleJob.xml + src/test/resources/jobs/sample-steps.xml + + + + + + + true + false + + src/test/resources/data-source-context.xml + src/test/resources/jobs/sampleFlowJob.xml + src/test/resources/org/springframework/batch/sample/config/common-context.xml + src/test/resources/simple-job-launcher-context.xml + + + + + + diff --git a/spring-batch-test/src/main/java/org/springframework/batch/test/DataSourceInitializer.java b/spring-batch-test/src/main/java/org/springframework/batch/test/DataSourceInitializer.java index 0f4ddfd3c..3bf89a20e 100755 --- a/spring-batch-test/src/main/java/org/springframework/batch/test/DataSourceInitializer.java +++ b/spring-batch-test/src/main/java/org/springframework/batch/test/DataSourceInitializer.java @@ -71,6 +71,7 @@ public class DataSourceInitializer implements InitializingBean, DisposableBean { * * @param args */ + @SuppressWarnings("resource") public static void main(String... args) { new ClassPathXmlApplicationContext(ClassUtils.addResourcePathToPackagePath(DataSourceInitializer.class, DataSourceInitializer.class.getSimpleName() + "-context.xml")); @@ -118,11 +119,11 @@ public class DataSourceInitializer implements InitializingBean, DisposableBean { if (scriptResource == null || !scriptResource.exists()) return; TransactionTemplate transactionTemplate = new TransactionTemplate(new DataSourceTransactionManager(dataSource)); - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback() { @Override @SuppressWarnings("unchecked") - public Object doInTransaction(TransactionStatus status) { + public Void doInTransaction(TransactionStatus status) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String[] scripts; try { diff --git a/spring-batch-test/src/main/java/org/springframework/batch/test/JobScopeTestExecutionListener.java b/spring-batch-test/src/main/java/org/springframework/batch/test/JobScopeTestExecutionListener.java index 685ff91c6..e1324f52c 100644 --- a/spring-batch-test/src/main/java/org/springframework/batch/test/JobScopeTestExecutionListener.java +++ b/spring-batch-test/src/main/java/org/springframework/batch/test/JobScopeTestExecutionListener.java @@ -74,6 +74,7 @@ public class JobScopeTestExecutionListener implements TestExecutionListener { * @throws Exception if there is a problem * @see TestExecutionListener#prepareTestInstance(TestContext) */ + @Override public void prepareTestInstance(TestContext testContext) throws Exception { JobExecution jobExecution = getJobExecution(testContext); if (jobExecution != null) { @@ -86,6 +87,7 @@ public class JobScopeTestExecutionListener implements TestExecutionListener { * @throws Exception if there is a problem * @see TestExecutionListener#beforeTestMethod(TestContext) */ + @Override public void beforeTestMethod(org.springframework.test.context.TestContext testContext) throws Exception { if (testContext.hasAttribute(JOB_EXECUTION)) { JobExecution jobExecution = (JobExecution) testContext.getAttribute(JOB_EXECUTION); @@ -99,6 +101,7 @@ public class JobScopeTestExecutionListener implements TestExecutionListener { * @throws Exception if there is a problem * @see TestExecutionListener#afterTestMethod(TestContext) */ + @Override public void afterTestMethod(TestContext testContext) throws Exception { if (testContext.hasAttribute(JOB_EXECUTION)) { JobSynchronizationManager.close(); @@ -108,12 +111,14 @@ public class JobScopeTestExecutionListener implements TestExecutionListener { /* * Support for Spring 3.0 (empty). */ + @Override public void afterTestClass(TestContext testContext) throws Exception { } /* * Support for Spring 3.0 (empty). */ + @Override public void beforeTestClass(TestContext testContext) throws Exception { } @@ -168,6 +173,7 @@ public class JobScopeTestExecutionListener implements TestExecutionListener { return result == null ? null : result.getName(); } + @Override public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { Class type = method.getReturnType(); if (preferredType.isAssignableFrom(type)) { diff --git a/spring-batch-test/src/test/java/org/springframework/batch/test/AbstractSampleJobTests.java b/spring-batch-test/src/test/java/org/springframework/batch/test/AbstractSampleJobTests.java index 64e08e864..f9b323d97 100644 --- a/spring-batch-test/src/test/java/org/springframework/batch/test/AbstractSampleJobTests.java +++ b/spring-batch-test/src/test/java/org/springframework/batch/test/AbstractSampleJobTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.test; import static org.junit.Assert.assertEquals; @@ -91,7 +106,7 @@ public abstract class AbstractSampleJobTests { } private void verifyTasklet(int id) { - assertEquals(id, jdbcTemplate.queryForInt("SELECT ID from TESTS where NAME = 'SampleTasklet" + id + "'")); + assertEquals(id, jdbcTemplate.queryForObject("SELECT ID from TESTS where NAME = 'SampleTasklet" + id + "'", Integer.class).intValue()); } } diff --git a/spring-batch-test/src/test/java/org/springframework/batch/test/AssertFileTests.java b/spring-batch-test/src/test/java/org/springframework/batch/test/AssertFileTests.java index afb3fcaa6..e6ae5720d 100644 --- a/spring-batch-test/src/test/java/org/springframework/batch/test/AssertFileTests.java +++ b/spring-batch-test/src/test/java/org/springframework/batch/test/AssertFileTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.test; import static junit.framework.Assert.assertTrue; diff --git a/spring-batch-test/src/test/java/org/springframework/batch/test/JobScopeTestExecutionListenerIntegrationTests.java b/spring-batch-test/src/test/java/org/springframework/batch/test/JobScopeTestExecutionListenerIntegrationTests.java index 5678a82b9..342df9b61 100644 --- a/spring-batch-test/src/test/java/org/springframework/batch/test/JobScopeTestExecutionListenerIntegrationTests.java +++ b/spring-batch-test/src/test/java/org/springframework/batch/test/JobScopeTestExecutionListenerIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.test; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-test/src/test/java/org/springframework/batch/test/JobScopeTestExecutionListenerTests.java b/spring-batch-test/src/test/java/org/springframework/batch/test/JobScopeTestExecutionListenerTests.java index 3b38a5262..66983355c 100644 --- a/spring-batch-test/src/test/java/org/springframework/batch/test/JobScopeTestExecutionListenerTests.java +++ b/spring-batch-test/src/test/java/org/springframework/batch/test/JobScopeTestExecutionListenerTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.test; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-test/src/test/java/org/springframework/batch/test/SampleFlowJobTests.java b/spring-batch-test/src/test/java/org/springframework/batch/test/SampleFlowJobTests.java index 7e0da03d3..3f3fc6791 100644 --- a/spring-batch-test/src/test/java/org/springframework/batch/test/SampleFlowJobTests.java +++ b/spring-batch-test/src/test/java/org/springframework/batch/test/SampleFlowJobTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.test; import org.junit.runner.RunWith; diff --git a/spring-batch-test/src/test/java/org/springframework/batch/test/SampleSimpleJobTests.java b/spring-batch-test/src/test/java/org/springframework/batch/test/SampleSimpleJobTests.java index f8f4e86ee..2b88a9261 100644 --- a/spring-batch-test/src/test/java/org/springframework/batch/test/SampleSimpleJobTests.java +++ b/spring-batch-test/src/test/java/org/springframework/batch/test/SampleSimpleJobTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.test; import org.junit.runner.RunWith; diff --git a/spring-batch-test/src/test/java/org/springframework/batch/test/SampleStepTests.java b/spring-batch-test/src/test/java/org/springframework/batch/test/SampleStepTests.java index daca86a87..cd546808b 100755 --- a/spring-batch-test/src/test/java/org/springframework/batch/test/SampleStepTests.java +++ b/spring-batch-test/src/test/java/org/springframework/batch/test/SampleStepTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.test; import static org.junit.Assert.*; @@ -50,7 +65,7 @@ public class SampleStepTests implements ApplicationContextAware { public void testTasklet() { Step step = (Step) context.getBean("s2"); assertEquals(BatchStatus.COMPLETED, stepRunner.launchStep(step).getStatus()); - assertEquals(2, jdbcTemplate.queryForInt("SELECT ID from TESTS where NAME = 'SampleTasklet2'")); + assertEquals(2, jdbcTemplate.queryForObject("SELECT ID from TESTS where NAME = 'SampleTasklet2'", Integer.class).intValue()); } @Override diff --git a/spring-batch-test/src/test/java/org/springframework/batch/test/StepScopeAnnotatedListenerIntegrationTests.java b/spring-batch-test/src/test/java/org/springframework/batch/test/StepScopeAnnotatedListenerIntegrationTests.java index b50806a0a..7d301b51a 100644 --- a/spring-batch-test/src/test/java/org/springframework/batch/test/StepScopeAnnotatedListenerIntegrationTests.java +++ b/spring-batch-test/src/test/java/org/springframework/batch/test/StepScopeAnnotatedListenerIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.test; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-test/src/test/java/org/springframework/batch/test/StepScopeTestExecutionListenerIntegrationTests.java b/spring-batch-test/src/test/java/org/springframework/batch/test/StepScopeTestExecutionListenerIntegrationTests.java index 863158f4c..cf8a7efa0 100644 --- a/spring-batch-test/src/test/java/org/springframework/batch/test/StepScopeTestExecutionListenerIntegrationTests.java +++ b/spring-batch-test/src/test/java/org/springframework/batch/test/StepScopeTestExecutionListenerIntegrationTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.test; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-test/src/test/java/org/springframework/batch/test/StepScopeTestExecutionListenerTests.java b/spring-batch-test/src/test/java/org/springframework/batch/test/StepScopeTestExecutionListenerTests.java index cae61a8fb..2a48b8bd6 100644 --- a/spring-batch-test/src/test/java/org/springframework/batch/test/StepScopeTestExecutionListenerTests.java +++ b/spring-batch-test/src/test/java/org/springframework/batch/test/StepScopeTestExecutionListenerTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.test; import static org.junit.Assert.assertEquals; diff --git a/spring-batch-test/src/test/java/org/springframework/batch/test/jmx/JobExecutionNotificationPublisher.java b/spring-batch-test/src/test/java/org/springframework/batch/test/jmx/JobExecutionNotificationPublisher.java index be5386702..a7fc86166 100755 --- a/spring-batch-test/src/test/java/org/springframework/batch/test/jmx/JobExecutionNotificationPublisher.java +++ b/spring-batch-test/src/test/java/org/springframework/batch/test/jmx/JobExecutionNotificationPublisher.java @@ -31,7 +31,7 @@ import org.springframework.jmx.export.notification.NotificationPublisherAware; * @author Dave Syer * @since 1.0 */ -public class JobExecutionNotificationPublisher implements ApplicationListener, NotificationPublisherAware { +public class JobExecutionNotificationPublisher implements ApplicationListener, NotificationPublisherAware { protected static final Log logger = LogFactory.getLog(JobExecutionNotificationPublisher.class); @@ -57,12 +57,10 @@ public class JobExecutionNotificationPublisher implements ApplicationListener, N * @see ApplicationListener#onApplicationEvent(ApplicationEvent) */ @Override - public void onApplicationEvent(ApplicationEvent applicationEvent) { - if (applicationEvent instanceof SimpleMessageApplicationEvent) { - String message = applicationEvent.toString(); - logger.info(message); - publish(message); - } + public void onApplicationEvent(SimpleMessageApplicationEvent applicationEvent) { + String message = applicationEvent.toString(); + logger.info(message); + publish(message); } /** diff --git a/spring-batch-test/src/test/java/org/springframework/batch/test/jmx/SimpleMessageApplicationEvent.java b/spring-batch-test/src/test/java/org/springframework/batch/test/jmx/SimpleMessageApplicationEvent.java index e62f2f35e..272332ef3 100755 --- a/spring-batch-test/src/test/java/org/springframework/batch/test/jmx/SimpleMessageApplicationEvent.java +++ b/spring-batch-test/src/test/java/org/springframework/batch/test/jmx/SimpleMessageApplicationEvent.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.test.jmx; import org.springframework.context.ApplicationEvent; diff --git a/spring-batch-test/src/test/java/org/springframework/batch/test/sample/LoggingTasklet.java b/spring-batch-test/src/test/java/org/springframework/batch/test/sample/LoggingTasklet.java index 07f9256b8..66cd450cc 100644 --- a/spring-batch-test/src/test/java/org/springframework/batch/test/sample/LoggingTasklet.java +++ b/spring-batch-test/src/test/java/org/springframework/batch/test/sample/LoggingTasklet.java @@ -1,3 +1,18 @@ +/* + * Copyright 2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.test.sample; import org.apache.commons.logging.Log; diff --git a/spring-batch-test/src/test/java/org/springframework/batch/test/sample/SampleTasklet.java b/spring-batch-test/src/test/java/org/springframework/batch/test/sample/SampleTasklet.java index e9a75575a..7f0a4ff6a 100755 --- a/spring-batch-test/src/test/java/org/springframework/batch/test/sample/SampleTasklet.java +++ b/spring-batch-test/src/test/java/org/springframework/batch/test/sample/SampleTasklet.java @@ -1,3 +1,18 @@ +/* + * Copyright 2008-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.batch.test.sample; import org.springframework.batch.core.JobExecution; diff --git a/spring-batch-test/src/test/resources/simple-job-launcher-context.xml b/spring-batch-test/src/test/resources/simple-job-launcher-context.xml index 73720e8bd..31b5ac34b 100755 --- a/spring-batch-test/src/test/resources/simple-job-launcher-context.xml +++ b/spring-batch-test/src/test/resources/simple-job-launcher-context.xml @@ -39,7 +39,7 @@