Batch-295:Added DefaultJobLauncher, which implements the JobLauncher interface in a different. Misc. other changes were made in support of this.
This commit is contained in:
@@ -29,8 +29,8 @@ import org.springframework.batch.repeat.context.RepeatContextSupport;
|
||||
*/
|
||||
public class JobExecutionTests extends TestCase {
|
||||
|
||||
private JobExecution execution = new JobExecution(new JobInstance(null, new Long(11)));
|
||||
private JobExecution context = new JobExecution(new JobInstance(new SimpleJobIdentifier("foo"), new Long(11)));
|
||||
private JobExecution execution = new JobExecution(new JobInstance(null, new Long(11), null));
|
||||
private JobExecution context = new JobExecution(new JobInstance(new SimpleJobIdentifier("foo"), new Long(11), null));
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.JobExecution#JobExecution()}.
|
||||
@@ -80,7 +80,7 @@ public class JobExecutionTests extends TestCase {
|
||||
*/
|
||||
public void testGetJobId() {
|
||||
assertEquals(11, execution.getJobId().longValue());
|
||||
execution = new JobExecution(new JobInstance(null, new Long(23)));
|
||||
execution = new JobExecution(new JobInstance(null, new Long(23), null));
|
||||
assertEquals(23, execution.getJobId().longValue());
|
||||
}
|
||||
|
||||
|
||||
@@ -28,13 +28,13 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class JobInstanceTests extends TestCase {
|
||||
|
||||
private JobInstance instance = new JobInstance(null, new Long(11));
|
||||
private JobInstance instance = new JobInstance(null, new Long(11), new Job("job"));
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.JobInstance#JobInstance()}.
|
||||
*/
|
||||
public void testJobInstance() {
|
||||
assertNull(new JobInstance(null).getId());
|
||||
assertNull(new JobInstance(null, null, null).getId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,7 +77,7 @@ public class JobInstanceTests extends TestCase {
|
||||
*/
|
||||
public void testGetIdentifier() {
|
||||
assertEquals(null, instance.getIdentifier());
|
||||
instance = new JobInstance(new SimpleJobIdentifier("foo"));
|
||||
instance = new JobInstance(new SimpleJobIdentifier("foo"), new Long(1));
|
||||
assertEquals("foo", instance.getIdentifier().getName());
|
||||
}
|
||||
|
||||
@@ -86,8 +86,12 @@ public class JobInstanceTests extends TestCase {
|
||||
*/
|
||||
public void testGetName() {
|
||||
assertEquals(null, instance.getName());
|
||||
instance = new JobInstance(new SimpleJobIdentifier("foo"));
|
||||
instance = new JobInstance(new SimpleJobIdentifier("foo"), new Long(1));
|
||||
assertEquals("foo", instance.getName());
|
||||
}
|
||||
|
||||
public void testGetJob(){
|
||||
|
||||
assertEquals("job", instance.getJob().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ public class StepExecutionTests extends TestCase {
|
||||
}
|
||||
|
||||
private StepExecution newStepExecution(Long long1, Long long2) {
|
||||
JobInstance job = new JobInstance(null);
|
||||
JobInstance job = new JobInstance(null, null);
|
||||
StepInstance step = new StepInstance(job, "foo", long1);
|
||||
StepExecution execution = new StepExecution(step, new JobExecution(job, long2));
|
||||
return execution;
|
||||
|
||||
@@ -17,6 +17,7 @@ package org.springframework.batch.core.domain;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.springframework.batch.core.runtime.SimpleJobIdentifier;
|
||||
import org.springframework.batch.restart.GenericRestartData;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
@@ -67,13 +68,21 @@ public class StepInstanceTests extends TestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.StepInstance#getJob()}.
|
||||
* Test method for {@link org.springframework.batch.core.domain.StepInstance#getJobInstance()}.
|
||||
*/
|
||||
public void testGetJob() {
|
||||
assertEquals(null, instance.getJob());
|
||||
JobInstance job = new JobInstance(null);
|
||||
instance = new StepInstance(job, null);
|
||||
assertEquals(job, instance.getJob());
|
||||
public void testGetJobInstance() {
|
||||
assertEquals(null, instance.getJobInstance());
|
||||
JobInstance jobInstance = new JobInstance(null, null);
|
||||
instance = new StepInstance(jobInstance, null);
|
||||
assertEquals(jobInstance, instance.getJobInstance());
|
||||
}
|
||||
|
||||
public void testGetJob(){
|
||||
|
||||
Job job = new Job("job");
|
||||
JobInstance jobInstance = new JobInstance(null, null, job);
|
||||
instance = new StepInstance(jobInstance, null);
|
||||
assertEquals(job, instance.getJobInstance().getJob());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,12 +99,12 @@ public class StepInstanceTests extends TestCase {
|
||||
*/
|
||||
public void testGetJobId() {
|
||||
assertEquals(null, instance.getJobId());
|
||||
instance = new StepInstance(new JobInstance(null, new Long(23)), null);
|
||||
instance = new StepInstance(new JobInstance(null, new Long(23), null), null);
|
||||
assertEquals(23, instance.getJobId().longValue());
|
||||
}
|
||||
|
||||
public void testEqualsWithSameIdentifier() throws Exception {
|
||||
JobInstance job = new JobInstance(null, new Long(100));
|
||||
JobInstance job = new JobInstance(null, new Long(100), null);
|
||||
StepInstance step1 = new StepInstance(job, "foo", new Long(0));
|
||||
StepInstance step2 = new StepInstance(job, "foo", new Long(0));
|
||||
assertEquals(step1, step2);
|
||||
|
||||
Reference in New Issue
Block a user