INT-1899 polishing
This commit is contained in:
@@ -100,14 +100,11 @@ public abstract class AbstractConsumerEndpointParser extends AbstractBeanDefinit
|
||||
else {
|
||||
channelExists = parserContext.getRegistry().containsBeanDefinition(inputChannelName);
|
||||
}
|
||||
if (!channelExists) {
|
||||
// create a default DirectChannel instance
|
||||
if (!IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME.equals(inputChannelName)){
|
||||
BeanDefinitionBuilder channelDef = BeanDefinitionBuilder.genericBeanDefinition(
|
||||
IntegrationNamespaceUtils.BASE_PACKAGE + ".channel.DirectChannel");
|
||||
BeanDefinitionHolder holder = new BeanDefinitionHolder(channelDef.getBeanDefinition(), inputChannelName);
|
||||
BeanDefinitionReaderUtils.registerBeanDefinition(holder, parserContext.getRegistry());
|
||||
}
|
||||
if (!channelExists && this.shouldAutoCreateChannel(inputChannelName)) {
|
||||
BeanDefinitionBuilder channelDef = BeanDefinitionBuilder.genericBeanDefinition(
|
||||
IntegrationNamespaceUtils.BASE_PACKAGE + ".channel.DirectChannel");
|
||||
BeanDefinitionHolder holder = new BeanDefinitionHolder(channelDef.getBeanDefinition(), inputChannelName);
|
||||
BeanDefinitionReaderUtils.registerBeanDefinition(holder, parserContext.getRegistry());
|
||||
}
|
||||
builder.addPropertyValue("inputChannelName", inputChannelName);
|
||||
List<Element> pollerElementList = DomUtils.getChildElementsByTagName(element, "poller");
|
||||
@@ -126,4 +123,9 @@ public abstract class AbstractConsumerEndpointParser extends AbstractBeanDefinit
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean shouldAutoCreateChannel(String channelName) {
|
||||
return !IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME.equals(channelName)
|
||||
&& !IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME.equals(channelName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,9 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration.config.xml;
|
||||
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -40,7 +41,7 @@ public class ErrorChannelAutoCreationTests {
|
||||
// see INT-1899
|
||||
@Test
|
||||
public void testErrorChannelIsPubSub(){
|
||||
assertTrue(errorChannel instanceof PublishSubscribeChannel);
|
||||
assertEquals(PublishSubscribeChannel.class, errorChannel.getClass());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user