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 9dd60a496..52b5cfbdf 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 @@ -108,6 +108,21 @@ public class JdbcJobRepositoryTests { assertNotNull(execution.getId()); } + @Test + public void testFindOrCreateJobWithExecutionContext() throws Exception { + job.setName("foo"); + int before = 0; + JobExecution execution = repository.createJobExecution(job.getName(), new JobParameters()); + execution.getExecutionContext().put("foo", "bar"); + repository.updateExecutionContext(execution); + int after = simpleJdbcTemplate.queryForInt("SELECT COUNT(*) FROM BATCH_JOB_EXECUTION_CONTEXT"); + assertEquals(before + 1, after); + assertNotNull(execution.getId()); + JobExecution last = repository.getLastJobExecution(job.getName(), new JobParameters()); + assertEquals(execution, last); + assertEquals(execution.getExecutionContext(), last.getExecutionContext()); + } + @Test public void testFindOrCreateJobConcurrently() throws Exception { 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 30e1aa2e3..f7377931f 100644 --- a/spring-batch-core-tests/src/test/resources/batch-mysql.properties +++ b/spring-batch-core-tests/src/test/resources/batch-mysql.properties @@ -4,13 +4,10 @@ batch.jdbc.driver=com.mysql.jdbc.Driver batch.jdbc.url=jdbc:mysql://localhost/test batch.jdbc.user=root batch.jdbc.password=root -batch.schema= -batch.jndi.name= -batch.naming.factory.initial= -batch.naming.provider.url= batch.schema.script=classpath:/org/springframework/batch/core/schema-mysql.sql -batch.drop.script= -batch.business.schema.script=business-schema-mysql.sql +batch.business.schema.script=classpath:/business-schema-mysql.sql +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