Final attempt at fixing test failure on build machine. Works as expected in a cloned plan

This commit is contained in:
Chris Schaefer
2014-06-09 18:24:44 -04:00
committed by Michael Minella
parent 1f8cc9a557
commit 0f5a7af1a3
2 changed files with 25 additions and 19 deletions

View File

@@ -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());

View File

@@ -8,8 +8,6 @@
http://www.springframework.org/schema/batch
http://www.springframework.org/schema/batch/spring-batch.xsd">
<import resource="classpath:/org/springframework/batch/core/repository/dao/data-source-context.xml" />
<batch:job id="locking">
<batch:step id="step1" next="step2">
<batch:tasklet ref="tasklet"/>
@@ -62,4 +60,21 @@
<property name="jobExplorer" ref="jobExplorer"/>
<property name="jobRegistry" ref="jobRegistry"/>
</bean>
<bean class="test.jdbc.datasource.DataSourceInitializer">
<property name="dataSource" ref="dataSource" />
<property name="initScripts">
<list>
<value>org/springframework/batch/core/schema-drop-hsqldb.sql</value>
<value>org/springframework/batch/core/schema-hsqldb.sql</value>
</list>
</property>
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
<property name="url" value="jdbc:hsqldb:mem:testd;sql.enforce_strict_size=true;hsqldb.tx=mvcc" />
<property name="username" value="sa" />
<property name="password" value="" />
</bean>
</beans>