diff --git a/execution/src/main/java/org/springframework/batch/execution/scope/SimpleStepContext.java b/execution/src/main/java/org/springframework/batch/execution/scope/SimpleStepContext.java index 3d49ff6df..56a09d819 100644 --- a/execution/src/main/java/org/springframework/batch/execution/scope/SimpleStepContext.java +++ b/execution/src/main/java/org/springframework/batch/execution/scope/SimpleStepContext.java @@ -23,7 +23,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.springframework.batch.core.domain.JobIdentifier; +import org.springframework.batch.core.domain.StepExecution; import org.springframework.batch.repeat.context.SynchronizedAttributeAccessor; /** @@ -36,7 +36,7 @@ public class SimpleStepContext extends SynchronizedAttributeAccessor implements private Map callbacks = new HashMap(); private StepContext parent; - private JobIdentifier jobIdentifier; + private StepExecution stepExecution; /** * Default constructor. @@ -123,17 +123,17 @@ public class SimpleStepContext extends SynchronizedAttributeAccessor implements /** - * @param jobIdentifier + * @param stepExecution */ - public void setJobIdentifier(JobIdentifier jobIdentifier) { - this.jobIdentifier = jobIdentifier; + public void setStepExecution(StepExecution stepExecution) { + this.stepExecution = stepExecution; } /* (non-Javadoc) * @see org.springframework.batch.execution.scope.StepContext#getJobIdentifier() */ - public JobIdentifier getJobIdentifier() { - return jobIdentifier; + public StepExecution getStepExecution() { + return stepExecution; } } diff --git a/execution/src/main/java/org/springframework/batch/execution/scope/StepContext.java b/execution/src/main/java/org/springframework/batch/execution/scope/StepContext.java index bf555a120..61cafb629 100644 --- a/execution/src/main/java/org/springframework/batch/execution/scope/StepContext.java +++ b/execution/src/main/java/org/springframework/batch/execution/scope/StepContext.java @@ -15,7 +15,7 @@ */ package org.springframework.batch.execution.scope; -import org.springframework.batch.core.domain.JobIdentifier; +import org.springframework.batch.core.domain.StepExecution; import org.springframework.core.AttributeAccessor; /** @@ -27,12 +27,12 @@ import org.springframework.core.AttributeAccessor; public interface StepContext extends AttributeAccessor { /** - * Accessor for the {@link JobIdentifier} associated with the currently + * Accessor for the {@link StepExecution} associated with the currently * executing step. * - * @return the {@link JobIdentifier} associated with the current step + * @return the {@link StepExecution} associated with the current step */ - JobIdentifier getJobIdentifier(); + StepExecution getStepExecution(); /** * Accessor for the parent context. diff --git a/execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleStepExecutor.java b/execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleStepExecutor.java index a1b8207c2..fa36d52cc 100644 --- a/execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleStepExecutor.java +++ b/execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleStepExecutor.java @@ -182,7 +182,7 @@ public class SimpleStepExecutor implements StepExecutor { stepExecution.getJobExecution().unregisterStepContext(context); } }); - stepScopeContext.setJobIdentifier(stepExecution.getJobExecution().getJobIdentifier()); + stepScopeContext.setStepExecution(stepExecution); context.setAttribute(StepScope.ID_KEY, stepExecution.getJobExecution() .getJobIdentifier()); // Mark the context as a step context as a hint to scope diff --git a/execution/src/test/java/org/springframework/batch/execution/scope/StepScopeContextTests.java b/execution/src/test/java/org/springframework/batch/execution/scope/SimpleStepContextTests.java similarity index 88% rename from execution/src/test/java/org/springframework/batch/execution/scope/StepScopeContextTests.java rename to execution/src/test/java/org/springframework/batch/execution/scope/SimpleStepContextTests.java index 97711cd81..cd67c2b1a 100644 --- a/execution/src/test/java/org/springframework/batch/execution/scope/StepScopeContextTests.java +++ b/execution/src/test/java/org/springframework/batch/execution/scope/SimpleStepContextTests.java @@ -20,13 +20,13 @@ import java.util.List; import junit.framework.TestCase; -import org.springframework.batch.core.runtime.SimpleJobIdentifier; +import org.springframework.batch.core.domain.StepExecution; /** * @author Dave Syer * */ -public class StepScopeContextTests extends TestCase { +public class SimpleStepContextTests extends TestCase { private SimpleStepContext context = new SimpleStepContext(new SimpleStepContext()); @@ -45,12 +45,12 @@ public class StepScopeContextTests extends TestCase { } /** - * Test method for {@link org.springframework.batch.execution.scope.SimpleStepContext#getJobIdentifier()}. + * Test method for {@link org.springframework.batch.execution.scope.SimpleStepContext#getStepExecution()}. */ public void testGetJobIdentifier() { - assertNull(context.getJobIdentifier()); - context.setJobIdentifier(new SimpleJobIdentifier("bar")); - assertEquals("bar", context.getJobIdentifier().getName()); + assertNull(context.getStepExecution()); + context.setStepExecution(new StepExecution(null, null)); + assertNotNull(context.getStepExecution()); } private List list = new ArrayList(); diff --git a/execution/src/test/java/org/springframework/batch/execution/step/simple/DefaultStepExecutorTests.java b/execution/src/test/java/org/springframework/batch/execution/step/simple/DefaultStepExecutorTests.java index 7a3ffb8c3..b3b57d0b8 100644 --- a/execution/src/test/java/org/springframework/batch/execution/step/simple/DefaultStepExecutorTests.java +++ b/execution/src/test/java/org/springframework/batch/execution/step/simple/DefaultStepExecutorTests.java @@ -148,7 +148,7 @@ public class DefaultStepExecutorTests extends TestCase { assertEquals(1, jobExecution.getChunkContexts().size()); assertEquals(1, jobExecution.getStepContexts().size()); assertNotNull(StepSynchronizationManager.getContext() - .getJobIdentifier()); + .getStepExecution()); processed.add("foo"); return ExitStatus.CONTINUABLE; }