INT-1848 Add order Attribute (xmpp)
This commit is contained in:
@@ -17,7 +17,8 @@
|
||||
|
||||
<int-xmpp:presence-outbound-channel-adapter id="pollingOutboundRosterAdapter"
|
||||
xmpp-connection="testConnection"
|
||||
channel="pollingChannel">
|
||||
channel="pollingChannel"
|
||||
order="23">
|
||||
<int:poller fixed-rate="1000" max-messages-per-poll="1"/>
|
||||
</int-xmpp:presence-outbound-channel-adapter>
|
||||
|
||||
@@ -26,10 +27,12 @@
|
||||
|
||||
<int-xmpp:presence-outbound-channel-adapter id="eventOutboundRosterAdapter"
|
||||
xmpp-connection="testConnection"
|
||||
channel="eventChannel"/>
|
||||
channel="eventChannel"
|
||||
order="34"/>
|
||||
|
||||
<int-xmpp:presence-outbound-channel-adapter id="eventOutboundRosterChannel"
|
||||
xmpp-connection="testConnection"/>
|
||||
xmpp-connection="testConnection"
|
||||
order="45"/>
|
||||
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2011 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.
|
||||
@@ -17,21 +17,29 @@
|
||||
package org.springframework.integration.xmpp.config;
|
||||
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
import org.springframework.integration.core.SubscribableChannel;
|
||||
import org.springframework.integration.dispatcher.UnicastingDispatcher;
|
||||
import org.springframework.integration.endpoint.EventDrivenConsumer;
|
||||
import org.springframework.integration.endpoint.PollingConsumer;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.integration.xmpp.core.AbstractXmppConnectionAwareMessageHandler;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Mark Fisher
|
||||
* @author Gary Russell
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@@ -44,18 +52,30 @@ public class PresenceOutboundChannelAdapterParserTests {
|
||||
public void testRosterEventOutboundChannelAdapterParserAsPollingConsumer(){
|
||||
Object pollingConsumer = context.getBean("pollingOutboundRosterAdapter");
|
||||
assertTrue(pollingConsumer instanceof PollingConsumer);
|
||||
AbstractXmppConnectionAwareMessageHandler handler = (AbstractXmppConnectionAwareMessageHandler) TestUtils
|
||||
.getPropertyValue(pollingConsumer, "handler");
|
||||
assertEquals(23, TestUtils.getPropertyValue(handler, "order"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRosterEventOutboundChannelAdapterParserEventConsumer(){
|
||||
Object eventConsumer = context.getBean("eventOutboundRosterAdapter");
|
||||
assertTrue(eventConsumer instanceof EventDrivenConsumer);
|
||||
AbstractXmppConnectionAwareMessageHandler handler = (AbstractXmppConnectionAwareMessageHandler) TestUtils
|
||||
.getPropertyValue(eventConsumer, "handler");
|
||||
assertEquals(34, TestUtils.getPropertyValue(handler, "order"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRosterEventOutboundChannel(){
|
||||
Object channel = context.getBean("eventOutboundRosterChannel");
|
||||
assertTrue(channel instanceof SubscribableChannel);
|
||||
UnicastingDispatcher dispatcher = (UnicastingDispatcher) TestUtils
|
||||
.getPropertyValue(channel, "dispatcher");
|
||||
@SuppressWarnings("unchecked")
|
||||
Set<MessageHandler> handlers = (Set<MessageHandler>) TestUtils
|
||||
.getPropertyValue(dispatcher, "handlers");
|
||||
assertEquals(45, TestUtils.getPropertyValue(handlers.toArray()[0], "order"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user