INT-3518: Upgrade versions and some cleanup

JIRA: https://jira.spring.io/browse/INT-3518
This commit is contained in:
Artem Bilan
2014-09-12 17:23:34 +03:00
committed by Gary Russell
parent 30b58836e5
commit 2587ed6bd0
8 changed files with 71 additions and 103 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@@ -36,20 +36,20 @@ import org.mockito.Mockito;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessagingException;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.messaging.MessageHandler;
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
import org.springframework.integration.feed.inbound.FeedEntryMessageSource;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.metadata.MetadataStore;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessagingException;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.fetcher.impl.AbstractFeedFetcher;
import com.sun.syndication.fetcher.impl.HttpURLFeedFetcher;
import com.rometools.fetcher.impl.AbstractFeedFetcher;
import com.rometools.fetcher.impl.HttpURLFeedFetcher;
import com.rometools.rome.feed.synd.SyndEntry;
/**
* @author Oleg Zhurakousky
@@ -175,6 +175,7 @@ public class FeedInboundChannelAdapterParserTests {
public void receiveFeedEntry(SyndEntry entry) {
latch.countDown();
}
}
@@ -191,6 +192,7 @@ public class FeedInboundChannelAdapterParserTests {
public String remove(String key) {
return null;
}
}
}

View File

@@ -31,8 +31,8 @@ import org.springframework.beans.factory.BeanFactory;
import org.springframework.integration.metadata.PropertiesPersistingMetadataStore;
import org.springframework.messaging.Message;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.fetcher.FeedFetcher;
import com.rometools.fetcher.FeedFetcher;
import com.rometools.rome.feed.synd.SyndEntry;
/**
* @author Oleg Zhurakousky
@@ -47,7 +47,8 @@ public class FeedEntryMessageSourceTests {
@Before
public void prepare() {
File metadataStoreFile = new File(System.getProperty("java.io.tmpdir") + "/spring-integration/", "metadata-store.properties");
File metadataStoreFile = new File(System.getProperty("java.io.tmpdir") + "/spring-integration/",
"metadata-store.properties");
if (metadataStoreFile.exists()) {
metadataStoreFile.delete();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2014 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.
@@ -25,26 +25,29 @@ import java.util.zip.GZIPInputStream;
import org.springframework.util.Assert;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.fetcher.FetcherEvent;
import com.sun.syndication.fetcher.FetcherException;
import com.sun.syndication.fetcher.impl.AbstractFeedFetcher;
import com.sun.syndication.fetcher.impl.SyndFeedInfo;
import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;
import com.rometools.fetcher.FeedFetcher;
import com.rometools.fetcher.FetcherEvent;
import com.rometools.fetcher.FetcherException;
import com.rometools.fetcher.impl.AbstractFeedFetcher;
import com.rometools.fetcher.impl.SyndFeedInfo;
import com.rometools.rome.feed.synd.SyndFeed;
import com.rometools.rome.io.FeedException;
import com.rometools.rome.io.SyndFeedInput;
import com.rometools.rome.io.XmlReader;
/**
* @author Oleg Zhurakousky
* @author Mark Fisher
* @author Artem Bilan
* @since 2.0
*/
class FileUrlFeedFetcher extends AbstractFeedFetcher {
/**
* Retrieve a SyndFeed for the given URL.
* @see com.sun.syndication.fetcher.FeedFetcher#retrieveFeed(java.net.URL)
* @see FeedFetcher#retrieveFeed(java.net.URL)
*/
@Override
public SyndFeed retrieveFeed(URL feedUrl) throws IOException, FeedException, FetcherException {
Assert.notNull(feedUrl, "feedUrl must not be null");
URLConnection connection = feedUrl.openConnection();
@@ -53,7 +56,14 @@ class FileUrlFeedFetcher extends AbstractFeedFetcher {
return syndFeedInfo.getSyndFeed();
}
private void refreshFeedInfo(URL feedUrl, SyndFeedInfo syndFeedInfo, URLConnection connection) throws IOException, FeedException {
@Override
public SyndFeed retrieveFeed(String userAgent, URL url)
throws IllegalArgumentException, IOException, FeedException, FetcherException {
return retrieveFeed(url);
}
private void refreshFeedInfo(URL feedUrl, SyndFeedInfo syndFeedInfo, URLConnection connection)
throws IOException, FeedException {
// need to always set the URL because this may have changed due to 3xx redirects
syndFeedInfo.setUrl(connection.getURL());
@@ -62,7 +72,7 @@ class FileUrlFeedFetcher extends AbstractFeedFetcher {
syndFeedInfo.setId(feedUrl.toString());
// This will be 0 if the server doesn't support or isn't setting the last modified header
syndFeedInfo.setLastModified(new Long(connection.getLastModified()));
syndFeedInfo.setLastModified(connection.getLastModified());
// get the contents
InputStream inputStream = null;
@@ -81,7 +91,8 @@ class FileUrlFeedFetcher extends AbstractFeedFetcher {
}
}
private SyndFeed readFeedFromStream(InputStream inputStream, URLConnection connection) throws IOException, FeedException {
private SyndFeed readFeedFromStream(InputStream inputStream, URLConnection connection)
throws IOException, FeedException {
BufferedInputStream bufferedInputStream;
if ("gzip".equalsIgnoreCase(connection.getContentEncoding())) {
// handle gzip encoded content