Add additional integration test for list values in step scope.

This commit is contained in:
dsyer
2009-09-18 16:29:51 +00:00
parent 7969f56fd9
commit cd12d1050e
5 changed files with 40 additions and 9 deletions

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry excluding="**/.svn" kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**/.svn" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry excluding="**/.svn" kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**/.svn" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">

View File

@@ -1,9 +1,13 @@
package org.springframework.batch.core.scope;
import java.util.List;
public interface Collaborator {
String getName();
Collaborator getParent();
List<String> getList();
}

View File

@@ -39,6 +39,10 @@ public class StepScopePlaceholderIntegrationTests implements BeanFactoryAware {
@Qualifier("ref")
private Collaborator ref;
@Autowired
@Qualifier("list")
private Collaborator list;
@Autowired
@Qualifier("bar")
private Collaborator bar;
@@ -101,4 +105,9 @@ public class StepScopePlaceholderIntegrationTests implements BeanFactoryAware {
assertEquals("bar", value.getParent().getName());
}
@Test
public void testList() throws Exception {
assertEquals("[bar]", list.getList().toString());
}
}

View File

@@ -1,6 +1,7 @@
package org.springframework.batch.core.scope;
import java.io.Serializable;
import java.util.List;
public class TestCollaborator implements Collaborator, Serializable {
@@ -8,6 +9,16 @@ public class TestCollaborator implements Collaborator, Serializable {
private String name;
private Collaborator parent;
private List<String> list;
public List<String> getList() {
return list;
}
public void setList(List<String> list) {
this.list = list;
}
public Collaborator getParent() {
return parent;

View File

@@ -1,12 +1,10 @@
<?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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<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.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<bean id="simple" class="org.springframework.batch.core.scope.TestCollaborator" scope="step">
<property name="name" value="#{stepExecutionContext[foo]}" />
</bean>
@@ -20,6 +18,15 @@
<property name="parent" value="#{stepExecutionContext[parent]}" />
</bean>
<bean id="list" class="org.springframework.batch.core.scope.TestCollaborator" scope="step">
<property name="name" value="foo" />
<property name="list">
<list>
<value>#{stepExecutionContext[foo]}</value>
</list>
</property>
</bean>
<bean id="ref" class="org.springframework.batch.core.scope.TestCollaborator" scope="step">
<property name="name" value="foo" />
<property name="parent" ref="#{stepExecutionContext[foo]}" />