INT-1682, INT-1683 ChatMessageListeningEndpoint and PresenceListeningEndpoint now extend MessageProducerSupport, gaining errorChannel and history writing capabilities

This commit is contained in:
Mark Fisher
2010-12-13 14:00:31 -05:00
parent f5228728e0
commit 228edd8b37
7 changed files with 33 additions and 38 deletions

View File

@@ -46,7 +46,7 @@ public class ChatMessageInboundChannelAdapterParserTests {
public void testInboundAdapter(){
ChatMessageListeningEndpoint adapter = context.getBean("xmppInboundAdapter", ChatMessageListeningEndpoint.class);
assertFalse(adapter.isAutoStartup());
DirectChannel channel = (DirectChannel) TestUtils.getPropertyValue(adapter, "messagingTemplate.defaultChannel");
DirectChannel channel = (DirectChannel) TestUtils.getPropertyValue(adapter, "outputChannel");
assertEquals("xmppInbound", channel.getComponentName());
XMPPConnection connection = (XMPPConnection)TestUtils.getPropertyValue(adapter, "xmppConnection");
assertEquals(connection, context.getBean("testConnection"));

View File

@@ -31,6 +31,7 @@ import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.integration.xmpp.core.XmppContextUtils;
import org.springframework.integration.xmpp.inbound.ChatMessageListeningEndpoint;
@@ -66,6 +67,7 @@ public class ChatMessageListeningEndpointTests {
}).when(connection).removePacketListener(Mockito.any(PacketListener.class));
assertEquals(0, packetListSet.size());
endpoint.setOutputChannel(new QueueChannel());
endpoint.afterPropertiesSet();
endpoint.start();
assertEquals(1, packetListSet.size());
@@ -85,6 +87,7 @@ public class ChatMessageListeningEndpointTests {
bf.registerSingleton(XmppContextUtils.XMPP_CONNECTION_BEAN_NAME, mock(XMPPConnection.class));
ChatMessageListeningEndpoint endpoint = new ChatMessageListeningEndpoint();
endpoint.setBeanFactory(bf);
endpoint.setOutputChannel(new QueueChannel());
endpoint.afterPropertiesSet();
assertNotNull(TestUtils.getPropertyValue(endpoint,"xmppConnection"));
}

View File

@@ -68,6 +68,7 @@ public class PresenceListeningEndpointTests {
}
}).when(roster).removeRosterListener(Mockito.any(RosterListener.class));
PresenceListeningEndpoint rosterEndpoint = new PresenceListeningEndpoint(connection);
rosterEndpoint.setOutputChannel(new QueueChannel());
rosterEndpoint.afterPropertiesSet();
assertEquals(0, rosterSet.size());
rosterEndpoint.start();
@@ -89,7 +90,7 @@ public class PresenceListeningEndpointTests {
when(connection.getRoster()).thenReturn(roster);
PresenceListeningEndpoint rosterEndpoint = new PresenceListeningEndpoint(connection);
QueueChannel channel = new QueueChannel();
rosterEndpoint.setRequestChannel(channel);
rosterEndpoint.setOutputChannel(channel);
rosterEndpoint.afterPropertiesSet();
rosterEndpoint.start();
RosterListener rosterListener = (RosterListener) TestUtils.getPropertyValue(rosterEndpoint, "rosterListener");
@@ -105,6 +106,7 @@ public class PresenceListeningEndpointTests {
bf.registerSingleton(XmppContextUtils.XMPP_CONNECTION_BEAN_NAME, mock(XMPPConnection.class));
PresenceListeningEndpoint endpoint = new PresenceListeningEndpoint();
endpoint.setBeanFactory(bf);
endpoint.setOutputChannel(new QueueChannel());
endpoint.afterPropertiesSet();
assertNotNull(TestUtils.getPropertyValue(endpoint,"xmppConnection"));
}