Modify factory method signature in JobExecution to make it not dependent on non-entity
This commit is contained in:
@@ -20,7 +20,6 @@ import java.util.Date;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.commons.lang.SerializationUtils;
|
||||
import org.springframework.batch.core.step.StepSupport;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
|
||||
/**
|
||||
@@ -128,12 +127,12 @@ public class JobExecutionTests extends TestCase {
|
||||
|
||||
public void testAddAndRemoveStepExecution() throws Exception {
|
||||
assertEquals(0, execution.getStepExecutions().size());
|
||||
execution.createStepExecution(new StepSupport("stepName"));
|
||||
execution.createStepExecution("step");
|
||||
assertEquals(1, execution.getStepExecutions().size());
|
||||
}
|
||||
|
||||
public void testStop() throws Exception {
|
||||
StepExecution stepExecution = execution.createStepExecution(new StepSupport("stepName"));
|
||||
StepExecution stepExecution = execution.createStepExecution("step");
|
||||
assertFalse(stepExecution.isTerminateOnly());
|
||||
execution.stop();
|
||||
assertTrue(stepExecution.isTerminateOnly());
|
||||
|
||||
@@ -50,7 +50,6 @@ import org.springframework.batch.core.repository.JobExecutionAlreadyRunningExcep
|
||||
import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.JobRestartException;
|
||||
import org.springframework.batch.core.step.StepSupport;
|
||||
import org.springframework.batch.support.PropertiesConverter;
|
||||
|
||||
/**
|
||||
@@ -234,8 +233,8 @@ public class SimpleJobOperatorTests {
|
||||
jobParameters = new JobParameters();
|
||||
jobExplorer.getJobExecution(111L);
|
||||
JobExecution jobExecution = new JobExecution(new JobInstance(123L, jobParameters, job.getName()), 111L);
|
||||
jobExecution.createStepExecution(new StepSupport("step1"));
|
||||
jobExecution.createStepExecution(new StepSupport("step2"));
|
||||
jobExecution.createStepExecution("step1");
|
||||
jobExecution.createStepExecution("step2");
|
||||
jobExecution.getStepExecutions().iterator().next().setId(21L);
|
||||
EasyMock.expectLastCall().andReturn(jobExecution);
|
||||
EasyMock.replay(jobExplorer);
|
||||
|
||||
@@ -14,7 +14,6 @@ import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobInstance;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.step.StepSupport;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -146,7 +145,7 @@ public abstract class AbstractJobExecutionDaoTests extends AbstractTransactional
|
||||
dao.saveJobExecution(exec);
|
||||
exec = new JobExecution(jobInstance);
|
||||
exec.setLastUpdated(new Date(5L));
|
||||
exec.createStepExecution(new StepSupport("foo"));
|
||||
exec.createStepExecution("step");
|
||||
dao.saveJobExecution(exec);
|
||||
StepExecutionDao stepExecutionDao = getStepExecutionDao();
|
||||
if (stepExecutionDao != null) {
|
||||
@@ -180,7 +179,7 @@ public abstract class AbstractJobExecutionDaoTests extends AbstractTransactional
|
||||
public void testGetExecution() {
|
||||
JobExecution exec = new JobExecution(jobInstance);
|
||||
exec.setCreateTime(new Date(0));
|
||||
exec.createStepExecution(new StepSupport("foo"));
|
||||
exec.createStepExecution("step");
|
||||
|
||||
dao.saveJobExecution(exec);
|
||||
StepExecutionDao stepExecutionDao = getStepExecutionDao();
|
||||
|
||||
@@ -64,7 +64,7 @@ public class StepExecutionResourceProxyTests extends TestCase {
|
||||
jobInstance = new JobInstance(new Long(0), new JobParameters(), "testJob");
|
||||
JobExecution jobExecution = new JobExecution(jobInstance);
|
||||
Step step = new StepSupport("bar");
|
||||
stepExecution = jobExecution.createStepExecution(step);
|
||||
stepExecution = jobExecution.createStepExecution(step.getName());
|
||||
resource.beforeStep(stepExecution);
|
||||
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public class StepExecutionResourceProxyTests extends TestCase {
|
||||
.toJobParameters(), "testJob");
|
||||
JobExecution jobExecution = new JobExecution(jobInstance);
|
||||
Step step = new StepSupport("bar");
|
||||
resource.beforeStep(jobExecution.createStepExecution(step));
|
||||
resource.beforeStep(jobExecution.createStepExecution(step.getName()));
|
||||
doTestPathName("spam-foo", "foo" + pathsep + "data" + pathsep);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class StepExecutionSimpleCompletionPolicyTests extends TestCase {
|
||||
jobInstance = new JobInstance(new Long(0), jobParameters, "testJob");
|
||||
JobExecution jobExecution = new JobExecution(jobInstance);
|
||||
Step step = new StepSupport("bar");
|
||||
stepExecution = jobExecution.createStepExecution(step);
|
||||
stepExecution = jobExecution.createStepExecution(step.getName());
|
||||
policy.beforeStep(stepExecution);
|
||||
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ public class SkipLimitStepFactoryBeanTests {
|
||||
|
||||
Step step = (Step) factory.getObject();
|
||||
|
||||
StepExecution stepExecution = jobExecution.createStepExecution(step);
|
||||
StepExecution stepExecution = jobExecution.createStepExecution(step.getName());
|
||||
|
||||
step.execute(stepExecution);
|
||||
assertEquals(4, stepExecution.getSkipCount());
|
||||
@@ -344,7 +344,7 @@ public class SkipLimitStepFactoryBeanTests {
|
||||
|
||||
Step step = (Step) factory.getObject();
|
||||
|
||||
StepExecution stepExecution = jobExecution.createStepExecution(step);
|
||||
StepExecution stepExecution = jobExecution.createStepExecution(step.getName());
|
||||
|
||||
step.execute(stepExecution);
|
||||
assertEquals(4, stepExecution.getSkipCount());
|
||||
|
||||
Reference in New Issue
Block a user