Upgrade to Spring 2.5.5

This commit is contained in:
dsyer
2008-06-24 13:40:42 +00:00
parent b296101766
commit 80b4386c1b
5 changed files with 54 additions and 38 deletions

View File

@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -17,6 +18,7 @@
<module>spring-batch-samples</module>
<module>spring-batch-integration</module>
<module>docs</module>
<module>archetypes</module>
</modules>
<url>http://www.springframework.org/spring-batch</url>
<organization>
@@ -61,7 +63,7 @@
</licenses>
<properties>
<maven.test.failure.ignore>true</maven.test.failure.ignore>
<spring.framework.version>2.5.2</spring.framework.version>
<spring.framework.version>2.5.5</spring.framework.version>
</properties>
<profiles>
<profile>
@@ -680,4 +682,4 @@
<url>https://springframework.svn.sourceforge.net/svnroot/springframework/repos/repo-ext</url>
</pluginRepository>
</pluginRepositories>
</project>
</project>

View File

@@ -188,6 +188,15 @@ public class StepExecutionResourceProxy extends StepExecutionListenerSupport imp
return delegate.isReadable();
}
/**
* @see org.springframework.core.io.Resource#lastModified()
*/
public long lastModified() throws IOException {
Assert.state(delegate != null, "The delegate resource has not been initialised. "
+ "Remember to register this object as a StepListener.");
return delegate.lastModified();
}
/**
* Public setter for the {@link JobParametersConverter} used to translate
* {@link JobParameters} into {@link Properties}. Defaults to a

View File

@@ -58,19 +58,19 @@ public class BatchMessageListenerContainer extends DefaultMessageListenerContain
*
*/
public static interface ContainerDelegate {
boolean receiveAndExecute(Session session, MessageConsumer consumer) throws JMSException;
boolean receiveAndExecute(Object invoker, Session session, MessageConsumer consumer) throws JMSException;
}
private Advice[] advices = new Advice[0];
private ContainerDelegate delegate = new ContainerDelegate() {
public boolean receiveAndExecute(Session session, MessageConsumer consumer) throws JMSException {
return BatchMessageListenerContainer.super.receiveAndExecute(session, consumer);
public boolean receiveAndExecute(Object invoker, Session session, MessageConsumer consumer) throws JMSException {
return BatchMessageListenerContainer.super.receiveAndExecute(invoker, session, consumer);
}
};
private ContainerDelegate proxy = delegate;
/**
* Public setter for the {@link Advice}.
* @param advices the advice to set
@@ -81,7 +81,7 @@ public class BatchMessageListenerContainer extends DefaultMessageListenerContain
/**
* Set up interceptor with provided advice on the
* {@link #receiveAndExecute(Session, MessageConsumer)} method.
* {@link #receiveAndExecute(Object, Session, MessageConsumer)} method.
*
* @see org.springframework.jms.listener.AbstractJmsListeningContainer#afterPropertiesSet()
*/
@@ -117,11 +117,12 @@ public class BatchMessageListenerContainer extends DefaultMessageListenerContain
/**
* Override base class method to wrap call in advice if provided.
* @see org.springframework.jms.listener.AbstractPollingMessageListenerContainer#receiveAndExecute(javax.jms.Session,
* javax.jms.MessageConsumer)
* @see org.springframework.jms.listener.AbstractPollingMessageListenerContainer#receiveAndExecute(Object,
* javax.jms.Session, javax.jms.MessageConsumer)
*/
protected boolean receiveAndExecute(final Session session, final MessageConsumer consumer) throws JMSException {
return proxy.receiveAndExecute(session, consumer);
protected boolean receiveAndExecute(final Object invoker, final Session session, final MessageConsumer consumer)
throws JMSException {
return proxy.receiveAndExecute(invoker, session, consumer);
}
/**
@@ -139,7 +140,7 @@ public class BatchMessageListenerContainer extends DefaultMessageListenerContain
factory.setProxyTargetClass(false);
factory.addInterface(ContainerDelegate.class);
factory.setTarget(delegate);
proxy = (ContainerDelegate) factory.getProxy();
proxy = (ContainerDelegate) factory.getProxy();
}
}

View File

@@ -139,7 +139,14 @@ public class BatchMessageListenerContainerTests extends TestCase {
private BatchMessageListenerContainer getContainer(RepeatTemplate template) {
MockControl connectionFactoryControl = MockControl.createControl(ConnectionFactory.class);
ConnectionFactory connectionFactory = (ConnectionFactory) connectionFactoryControl.getMock();
BatchMessageListenerContainer container = new BatchMessageListenerContainer();
// Yuck: we need to turn these method in base class to no-ops because the invoker is a private class
// we can't create for test purposes...
BatchMessageListenerContainer container = new BatchMessageListenerContainer() {
protected void messageReceived(Object invoker, Session session) {
}
protected void noMessageReceived(Object invoker, Session session) {
}
};
RepeatOperationsInterceptor interceptor = new RepeatOperationsInterceptor();
interceptor.setRepeatOperations(template);
container.setAdviceChain(new Advice[] {interceptor});
@@ -193,11 +200,12 @@ public class BatchMessageListenerContainerTests extends TestCase {
private boolean doExecute(Session session, MessageConsumer consumer) throws IllegalAccessException {
Method method = ReflectionUtils.findMethod(container.getClass(), "receiveAndExecute", new Class[] {
Session.class, MessageConsumer.class });
Object.class, Session.class, MessageConsumer.class });
method.setAccessible(true);
boolean received;
try {
received = ((Boolean) method.invoke(container, new Object[] { session, consumer })).booleanValue();
// A null invoker is not normal, but we don't care about the invoker for a unit test
received = ((Boolean) method.invoke(container, new Object[] { null, session, consumer })).booleanValue();
}
catch (InvocationTargetException e) {
if (e.getCause() instanceof RuntimeException) {

View File

@@ -61,8 +61,8 @@ public class BeanWrapperFieldSetMapperTests extends TestCase {
mapper.setTargetType(TestObject.class);
mapper.afterPropertiesSet();
FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "true", "C" }, new String[] {
"varString", "varBoolean", "varChar" });
FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "true", "C" },
new String[] { "varString", "varBoolean", "varChar" });
TestObject result = (TestObject) mapper.mapLine(fieldSet);
assertEquals("This is some dummy string", result.getVarString());
assertEquals(true, result.isVarBoolean());
@@ -76,8 +76,8 @@ public class BeanWrapperFieldSetMapperTests extends TestCase {
context.getBeanFactory().registerSingleton("bean", new TestObject());
mapper.setPrototypeBeanName("bean");
FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "true", "C" }, new String[] {
"varString", "varBoolean", "varChar" });
FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "true", "C" },
new String[] { "varString", "varBoolean", "varChar" });
TestObject result = (TestObject) mapper.mapLine(fieldSet);
assertEquals("This is some dummy string", result.getVarString());
assertEquals(true, result.isVarBoolean());
@@ -91,8 +91,8 @@ public class BeanWrapperFieldSetMapperTests extends TestCase {
context.getBeanFactory().registerSingleton("bean", new TestObject());
mapper.setPrototypeBeanName("bean");
FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "true", "C" }, new String[] {
"VarString", "VAR_BOOLEAN", "VAR_CHAR" });
FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "true", "C" },
new String[] { "VarString", "VAR_BOOLEAN", "VAR_CHAR" });
TestObject result = (TestObject) mapper.mapLine(fieldSet);
assertEquals("This is some dummy string", result.getVarString());
assertEquals(true, result.isVarBoolean());
@@ -104,8 +104,8 @@ public class BeanWrapperFieldSetMapperTests extends TestCase {
BeanWrapperFieldSetMapper mapper = (BeanWrapperFieldSetMapper) context.getBean("fieldSetMapper");
FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "true", "C" }, new String[] {
"varString", "varBoolean", "varChar" });
FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "true", "C" },
new String[] { "varString", "varBoolean", "varChar" });
TestObject result = (TestObject) mapper.mapLine(fieldSet);
assertEquals("This is some dummy string", result.getVarString());
assertEquals(true, result.isVarBoolean());
@@ -125,8 +125,9 @@ public class BeanWrapperFieldSetMapperTests extends TestCase {
context.getBeanFactory().registerSingleton("bean", testNestedA);
mapper.setPrototypeBeanName("bean");
FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "1", "Another dummy", "2" },
new String[] { "valueA", "valueB", "testObjectB.valueA", "testObjectB.testObjectC.value" });
FieldSet fieldSet = new DefaultFieldSet(
new String[] { "This is some dummy string", "1", "Another dummy", "2" }, new String[] { "valueA",
"valueB", "testObjectB.valueA", "testObjectB.testObjectC.value" });
TestNestedA result = (TestNestedA) mapper.mapLine(fieldSet);
@@ -145,8 +146,8 @@ public class BeanWrapperFieldSetMapperTests extends TestCase {
context.getBeanFactory().registerSingleton("bean", testNestedA);
mapper.setPrototypeBeanName("bean");
FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "1" }, new String[] { "VALUE_A",
"VALUE_B" });
FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "1" }, new String[] {
"VALUE_A", "VALUE_B" });
TestNestedA result = (TestNestedA) mapper.mapLine(fieldSet);
@@ -184,8 +185,8 @@ public class BeanWrapperFieldSetMapperTests extends TestCase {
context.getBeanFactory().registerSingleton("bean", testNestedA);
mapper.setPrototypeBeanName("bean");
FieldSet fieldSet = new DefaultFieldSet(new String[] { "Another dummy", "2" }, new String[] { "TestObjectB.ValueA",
"TestObjectB.TestObjectC.Value" });
FieldSet fieldSet = new DefaultFieldSet(new String[] { "Another dummy", "2" }, new String[] {
"TestObjectB.ValueA", "TestObjectB.TestObjectC.Value" });
TestNestedA result = (TestNestedA) mapper.mapLine(fieldSet);
@@ -283,14 +284,9 @@ public class BeanWrapperFieldSetMapperTests extends TestCase {
mapper.setTargetType(TestObject.class);
FieldSet fieldSet = new DefaultFieldSet(new String[] { "00009" }, new String[] { "varLong" });
try {
mapper.mapLine(fieldSet);
fail("Expected BindingException");
}
catch (BindingException e) {
assertTrue("Message does not contain source value: " + e.getMessage(), e.getMessage().indexOf("0009") >= 0);
}
TestObject bean = (TestObject) mapper.mapLine(fieldSet);
// since Spring 2.5.5 this is OK (before that BATCH-261)
assertEquals(9, bean.getVarLong());
}
public void testPaddedLongWithEditor() throws Exception {