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 8085c4ed7..63874d038 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
@@ -15,18 +15,12 @@
*/
package org.springframework.batch.core.test.repository;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
@@ -35,6 +29,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobParameters;
@@ -45,6 +40,11 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/simple-job-launcher-context.xml" })
public class JdbcJobRepositoryTests {
@@ -74,28 +74,30 @@ public class JdbcJobRepositoryTests {
public void onSetUpInTransaction() throws Exception {
job = new JobSupport("test-job");
job.setRestartable(true);
+ }
+
+ @After
+ public void onTearDownAfterTransaction() throws Exception {
+
jdbcTemplate.update("DELETE FROM BATCH_STEP_EXECUTION_CONTEXT");
jdbcTemplate.update("DELETE FROM BATCH_JOB_EXECUTION_CONTEXT");
jdbcTemplate.update("DELETE FROM BATCH_STEP_EXECUTION");
jdbcTemplate.update("DELETE FROM BATCH_JOB_EXECUTION_PARAMS");
jdbcTemplate.update("DELETE FROM BATCH_JOB_EXECUTION");
jdbcTemplate.update("DELETE FROM BATCH_JOB_INSTANCE");
- }
- @After
- public void onTearDownAfterTransaction() throws Exception {
- for (Long id : jobExecutionIds) {
- jdbcTemplate.update("DELETE FROM BATCH_JOB_EXECUTION_CONTEXT where JOB_EXECUTION_ID=?", id);
- jdbcTemplate.update("DELETE FROM BATCH_JOB_EXECUTION where JOB_EXECUTION_ID=?", id);
- }
- for (Long id : jobIds) {
- jdbcTemplate.update("DELETE FROM BATCH_JOB_INSTANCE where JOB_INSTANCE_ID=?", id);
- }
- for (Long id : jobIds) {
- int count = jdbcTemplate.queryForObject(
- "SELECT COUNT(*) FROM BATCH_JOB_INSTANCE where JOB_INSTANCE_ID=?", Integer.class, id);
- assertEquals(0, count);
- }
+// for (Long id : jobExecutionIds) {
+// jdbcTemplate.update("DELETE FROM BATCH_JOB_EXECUTION_CONTEXT where JOB_EXECUTION_ID=?", id);
+// jdbcTemplate.update("DELETE FROM BATCH_JOB_EXECUTION where JOB_EXECUTION_ID=?", id);
+// }
+// for (Long id : jobIds) {
+// jdbcTemplate.update("DELETE FROM BATCH_JOB_INSTANCE where JOB_INSTANCE_ID=?", id);
+// }
+// for (Long id : jobIds) {
+// int count = jdbcTemplate.queryForObject(
+// "SELECT COUNT(*) FROM BATCH_JOB_INSTANCE where JOB_INSTANCE_ID=?", Integer.class, id);
+// assertEquals(0, count);
+// }
}
@Test
diff --git a/spring-batch-core-tests/src/test/resources/batch-derby.properties b/spring-batch-core-tests/src/test/resources/batch-derby.properties
index 380004cd1..5ed99a6d3 100644
--- a/spring-batch-core-tests/src/test/resources/batch-derby.properties
+++ b/spring-batch-core-tests/src/test/resources/batch-derby.properties
@@ -13,4 +13,5 @@ batch.data.source.init=true
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.DerbyMaxValueIncrementer
batch.database.incrementer.parent=columnIncrementerParent
batch.grid.size=2
-batch.verify.cursor.position=false
\ No newline at end of file
+batch.verify.cursor.position=false
+batch.jdbc.validationQuery=values 1
diff --git a/spring-batch-core-tests/src/test/resources/batch-hsql.properties b/spring-batch-core-tests/src/test/resources/batch-hsql.properties
index 08baa13e8..7af206ad1 100644
--- a/spring-batch-core-tests/src/test/resources/batch-hsql.properties
+++ b/spring-batch-core-tests/src/test/resources/batch-hsql.properties
@@ -16,3 +16,4 @@ batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.Hs
batch.database.incrementer.parent=columnIncrementerParent
batch.grid.size=2
batch.verify.cursor.position=true
+batch.jdbc.validationQuery=SELECT 1 FROM INFORMATION_SCHEMA.SYSTEM_USERS
diff --git a/spring-batch-core-tests/src/test/resources/batch-mysql.properties b/spring-batch-core-tests/src/test/resources/batch-mysql.properties
index f7377931f..1c157a6ed 100644
--- a/spring-batch-core-tests/src/test/resources/batch-mysql.properties
+++ b/spring-batch-core-tests/src/test/resources/batch-mysql.properties
@@ -10,4 +10,5 @@ batch.data.source.init=false
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.MySQLMaxValueIncrementer
batch.database.incrementer.parent=columnIncrementerParent
batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler
-batch.verify.cursor.position=true
\ No newline at end of file
+batch.verify.cursor.position=true
+batch.jdbc.validationQuery=SELECT 1
diff --git a/spring-batch-core-tests/src/test/resources/batch-postgres.properties b/spring-batch-core-tests/src/test/resources/batch-postgres.properties
index 9e47c540f..c399a8b7a 100644
--- a/spring-batch-core-tests/src/test/resources/batch-postgres.properties
+++ b/spring-batch-core-tests/src/test/resources/batch-postgres.properties
@@ -14,3 +14,4 @@ batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.Po
batch.database.incrementer.parent=sequenceIncrementerParent
batch.grid.size=2
batch.verify.cursor.position=true
+batch.jdbc.validationQuery=SELECT 1
diff --git a/spring-batch-core-tests/src/test/resources/data-source-context.xml b/spring-batch-core-tests/src/test/resources/data-source-context.xml
index 250993947..568ea2eb6 100644
--- a/spring-batch-core-tests/src/test/resources/data-source-context.xml
+++ b/spring-batch-core-tests/src/test/resources/data-source-context.xml
@@ -22,6 +22,7 @@
+