INT-1596, fixed the broken links as well as all warnings
This commit is contained in:
@@ -21,7 +21,6 @@ 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;
|
||||
|
||||
/**
|
||||
@@ -38,7 +37,7 @@ public class XmppConnectionFactoryBeanTests {
|
||||
}
|
||||
@Test
|
||||
public void testXmppConnectionFactoryBeanViaConfig() throws Exception{
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("XmppConnectionFactoryBeanTests-context.xml", this.getClass());
|
||||
new ClassPathXmlApplicationContext("XmppConnectionFactoryBeanTests-context.xml", this.getClass());
|
||||
// the fact that no exception was thrown satisfies this test
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* 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.ignore;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageHeaders;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
import org.springframework.integration.xmpp.XmppHeaders;
|
||||
|
||||
/**
|
||||
* This class reacts to changes in
|
||||
* {@link org.jivesoftware.smack.packet.Presence} objects for a given account.
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.0
|
||||
*/
|
||||
public class XmppRosterEventConsumer {
|
||||
|
||||
@ServiceActivator
|
||||
public void presenceChanged(Message<?> presenceEventMsg) throws Exception {
|
||||
// System.out.println(StringUtils.repeat("-", 100));
|
||||
// String whosePresence = (String) presenceEventMsg.getHeaders().get(XmppHeaders.PRESENCE_FROM);
|
||||
// System.out.println("entries affected: " + whosePresence);
|
||||
// MessageHeaders messageHeaders = presenceEventMsg.getHeaders();
|
||||
// for (String h : messageHeaders.keySet()) {
|
||||
// System.out.println(String.format("%s = %s", h, messageHeaders.get(h)));
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* 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.ignore;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
import org.jivesoftware.smack.packet.Presence.Type;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.core.MessageSource;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.integration.xmpp.XmppHeaders;
|
||||
|
||||
/**
|
||||
* This is used in
|
||||
* {@link org.springframework.integration.xmpp.ignore.OutboundXmppRosterEventsEndpointTests}
|
||||
* to produce fake status / presence updates.
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.0
|
||||
*/
|
||||
public class XmppRosterEventProducer implements MessageSource<String> {
|
||||
|
||||
public Message<String> receive() {
|
||||
// try {
|
||||
// Thread.sleep(1000 * 10);
|
||||
// }
|
||||
// catch (InterruptedException e) {
|
||||
// // eat it
|
||||
// }
|
||||
// return (Math.random() > .5) ? MessageBuilder.withPayload("available").setHeader(
|
||||
// XmppHeaders.PRESENCE_MODE, Presence.Mode.chat)
|
||||
// .setHeader(XmppHeaders.PRESENCE_STATUS, "She Loves me").build()
|
||||
// : MessageBuilder.withPayload(StringUtils.EMPTY).setHeader(XmppHeaders.PRESENCE_MODE, Presence.Mode.dnd)
|
||||
// .setHeader(XmppHeaders.PRESENCE_STATUS, "She Loves me not").build();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,6 +34,7 @@ import org.springframework.integration.xmpp.presence.XmppRosterEventMessageSendi
|
||||
*/
|
||||
public class XmppRosterEventMessageSendingHandlerTests {
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Test
|
||||
public void testPresencePayload(){
|
||||
XmppRosterEventMessageSendingHandler handler = new XmppRosterEventMessageSendingHandler(mock(XMPPConnection.class));
|
||||
@@ -41,6 +42,7 @@ public class XmppRosterEventMessageSendingHandlerTests {
|
||||
handler.handleMessage(new GenericMessage(mock(Presence.class)));
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Test(expected=MessageHandlingException.class)
|
||||
public void testWrongPayload(){
|
||||
XmppRosterEventMessageSendingHandler handler = new XmppRosterEventMessageSendingHandler(mock(XMPPConnection.class));
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* 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.presence;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
import org.jivesoftware.smack.packet.Presence.Mode;
|
||||
import org.jivesoftware.smack.packet.Presence.Type;
|
||||
import org.junit.Test;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.mapping.MessageMappingException;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
*/
|
||||
public class XmppPresenceMessageMapperTests {
|
||||
|
||||
@Test
|
||||
public void testFromMessageWithPayloadPresence() throws Exception{
|
||||
// Presence presence = new Presence(Type.available, "Hello", 1, Mode.chat);
|
||||
// Message<?> message = MessageBuilder.withPayload(presence).build();
|
||||
// XmppPresenceMessageMapper mapper = new XmppPresenceMessageMapper();
|
||||
// Presence mappedPresence = mapper.fromMessage(message);
|
||||
// assertEquals(Mode.chat, mappedPresence.getMode());
|
||||
// assertEquals(Type.available, mappedPresence.getType());
|
||||
// assertEquals("Hello", mappedPresence.getStatus());
|
||||
// assertEquals(1, mappedPresence.getPriority());
|
||||
}
|
||||
|
||||
// @Test
|
||||
// public void testFromMessageWithPayloadPresenceType() throws Exception{
|
||||
// Message<?> message = MessageBuilder.withPayload(Type.available)
|
||||
// .setHeader(XmppHeaders.PRESENCE_FROM, "oleg")
|
||||
// .setHeader(XmppHeaders.PRESENCE_MODE, Mode.chat)
|
||||
// .setHeader(XmppHeaders.PRESENCE_STATUS, "hello")
|
||||
// .setHeader(XmppHeaders.PRESENCE_PRIORITY, 1)
|
||||
// .build();
|
||||
// XmppPresenceMessageMapper mapper = new XmppPresenceMessageMapper();
|
||||
// Presence mappedPresence = mapper.fromMessage(message);
|
||||
// assertEquals(Mode.chat, mappedPresence.getMode());
|
||||
// assertEquals(Type.available, mappedPresence.getType());
|
||||
// assertEquals("hello", mappedPresence.getStatus());
|
||||
// assertEquals(1, mappedPresence.getPriority());
|
||||
// }
|
||||
// @Test
|
||||
// public void testFromMessageWithPayloadPresenceTypeAndStringModeType() throws Exception{
|
||||
// Message<?> message = MessageBuilder.withPayload(Type.available)
|
||||
// .setHeader(XmppHeaders.PRESENCE_FROM, "oleg")
|
||||
// .setHeader(XmppHeaders.PRESENCE_MODE, "chat")
|
||||
// .setHeader(XmppHeaders.PRESENCE_STATUS, "hello")
|
||||
// .setHeader(XmppHeaders.PRESENCE_PRIORITY, 1)
|
||||
// .build();
|
||||
// XmppPresenceMessageMapper mapper = new XmppPresenceMessageMapper();
|
||||
// Presence mappedPresence = mapper.fromMessage(message);
|
||||
// assertEquals(Mode.chat, mappedPresence.getMode());
|
||||
// assertEquals(Type.available, mappedPresence.getType());
|
||||
// assertEquals("hello", mappedPresence.getStatus());
|
||||
// assertEquals(1, mappedPresence.getPriority());
|
||||
// }
|
||||
|
||||
// @Test(expected=MessageMappingException.class)
|
||||
// public void testFromMessageWithPayloadPresenceTypeUnsupportedMode() throws Exception{
|
||||
//
|
||||
// Message<?> message = MessageBuilder.withPayload(Type.available)
|
||||
// .setHeader(XmppHeaders.PRESENCE_MODE, 1)
|
||||
// .build();
|
||||
// XmppPresenceMessageMapper mapper = new XmppPresenceMessageMapper();
|
||||
// mapper.fromMessage(message);
|
||||
// }
|
||||
|
||||
// @Test(expected=MessageMappingException.class)
|
||||
// public void testFromMessageWithUnsupportedPayload() throws Exception{
|
||||
// Message<?> message = MessageBuilder.withPayload("hello").build();
|
||||
// XmppPresenceMessageMapper mapper = new XmppPresenceMessageMapper();
|
||||
// mapper.fromMessage(message);
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user