From 6eff89ca6c4dfc6ae9e0777e5f97e63c45615afc Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Thu, 26 Oct 2017 10:16:57 -0400 Subject: [PATCH] Added MessageChannel configuration assertion (#1113) Added assertion to org.springframework.cloud.stream.binder.AbstractTestBinder to ensure that MessageChannels that are passed to any of the bind methods are configured with Message Interceptors --- .../stream/binder/AbstractTestBinder.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/spring-cloud-stream-binder-test/src/main/java/org/springframework/cloud/stream/binder/AbstractTestBinder.java b/spring-cloud-stream-binder-test/src/main/java/org/springframework/cloud/stream/binder/AbstractTestBinder.java index b1fb7805d..834ea5fb5 100644 --- a/spring-cloud-stream-binder-test/src/main/java/org/springframework/cloud/stream/binder/AbstractTestBinder.java +++ b/spring-cloud-stream-binder-test/src/main/java/org/springframework/cloud/stream/binder/AbstractTestBinder.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,14 @@ package org.springframework.cloud.stream.binder; + import java.util.HashSet; import java.util.Set; +import org.springframework.integration.channel.AbstractSubscribableChannel; import org.springframework.messaging.MessageChannel; +import org.springframework.util.Assert; +import org.springframework.util.CollectionUtils; /** * Abstract class that adds test support for {@link Binder}. @@ -27,6 +31,7 @@ import org.springframework.messaging.MessageChannel; * @author Ilayaperumal Gopinathan * @author Gary Russell * @author Mark Fisher + * @author Oleg Zhurakousky */ public abstract class AbstractTestBinder, CP extends ConsumerProperties, PP extends ProducerProperties> implements Binder { @@ -38,12 +43,14 @@ public abstract class AbstractTestBinder bindConsumer(String name, String group, MessageChannel moduleInputChannel, CP properties) { + this.checkChannelIsConfigured(moduleInputChannel); queues.add(name); return binder.bindConsumer(name, group, moduleInputChannel, properties); } @Override public Binding bindProducer(String name, MessageChannel moduleOutputChannel, PP properties) { + this.checkChannelIsConfigured(moduleOutputChannel); queues.add(name); return binder.bindProducer(name, moduleOutputChannel, properties); } @@ -68,4 +75,15 @@ public abstract class AbstractTestBinder