INT-1580, more polishing, added Lifecycle to XmppConnectionFactoryBean, added tests
This commit is contained in:
@@ -1,27 +1,38 @@
|
||||
/**
|
||||
*
|
||||
/*
|
||||
* 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.messages;
|
||||
package org.springframework.integration.xmpp.config;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.integration.xmpp.messages.XmppMessageDrivenEndpoint;
|
||||
|
||||
/**
|
||||
* @author ozhurakousky
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
*/
|
||||
public class InboundXmppEndpointParserTests {
|
||||
|
||||
@Test
|
||||
@Ignore // temporary
|
||||
public void testInboundAdapter(){
|
||||
ApplicationContext context =
|
||||
new ClassPathXmlApplicationContext("InboundXmppEndpointParserTests-context.xml", this.getClass());
|
||||
@@ -7,7 +7,7 @@
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-xmpp="http://www.springframework.org/schema/integration/xmpp">
|
||||
|
||||
<int-xmpp:xmpp-connection id="connection" user="foo" password="foo" host="localhost"/>
|
||||
<int-xmpp:xmpp-connection id="connection"
|
||||
user="happy.user" password="blah" host="localhost" auto-startup="false"/>
|
||||
|
||||
<int:bridge ></int:bridge>
|
||||
</beans>
|
||||
|
||||
@@ -1,24 +1,49 @@
|
||||
/**
|
||||
*
|
||||
/*
|
||||
* 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.config;
|
||||
|
||||
import static org.mockito.Mockito.when;
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
import static junit.framework.Assert.assertNull;
|
||||
|
||||
import org.junit.Ignore;
|
||||
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;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.integration.xmpp.XmppConnectionFactoryBean;
|
||||
|
||||
/**
|
||||
* @author ozhurakousky
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
*/
|
||||
public class XmppConnectionParserTests {
|
||||
|
||||
@Test
|
||||
@Ignore // temporary
|
||||
public void testSimpleConfiguration(){
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("XmppConnectionParserTest-simple.xml", this.getClass());
|
||||
XMPPConnection connection = ac.getBean("connection", XMPPConnection.class);
|
||||
assertNull(connection.getServiceName());
|
||||
assertFalse(connection.isConnected());
|
||||
XmppConnectionFactoryBean xmppFb = ac.getBean("&connection", XmppConnectionFactoryBean.class);
|
||||
assertEquals("happy.user", TestUtils.getPropertyValue(xmppFb, "user"));
|
||||
assertEquals("blah", TestUtils.getPropertyValue(xmppFb, "password"));
|
||||
ConnectionConfiguration configuration = (ConnectionConfiguration) TestUtils.getPropertyValue(connection, "configuration");
|
||||
assertEquals("localhost", configuration.getHost());
|
||||
assertEquals(5222, configuration.getPort());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user