diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobExecutor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobExecutor.java deleted file mode 100644 index f959e5895..000000000 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobExecutor.java +++ /dev/null @@ -1,34 +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 org.springframework.batch.io.exception.BatchCriticalException; -import org.springframework.batch.repeat.ExitStatus; - -/** - * Interface for running a job. - * - * @author Lucas Ward - * @author Dave Syer - * @see Job - * @see JobExecution - */ -public interface JobExecutor { - - public ExitStatus run(Job job, JobExecution execution) throws BatchCriticalException; - -} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/Job.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobSupport.java similarity index 73% rename from spring-batch-core/src/main/java/org/springframework/batch/core/domain/Job.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobSupport.java index 9ee347777..ef183782c 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/Job.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobSupport.java @@ -19,6 +19,8 @@ package org.springframework.batch.core.domain; import java.util.ArrayList; import java.util.List; +import org.springframework.batch.io.exception.BatchCriticalException; +import org.springframework.batch.repeat.ExitStatus; import org.springframework.beans.factory.BeanNameAware; import org.springframework.util.ClassUtils; @@ -31,7 +33,7 @@ import org.springframework.util.ClassUtils; * @author Lucas Ward * @author Dave Syer */ -public class Job implements BeanNameAware { +public class JobSupport implements BeanNameAware, Job { private List steps = new ArrayList(); @@ -44,7 +46,7 @@ public class Job implements BeanNameAware { /** * Default constructor. */ - public Job() { + public JobSupport() { super(); } @@ -54,7 +56,7 @@ public class Job implements BeanNameAware { * * @param name */ - public Job(String name) { + public JobSupport(String name) { super(); this.name = name; } @@ -84,10 +86,16 @@ public class Job implements BeanNameAware { this.name = name; } + /* (non-Javadoc) + * @see org.springframework.batch.core.domain.IJob#getName() + */ public String getName() { return name; } + /* (non-Javadoc) + * @see org.springframework.batch.core.domain.IJob#getSteps() + */ public List getSteps() { return steps; } @@ -101,6 +109,9 @@ public class Job implements BeanNameAware { this.steps.add(step); } + /* (non-Javadoc) + * @see org.springframework.batch.core.domain.IJob#getStartLimit() + */ public int getStartLimit() { return startLimit; } @@ -113,11 +124,21 @@ public class Job implements BeanNameAware { this.restartable = restartable; } + /* (non-Javadoc) + * @see org.springframework.batch.core.domain.IJob#isRestartable() + */ public boolean isRestartable() { return restartable; } + + /* (non-Javadoc) + * @see org.springframework.batch.core.domain.Job#run(org.springframework.batch.core.domain.JobExecution) + */ + public ExitStatus run(JobExecution execution) throws BatchCriticalException { + throw new UnsupportedOperationException("JobSupport does not provide an implementation of run(). Use a smarter subclass."); + } public String toString() { - return ClassUtils.getShortName(Job.class) + ": [name=" + name + "]"; + return ClassUtils.getShortName(JobSupport.class) + ": [name=" + name + "]"; } } 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 2482cdfba..266984873 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 @@ -15,6 +15,9 @@ */ package org.springframework.batch.core.domain; +import org.springframework.batch.io.exception.BatchCriticalException; +import org.springframework.batch.repeat.ExitStatus; + /** * Batch domain interface representing the configuration of a step. As with the @@ -52,8 +55,16 @@ public interface Step { int getStartLimit(); /** - * @return a {@link StepExecutor} that could be used to execute this step + * It is not safe to re-use an instance of {@link StepExecutor} to process + * multiple concurrent executions. Use the factory method in {@link Step} to + * create a new instance and execute that. + * + * @param stepExecution an entity representing the step to be executed + * + * @throws StepInterruptedException if the step is interrupted externally + * @throws BatchCriticalException if there is a problem that needs to be + * signalled to the caller */ - StepExecutor createStepExecutor(); + ExitStatus process(StepExecution stepExecution) throws StepInterruptedException, BatchCriticalException; } \ No newline at end of file diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepExecutor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepExecutor.java deleted file mode 100644 index fe16f2a61..000000000 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepExecutor.java +++ /dev/null @@ -1,50 +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 org.springframework.batch.io.exception.BatchCriticalException; -import org.springframework.batch.repeat.ExitStatus; - -/** - * Interface for processing a step. Implementations are free to process the step - * and return when finished, or to schedule the step for processing - * concurrently, or in the future. The status of the execution should be - * trackable with the step execution. The step should be treated as immutable.
- * - * Because step execution parameters and policies can vary from step to step, a - * {@link StepExecutor} should be created by the caller using a {@link Step}. - * - * @author Lucas Ward - * @author Dave Syer - * - */ -public interface StepExecutor { - - /** - * It is not safe to re-use an instance of {@link StepExecutor} to process - * multiple concurrent executions. Use the factory method in {@link Step} to - * create a new instance and execute that. - * - * @param stepExecution an entity representing the step to be executed - * - * @throws StepInterruptedException if the step is interrupted externally - * @throws BatchCriticalException if there is a problem that needs to be - * signalled to the caller - */ - ExitStatus process(StepExecution stepExecution) throws StepInterruptedException, BatchCriticalException; - -} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepSupport.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepSupport.java index 6e5943ae0..bcbee4640 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepSupport.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepSupport.java @@ -15,6 +15,7 @@ */ package org.springframework.batch.core.domain; +import org.springframework.batch.io.exception.BatchCriticalException; import org.springframework.beans.factory.BeanNameAware; /** @@ -133,10 +134,11 @@ public class StepSupport implements Step, BeanNameAware { * * @throws UnsupportedOperationException always * - * @see org.springframework.batch.core.domain.Step#createStepExecutor() + * @see org.springframework.batch.core.domain.Step#process(org.springframework.batch.core.domain.StepExecution) */ - public StepExecutor createStepExecutor() { + public org.springframework.batch.repeat.ExitStatus process(StepExecution stepExecution) + throws StepInterruptedException, BatchCriticalException { throw new UnsupportedOperationException( - "Cannot create a StepExecutor. Use a smarter subclass of StepSupport like a SimpleStep."); + "Cannot process a StepExecution. Use a smarter subclass of StepSupport."); } } 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 75db95b33..0302fc800 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.Job; +import org.springframework.batch.core.domain.JobSupport; /** * Checked exception that indicates a name clash when registering - * {@link Job} instances. + * {@link JobSupport} 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 7cf809797..337a77a5a 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.Job; +import org.springframework.batch.core.domain.JobSupport; /** - * Base class for checked exceptions related to {@link Job} + * Base class for checked exceptions related to {@link JobSupport} * 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 43ca793e0..3edfd0868 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,6 +16,7 @@ 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 @@ -27,11 +28,11 @@ import org.springframework.batch.core.domain.Job; public interface JobLocator { /** - * Locates a {@link Job} at runtime. + * Locates a {@link JobSupport} at runtime. * - * @param name the name of the {@link Job} which should be + * @param name the name of the {@link JobSupport} which should be * unique - * @return a {@link Job} identified by the given name + * @return a {@link JobSupport} 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 2034f4558..1b54df276 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,6 +16,7 @@ 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 @@ -27,9 +28,9 @@ import org.springframework.batch.core.domain.Job; public interface JobRegistry extends JobLocator { /** - * Registers a {@link Job} at runtime. + * Registers a {@link JobSupport} at runtime. * - * @param jobConfiguration the {@link Job} to be registered + * @param jobConfiguration the {@link JobSupport} to be registered * * @throws DuplicateJobException if a configuration with the * same name has already been registered. @@ -37,10 +38,10 @@ public interface JobRegistry extends JobLocator { void register(Job jobConfiguration) throws DuplicateJobException; /** - * Unregisters a previously registered {@link Job}. If it was + * Unregisters a previously registered {@link JobSupport}. If it was * not previously registered there is no error. * - * @param jobConfiguration the {@link Job} to unregister. + * @param jobConfiguration the {@link JobSupport} 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 2632c4507..3bad803ee 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.Job; +import org.springframework.batch.core.domain.JobSupport; /** * 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 Job} instances. Empty if none + * @return a collection of {@link JobSupport} 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 a3c135c4a..9841390f7 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.Job; +import org.springframework.batch.core.domain.JobSupport; /** - * Checked exception to indicate that a required {@link Job} is not + * Checked exception to indicate that a required {@link JobSupport} is not * available. * * @author Dave Syer diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobExecutionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobExecutionTests.java index 898a6ddeb..543ec82ce 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobExecutionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobExecutionTests.java @@ -29,7 +29,7 @@ public class JobExecutionTests extends TestCase { private JobExecution execution = new JobExecution(new JobInstance(new Long(11), new JobParameters()), new Long(12)); - private JobExecution context = new JobExecution(new JobInstance(new Long(11), new JobParameters(), new Job("foo")), new Long(12)); + private JobExecution context = new JobExecution(new JobInstance(new Long(11), new JobParameters(), new JobSupport("foo")), new Long(12)); /** * Test method for diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobInstanceTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobInstanceTests.java index de7fd6ce0..0f9b48e1e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobInstanceTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobInstanceTests.java @@ -25,7 +25,7 @@ import junit.framework.TestCase; */ public class JobInstanceTests extends TestCase { - private JobInstance instance = new JobInstance(new Long(11), new JobParameters(), new Job("job")); + private JobInstance instance = new JobInstance(new Long(11), new JobParameters(), new JobSupport("job")); /** * Test method for {@link org.springframework.batch.core.domain.JobInstance#getStatus()}. @@ -66,7 +66,7 @@ public class JobInstanceTests extends TestCase { * Test method for {@link org.springframework.batch.core.domain.JobInstance#getIdentifier()}. */ public void testGetName() { - instance = new JobInstance(new Long(1), new JobParameters(), new Job("foo")); + instance = new JobInstance(new Long(1), new JobParameters(), new JobSupport("foo")); assertEquals("foo", instance.getJobName()); } 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 new file mode 100644 index 000000000..d0c42b326 --- /dev/null +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobSupportTests.java @@ -0,0 +1,100 @@ +/* + * 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#setSteps(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#addStepInstance(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()); + } + +} diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobTests.java deleted file mode 100644 index 389757528..000000000 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobTests.java +++ /dev/null @@ -1,100 +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.Job; -import org.springframework.batch.core.domain.StepSupport; - -import junit.framework.TestCase; - -/** - * @author Dave Syer - * - */ -public class JobTests extends TestCase { - - Job configuration = new Job("job"); - - /** - * Test method for - * {@link org.springframework.batch.core.domain.Job#JobConfiguration()}. - */ - public void testJobConfiguration() { - configuration = new Job(); - assertNull(configuration.getName()); - } - - /** - * Test method for - * {@link org.springframework.batch.core.domain.Job#setBeanName(java.lang.String)}. - */ - public void testSetBeanName() { - configuration.setBeanName("foo"); - assertEquals("job", configuration.getName()); - } - - /** - * Test method for - * {@link org.springframework.batch.core.domain.Job#setBeanName(java.lang.String)}. - */ - public void testSetBeanNameWithNullName() { - configuration = new Job(null); - assertEquals(null, configuration.getName()); - configuration.setBeanName("foo"); - assertEquals("foo", configuration.getName()); - } - - /** - * Test method for - * {@link org.springframework.batch.core.domain.Job#setSteps(java.util.List)}. - */ - public void testSetSteps() { - configuration.setSteps(Collections.singletonList(new StepSupport("step"))); - assertEquals(1, configuration.getSteps().size()); - } - - /** - * Test method for - * {@link org.springframework.batch.core.domain.Job#addStepInstance(org.springframework.batch.core.configuration.StepConfiguration)}. - */ - public void testAddStep() { - configuration.addStep(new StepSupport("step")); - assertEquals(1, configuration.getSteps().size()); - } - - /** - * Test method for - * {@link org.springframework.batch.core.domain.Job#setStartLimit(int)}. - */ - public void testSetStartLimit() { - assertEquals(Integer.MAX_VALUE, configuration.getStartLimit()); - configuration.setStartLimit(10); - assertEquals(10, configuration.getStartLimit()); - } - - /** - * Test method for - * {@link org.springframework.batch.core.domain.Job#setRestartable(boolean)}. - */ - public void testSetRestartable() { - assertFalse(configuration.isRestartable()); - configuration.setRestartable(true); - assertTrue(configuration.isRestartable()); - } - -} 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 98c316002..d1ceda2d2 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,7 @@ package org.springframework.batch.core.domain; import junit.framework.TestCase; -import org.springframework.batch.core.domain.Job; +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; @@ -29,7 +29,7 @@ public class SpringBeanJobTests extends TestCase { public void testBeanName() throws Exception { StaticApplicationContext context = new StaticApplicationContext(); - Job configuration = new Job(); + JobSupport configuration = new JobSupport(); context.getAutowireCapableBeanFactory().initializeBean(configuration, "bean"); assertNotNull(configuration.getName()); @@ -44,8 +44,8 @@ public class SpringBeanJobTests extends TestCase { ConstructorArgumentValues args = new ConstructorArgumentValues(); args.addGenericArgumentValue("foo"); context.registerBeanDefinition("bean", new RootBeanDefinition( - Job.class, args, null)); - Job configuration = (Job) context + JobSupport.class, args, null)); + JobSupport configuration = (JobSupport) context .getBean("bean"); assertNotNull(configuration.getName()); assertEquals("foo", configuration.getName()); @@ -58,9 +58,9 @@ public class SpringBeanJobTests extends TestCase { ConstructorArgumentValues args = new ConstructorArgumentValues(); args.addGenericArgumentValue("bar"); context.registerBeanDefinition("parent", new RootBeanDefinition( - Job.class, args, null)); + JobSupport.class, args, null)); context.registerBeanDefinition("bean", new ChildBeanDefinition("parent")); - Job configuration = (Job) context + JobSupport configuration = (JobSupport) context .getBean("bean"); assertNotNull(configuration.getName()); assertEquals("bar", configuration.getName()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepInstanceTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepInstanceTests.java index 192b1be21..eb62a81f0 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepInstanceTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepInstanceTests.java @@ -78,7 +78,7 @@ public class StepInstanceTests extends TestCase { public void testGetJob(){ - Job job = new Job("job"); + Job job = new JobSupport("job"); JobInstance jobInstance = new JobInstance(new Long(2), new JobParameters(), job); instance = new StepInstance(jobInstance, null); assertEquals(job, instance.getJobInstance().getJob()); 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 index e135d6c61..1ab5815b6 100644 --- 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 @@ -62,14 +62,14 @@ public class StepSupportTests extends TestCase { public void testUnsuccessfulWrongConfiguration() throws Exception { try { - new StepSupport().createStepExecutor(); + new StepSupport().process(null); fail("Expected UnsupportedOperationException"); } catch (UnsupportedOperationException e) { // expected assertTrue( - "Error message does not contain SimpleStep: " + "Error message does not contain StepExecution: " + e.getMessage(), e.getMessage().indexOf( - "SimpleStep") >= 0); + "StepExecution") >= 0); } } diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/CommandLineJobRunner.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/CommandLineJobRunner.java index 09dafb967..c34769fac 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/CommandLineJobRunner.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/CommandLineJobRunner.java @@ -20,6 +20,7 @@ import java.util.Properties; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.batch.core.domain.Job; +import org.springframework.batch.core.domain.JobSupport; import org.springframework.batch.core.domain.JobExecution; import org.springframework.batch.core.domain.JobParameters; import org.springframework.batch.core.repository.JobLocator; @@ -80,7 +81,7 @@ import org.springframework.util.StringUtils; * *

*