Fixing integration tests for CI build
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
batch.verify.cursor.position=false
|
||||
batch.jdbc.validationQuery=values 1
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
batch.verify.cursor.position=true
|
||||
batch.jdbc.validationQuery=SELECT 1
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<property name="url" value="${batch.jdbc.url}" />
|
||||
<property name="username" value="${batch.jdbc.user}" />
|
||||
<property name="password" value="${batch.jdbc.password}" />
|
||||
<property name="validationQuery" value="${batch.jdbc.validationQuery}"/>
|
||||
</bean>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" lazy-init="true">
|
||||
|
||||
Reference in New Issue
Block a user