diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.java b/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.java index 2072d40ea..bc4704586 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.java @@ -146,9 +146,10 @@ public class JobExecution extends Entity { /** * Register a step execution with the current job execution. + * @param stepName TODO */ - public StepExecution createStepExecution(Step step) { - StepExecution stepExecution = new StepExecution(step.getName(), this); + public StepExecution createStepExecution(String stepName) { + StepExecution stepExecution = new StepExecution(stepName, this); this.stepExecutions.add(stepExecution); return stepExecution; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/UnexpectedJobExecutionException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/UnexpectedJobExecutionException.java index 75376babb..bbf4f2397 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/UnexpectedJobExecutionException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/UnexpectedJobExecutionException.java @@ -46,20 +46,4 @@ public class UnexpectedJobExecutionException extends RuntimeException { super(msg, nested); } - /** - * Constructs a new instance with a nested exception. The message is empty. - * @deprecated use one of the other constructors - */ - public UnexpectedJobExecutionException(Throwable nested) { - super(nested); - } - - /** - * Constructs a new instance, the message is empty. - * @deprecated use one of the other constructors - */ - public UnexpectedJobExecutionException() { - super(); - } - } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/SimpleJob.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/SimpleJob.java index cf17d210f..13b111fcc 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/SimpleJob.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/SimpleJob.java @@ -81,7 +81,7 @@ public class SimpleJob extends AbstractJob { startedCount++; updateStatus(execution, BatchStatus.STARTED); - currentStepExecution = execution.createStepExecution(step); + currentStepExecution = execution.createStepExecution(step.getName()); StepExecution lastStepExecution = getJobRepository().getLastStepExecution(jobInstance, step); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/JobExecutionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/JobExecutionTests.java index 7016ce4ac..0db2b9a34 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/JobExecutionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/JobExecutionTests.java @@ -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()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/SimpleJobOperatorTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/SimpleJobOperatorTests.java index 1fa2be563..1bf1e19dc 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/SimpleJobOperatorTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/SimpleJobOperatorTests.java @@ -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); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobExecutionDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobExecutionDaoTests.java index 86a591041..bb274b5f8 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobExecutionDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobExecutionDaoTests.java @@ -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(); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/resource/StepExecutionResourceProxyTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/resource/StepExecutionResourceProxyTests.java index 88effa843..7846c6597 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/resource/StepExecutionResourceProxyTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/resource/StepExecutionResourceProxyTests.java @@ -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); } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/resource/StepExecutionSimpleCompletionPolicyTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/resource/StepExecutionSimpleCompletionPolicyTests.java index fa2ed1d6e..0e3d93b1b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/resource/StepExecutionSimpleCompletionPolicyTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/resource/StepExecutionSimpleCompletionPolicyTests.java @@ -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); } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipLimitStepFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipLimitStepFactoryBeanTests.java index b1e443065..50c1f01fc 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipLimitStepFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipLimitStepFactoryBeanTests.java @@ -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()); diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/job/StepExecutionMessageHandler.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/job/StepExecutionMessageHandler.java index 11448f5d3..d94ea5b08 100644 --- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/job/StepExecutionMessageHandler.java +++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/job/StepExecutionMessageHandler.java @@ -69,7 +69,7 @@ public class StepExecutionMessageHandler { JobExecution jobExecution = request.getJobExecution(); JobInstance jobInstance = jobExecution.getJobInstance(); - StepExecution stepExecution = jobExecution.createStepExecution(step); + StepExecution stepExecution = jobExecution.createStepExecution(step.getName()); try { StepExecution lastStepExecution = jobRepository.getLastStepExecution(jobInstance, step); diff --git a/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/ChunkMessageItemWriterIntegrationTests.java b/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/ChunkMessageItemWriterIntegrationTests.java index 2ecb4701d..c47c0dc0f 100644 --- a/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/ChunkMessageItemWriterIntegrationTests.java +++ b/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/ChunkMessageItemWriterIntegrationTests.java @@ -324,7 +324,7 @@ public class ChunkMessageItemWriterIntegrationTests { JobExecution jobExecution = jobRepository.createJobExecution(job, new JobParametersBuilder().addLong("job.counter", jobCounter++) .toJobParameters()); - StepExecution stepExecution = jobExecution.createStepExecution(step); + StepExecution stepExecution = jobExecution.createStepExecution(step.getName()); return stepExecution; } diff --git a/spring-batch-integration/src/test/java/org/springframework/batch/integration/job/MessageOrientedStepTests.java b/spring-batch-integration/src/test/java/org/springframework/batch/integration/job/MessageOrientedStepTests.java index 5e9b1ad3f..a6fb37a9b 100644 --- a/spring-batch-integration/src/test/java/org/springframework/batch/integration/job/MessageOrientedStepTests.java +++ b/spring-batch-integration/src/test/java/org/springframework/batch/integration/job/MessageOrientedStepTests.java @@ -104,7 +104,7 @@ public class MessageOrientedStepTests { try { step.setExecutionTimeout(1000); step.setPollingInterval(100); - step.execute(jobExecution.createStepExecution(step)); + step.execute(jobExecution.createStepExecution(step.getName())); fail("Expected StepExecutionTimeoutException"); } catch (StepExecutionTimeoutException e) { @@ -123,7 +123,7 @@ public class MessageOrientedStepTests { return replyChannel.send(message); } }); - step.execute(jobExecution.createStepExecution(step)); + step.execute(jobExecution.createStepExecution(step.getName())); } @Test @@ -136,7 +136,7 @@ public class MessageOrientedStepTests { } }); try { - step.execute(jobExecution.createStepExecution(step)); + step.execute(jobExecution.createStepExecution(step.getName())); fail("Expected RuntimeException"); } catch (RuntimeException e) { @@ -153,7 +153,7 @@ public class MessageOrientedStepTests { // Send a message to the reply channel to simulate step that we were // waiting for when we failed on the last execution. replyChannel.send(new GenericMessage(jobExecutionRequest)); - StepExecution stepExecution = jobExecution.createStepExecution(step); + StepExecution stepExecution = jobExecution.createStepExecution(step.getName()); stepExecution.getExecutionContext().putString(MessageOrientedStep.WAITING, "true"); step.execute(stepExecution); }