Relax Consumer channel binding in AbstractTestBinder

When native decoding is enabled on the consumer, relax the requirement
for using AbstractBinderTest.createBindableChannel(..)

Fixes #1137
Resolves #1138
This commit is contained in:
Soby Chacko
2017-11-13 16:20:47 -05:00
committed by Oleg Zhurakousky
parent 2275d40d7d
commit 73f0fc38a6

View File

@@ -43,7 +43,7 @@ public abstract class AbstractTestBinder<C extends AbstractBinder<MessageChannel
@Override
public Binding<MessageChannel> bindConsumer(String name, String group, MessageChannel moduleInputChannel,
CP properties) {
this.checkChannelIsConfigured(moduleInputChannel);
this.checkChannelIsConfigured(moduleInputChannel, properties);
queues.add(name);
return binder.bindConsumer(name, group, moduleInputChannel, properties);
}
@@ -79,8 +79,8 @@ public abstract class AbstractTestBinder<C extends AbstractBinder<MessageChannel
* methods was properly configured (i.e., interceptors, converters etc).
* see org.springframework.cloud.stream.binding.MessageConverterConfigurer
*/
private void checkChannelIsConfigured(MessageChannel messageChannel) {
if (messageChannel instanceof AbstractSubscribableChannel){
private void checkChannelIsConfigured(MessageChannel messageChannel, CP properties) {
if (messageChannel instanceof AbstractSubscribableChannel && !properties.isUseNativeDecoding()){
Assert.isTrue(!CollectionUtils.isEmpty(((AbstractSubscribableChannel)messageChannel).getChannelInterceptors()),
"'messageChannel' appears to be misconfigured. Consider creating channel via AbstractBinderTest.createBindableChannel(..)");
}