diff --git a/spring-integration-xmpp/src/main/resources/org/springframework/integration/xmpp/config/spring-integration-xmpp-2.0.xsd b/spring-integration-xmpp/src/main/resources/org/springframework/integration/xmpp/config/spring-integration-xmpp-2.0.xsd index 0046db2aa3..c316c620d1 100644 --- a/spring-integration-xmpp/src/main/resources/org/springframework/integration/xmpp/config/spring-integration-xmpp-2.0.xsd +++ b/spring-integration-xmpp/src/main/resources/org/springframework/integration/xmpp/config/spring-integration-xmpp-2.0.xsd @@ -228,6 +228,14 @@ + + + + Specifies the order for invocation when this endpoint is connected as a + subscriber to a SubscribableChannel. + + + diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/PresenceOutboundChannelAdapterParserTests-context.xml b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/PresenceOutboundChannelAdapterParserTests-context.xml index b136a37862..09549bdd9c 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/PresenceOutboundChannelAdapterParserTests-context.xml +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/PresenceOutboundChannelAdapterParserTests-context.xml @@ -17,7 +17,8 @@ + channel="pollingChannel" + order="23"> @@ -26,10 +27,12 @@ + channel="eventChannel" + order="34"/> + xmpp-connection="testConnection" + order="45"/> diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/PresenceOutboundChannelAdapterParserTests.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/PresenceOutboundChannelAdapterParserTests.java index 11c5e0aab7..54fc656be7 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/PresenceOutboundChannelAdapterParserTests.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/PresenceOutboundChannelAdapterParserTests.java @@ -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 handlers = (Set) TestUtils + .getPropertyValue(dispatcher, "handlers"); + assertEquals(45, TestUtils.getPropertyValue(handlers.toArray()[0], "order")); } }