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
@@ -21,14 +21,21 @@
|
||||
<beans:bean id="testConnection" class="org.mockito.Mockito" factory-method="mock">
|
||||
<beans:constructor-arg value="org.jivesoftware.smack.XMPPConnection"/>
|
||||
</beans:bean>
|
||||
|
||||
|
||||
<channel id="xmppInbound">
|
||||
<queue/>
|
||||
</channel>
|
||||
|
||||
<xmpp:inbound-channel-adapter id="xmppInboundAdapter" channel="xmppInbound"
|
||||
xmpp-connection="testConnection" extract-payload="false"
|
||||
<xmpp:inbound-channel-adapter id="xmppInboundAdapter" channel="xmppInbound"
|
||||
xmpp-connection="testConnection" extract-payload="false"
|
||||
auto-startup="false" error-channel="errorChannel"
|
||||
mapped-request-headers="foo*, xmpp*"/>
|
||||
|
||||
<xmpp:inbound-channel-adapter id="autoChannel"
|
||||
xmpp-connection="testConnection" extract-payload="false"
|
||||
auto-startup="false" error-channel="errorChannel"
|
||||
mapped-request-headers="foo*, xmpp*"/>
|
||||
|
||||
<bridge input-channel="autoChannel" output-channel="nullChannel" />
|
||||
|
||||
</beans:beans>
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
|
||||
package org.springframework.integration.xmpp.config;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertSame;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.jivesoftware.smack.Chat;
|
||||
@@ -23,12 +27,11 @@ import org.jivesoftware.smack.ChatManager;
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
@@ -38,9 +41,6 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Mark Fisher
|
||||
@@ -51,10 +51,16 @@ public class ChatMessageInboundChannelAdapterParserTests {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
|
||||
|
||||
@Autowired
|
||||
private QueueChannel xmppInbound;
|
||||
|
||||
@Autowired
|
||||
private MessageChannel autoChannel;
|
||||
|
||||
@Autowired @Qualifier("autoChannel.adapter")
|
||||
private ChatMessageListeningEndpoint autoChannelAdapter;
|
||||
|
||||
@Test
|
||||
public void testInboundAdapter(){
|
||||
ChatMessageListeningEndpoint adapter = context.getBean("xmppInboundAdapter", ChatMessageListeningEndpoint.class);
|
||||
@@ -94,4 +100,8 @@ public class ChatMessageInboundChannelAdapterParserTests {
|
||||
assertEquals("oleg", siMessage.getHeaders().get("xmpp_to"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAutoChannel() {
|
||||
assertSame(autoChannel, TestUtils.getPropertyValue(autoChannelAdapter, "outputChannel"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user