RESOLVED - issue BATCH-603: JobExecution fields could be modified in another Thread and are not volatile
Added final and volatile as appropriate in domain entities.
This commit is contained in:
@@ -31,12 +31,8 @@ public class JobExecutionTests extends TestCase {
|
||||
|
||||
private JobExecution execution = new JobExecution(new JobInstance(new Long(11), new JobParameters(), "foo"), new Long(12));
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.JobExecution#JobExecution()}.
|
||||
*/
|
||||
public void testJobExecution() {
|
||||
assertNull(new JobExecution().getId());
|
||||
assertNull(new JobExecution(new JobInstance(null,null,"foo")).getId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,7 +146,7 @@ public class JobExecutionTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testToStringWithNullJob() throws Exception {
|
||||
execution = new JobExecution();
|
||||
execution = new JobExecution(new JobInstance(null,null,"foo"));
|
||||
assertTrue("JobExecution string does not contain id", execution.toString().indexOf("id=") >= 0);
|
||||
assertTrue("JobExecution string does not contain job: " + execution, execution.toString().indexOf("job=") >= 0);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class StepContributionTests extends TestCase {
|
||||
|
||||
private StepExecution execution = new StepExecution();
|
||||
private StepExecution execution = new StepExecution("step", null);
|
||||
|
||||
private StepContribution contribution = new StepContribution(execution);
|
||||
|
||||
|
||||
@@ -35,22 +35,14 @@ public class StepExecutionTests extends TestCase {
|
||||
|
||||
private StepExecution execution = newStepExecution(new StepSupport("stepName"), new Long(23));
|
||||
|
||||
private StepExecution blankExecution = new StepExecution("blank", new JobExecution());
|
||||
private StepExecution blankExecution = newStepExecution(new StepSupport("blank"), null);
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.JobExecution#JobExecution()}.
|
||||
*/
|
||||
public void testStepExecution() {
|
||||
assertNull(new StepExecution().getId());
|
||||
assertNull(new StepExecution("step", null).getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.JobExecution#JobExecution()}.
|
||||
*/
|
||||
public void testStepExecutionWithNullId() {
|
||||
assertNull(new StepExecution("stepName", new JobExecution()).getId());
|
||||
assertNull(new StepExecution("stepName", new JobExecution(new JobInstance(null,null,"foo"))).getId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,7 +130,7 @@ public class StepExecutionTests extends TestCase {
|
||||
|
||||
public void testNullNameIsIllegal() throws Exception {
|
||||
try {
|
||||
new StepExecution(null, new JobExecution());
|
||||
new StepExecution(null, new JobExecution(new JobInstance(null, null, "job")));
|
||||
fail();
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
@@ -183,11 +175,6 @@ public class StepExecutionTests extends TestCase {
|
||||
assertFalse(stepExecution.equals(blankExecution));
|
||||
}
|
||||
|
||||
public void testEqualsWithNullStep() throws Exception {
|
||||
Entity stepExecution = newStepExecution(new StepSupport("stepName"), null);
|
||||
assertFalse(stepExecution.equals(blankExecution));
|
||||
}
|
||||
|
||||
public void testEqualsWithSelf() throws Exception {
|
||||
assertTrue(execution.equals(execution));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user