diff --git a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/presence/XmppRosterEventMessageDrivenEndpoint.java b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/presence/XmppRosterEventMessageDrivenEndpoint.java index 0e376bbb45..bc15f7b31e 100644 --- a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/presence/XmppRosterEventMessageDrivenEndpoint.java +++ b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/presence/XmppRosterEventMessageDrivenEndpoint.java @@ -36,7 +36,8 @@ import org.springframework.util.Assert; /** * Describes an inbound endpoint that is able to login and then emit {@link Message}s when a - * particular event happens to the logged in users {@link Roster} (e.g., logged in/out, changed status etc.) + * particular Presence event happens to the logged in users {@link Roster} + * (e.g., logged in/out, changed status etc.) * * @author Josh Long * @author Oleg Zhurakousky @@ -71,7 +72,6 @@ public class XmppRosterEventMessageDrivenEndpoint extends AbstractEndpoint { * @param requestChannel the channel on which the inbound message should be sent */ public void setRequestChannel(final MessageChannel requestChannel) { - this.messagingTemplate.setDefaultChannel(requestChannel); this.requestChannel = requestChannel; } @@ -95,7 +95,7 @@ public class XmppRosterEventMessageDrivenEndpoint extends AbstractEndpoint { if (null == this.messageMapper) { this.messageMapper = new XmppPresenceMessageMapper(); } - + this.messagingTemplate.setDefaultChannel(requestChannel); this.messagingTemplate.afterPropertiesSet(); this.initialized = true; } diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/XmppConnectionFactoryBeanTests-context.xml b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/XmppConnectionFactoryBeanTests-context.xml new file mode 100644 index 0000000000..7ff2662de6 --- /dev/null +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/XmppConnectionFactoryBeanTests-context.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/XmppConnectionFactoryBeanTests.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/XmppConnectionFactoryBeanTests.java new file mode 100644 index 0000000000..555a3b791e --- /dev/null +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/XmppConnectionFactoryBeanTests.java @@ -0,0 +1,44 @@ +/* + * Copyright 2002-2010 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.xmpp; + +import static junit.framework.Assert.assertNotNull; +import static org.mockito.Mockito.mock; + +import org.jivesoftware.smack.ConnectionConfiguration; +import org.jivesoftware.smack.XMPPConnection; +import org.junit.Test; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +/** + * @author Oleg Zhurakousky + * + */ +public class XmppConnectionFactoryBeanTests { + + @Test + public void testXmppConnectionFactoryBean() throws Exception{ + XmppConnectionFactoryBean xmppConnectionFactoryBean = new XmppConnectionFactoryBean(mock(ConnectionConfiguration.class)); + XMPPConnection connection = xmppConnectionFactoryBean.createInstance(); + assertNotNull(connection); + } + @Test + public void testXmppConnectionFactoryBeanViaConfig() throws Exception{ + ApplicationContext ac = new ClassPathXmlApplicationContext("XmppConnectionFactoryBeanTests-context.xml", this.getClass()); + // the fact that no exception was thrown satisfies this test + } +}