--- a/connectivity/com.nokia.carbide.remoteConnections.tests/src/com/nokia/carbide/remoteconnections/tests/extensions/TestFilter.java Wed May 20 13:57:00 2009 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections.tests/src/com/nokia/carbide/remoteconnections/tests/extensions/TestFilter.java Wed May 20 13:59:07 2009 -0500
@@ -33,8 +33,8 @@
private static List<String> serviceIds = new ArrayList<String>();
private static List<Pair<String, String>> connectedServiceIdPairs = new ArrayList<Pair<String,String>>();
- public static boolean isTest = true;
-
+ public static boolean isTest = Boolean.parseBoolean(System.getenv("remoteconnections.tests"));
+
public static void reset() {
connectionTypeIds.clear();
serviceIds.clear();
--- a/core/com.nokia.carbide.cpp.news.reader.tests/src/com/nokia/carbide/cpp/news/reader/tests/FeedCacheManagerTest.java Wed May 20 13:57:00 2009 -0500
+++ b/core/com.nokia.carbide.cpp.news.reader.tests/src/com/nokia/carbide/cpp/news/reader/tests/FeedCacheManagerTest.java Wed May 20 13:59:07 2009 -0500
@@ -19,9 +19,11 @@
import java.io.File;
import java.net.URL;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import com.nokia.carbide.cpp.internal.news.reader.feed.CarbideSyndEntry;
import com.nokia.carbide.cpp.internal.news.reader.feed.CarbideSyndFeed;
import com.nokia.carbide.cpp.internal.news.reader.feed.FeedManager;
import com.nokia.carbide.cpp.internal.news.reader.gen.FeedCache.FeedCacheFactory;
@@ -29,6 +31,10 @@
import com.nokia.carbide.cpp.internal.news.reader.gen.FeedCache.FeedCacheType;
import com.nokia.carbide.cpp.internal.news.reader.gen.FeedCache.FeedType;
import com.nokia.carbide.cpp.internal.news.reader.gen.FeedCache.IFeedCacheChangedlistener;
+import com.sun.syndication.feed.synd.SyndEntry;
+import com.sun.syndication.feed.synd.SyndEntryImpl;
+import com.sun.syndication.feed.synd.SyndFeed;
+import com.sun.syndication.feed.synd.SyndFeedImpl;
import junit.framework.TestCase;
@@ -190,6 +196,32 @@
}
}
+ public void testSaveFeedToCache() {
+ try {
+ feedCacheManager.setFeedCache(null);
+ feedCacheManager.saveFeedToCache(null);
+ assertNull(feedCacheManager.getFeedCache());
+ File file = getDefaultFeedCacheFile();
+ URL url = file.toURL();
+ if (feedCacheManager.loadCacheFromFile(url)) {
+ SyndFeed syndFeed = new SyndFeedImpl();
+ CarbideSyndFeed feed = new CarbideSyndFeed(syndFeed);
+ List<CarbideSyndEntry> entries = new ArrayList<CarbideSyndEntry>();
+ SyndEntry syndEntry = new SyndEntryImpl();
+ CarbideSyndEntry entry = new CarbideSyndEntry(syndEntry);
+ entries.add(entry);
+ feed.setEntries(entries);
+ feed.setDescription("A feed for testing feed cache manager.");
+ feed.setTitle("Test feed");
+ feed.setLink("http://www.nokia.com");
+ feedCacheManager.saveFeedToCache(feed);
+ assertTrue(feedCacheManager.isFeedInCache(feed));
+ }
+ } catch (Exception e) {
+ fail();
+ }
+ }
+
public void testSetCacheUpdated() {
feedCacheManager.setCacheUpdated(true);
assertTrue(feedCacheManager.isCacheUpdated());
--- a/core/com.nokia.carbide.cpp.news.reader/src/com/nokia/carbide/cpp/internal/news/reader/gen/FeedCache/FeedCacheManager.java Wed May 20 13:57:00 2009 -0500
+++ b/core/com.nokia.carbide.cpp.news.reader/src/com/nokia/carbide/cpp/internal/news/reader/gen/FeedCache/FeedCacheManager.java Wed May 20 13:59:07 2009 -0500
@@ -142,6 +142,9 @@
List<FeedType> cachedFeeds = feedCache.getFeeds().getFeed();
for (Iterator<FeedType> iterator = cachedFeeds.iterator(); iterator.hasNext();) {
FeedType cachedFeed = iterator.next();
+ if (cachedFeed == null) {
+ continue;
+ }
if (cachedFeed.getTitle().equals(feed.getTitle()) &&
cachedFeed.getLink().equals(feed.getLink())) {
return true;
@@ -284,6 +287,9 @@
EList<EntryType> entryList = entries.getEntry();
for (Iterator<CarbideSyndEntry> iterator = feed.getEntries().iterator(); iterator.hasNext();) {
CarbideSyndEntry feedEntry = iterator.next();
+ if (feedEntry == null) {
+ continue;
+ }
EntryType cachedEntry = FeedCacheFactory.eINSTANCE.createEntryType();
if (feedEntry.getDescription() != null) {
cachedEntry.setDescription(feedEntry.getDescription());
@@ -409,6 +415,9 @@
int index = -1;
for (Iterator<FeedType> iterator = cachedFeeds.iterator(); iterator.hasNext();) {
FeedType oldFeed = iterator.next();
+ if (oldFeed == null) {
+ continue;
+ }
if (oldFeed.getTitle().equals(newFeed.getTitle()) &&
oldFeed.getLink().equals(newFeed.getLink())) {
cachedUpdated = isCachedFeedOutOfSync(oldFeed, newFeed);