Split MessageSource types into 2 sub-interfaces: PollableSource and SubscribableSource. The MessageChannel hierarchy has also been revised accordingly. DirectChannel and PublishSubscribeChannel are now SubscribableSources, while the other queue-based channels are PollableSources. The PollableChannel interface extends BlockingSource which in turn is an extension of PollableSource that adds timeout-aware methods.
This commit is contained in:
@@ -25,7 +25,7 @@ import org.easymock.EasyMock;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.integration.channel.AbstractMessageChannel;
|
||||
import org.springframework.integration.channel.AbstractPollableChannel;
|
||||
import org.springframework.integration.channel.ChannelInterceptor;
|
||||
import org.springframework.integration.channel.MessageChannel;
|
||||
import org.springframework.integration.channel.interceptor.ChannelInterceptorAdapter;
|
||||
@@ -44,7 +44,6 @@ public class ChannelInterceptorRegisteringBeanPostProcessorTests {
|
||||
public void setUp() {
|
||||
matchAll = new ArrayList<String>();
|
||||
matchAll.add(".*");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +80,7 @@ public class ChannelInterceptorRegisteringBeanPostProcessorTests {
|
||||
}
|
||||
|
||||
|
||||
private static class TestChannel extends AbstractMessageChannel {
|
||||
private static class TestChannel extends AbstractPollableChannel {
|
||||
|
||||
ChannelInterceptor channelInterceptor;
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ import java.util.List;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.integration.channel.AbstractMessageChannel;
|
||||
|
||||
import org.springframework.integration.channel.AbstractPollableChannel;
|
||||
import org.springframework.integration.channel.ChannelInterceptor;
|
||||
import org.springframework.integration.message.Message;
|
||||
import org.springframework.integration.message.selector.MessageSelector;
|
||||
@@ -111,7 +112,7 @@ public class SecuredChannelsParserTests extends AbstractJUnit4SpringContextTests
|
||||
}
|
||||
|
||||
|
||||
static class TestMessageChannel extends AbstractMessageChannel {
|
||||
static class TestMessageChannel extends AbstractPollableChannel {
|
||||
|
||||
List<ChannelInterceptor> interceptors = new ArrayList<ChannelInterceptor>();
|
||||
|
||||
|
||||
@@ -20,9 +20,10 @@ import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.channel.MessageChannel;
|
||||
import org.springframework.integration.channel.PollableChannel;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.integration.message.StringMessage;
|
||||
import org.springframework.security.context.SecurityContext;
|
||||
@@ -48,7 +49,7 @@ public class SecurityPropagatingChannelsParserTests {
|
||||
@Test
|
||||
public void testPropagationByDefault() {
|
||||
loadApplicationContext(this.getClass().getSimpleName() + "-propagateByDefaultContext.xml");
|
||||
MessageChannel channel = new QueueChannel();
|
||||
QueueChannel channel = new QueueChannel();
|
||||
applicationContext.getAutowireCapableBeanFactory().applyBeanPostProcessorsAfterInitialization(channel,
|
||||
"Does not matter");
|
||||
assertTrue("security context did not propagate by setting message bus level default",
|
||||
@@ -67,13 +68,13 @@ public class SecurityPropagatingChannelsParserTests {
|
||||
@Test
|
||||
public void testNoPropagationWithExcludedChannel() {
|
||||
loadApplicationContext(this.getClass().getSimpleName() + "-noPropagationByDefaultContext.xml");
|
||||
MessageChannel channel = new QueueChannel();
|
||||
QueueChannel channel = new QueueChannel();
|
||||
applicationContext.getAutowireCapableBeanFactory().applyBeanPostProcessorsAfterInitialization(channel,
|
||||
"adminSpecial");
|
||||
assertFalse("security context propagated when channel excluded", channelPropagatesSecurityContext(channel));
|
||||
}
|
||||
|
||||
private boolean channelPropagatesSecurityContext(MessageChannel channel) {
|
||||
private boolean channelPropagatesSecurityContext(PollableChannel channel) {
|
||||
login("bob", "bobspassword");
|
||||
channel.send(new StringMessage("testMessage"));
|
||||
SecurityContext context = (SecurityContext) channel.receive(-1).getHeaders().get(
|
||||
|
||||
Reference in New Issue
Block a user