diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/Step.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/Step.java index e2434e13e..6d1eb3f36 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/Step.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/Step.java @@ -39,12 +39,6 @@ public interface Step { */ boolean isAllowStartIfComplete(); - /** - * Flag to indicate if restart data needs to be saved for this step. - * @return true if restart data should be saved - */ - boolean isSaveExecutionContext(); - /** * @return the number of times a job can be started with the same * identifier. diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/DuplicateJobException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/DuplicateJobException.java index 0302fc800..75db95b33 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/DuplicateJobException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/DuplicateJobException.java @@ -15,11 +15,11 @@ */ package org.springframework.batch.core.repository; -import org.springframework.batch.core.domain.JobSupport; +import org.springframework.batch.core.domain.Job; /** * Checked exception that indicates a name clash when registering - * {@link JobSupport} instances. + * {@link Job} instances. * * @author Dave Syer * diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobException.java index 337a77a5a..7cf809797 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobException.java @@ -15,10 +15,10 @@ */ package org.springframework.batch.core.repository; -import org.springframework.batch.core.domain.JobSupport; +import org.springframework.batch.core.domain.Job; /** - * Base class for checked exceptions related to {@link JobSupport} + * Base class for checked exceptions related to {@link Job} * creation, registration or use. * * @author Dave Syer diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobLocator.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobLocator.java index 3edfd0868..43ca793e0 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobLocator.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobLocator.java @@ -16,7 +16,6 @@ package org.springframework.batch.core.repository; import org.springframework.batch.core.domain.Job; -import org.springframework.batch.core.domain.JobSupport; /** * A runtime service locator interface for retrieving job configurations by @@ -28,11 +27,11 @@ import org.springframework.batch.core.domain.JobSupport; public interface JobLocator { /** - * Locates a {@link JobSupport} at runtime. + * Locates a {@link Job} at runtime. * - * @param name the name of the {@link JobSupport} which should be + * @param name the name of the {@link Job} which should be * unique - * @return a {@link JobSupport} identified by the given name + * @return a {@link Job} identified by the given name * * @throws NoSuchJobException if the required configuratio can * not be found. diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRegistry.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRegistry.java index 1b54df276..2034f4558 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRegistry.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRegistry.java @@ -16,7 +16,6 @@ package org.springframework.batch.core.repository; import org.springframework.batch.core.domain.Job; -import org.springframework.batch.core.domain.JobSupport; /** * A runtime service registry interface for registering job configurations by @@ -28,9 +27,9 @@ import org.springframework.batch.core.domain.JobSupport; public interface JobRegistry extends JobLocator { /** - * Registers a {@link JobSupport} at runtime. + * Registers a {@link Job} at runtime. * - * @param jobConfiguration the {@link JobSupport} to be registered + * @param jobConfiguration the {@link Job} to be registered * * @throws DuplicateJobException if a configuration with the * same name has already been registered. @@ -38,10 +37,10 @@ public interface JobRegistry extends JobLocator { void register(Job jobConfiguration) throws DuplicateJobException; /** - * Unregisters a previously registered {@link JobSupport}. If it was + * Unregisters a previously registered {@link Job}. If it was * not previously registered there is no error. * - * @param jobConfiguration the {@link JobSupport} to unregister. + * @param jobConfiguration the {@link Job} to unregister. */ void unregister(Job jobConfiguration); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/ListableJobRegistry.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/ListableJobRegistry.java index 3bad803ee..2632c4507 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/ListableJobRegistry.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/ListableJobRegistry.java @@ -17,7 +17,7 @@ package org.springframework.batch.core.repository; import java.util.Collection; -import org.springframework.batch.core.domain.JobSupport; +import org.springframework.batch.core.domain.Job; /** * A listable extension of {@link JobRegistry}. @@ -31,7 +31,7 @@ public interface ListableJobRegistry extends JobRegistry { * Provides the currently registered configurations. The return value is * unmodifiable and disconnected from the underlying registry storage. * - * @return a collection of {@link JobSupport} instances. Empty if none + * @return a collection of {@link Job} instances. Empty if none * are registered. */ Collection getJobConfigurations(); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/NoSuchJobException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/NoSuchJobException.java index 9841390f7..a3c135c4a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/NoSuchJobException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/NoSuchJobException.java @@ -15,11 +15,11 @@ */ package org.springframework.batch.core.repository; -import org.springframework.batch.core.domain.JobSupport; +import org.springframework.batch.core.domain.Job; /** - * Checked exception to indicate that a required {@link JobSupport} is not + * Checked exception to indicate that a required {@link Job} is not * available. * * @author Dave Syer diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobSupport.java b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobSupport.java similarity index 95% rename from spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobSupport.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobSupport.java index eee92e7a5..8e97ee695 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobSupport.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobSupport.java @@ -19,6 +19,9 @@ package org.springframework.batch.core.domain; import java.util.ArrayList; import java.util.List; +import org.springframework.batch.core.domain.Job; +import org.springframework.batch.core.domain.JobExecution; +import org.springframework.batch.core.domain.Step; import org.springframework.batch.io.exception.BatchCriticalException; import org.springframework.beans.factory.BeanNameAware; import org.springframework.util.ClassUtils; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobSupportTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobSupportTests.java deleted file mode 100644 index e6a475b7b..000000000 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobSupportTests.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2006-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.batch.core.domain; - -import java.util.Collections; - -import org.springframework.batch.core.domain.JobSupport; -import org.springframework.batch.core.domain.StepSupport; - -import junit.framework.TestCase; - -/** - * @author Dave Syer - * - */ -public class JobSupportTests extends TestCase { - - JobSupport job = new JobSupport("job"); - - /** - * Test method for - * {@link org.springframework.batch.core.domain.JobSupport#JobConfiguration()}. - */ - public void testJobConfiguration() { - job = new JobSupport(); - assertNull(job.getName()); - } - - /** - * Test method for - * {@link org.springframework.batch.core.domain.JobSupport#setBeanName(java.lang.String)}. - */ - public void testSetBeanName() { - job.setBeanName("foo"); - assertEquals("job", job.getName()); - } - - /** - * Test method for - * {@link org.springframework.batch.core.domain.JobSupport#setBeanName(java.lang.String)}. - */ - public void testSetBeanNameWithNullName() { - job = new JobSupport(null); - assertEquals(null, job.getName()); - job.setBeanName("foo"); - assertEquals("foo", job.getName()); - } - - /** - * Test method for - * {@link org.springframework.batch.core.domain.JobSupport#setStepNames(java.util.List)}. - */ - public void testSetSteps() { - job.setSteps(Collections.singletonList(new StepSupport("step"))); - assertEquals(1, job.getSteps().size()); - } - - /** - * Test method for - * {@link org.springframework.batch.core.domain.JobSupport#addStepName(org.springframework.batch.core.configuration.StepConfiguration)}. - */ - public void testAddStep() { - job.addStep(new StepSupport("step")); - assertEquals(1, job.getSteps().size()); - } - - /** - * Test method for - * {@link org.springframework.batch.core.domain.JobSupport#setStartLimit(int)}. - */ - public void testSetStartLimit() { - assertEquals(Integer.MAX_VALUE, job.getStartLimit()); - job.setStartLimit(10); - assertEquals(10, job.getStartLimit()); - } - - /** - * Test method for - * {@link org.springframework.batch.core.domain.JobSupport#setRestartable(boolean)}. - */ - public void testSetRestartable() { - assertFalse(job.isRestartable()); - job.setRestartable(true); - assertTrue(job.isRestartable()); - } - - public void testToString() throws Exception { - String value = job.toString(); - assertTrue("Should contain name: "+value, value.indexOf("name=")>=0); - } - - public void testRunNotSupported() throws Exception { - try { - job.execute(null); - } catch (UnsupportedOperationException e) { - // expected - String message = e.getMessage(); - assertTrue("Message should contain JobSupport: "+message, message.contains("JobSupport")); - } - } - -} diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/SpringBeanJobTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/SpringBeanJobTests.java index d1ceda2d2..95f8c4b4e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/SpringBeanJobTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/SpringBeanJobTests.java @@ -18,7 +18,6 @@ package org.springframework.batch.core.domain; import junit.framework.TestCase; -import org.springframework.batch.core.domain.JobSupport; import org.springframework.beans.factory.config.ConstructorArgumentValues; import org.springframework.beans.factory.support.ChildBeanDefinition; import org.springframework.beans.factory.support.RootBeanDefinition; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepSupport.java b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepSupport.java similarity index 89% rename from spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepSupport.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepSupport.java index f2e4c6e85..91d831f07 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepSupport.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepSupport.java @@ -15,6 +15,9 @@ */ package org.springframework.batch.core.domain; +import org.springframework.batch.core.domain.JobInterruptedException; +import org.springframework.batch.core.domain.Step; +import org.springframework.batch.core.domain.StepExecution; import org.springframework.batch.io.exception.BatchCriticalException; import org.springframework.beans.factory.BeanNameAware; @@ -33,8 +36,6 @@ public class StepSupport implements Step, BeanNameAware { private boolean allowStartIfComplete; - private boolean saveExecutionContext = false; - /** * Default constructor for {@link StepSupport}. */ @@ -102,14 +103,6 @@ public class StepSupport implements Step, BeanNameAware { this.allowStartIfComplete = allowStartIfComplete; } - public void setSaveExecutionContext(boolean saveExecutionContext) { - this.saveExecutionContext = saveExecutionContext; - } - - public boolean isSaveExecutionContext() { - return saveExecutionContext; - } - /** * Not supported but provided so that tests can easily create a step. * diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepSupportTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepSupportTests.java deleted file mode 100644 index 3e85bbf33..000000000 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepSupportTests.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2006-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.batch.core.domain; - -import junit.framework.TestCase; - -import org.springframework.batch.core.domain.StepSupport; - -/** - * @author Dave Syer - * - */ -public class StepSupportTests extends TestCase { - - private StepSupport configuration = new StepSupport("step"); - - /** - * Test method for {@link org.springframework.batch.core.domain.StepSupport#StepConfigurationSupport()}. - */ - public void testStepConfigurationSupport() { - configuration = new StepSupport(); - assertNull(configuration.getName()); - } - - /** - * Test method for {@link org.springframework.batch.core.domain.StepSupport#getName()}. - */ - public void testGetName() { - assertEquals("step", configuration.getName()); - configuration.setName("bar"); - assertEquals("bar", configuration.getName()); - } - - /** - * Test method for {@link org.springframework.batch.core.domain.StepSupport#getName()}. - */ - public void testBeanNameAlreadySet() { - assertEquals("step", configuration.getName()); - configuration.setBeanName("bar"); - assertEquals("step", configuration.getName()); - } - - /** - * Test method for {@link org.springframework.batch.core.domain.StepSupport#getName()}. - */ - public void testBeanNameOnNew() { - configuration = new StepSupport(); - assertEquals(null, configuration.getName()); - configuration.setBeanName("bar"); - assertEquals("bar", configuration.getName()); - } - - public void testSaveRestartFlag() throws Exception { - assertEquals(false, configuration.isSaveExecutionContext()); - configuration.setSaveExecutionContext(true); - assertEquals(true, configuration.isSaveExecutionContext()); - } - - /** - * Test method for {@link org.springframework.batch.core.domain.StepSupport#getStartLimit()}. - */ - public void testGetStartLimit() { - assertEquals(Integer.MAX_VALUE, configuration.getStartLimit()); - configuration.setStartLimit(10); - assertEquals(10, configuration.getStartLimit()); - } - - /** - * Test method for {@link org.springframework.batch.core.domain.StepSupport#isAllowStartIfComplete()}. - */ - public void testShouldAllowStartIfComplete() { - assertEquals(false, configuration.isAllowStartIfComplete()); - configuration.setAllowStartIfComplete(true); - assertEquals(true, configuration.isAllowStartIfComplete()); - } - - public void testUnsuccessfulWrongConfiguration() throws Exception { - try { - new StepSupport().execute(null); - fail("Expected UnsupportedOperationException"); - } catch (UnsupportedOperationException e) { - // expected - assertTrue( - "Error message does not contain StepExecution: " - + e.getMessage(), e.getMessage().indexOf( - "StepExecution") >= 0); - } - } - -}