# HG changeset patch # User timkelly # Date 1242845947 18000 # Node ID 0bf059ef23f8ba16db4f9160f834db6c6c758226 # Parent 11eeeeeb1733738721d607a7e71982ce2e342408# Parent f70af3d98d078a3aabf0c1bb6e92be7f707db76a merge commit diff -r 11eeeeeb1733 -r 0bf059ef23f8 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java diff -r 11eeeeeb1733 -r 0bf059ef23f8 connectivity/com.nokia.carbide.remoteConnections.tests/src/com/nokia/carbide/remoteconnections/tests/extensions/TestFilter.java --- 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 serviceIds = new ArrayList(); private static List> connectedServiceIdPairs = new ArrayList>(); - public static boolean isTest = true; - + public static boolean isTest = Boolean.parseBoolean(System.getenv("remoteconnections.tests")); + public static void reset() { connectionTypeIds.clear(); serviceIds.clear(); diff -r 11eeeeeb1733 -r 0bf059ef23f8 core/com.nokia.carbide.cpp.news.reader.tests/src/com/nokia/carbide/cpp/news/reader/tests/FeedCacheManagerTest.java --- 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 entries = new ArrayList(); + 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()); diff -r 11eeeeeb1733 -r 0bf059ef23f8 core/com.nokia.carbide.cpp.news.reader/src/com/nokia/carbide/cpp/internal/news/reader/gen/FeedCache/FeedCacheManager.java --- 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 cachedFeeds = feedCache.getFeeds().getFeed(); for (Iterator 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 entryList = entries.getEntry(); for (Iterator 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 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);