INT-2404 Fix Auto-Created Channel; Event, TCP, UDP
The AbstractChannelAdapterParser creates an implicit DirectChannel if the adapter has no 'channel' attribute. The Event, TCP, and UDP channel adapter parsers did not bind this channel to the adapter and AC initialization failed with 'outputChannel is required'. Further, the event schema marked the channel as being 'required', precluding this feature. INT-2407 Remove Channel use="required" Parsers automatically generate the channel when none is provided. - JMX - JDBC - SFTP - Redis - Feed - XMPP - Mail - FTP - HTTP
This commit is contained in:
committed by
Mark Fisher
parent
e7b514a1e4
commit
292aa90599
@@ -38,6 +38,10 @@
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<int-event:inbound-channel-adapter id="autoChannel" payload-expression="source + '-test'"/>
|
||||
|
||||
<int:bridge input-channel="autoChannel" output-channel="nullChannel"/>
|
||||
|
||||
<context:property-placeholder location="classpath:org/springframework/integration/event/config/inbound-adapter.properties"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2012 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.
|
||||
@@ -19,6 +19,7 @@ package org.springframework.integration.event.config;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Properties;
|
||||
@@ -31,6 +32,7 @@ import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
@@ -60,6 +62,12 @@ public class EventInboundChannelAdapterParserTests {
|
||||
@Autowired
|
||||
MessageChannel errorChannel;
|
||||
|
||||
@Autowired
|
||||
MessageChannel autoChannel;
|
||||
|
||||
@Autowired @Qualifier("autoChannel.adapter")
|
||||
ApplicationEventListeningMessageProducer eventListener;
|
||||
|
||||
@Test
|
||||
public void validateEventParser() {
|
||||
Object adapter = context.getBean("eventAdapterSimple");
|
||||
@@ -126,6 +134,10 @@ public class EventInboundChannelAdapterParserTests {
|
||||
Assert.assertEquals("source + '-test'", expression.getExpressionString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAutoCreateChannel() {
|
||||
assertSame(autoChannel, TestUtils.getPropertyValue(eventListener, "outputChannel"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class SampleEvent extends ApplicationEvent {
|
||||
|
||||
Reference in New Issue
Block a user