INT-1596, fixed the broken links as well as all warnings
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* 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.
|
||||
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
import org.springframework.integration.Message;
|
||||
|
||||
/**
|
||||
* Extends {@link AbstractChannelNameResolvingMessageRouter} to support router
|
||||
* Extends {@link AbstractMessageRouter} to support router
|
||||
* implementations that always return a single channel name (or null).
|
||||
*
|
||||
* @author Mark Fisher
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.util.Assert;
|
||||
* <p/>
|
||||
* For more advanced, programmatic control
|
||||
* of dynamic recipient lists, consider using the @Router annotation or
|
||||
* extending {@link AbstractChannelNameResolvingMessageRouter} instead.
|
||||
* extending {@link AbstractMessageRouter} instead.
|
||||
* <p/>
|
||||
* Contrary to a standard <router .../> this handler will try to send to all channels that are configured as
|
||||
* recipients. It is to channels what a publish subscribe channel is to endpoints.
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.integration.MessagingException;
|
||||
import org.springframework.integration.aggregator.ResequencingMessageGroupProcessor;
|
||||
import org.springframework.integration.context.IntegrationObjectSupport;
|
||||
import org.springframework.integration.core.MessageSource;
|
||||
import org.springframework.integration.file.filters.AcceptOnceFileListFilter;
|
||||
import org.springframework.integration.file.filters.FileListFilter;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -38,22 +39,19 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* {@link MessageSource} that creates messages from a file system directory. To
|
||||
* prevent messages for certain files, you may supply a
|
||||
* {@link org.springframework.integration.file.filters.FileListFilter}. By
|
||||
* {@link FileListFilter}. By
|
||||
* default, an
|
||||
* {@link org.springframework.integration.file.entries.AcceptOnceEntryFileListFilter}
|
||||
* {@link AcceptOnceFileListFilter}
|
||||
* is used. It ensures files are picked up only once from the directory.
|
||||
* <p/>
|
||||
* A common problem with reading files is that a file may be detected before it
|
||||
* is ready. The default
|
||||
* {@link org.springframework.integration.file.entries.AcceptOnceEntryFileListFilter}
|
||||
* {@link AcceptOnceEntryFileListFilter}
|
||||
* does not prevent this. In most cases, this can be prevented if the
|
||||
* file-writing process renames each file as soon as it is ready for reading. A
|
||||
* pattern-matching filter that accepts only files that are ready (e.g. based on
|
||||
* a known suffix), composed with the default
|
||||
* {@link org.springframework.integration.file.entries.AcceptOnceEntryFileListFilter}
|
||||
* would allow for this. See
|
||||
* {@link org.springframework.integration.file.entries.CompositeEntryListFilter}
|
||||
* for a way to do this.
|
||||
* a known suffix), composed with the default {@link AcceptOnceFileListFilter}
|
||||
* would allow for this.
|
||||
* <p/>
|
||||
* A {@link Comparator} can be used to ensure internal ordering of the Files in
|
||||
* a {@link PriorityBlockingQueue}. This does not provide the same guarantees as
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Filters a listing of files by qualifying their 'name' (as determined by {@link org.springframework.integration.file.entries.EntryNameExtractor})
|
||||
* Filters a listing of files by qualifying their 'name'
|
||||
* against a regular expression (an instance of {@link java.util.regex.Pattern})
|
||||
*
|
||||
* @author Iwein Fuld
|
||||
|
||||
@@ -90,9 +90,9 @@ public abstract class AbstractInboundRemoteFileSystemSychronizer<F> extends Abst
|
||||
* be a 'live' stateful client (a connection?) that is inappropriate to cache as it has per-request state.
|
||||
* @param t
|
||||
* leverages strategy implementations to enable different
|
||||
* behavior. It's a hook to the file entry ({@link F}) after it's been
|
||||
* behavior. It's a hook to the file entry after it's been
|
||||
* successfully downloaded. Conceptually, you might delete the
|
||||
* remote one or rename it, etc.
|
||||
* remote one or rename it, etc.
|
||||
* @throws Throwable
|
||||
* escape hatch exception, let the adapter deal with it.
|
||||
*/
|
||||
|
||||
@@ -88,7 +88,6 @@ public class QueuedFtpClientPool implements FtpClientPool {
|
||||
* implement their own preparation strategy.
|
||||
*
|
||||
* @param client the unprepared client
|
||||
* @return
|
||||
* @throws SocketException
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.springframework.util.Assert;
|
||||
* @author Mark Fisher
|
||||
* @since 2.0
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class AttributePollingMessageSource implements MessageSource {
|
||||
|
||||
private volatile ObjectName objectName;
|
||||
|
||||
@@ -186,7 +186,7 @@ public class OperationInvokingMessageHandler extends AbstractReplyProducingMessa
|
||||
return operationName;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private Map<String, Object> resolveParameters(Message<?> message) {
|
||||
Map<String, Object> map = null;
|
||||
if (message.getPayload() instanceof Map) {
|
||||
@@ -208,7 +208,8 @@ public class OperationInvokingMessageHandler extends AbstractReplyProducingMessa
|
||||
return map;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private Map<String, Object> createParameterMapFromList(List parameters) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
for (int i = 0; i < parameters.size(); i++) {
|
||||
|
||||
@@ -70,7 +70,7 @@ public class LifecycleMessageSourceMetrics implements MessageSourceMetrics, Life
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @return int
|
||||
* @see org.springframework.integration.monitor.MessageSourceMetrics#getMessageCount()
|
||||
*/
|
||||
public int getMessageCount() {
|
||||
|
||||
@@ -61,7 +61,6 @@ public class SimpleDynamicRouter{
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String, String> getChannelMappings(){
|
||||
return channelMappings;
|
||||
@@ -69,7 +68,6 @@ public class SimpleDynamicRouter{
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public String route(Object key){
|
||||
String className = key.getClass().getName();
|
||||
|
||||
@@ -68,14 +68,12 @@ public class ImapMailReceiver extends AbstractMailReceiver {
|
||||
|
||||
/**
|
||||
* Check if messages should be marked as read
|
||||
* @return
|
||||
*/
|
||||
public Boolean isShouldMarkMessagesAsRead() {
|
||||
return shouldMarkMessagesAsRead;
|
||||
}
|
||||
/**
|
||||
* Specify is messages should be marked as read
|
||||
* @return
|
||||
*/
|
||||
public void setShouldMarkMessagesAsRead(Boolean shouldMarkMessagesAsRead) {
|
||||
this.shouldMarkMessagesAsRead = shouldMarkMessagesAsRead;
|
||||
|
||||
@@ -68,7 +68,7 @@ public class SecuredChannelsParser extends AbstractSingleBeanDefinitionParser {
|
||||
builder.addConstructorArgReference(interceptorBeanName);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private String parseObjectDefinitionSource(Element element, ParserContext parserContext) {
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(
|
||||
BASE_PACKAGE_NAME + ".channel.ChannelInvocationDefinitionSource");
|
||||
|
||||
@@ -41,17 +41,10 @@ public class SftpMessageSendingConsumerFactoryBean implements FactoryBean<SftpSe
|
||||
|
||||
private String username;
|
||||
|
||||
private boolean autoCreateDirectories;
|
||||
|
||||
private int port;
|
||||
|
||||
private String charset;
|
||||
|
||||
|
||||
public void setAutoCreateDirectories(final boolean autoCreateDirectories) {
|
||||
this.autoCreateDirectories = autoCreateDirectories;
|
||||
}
|
||||
|
||||
public void setCharset(String charset) {
|
||||
this.charset = charset;
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ public class SftpInboundRemoteFileSystemSynchronizerTests {
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@org.junit.Ignore
|
||||
@Test
|
||||
public void testCopyAndRenameWhenLocalFileDoesntExist() throws Exception {
|
||||
|
||||
@@ -19,8 +19,10 @@ package org.springframework.integration.test.util;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import org.hamcrest.Matcher;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy;
|
||||
|
||||
import org.hamcrest.Matcher;
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.FatalBeanException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
@@ -39,18 +41,13 @@ import org.springframework.integration.context.IntegrationContextUtils;
|
||||
import org.springframework.integration.context.NamedComponent;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
import org.springframework.integration.endpoint.AbstractEndpoint;
|
||||
import org.springframework.integration.endpoint.AbstractPollingEndpoint;
|
||||
import org.springframework.integration.history.MessageHistory;
|
||||
import org.springframework.integration.support.channel.BeanFactoryChannelResolver;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import org.springframework.scheduling.support.PeriodicTrigger;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ErrorHandler;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @author Iwein Fuld
|
||||
@@ -150,8 +147,8 @@ public abstract class TestUtils {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static MessageHandler handlerExpecting(final Matcher<Message> messageMatcher) {
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static MessageHandler handlerExpecting(final Matcher<Message> messageMatcher) {
|
||||
return new MessageHandler() {
|
||||
public void handleMessage(Message<?> message) throws MessageRejectedException, MessageHandlingException, MessageDeliveryException {
|
||||
assertThat(message, is(messageMatcher));
|
||||
|
||||
@@ -48,7 +48,6 @@ import twitter4j.Paging;
|
||||
import twitter4j.RateLimitStatus;
|
||||
import twitter4j.ResponseList;
|
||||
import twitter4j.Twitter;
|
||||
import twitter4j.TwitterFactory;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
|
||||
@@ -111,7 +111,8 @@ public class MarshallingWebServiceIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public boolean supports(Class clazz) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.springframework.oxm.XmlMappingException;
|
||||
*/
|
||||
public class StubMarshaller implements Marshaller {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings("rawtypes")
|
||||
public boolean supports(Class clazz) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,8 @@ import org.springframework.oxm.XmlMappingException;
|
||||
*/
|
||||
public class StubMarshallerAndUnmarshaller implements Marshaller, Unmarshaller {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public boolean supports(Class clazz) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ import org.springframework.oxm.XmlMappingException;
|
||||
*/
|
||||
public class StubUnmarshaller implements Unmarshaller {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public boolean supports(Class clazz) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class StubMarshaller implements Marshaller {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings("rawtypes")
|
||||
public boolean supports(Class clazz) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class StubUnmarshaller implements Unmarshaller {
|
||||
|
||||
public LinkedList<Source> sourcesPassed = new LinkedList<Source>();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings("rawtypes")
|
||||
public boolean supports(Class clazz) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ public class XmlPayloadValidatingFilterParserTests {
|
||||
inputChannel.send(docMessage);
|
||||
assertNotNull(validChannel.receive(100));
|
||||
}
|
||||
@SuppressWarnings("unused")
|
||||
@Test
|
||||
public void testInvalidMessageWithValidatorAndDiscardChannel() throws Exception {
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("XmlPayloadValidatingFilterParserTests-context.xml", this.getClass());
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.springframework.xml.xpath.XPathExpressionFactory;
|
||||
public class XPathRouterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void simpleSingleAttribute() throws Exception {
|
||||
Document doc = XmlTestUtil.getDocumentForString("<doc type=\"one\" />");
|
||||
XPathExpression expression = XPathExpressionFactory.createXPathExpression("/doc/@type");
|
||||
@@ -47,7 +47,7 @@ public class XPathRouterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void multipleNodeValues() throws Exception {
|
||||
Document doc = XmlTestUtil.getDocumentForString("<doc type=\"one\"><book>bOne</book><book>bTwo</book></doc>");
|
||||
XPathExpression expression = XPathExpressionFactory.createXPathExpression("/doc/book");
|
||||
@@ -59,7 +59,7 @@ public class XPathRouterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void multipleNodeValuesAsString() throws Exception {
|
||||
XPathExpression expression = XPathExpressionFactory.createXPathExpression("/doc/book");
|
||||
XPathRouter router = new XPathRouter(expression);
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package org.springframework.integration.xmpp.messages;
|
||||
|
||||
import org.jivesoftware.smack.Chat;
|
||||
import org.jivesoftware.smack.ChatManager;
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
@@ -31,26 +30,11 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* This component logs in as a user and forwards any messages <em>to</em> that
|
||||
* user on to downstream components.
|
||||
* It takes any message from a given XMPP session (as established by
|
||||
* the current {@link XMPPConnection}) and forwards the
|
||||
* {@link org.jivesoftware.smack.packet.Message} as the payload of the Spring
|
||||
* Integration {@link org.springframework.integration.Message}.
|
||||
* <strong>Note</strong>: the {@link org.jivesoftware.smack.ChatManager}
|
||||
* maintains a Map<String, Chat> for threads and users, where the threadID
|
||||
* ({@link String}) is the key or the userID {@link String} is the key. This
|
||||
* {@link java.util.Map} is a Smack-specific implementation called
|
||||
* {@link org.jivesoftware.smack.util.collections.ReferenceMap} that removes
|
||||
* key/values as references are dereferenced.
|
||||
*
|
||||
* @author Josh Long
|
||||
* @author Mark Fisher
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
* @see ChatManager the ChatManager class that
|
||||
* keeps watch over all Chats between the client and any other
|
||||
* participants.
|
||||
* @see XMPPConnection the XMPPConnection (as
|
||||
* created by {@link XmppConnectionFactory}
|
||||
*/
|
||||
public class XmppMessageDrivenEndpoint extends AbstractXmppConnectionAwareEndpoint {
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.jivesoftware.smack.Roster;
|
||||
import org.jivesoftware.smack.RosterListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
@@ -33,7 +32,6 @@ import org.springframework.integration.MessagingException;
|
||||
import org.springframework.integration.core.MessagingTemplate;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.integration.xmpp.AbstractXmppConnectionAwareEndpoint;
|
||||
import org.springframework.integration.xmpp.XmppContextUtils;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
||||
@@ -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