INT-3349 BeanFactory Propagation
JIRA: https://jira.spring.io/browse/INT-3349 Several FactoryBeans did not propagate the BeanFactory to their created object(s). Beans that create messages must have access to a bean factory to get the message builder factory. Fix the FactoryBeans and add a mock FB to all tests that need one. Add a runtime environment variable to make any infractions fatal. This should be set to `true` on CI builds and on framework developer environments.
This commit is contained in:
@@ -32,6 +32,7 @@ import java.util.Properties;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.config.PropertiesFactoryBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.integration.metadata.SimpleMetadataStore;
|
||||
@@ -39,16 +40,17 @@ import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.social.twitter.api.SearchMetadata;
|
||||
import org.springframework.social.twitter.api.SearchOperations;
|
||||
import org.springframework.social.twitter.api.SearchParameters;
|
||||
import org.springframework.social.twitter.api.SearchResults;
|
||||
import org.springframework.social.twitter.api.Tweet;
|
||||
import org.springframework.social.twitter.api.Twitter;
|
||||
import org.springframework.social.twitter.api.SearchParameters;
|
||||
import org.springframework.social.twitter.api.impl.TwitterTemplate;
|
||||
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gunnar Hillert
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class SearchReceivingMessageSourceTests {
|
||||
|
||||
@@ -93,6 +95,7 @@ public class SearchReceivingMessageSourceTests {
|
||||
assertNull(metadataStore);
|
||||
assertNotNull(metadataKey);
|
||||
|
||||
messageSource.setBeanFactory(mock(BeanFactory.class));
|
||||
messageSource.afterPropertiesSet();
|
||||
|
||||
final Object metadataStoreInitialized = TestUtils.getPropertyValue(messageSource, "metadataStore");
|
||||
|
||||
Reference in New Issue
Block a user