INT-1617 renaming test classes and confif files
This commit is contained in:
@@ -28,9 +28,11 @@ import org.jivesoftware.smack.ChatManager;
|
||||
import org.jivesoftware.smack.MessageListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
@@ -40,48 +42,46 @@ import org.springframework.integration.endpoint.PollingConsumer;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.integration.xmpp.XmppHeaders;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class XmppMessageOutboundEndpointParserTests {
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class ChatMessageOutboundChannelAdapterParserTests {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
|
||||
@Test
|
||||
public void testPollingConsumer(){
|
||||
ApplicationContext context =
|
||||
new ClassPathXmlApplicationContext("XmppMessageOutboundEndpointParserTests-context.xml", XmppMessageOutboundEndpointParserTests.class);
|
||||
public void testPollingConsumer() {
|
||||
Object pollingConsumer = context.getBean("outboundPollingAdapter");
|
||||
QueueChannel channel = (QueueChannel) TestUtils.getPropertyValue(pollingConsumer, "inputChannel");
|
||||
assertEquals("outboundPollingChannel", channel.getComponentName());
|
||||
assertTrue(pollingConsumer instanceof PollingConsumer);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEventConsumerWithNoChannel(){
|
||||
ApplicationContext context =
|
||||
new ClassPathXmlApplicationContext("XmppMessageOutboundEndpointParserTests-context.xml", XmppMessageOutboundEndpointParserTests.class);
|
||||
public void testEventConsumerWithNoChannel() {
|
||||
Object eventConsumer = context.getBean("outboundNoChannelAdapter");
|
||||
assertTrue(eventConsumer instanceof SubscribableChannel);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEventConsumer(){
|
||||
ApplicationContext context =
|
||||
new ClassPathXmlApplicationContext("XmppMessageOutboundEndpointParserTests-context.xml", XmppMessageOutboundEndpointParserTests.class);
|
||||
public void testEventConsumer() {
|
||||
Object eventConsumer = context.getBean("outboundEventAdapter");
|
||||
assertTrue(eventConsumer instanceof EventDrivenConsumer);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testPollingConsumerUsage() throws Exception{
|
||||
ApplicationContext context =
|
||||
new ClassPathXmlApplicationContext("XmppMessageOutboundEndpointParserTests-context.xml", XmppMessageOutboundEndpointParserTests.class);
|
||||
Object pollingConsumer = context.getBean("outboundPollingAdapter");
|
||||
assertTrue(pollingConsumer instanceof PollingConsumer);
|
||||
MessageChannel channel = context.getBean("outboundEventChannel", MessageChannel.class);
|
||||
Message<?> message = MessageBuilder.withPayload("hello").setHeader(XmppHeaders.CHAT_TO, "oleg").build();
|
||||
|
||||
XMPPConnection connection = context.getBean("testConnection", XMPPConnection.class);
|
||||
ChatManager chatManager = mock(ChatManager.class);
|
||||
when(connection.getChatManager()).thenReturn(chatManager);
|
||||
@@ -90,4 +90,5 @@ public class XmppMessageOutboundEndpointParserTests {
|
||||
channel.send(message);
|
||||
verify(chat, times(1)).sendMessage("hello");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration.xmpp.config;
|
||||
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
@@ -26,19 +27,20 @@ import org.springframework.integration.xmpp.config.XmppConnectionFactoryBean;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
*/
|
||||
public class XmppConnectionFactoryBeanTests {
|
||||
|
||||
@Test
|
||||
public void testXmppConnectionFactoryBean() throws Exception{
|
||||
public void testXmppConnectionFactoryBean() throws Exception {
|
||||
XmppConnectionFactoryBean xmppConnectionFactoryBean = new XmppConnectionFactoryBean(mock(ConnectionConfiguration.class));
|
||||
XMPPConnection connection = xmppConnectionFactoryBean.createInstance();
|
||||
assertNotNull(connection);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testXmppConnectionFactoryBeanViaConfig() throws Exception{
|
||||
public void testXmppConnectionFactoryBeanViaConfig() throws Exception {
|
||||
new ClassPathXmlApplicationContext("XmppConnectionFactoryBeanTests-context.xml", this.getClass());
|
||||
// the fact that no exception was thrown satisfies this test
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration.xmpp.config;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
@@ -31,12 +32,11 @@ import org.springframework.integration.test.util.TestUtils;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
*/
|
||||
public class XmppConnectionParserTests {
|
||||
|
||||
@Test
|
||||
public void testSmackSasl(){
|
||||
public void testSmackSasl() {
|
||||
/*
|
||||
* Possible SASL mechanisms
|
||||
* EXTERNAL, GSSAPI, DIGEST-MD5, CRAM-MD5, PLAIN, ANONYMOUS
|
||||
@@ -48,7 +48,7 @@ public class XmppConnectionParserTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleConfiguration(){
|
||||
public void testSimpleConfiguration() {
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("XmppConnectionParserTest-simple.xml", this.getClass());
|
||||
XMPPConnection connection = ac.getBean("connection", XMPPConnection.class);
|
||||
assertNull(connection.getServiceName());
|
||||
@@ -62,8 +62,9 @@ public class XmppConnectionParserTests {
|
||||
assertEquals("localhost", configuration.getHost());
|
||||
assertEquals(5222, configuration.getPort());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompleteConfiguration(){
|
||||
public void testCompleteConfiguration() {
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("XmppConnectionParserTest-complete.xml", this.getClass());
|
||||
XMPPConnection connection = ac.getBean("connection", XMPPConnection.class);
|
||||
assertNull(connection.getServiceName());
|
||||
@@ -78,4 +79,5 @@ public class XmppConnectionParserTests {
|
||||
assertEquals(6222, configuration.getPort());
|
||||
assertEquals("foogle.com", configuration.getServiceName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user