diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/OptimisticLockingFailureTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/OptimisticLockingFailureTests.java index fae294145..2bb4de2be 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/OptimisticLockingFailureTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/OptimisticLockingFailureTests.java @@ -16,9 +16,7 @@ package org.springframework.batch.core.repository.dao; -import org.junit.Ignore; import org.junit.Test; -import org.junit.runner.RunWith; import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; @@ -31,29 +29,22 @@ import org.springframework.batch.core.scope.context.ChunkContext; import org.springframework.batch.core.step.tasklet.Tasklet; import org.springframework.batch.item.ItemWriter; import org.springframework.batch.repeat.RepeatStatus; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; import java.util.List; import static org.junit.Assert.assertTrue; -@Ignore -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) public class OptimisticLockingFailureTests { - @Autowired - private Job job; - - @Autowired - private JobLauncher jobLauncher; - - @Autowired - private JobOperator jobOperator; - @Test public void testAsyncStopOfStartingJob() throws Exception { + ApplicationContext applicationContext = + new ClassPathXmlApplicationContext("org/springframework/batch/core/repository/dao/OptimisticLockingFailureTests-context.xml"); + Job job = applicationContext.getBean(Job.class); + JobLauncher jobLauncher = applicationContext.getBean(JobLauncher.class); + JobOperator jobOperator = applicationContext.getBean(JobOperator.class); + JobExecution jobExecution = jobLauncher.run(job, new JobParametersBuilder() .addLong("test", 1L) .toJobParameters()); diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/repository/dao/OptimisticLockingFailureTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/repository/dao/OptimisticLockingFailureTests-context.xml index 0fe44ab11..784e4a869 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/repository/dao/OptimisticLockingFailureTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/repository/dao/OptimisticLockingFailureTests-context.xml @@ -8,8 +8,6 @@ http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd"> - - @@ -62,4 +60,21 @@ + + + + + + org/springframework/batch/core/schema-drop-hsqldb.sql + org/springframework/batch/core/schema-hsqldb.sql + + + + + + + + + +