OPEN BATCH-1303: Support Spring 3.0 EL.

This commit is contained in:
dsyer
2009-06-22 07:22:13 +00:00
parent 026bb0665e
commit 9e60248dfc
7 changed files with 112 additions and 42 deletions

View File

@@ -68,26 +68,26 @@ public class PlaceholderTargetSourceErrorTests extends ContextFactorySupport {
@Test
public void testPartialReplaceSunnyDay() throws Exception {
Node target = (Node) createValue("name", "#{foo}-bar").getTarget();
Node target = (Node) createValue("name", "%{foo}-bar").getTarget();
assertEquals("bar-bar", target.getName());
}
@Test
public void testPartialReplaceMissingProperty() throws Exception {
Node target = (Node) createValue("name", "#{garbage}-bar").getTarget();
assertEquals("#{garbage}-bar", target.getName());
Node target = (Node) createValue("name", "%{garbage}-bar").getTarget();
assertEquals("%{garbage}-bar", target.getName());
}
@Test
public void testFullReplaceSunnyDay() throws Exception {
Node target = (Node) createValue("name", "#{foo}").getTarget();
Node target = (Node) createValue("name", "%{foo}").getTarget();
assertEquals("bar", target.getName());
}
@Test
public void testFullReplaceMissingProperty() throws Exception {
try {
Node target = (Node) createValue("name", "#{garbage}").getTarget();
Node target = (Node) createValue("name", "%{garbage}").getTarget();
assertEquals("bar", target.getName());
fail("Expected IllegalStateException");
}
@@ -99,26 +99,26 @@ public class PlaceholderTargetSourceErrorTests extends ContextFactorySupport {
@Test
public void testPartialReplaceIntegerToString() throws Exception {
Node target = (Node) createValue("name", "foo-#{integer}").getTarget();
Node target = (Node) createValue("name", "foo-%{integer}").getTarget();
assertEquals("foo-4321", target.getName());
}
@Test
public void testFullReplaceIntegerToString() throws Exception {
Node target = (Node) createValue("name", "#{integer}").getTarget();
Node target = (Node) createValue("name", "%{integer}").getTarget();
assertEquals("4321", target.getName());
}
@Test
public void testFullReplaceIntegerToLong() throws Exception {
Node target = (Node) createValue("value", "#{integer}").getTarget();
Node target = (Node) createValue("value", "%{integer}").getTarget();
assertEquals(4321L, target.getValue());
}
@Test
public void testFullReplaceIntegerToNode() throws Exception {
try {
Node target = (Node) createValue("parent", "#{integer}").getTarget();
Node target = (Node) createValue("parent", "%{integer}").getTarget();
assertEquals("4321", target.getParent());
fail("Expected IllegalArgumentException");
}

View File

@@ -19,7 +19,7 @@
<bean id="simpleTarget"
class="org.springframework.batch.core.scope.util.AsyncPlaceholderTargetSourceTests$Foo" autowire-candidate="false">
<property name="name" value="#{attributes[foo]}" />
<property name="name" value="%{attributes[foo]}" />
</bean>
<bean id="context"

View File

@@ -27,11 +27,11 @@
</bean>
<bean id="simpleTarget" class="org.springframework.batch.core.scope.util.MultipleContextPlaceholderTargetSourceTests$TestBean">
<property name="name" value="#{attributes[foo]}" />
<property name="name" value="%{attributes[foo]}" />
</bean>
<bean id="listTarget" class="org.springframework.batch.core.scope.util.MultipleContextPlaceholderTargetSourceTests$TestBean">
<property name="names" value="#{attributes[foo]}" />
<property name="names" value="%{attributes[foo]}" />
</bean>
<bean id="context"

View File

@@ -90,37 +90,37 @@
<bean id="simpleTarget"
class="org.springframework.batch.core.scope.util.PlaceholderTargetSourceTests$Foo"
lazy-init="true">
<property name="name" value="#{map['foo.foo']}" />
<property name="name" value="%{map['foo.foo']}" />
</bean>
<bean id="compoundTarget"
class="org.springframework.batch.core.scope.util.PlaceholderTargetSourceTests$Foo"
lazy-init="true">
<property name="name" value="#{foo}-bar" />
<property name="name" value="%{foo}-bar" />
</bean>
<bean id="refTarget"
class="org.springframework.batch.core.scope.util.PlaceholderTargetSourceTests$Foo"
lazy-init="true">
<property name="parent" ref="#{foo}" />
<property name="parent" ref="%{foo}" />
</bean>
<bean id="valueTarget"
class="org.springframework.batch.core.scope.util.PlaceholderTargetSourceTests$Foo"
lazy-init="true">
<property name="parent" value="#{parent}" />
<property name="parent" value="%{parent}" />
</bean>
<bean id="withLongTarget"
class="org.springframework.batch.core.scope.util.PlaceholderTargetSourceTests$Foo"
lazy-init="true">
<property name="name" value="bar-#{long}" />
<property name="name" value="bar-%{long}" />
</bean>
<bean id="withIntegerTarget"
class="org.springframework.batch.core.scope.util.PlaceholderTargetSourceTests$Foo"
lazy-init="true">
<property name="name" value="bar-#{integer}" />
<property name="name" value="bar-%{integer}" />
</bean>
<bean id="withListTarget"
@@ -128,9 +128,9 @@
lazy-init="true">
<property name="list">
<list>
<value>#{foo}</value>
<value>foo-#{integer}</value>
<value>bar-#{integer}</value>
<value>%{foo}</value>
<value>foo-%{integer}</value>
<value>bar-%{integer}</value>
</list>
</property>
</bean>
@@ -138,25 +138,25 @@
<bean id="withMultipleTarget"
class="org.springframework.batch.core.scope.util.PlaceholderTargetSourceTests$Foo"
lazy-init="true">
<property name="name" value="bar-#{integer}-#{integer}" />
<property name="name" value="bar-%{integer}-%{integer}" />
</bean>
<bean id="withMultipleStartAndEndTarget"
class="org.springframework.batch.core.scope.util.PlaceholderTargetSourceTests$Foo"
lazy-init="true">
<property name="name" value="#{integer}-#{integer}" />
<property name="name" value="%{integer}-%{integer}" />
</bean>
<bean id="withEmbeddedDateTarget"
class="org.springframework.batch.core.scope.util.PlaceholderTargetSourceTests$Foo"
lazy-init="true">
<property name="name" value="bar-#{date}" />
<property name="name" value="bar-%{date}" />
</bean>
<bean id="withDateTarget"
class="org.springframework.batch.core.scope.util.PlaceholderTargetSourceTests$Foo"
lazy-init="true">
<property name="date" value="#{date}" />
<property name="date" value="%{date}" />
</bean>
<bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">

View File

@@ -21,7 +21,7 @@
<bean id="simpleTarget"
class="org.springframework.batch.core.scope.util.SimplePlaceholderTargetSourceTests$Foo"
lazy-init="true" autowire-candidate="false">
<property name="name" value="#{foo}" />
<property name="name" value="%{foo}" />
</bean>
<bean id="context"