INT-3115 Fix EvaluationContext Initialization
There were several "helper" classes where the context was initialized in the constructor, before the BeanFactory was passed in. Generally fixed by adding the BeanFactory to the constructor args. Other cases where the container-managed bean instantiated a helper and never passed in the BeanFactory. Finally, a fix to ExpressionUtils where the caller had a BeanFactory but the BF did not contain an EvaluationContext factory bean, the BeanResolver was not set up. This is unlikely in a Spring Integration application, but added for completeness. INT-3115 Add a BeanFactory to Test Cases Change the WARN log in ExpressionUtils to a fatal exception to detect cases where an EvaluationContext was created without a BeanFactory. While this was generally in test cases, it also exposed some cases in code where the context was initialized without a BF. polishing on merge
This commit is contained in:
committed by
Mark Fisher
parent
06b06b1c8f
commit
52b340956f
@@ -19,6 +19,7 @@ package org.springframework.integration.ws;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
@@ -29,10 +30,11 @@ import javax.xml.transform.TransformerException;
|
||||
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.Message;
|
||||
@@ -81,6 +83,7 @@ public class SimpleWebServiceOutboundGatewayTests {
|
||||
soapActionFromCallback.set(soapMessage.getSoapAction());
|
||||
}
|
||||
});
|
||||
gateway.setBeanFactory(mock(BeanFactory.class));
|
||||
gateway.afterPropertiesSet();
|
||||
String soapActionHeaderValue = "testAction";
|
||||
String request = "<test>foo</test>";
|
||||
|
||||
Reference in New Issue
Block a user