Fixes to get the codebase to compile successfully again, still a ways to go before all tests pass.

This commit is contained in:
lucasward
2008-02-10 01:28:41 +00:00
parent 75ff70d027
commit 4a37d15c61
7 changed files with 171 additions and 452 deletions

View File

@@ -29,12 +29,10 @@ import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobInstance;
import org.springframework.batch.core.domain.JobParameters;
import org.springframework.batch.core.domain.JobSupport;
import org.springframework.batch.core.domain.Step;
import org.springframework.batch.core.domain.StepContribution;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.domain.StepInstance;
import org.springframework.batch.core.domain.StepInterruptedException;
import org.springframework.batch.core.tasklet.Tasklet;
import org.springframework.batch.execution.repository.SimpleJobRepository;
import org.springframework.batch.execution.repository.dao.MapJobDao;
import org.springframework.batch.execution.repository.dao.MapStepDao;
@@ -161,8 +159,8 @@ public class SimpleStepExecutorTests extends TestCase {
final JobExecution jobExecution = new JobExecution(jobInstance);
final StepExecution stepExecution = new StepExecution(step, jobExecution);
stepConfiguration.setTasklet(new Tasklet() {
public ExitStatus execute() throws Exception {
stepConfiguration.setItemReader(new ItemReader() {
public Object read() throws Exception {
assertEquals(step, stepExecution.getStep());
assertNotNull(StepSynchronizationManager.getContext().getStepExecution());
processed.add("foo");
@@ -217,14 +215,14 @@ public class SimpleStepExecutorTests extends TestCase {
public void testIncrementRollbackCount() {
Tasklet tasklet = new Tasklet() {
ItemReader itemReader = new ItemReader() {
public ExitStatus execute() throws Exception {
public Object read() throws Exception {
int counter = 0;
counter++;
if (counter == 1) {
throw new Exception();
throw new RuntimeException();
}
return ExitStatus.CONTINUABLE;
@@ -233,7 +231,7 @@ public class SimpleStepExecutorTests extends TestCase {
};
StepInstance step = new StepInstance(new Long(1));
stepConfiguration.setTasklet(tasklet);
stepConfiguration.setItemReader(itemReader);
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(step, jobExecutionContext);
@@ -248,9 +246,9 @@ public class SimpleStepExecutorTests extends TestCase {
public void testExitCodeDefaultClassification() throws Exception {
Tasklet tasklet = new Tasklet() {
ItemReader itemReader = new ItemReader() {
public ExitStatus execute() throws Exception {
public Object read() throws Exception {
int counter = 0;
counter++;
@@ -264,7 +262,7 @@ public class SimpleStepExecutorTests extends TestCase {
};
StepInstance step = new StepInstance(new Long(1));
stepConfiguration.setTasklet(tasklet);
stepConfiguration.setItemReader(itemReader);
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(step, jobExecutionContext);
@@ -284,7 +282,7 @@ public class SimpleStepExecutorTests extends TestCase {
public void testNonRestartedJob() throws Exception {
StepInstance step = new StepInstance(new Long(1));
MockRestartableTasklet tasklet = new MockRestartableTasklet();
stepExecutor.setTasklet(tasklet);
stepExecutor.setItemReader(tasklet);
stepConfiguration.setSaveExecutionAttributes(true);
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(step, jobExecutionContext);
@@ -303,7 +301,7 @@ public class SimpleStepExecutorTests extends TestCase {
StepInstance step = new StepInstance(new Long(1));
step.setStepExecutionCount(1);
MockRestartableTasklet tasklet = new MockRestartableTasklet();
stepExecutor.setTasklet(tasklet);
stepExecutor.setItemReader(tasklet);
stepConfiguration.setSaveExecutionAttributes(true);
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(step, jobExecutionContext);
@@ -327,7 +325,7 @@ public class SimpleStepExecutorTests extends TestCase {
StepInstance step = new StepInstance(new Long(1));
step.setStepExecutionCount(1);
MockRestartableTasklet tasklet = new MockRestartableTasklet();
stepConfiguration.setTasklet(tasklet);
stepConfiguration.setItemReader(tasklet);
stepConfiguration.setSaveExecutionAttributes(false);
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(step, jobExecutionContext);
@@ -351,8 +349,8 @@ public class SimpleStepExecutorTests extends TestCase {
public void testRestartJobOnNonRestartableTasklet() throws Exception {
StepInstance step = new StepInstance(new Long(1));
step.setStepExecutionCount(1);
stepConfiguration.setTasklet(new Tasklet() {
public ExitStatus execute() throws Exception {
stepConfiguration.setItemReader(new ItemReader() {
public Object read() throws Exception {
return ExitStatus.FINISHED;
}
});
@@ -405,8 +403,8 @@ public class SimpleStepExecutorTests extends TestCase {
public void testStreamManager() throws Exception {
StepInstance step = new StepInstance(new Long(1));
step.setStepExecutionCount(1);
stepConfiguration.setTasklet(new Tasklet() {
public ExitStatus execute() throws Exception {
stepConfiguration.setItemReader(new ItemReader() {
public Object read() throws Exception {
return ExitStatus.FINISHED;
}
});
@@ -433,7 +431,7 @@ public class SimpleStepExecutorTests extends TestCase {
assertEquals(0, map.size());
}
private class MockRestartableTasklet extends ItemStreamAdapter implements Tasklet {
private class MockRestartableTasklet extends ItemStreamAdapter implements ItemReader {
private boolean getExecutionAttributesCalled = false;
@@ -441,7 +439,7 @@ public class SimpleStepExecutorTests extends TestCase {
private boolean restoreFromCalledWithSomeContext = false;
public ExitStatus execute() throws Exception {
public Object read() throws Exception {
StepSynchronizationManager.getContext().setAttribute("TASKLET_TEST", this);
return ExitStatus.FINISHED;
}
@@ -487,20 +485,22 @@ public class SimpleStepExecutorTests extends TestCase {
stepExecutor.setInterruptionPolicy(interruptionPolicy);
Tasklet tasklet = new Tasklet() {
ItemReader itemReader = new ItemReader() {
public ExitStatus execute() throws Exception {
public Object read() throws Exception {
int counter = 0;
counter++;
if (counter == 1) {
throw new StepInterruptedException("");
throw new RuntimeException();
}
return ExitStatus.CONTINUABLE;
}
};
stepExecutor.setTasklet(tasklet);
stepExecutor.setItemReader(itemReader);
StepInstance step = new StepInstance(new Long(1));
JobExecution jobExecutionContext = new JobExecution(jobInstance);
@@ -524,13 +524,13 @@ public class SimpleStepExecutorTests extends TestCase {
public void testStatusForResetFailedException() throws Exception {
Tasklet tasklet = new Tasklet() {
public ExitStatus execute() throws Exception {
ItemReader itemReader = new ItemReader() {
public Object read() throws Exception {
// Trigger a rollback
throw new RuntimeException("Foo");
}
};
stepExecutor.setTasklet(tasklet);
stepExecutor.setItemReader(itemReader);
stepExecutor.setStreamManager(new SimpleStreamManager(transactionManager) {
public void rollback(TransactionStatus status) {
super.rollback(status);

View File

@@ -25,7 +25,9 @@ import org.springframework.batch.core.domain.JobInstance;
import org.springframework.batch.core.domain.JobParameters;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.domain.StepInstance;
import org.springframework.batch.item.reader.ItemReaderAdapter;
import org.springframework.batch.item.stream.SimpleStreamManager;
import org.springframework.batch.item.writer.ItemWriterAdapter;
import org.springframework.batch.repeat.RepeatContext;
import org.springframework.batch.repeat.exception.handler.ExceptionHandler;
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
@@ -40,21 +42,25 @@ public class SimpleStepTests extends TestCase {
SimpleStep step = new SimpleStep();
step.setJobRepository(new JobRepositorySupport());
step.setTransactionManager(new ResourcelessTransactionManager());
step.setItemReader(new ItemReaderAdapter());
step.setItemWriter(new ItemWriterAdapter());
assertNotNull(step.createStepExecutor());
}
public void testSuccessfulExceptionHandler() throws Exception {
SimpleStep configuration = new SimpleStep("foo");
configuration.setJobRepository(new JobRepositorySupport());
configuration.setTransactionManager(new ResourcelessTransactionManager());
SimpleStep step = new SimpleStep("foo");
step.setItemReader(new ItemReaderAdapter());
step.setItemWriter(new ItemWriterAdapter());
step.setJobRepository(new JobRepositorySupport());
step.setTransactionManager(new ResourcelessTransactionManager());
final List list = new ArrayList();
configuration.setExceptionHandler(new ExceptionHandler() {
step.setExceptionHandler(new ExceptionHandler() {
public void handleException(RepeatContext context, Throwable throwable) throws RuntimeException {
list.add(throwable);
throw new RuntimeException("Oops");
}
});
SimpleStepExecutor executor = (SimpleStepExecutor) configuration.createStepExecutor();
SimpleStepExecutor executor = (SimpleStepExecutor) step.createStepExecutor();
StepExecution stepExecution = new StepExecution(new StepInstance(new Long(11)), new JobExecution(
new JobInstance(new Long(0L), new JobParameters()), new Long(12)));
try {
@@ -120,6 +126,8 @@ public class SimpleStepTests extends TestCase {
public void testMandatoryPropertiesAfterExecution() throws Exception {
SimpleStep step = new SimpleStep();
step.setItemReader(new ItemReaderAdapter());
step.setItemWriter(new ItemWriterAdapter());
step.setJobRepository(new JobRepositorySupport());
step.setTransactionManager(new ResourcelessTransactionManager());
assertNotNull(step.createStepExecutor());

View File

@@ -21,21 +21,22 @@ import java.util.List;
import junit.framework.TestCase;
import org.springframework.batch.core.domain.BatchStatus;
import org.springframework.batch.core.domain.JobSupport;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobInstance;
import org.springframework.batch.core.domain.JobParameters;
import org.springframework.batch.core.domain.JobSupport;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.domain.StepInstance;
import org.springframework.batch.core.domain.StepInterruptedException;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.tasklet.Tasklet;
import org.springframework.batch.execution.repository.SimpleJobRepository;
import org.springframework.batch.execution.repository.dao.JobDao;
import org.springframework.batch.execution.repository.dao.MapJobDao;
import org.springframework.batch.execution.repository.dao.MapStepDao;
import org.springframework.batch.execution.repository.dao.StepDao;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.reader.ItemReaderAdapter;
import org.springframework.batch.repeat.policy.SimpleCompletionPolicy;
import org.springframework.batch.repeat.support.RepeatTemplate;
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
@@ -50,43 +51,52 @@ public class StepExecutorInterruptionTests extends TestCase {
private JobInstance job;
private RepeatOperationsStep stepConfiguration;
private RepeatOperationsStep step;
public void setUp() throws Exception {
jobRepository = new SimpleJobRepository(jobDao, stepDao);
JobSupport jobConfiguration = new JobSupport();
stepConfiguration = new RepeatOperationsStep();
jobConfiguration.addStep(stepConfiguration);
step = new RepeatOperationsStep();
jobConfiguration.addStep(step);
jobConfiguration.setBeanName("testJob");
job = jobRepository.createJobExecution(jobConfiguration, new JobParameters()).getJobInstance();
stepConfiguration.setJobRepository(jobRepository);
stepConfiguration.setTransactionManager(new ResourcelessTransactionManager());
step.setJobRepository(jobRepository);
step.setTransactionManager(new ResourcelessTransactionManager());
step.setItemReader(new ItemReaderAdapter());
step.setItemWriter(new ItemWriter(){
public void write(Object item) throws Exception {
}});
}
public void testInterruptChunk() throws Exception {
List steps = job.getStepInstances();
final StepInstance step = (StepInstance) steps.get(0);
final StepInstance stepInstance = (StepInstance) steps.get(0);
JobExecution jobExecutionContext = new JobExecution(new JobInstance(new Long(0L), new JobParameters()));
final StepExecution stepExecution = new StepExecution(step, jobExecutionContext);
stepConfiguration.setTasklet(new Tasklet() {
public ExitStatus execute() throws Exception {
final StepExecution stepExecution = new StepExecution(stepInstance, jobExecutionContext);
step.setItemReader(new ItemReader() {
public Object read() throws Exception {
// do something non-trivial (and not Thread.sleep())
double foo = 1;
for (int i = 2; i < 250; i++) {
foo = foo * i;
}
// always return true, so processing always continues
return new ExitStatus(foo != 1);
if(foo != 1){
return new Double(foo);
}
else{
return null;
}
}
});
Thread processingThread = new Thread() {
public void run() {
try {
stepConfiguration.execute(stepExecution);
step.execute(stepExecution);
}
catch (StepInterruptedException e) {
// do nothing...
@@ -114,7 +124,7 @@ public class StepExecutorInterruptionTests extends TestCase {
RepeatTemplate template = new RepeatTemplate();
// N.B, If we don't set the completion policy it might run forever
template.setCompletionPolicy(new SimpleCompletionPolicy(2));
stepConfiguration.setChunkOperations(template);
step.setChunkOperations(template);
testInterruptChunk();
}

View File

@@ -1,320 +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.execution.tasklet;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import junit.framework.TestCase;
import org.springframework.batch.io.Skippable;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemRecoverer;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.KeyedItemReader;
import org.springframework.batch.item.exception.StreamException;
import org.springframework.batch.item.reader.AbstractItemReader;
import org.springframework.batch.item.writer.AbstractItemWriter;
import org.springframework.batch.repeat.context.RepeatContextSupport;
import org.springframework.batch.repeat.synch.RepeatSynchronizationManager;
import org.springframework.batch.retry.policy.SimpleRetryPolicy;
/**
* @author Dave Syer
* @author Peter Zozom
*/
public class ItemOrientedTaskletTests extends TestCase {
private List list = new ArrayList();
private List items = new ArrayList();
private ItemReader itemProvider = new AbstractItemReader() {
int count = 0;
public Object read() throws Exception {
if (count < items.size()) {
Object data = items.get(count++);
if (data instanceof Exception) {
throw (Exception) data;
}
return data;
}
return null;
}
public void close() throws StreamException {
}
};
private ItemWriter itemWriter = new AbstractItemWriter() {
public void write(Object data) throws Exception {
list.add(data);
}
};
private ItemOrientedTasklet module;
public void setUp() throws Exception {
// create module
module = new ItemOrientedTasklet();
// set up module
module.setItemReader(itemProvider);
module.setItemWriter(itemWriter);
module.afterPropertiesSet();
RepeatSynchronizationManager.register(new RepeatContextSupport(null));
}
/*
* (non-Javadoc)
*
* @see junit.framework.TestCase#tearDown()
*/
protected void tearDown() throws Exception {
super.tearDown();
RepeatSynchronizationManager.clear();
}
// tests also read and process
public void testExecute() throws Exception {
// TEST1: data provider returns some object and data processor should
// process it
// set up mock objects
items = Collections.singletonList("foo");
// call execute
assertTrue(module.execute().isContinuable());
// verify method calls
assertEquals(1, list.size());
assertEquals("foo", list.get(0));
}
public void testExecuteWithNothingToRead() throws Exception {
// TEST2: data provider returns null (nothing to read)
// call read
assertFalse(module.execute().isContinuable());
}
public void testExecuteWithExceptionOnRead() throws Exception {
// TEST3: exception is thrown by data provider
// set up mock objects
items = Collections.singletonList(new RuntimeException("foo"));
// call read
try {
module.execute();
fail("RuntimeException was expected");
}
catch (RuntimeException bce) {
// expected
assertEquals("foo", bce.getMessage());
}
}
public void testNotSkippable() throws Exception {
try {
module.skip();
}
catch (Exception e) {
// Unexpected
throw e;
}
}
public void testSkippableReader() throws Exception {
module.setItemReader(new SkippableItemReader());
module.setItemRecoverer(null);
module.skip();
assertEquals(1, list.size());
}
public void testSkippablReaderProcessor() throws Exception {
module.setItemReader(new SkippableItemReader());
module.setItemWriter(new SkippableItemWriter());
module.setItemRecoverer(null);
module.skip();
assertEquals(2, list.size());
}
public void testRecoverable() throws Exception {
// set up and call execute
items = Collections.singletonList("foo");
module.setItemRecoverer(new ItemRecoverer() {
public boolean recover(Object item, Throwable cause) {
assertEquals("FOO", cause.getMessage());
list.add(item);
return true;
}
});
module.setItemReader(new AbstractItemReader() {
public Object read() throws Exception {
return "bar";
}
public void close() throws StreamException {
}
});
module.setItemWriter(new AbstractItemWriter() {
public void write(Object data) throws Exception {
throw new RuntimeException("FOO");
}
});
module.afterPropertiesSet();
try {
module.execute();
fail("Expected RuntimeException");
}
catch (RuntimeException e) {
assertEquals("FOO", e.getMessage());
}
// After a processing exception the recovery is done automatically.
// verify method calls
assertEquals(1, list.size());
assertEquals("The item was not passed in to recover method", "bar", list.get(0));
}
public void testRetryPolicy() throws Exception {
module.setRetryPolicy(new SimpleRetryPolicy(1));
module.setItemRecoverer(new ItemRecoverer() {
public boolean recover(Object item, Throwable cause) {
assertEquals("FOO", cause.getMessage());
list.add(item + "_recovered");
return true;
}
});
module.setItemReader(new MockItemReader());
module.setItemWriter(new AbstractItemWriter() {
public void write(Object data) throws Exception {
throw new RuntimeException("FOO");
}
});
// finish initialisation
module.afterPropertiesSet();
try {
module.execute();
fail("Expected RuntimeException");
}
catch (RuntimeException e) {
assertEquals("FOO", e.getMessage());
}
// No exception thrown now because we are going to recover...
module.execute();
// No need for client has to call recover directly
// verify method calls
assertEquals(1, list.size());
assertEquals("The item was not passed in to recover method", "foo_recovered", list.get(0));
}
public void testInitialisationWithNullProvider() throws Exception {
module.setItemReader(null);
try {
module.afterPropertiesSet();
}
catch (IllegalArgumentException e) {
assertTrue(e.getMessage().toLowerCase().indexOf("reader") >= 0);
}
}
public void testInitialisationWithNullProcessor() throws Exception {
module.setItemWriter(null);
try {
module.afterPropertiesSet();
}
catch (IllegalArgumentException e) {
assertTrue("Message did not contain writer: " + e.getMessage(), e.getMessage().toLowerCase().indexOf(
"writer") >= 0);
}
}
private class MockItemReader extends AbstractItemReader implements KeyedItemReader {
public Object read() throws Exception {
return "foo";
}
public Object getKey(Object item) {
return item;
}
}
private class SkippableItemReader implements KeyedItemReader, Skippable {
public Object read() throws Exception {
return itemProvider.read();
}
public Object getKey(Object item) {
return item;
}
public void skip() {
list.add("provider");
}
public void close() throws StreamException {
}
}
private class SkippableItemWriter implements ItemWriter, Skippable {
String props = "foo=bar";
public SkippableItemWriter() {
super();
}
public SkippableItemWriter(String props) {
this();
this.props = props;
}
public void write(Object data) throws Exception {
// no-op
}
public void skip() {
list.add("writer");
}
public void close() throws Exception {
}
}
}

View File

@@ -1,35 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p"
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<bean class="org.springframework.batch.execution.configuration.JobRegistryBeanPostProcessor">
<property name="jobConfigurationRegistry" ref="jobRegistry"/>
<bean
class="org.springframework.batch.execution.configuration.JobRegistryBeanPostProcessor">
<property name="jobConfigurationRegistry" ref="jobRegistry" />
</bean>
<bean id="test-job" class="org.springframework.batch.core.domain.JobSupport">
<bean id="test-job"
class="org.springframework.batch.core.domain.JobSupport">
<property name="steps">
<bean id="step1" class="org.springframework.batch.execution.step.simple.SimpleStep">
<constructor-arg>
<bean id="step1"
class="org.springframework.batch.execution.step.simple.SimpleStep">
<property name="itemReader">
<bean
class="org.springframework.batch.execution.tasklet.ItemOrientedTasklet">
<property name="itemReader">
<bean
class="org.springframework.batch.item.reader.ListItemReader">
<constructor-arg value="foo,bar,spam"/>
</bean>
</property>
<property name="itemWriter">
<bean class="org.springframework.batch.execution.launch.EmptyItemWriter"/>
</property>
class="org.springframework.batch.item.reader.ListItemReader">
<constructor-arg value="foo,bar,spam" />
</bean>
</constructor-arg>
</property>
<property name="itemWriter">
<bean
class="org.springframework.batch.execution.launch.EmptyItemWriter" />
</property>
</bean>
</property>
</bean>
</bean>
</beans>

View File

@@ -1,31 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p"
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<bean id="test-job" class="org.springframework.batch.core.domain.JobSupport">
<bean id="test-job"
class="org.springframework.batch.core.domain.JobSupport">
<property name="steps">
<bean id="step1" class="org.springframework.batch.execution.step.simple.SimpleStep">
<constructor-arg>
<bean id="step1"
class="org.springframework.batch.execution.step.simple.SimpleStep">
<property name="itemReader">
<bean
class="org.springframework.batch.execution.tasklet.ItemOrientedTasklet">
<property name="itemReader">
<bean
class="org.springframework.batch.item.reader.ListItemReader">
<constructor-arg value="foo,bar,spam"/>
</bean>
</property>
<property name="itemWriter">
<bean class="org.springframework.batch.execution.launch.EmptyItemWriter"/>
</property>
class="org.springframework.batch.item.reader.ListItemReader">
<constructor-arg value="foo,bar,spam" />
</bean>
</constructor-arg>
</property>
<property name="itemWriter">
<bean
class="org.springframework.batch.execution.launch.EmptyItemWriter" />
</property>
<property name="jobRepository" >
<bean class="org.springframework.batch.execution.step.simple.JobRepositorySupport" />
</property>
<property name="streamManager">
<bean class="org.springframework.batch.item.stream.SimpleStreamManager" />
</property>
</bean>
</property>
</bean>
</beans>

View File

@@ -1,61 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p"
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<bean class="org.springframework.batch.execution.configuration.JobRegistryBeanPostProcessor">
<property name="jobConfigurationRegistry" ref="registry"/>
</bean>
<bean id="registry" class="org.springframework.batch.execution.configuration.MapJobRegistry"/>
<bean
class="org.springframework.batch.execution.configuration.JobRegistryBeanPostProcessor">
<property name="jobConfigurationRegistry" ref="registry" />
</bean>
<bean id="test-job" class="org.springframework.batch.core.domain.JobSupport">
<bean id="registry"
class="org.springframework.batch.execution.configuration.MapJobRegistry" />
<bean id="test-job"
class="org.springframework.batch.core.domain.JobSupport">
<property name="steps">
<bean id="step1" class="org.springframework.batch.execution.step.simple.SimpleStep">
<constructor-arg>
<bean id="step1">
<property name="itemReader">
<bean
class="org.springframework.batch.execution.tasklet.ItemOrientedTasklet">
<property name="itemReader">
<bean
class="org.springframework.batch.item.reader.ListItemReader">
<constructor-arg value="foo,bar,spam"/>
</bean>
</property>
<property name="itemWriter">
<bean class="org.springframework.batch.execution.launch.EmptyItemWriter"/>
</property>
class="org.springframework.batch.item.reader.ListItemReader">
<constructor-arg value="foo,bar,spam" />
</bean>
</constructor-arg>
</property>
<property name="itemWriter">
<bean
class="org.springframework.batch.execution.launch.EmptyItemWriter" />
</property>
<property name="jobRepository" >
<bean class="org.springframework.batch.execution.step.simple.JobRepositorySupport" />
</property>
</bean>
</property>
</bean>
<bean id="test-job-with-name" class="org.springframework.batch.core.domain.JobSupport">
<property name="name" value="foo"/>
</bean>
<bean id="test-job-with-bean-name" class="org.springframework.batch.core.domain.JobSupport">
<property name="beanName" value="bar"/>
</bean>
<bean id="abstract-job" class="org.springframework.batch.core.domain.JobSupport" abstract="true"/>
<bean id="test-job-with-parent" parent="abstract-job"/>
<bean id="test-job-with-parent-and-name" parent="abstract-job" p:name="spam"/>
<bean id="test-job-with-parent-and-bean-name" parent="abstract-job" p:beanName="bucket"/>
<bean id="parent-job" class="org.springframework.batch.core.domain.JobSupport"/>
<bean id="test-job-with-concrete-parent" parent="parent-job" p:name="maps"/>
<bean id="test-job-with-concrete-parent-and-name" parent="parent-job" p:name="oof"/>
<bean id="test-job-with-concrete-parent-and-bean-name" parent="parent-job" p:beanName="rab"/>
</bean>
<bean id="test-job-with-name"
class="org.springframework.batch.core.domain.JobSupport">
<property name="name" value="foo" />
</bean>
<bean id="test-job-with-bean-name"
class="org.springframework.batch.core.domain.JobSupport">
<property name="beanName" value="bar" />
</bean>
<bean id="abstract-job"
class="org.springframework.batch.core.domain.JobSupport"
abstract="true" />
<bean id="test-job-with-parent" parent="abstract-job" />
<bean id="test-job-with-parent-and-name" parent="abstract-job"
p:name="spam" />
<bean id="test-job-with-parent-and-bean-name" parent="abstract-job"
p:beanName="bucket" />
<bean id="parent-job"
class="org.springframework.batch.core.domain.JobSupport" />
<bean id="test-job-with-concrete-parent" parent="parent-job"
p:name="maps" />
<bean id="test-job-with-concrete-parent-and-name"
parent="parent-job" p:name="oof" />
<bean id="test-job-with-concrete-parent-and-bean-name"
parent="parent-job" p:beanName="rab" />
</beans>