RESOLVED - issue BATCH-1420: Late Binding only happens first time when using inner bean definition with collection property
This commit is contained in:
@@ -7,6 +7,7 @@ import static org.junit.Assert.fail;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -26,6 +27,8 @@ public class TaskExecutorPartitionHandlerTests {
|
||||
private TaskExecutorPartitionHandler handler = new TaskExecutorPartitionHandler();
|
||||
|
||||
private int count = 0;
|
||||
|
||||
private Collection<String> stepExecutions = new TreeSet<String>();
|
||||
|
||||
private StepExecution stepExecution = new StepExecution("step", new JobExecution(1L));
|
||||
|
||||
@@ -50,6 +53,7 @@ public class TaskExecutorPartitionHandlerTests {
|
||||
@Override
|
||||
public void execute(StepExecution stepExecution) throws JobInterruptedException {
|
||||
count++;
|
||||
stepExecutions.add(stepExecution.getStepName());
|
||||
}
|
||||
});
|
||||
handler.afterPropertiesSet();
|
||||
@@ -74,6 +78,7 @@ public class TaskExecutorPartitionHandlerTests {
|
||||
handler.setGridSize(2);
|
||||
handler.handle(stepExecutionSplitter, stepExecution);
|
||||
assertEquals(2, count);
|
||||
assertEquals("[foo0, foo1]", stepExecutions.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -61,6 +61,10 @@ public class MultipleContextPlaceholderTargetSourceTests {
|
||||
@Qualifier("list")
|
||||
private TestBean list;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("nestedList")
|
||||
private TestBean nestedList;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("map")
|
||||
private TestBean map;
|
||||
@@ -120,6 +124,23 @@ public class MultipleContextPlaceholderTargetSourceTests {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleValueInNestedList() throws Exception {
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
final String value = "foo" + i;
|
||||
contextFactory.setContext(this);
|
||||
attributes = Collections.singletonMap("foo", value);
|
||||
try {
|
||||
assertEquals("foo" + i, nestedList.getParent().getNames().get(0));
|
||||
}
|
||||
finally {
|
||||
contextFactory.clearContext();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleValueInMap() throws Exception {
|
||||
|
||||
@@ -144,10 +165,20 @@ public class MultipleContextPlaceholderTargetSourceTests {
|
||||
|
||||
public static class TestBean {
|
||||
private String name;
|
||||
|
||||
private TestBean parent;
|
||||
|
||||
private List<String> names = new ArrayList<String>();
|
||||
|
||||
private Map<String, String> map = new HashMap<String, String>();
|
||||
|
||||
public TestBean getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(TestBean parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
|
||||
Reference in New Issue
Block a user