summaryrefslogtreecommitdiff
path: root/src/instrumentationTest/de/test
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2014-05-18 00:09:45 +0200
committerdaniel oeh <daniel.oeh@gmail.com>2014-05-18 00:09:45 +0200
commit4f8fbf9ed98f646c994d890dc8fd0ffab32e7072 (patch)
tree7061e3e0cf44fd8eeed5bd3bf7e5e2c7472d7c74 /src/instrumentationTest/de/test
parent4a5077b80307d09b73b226c582765714e78224e8 (diff)
parentae0ef6ea6c8b905d2cb73ee0b88db7d5b3c8680b (diff)
downloadAntennaPod-4f8fbf9ed98f646c994d890dc8fd0ffab32e7072.zip
Merge branch 'better-feedparser-tests' into develop
Diffstat (limited to 'src/instrumentationTest/de/test')
-rw-r--r--src/instrumentationTest/de/test/antennapod/AntennaPodTestRunner.java11
-rw-r--r--src/instrumentationTest/de/test/antennapod/syndication/handler/FeedHandlerTest.java316
-rw-r--r--src/instrumentationTest/de/test/antennapod/syndication/handler/TestFeeds.java346
-rw-r--r--src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/AtomGenerator.java118
-rw-r--r--src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/FeedGenerator.java28
-rw-r--r--src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java21
-rw-r--r--src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/RSS2Generator.java110
7 files changed, 441 insertions, 509 deletions
diff --git a/src/instrumentationTest/de/test/antennapod/AntennaPodTestRunner.java b/src/instrumentationTest/de/test/antennapod/AntennaPodTestRunner.java
index 35ecf86dc..cc8494632 100644
--- a/src/instrumentationTest/de/test/antennapod/AntennaPodTestRunner.java
+++ b/src/instrumentationTest/de/test/antennapod/AntennaPodTestRunner.java
@@ -2,20 +2,15 @@ package instrumentationTest.de.test.antennapod;
import android.test.InstrumentationTestRunner;
import android.test.suitebuilder.TestSuiteBuilder;
-import android.util.Log;
-
-import instrumentationTest.de.test.antennapod.service.download.HttpDownloaderTest;
-import instrumentationTest.de.test.antennapod.util.FilenameGeneratorTest;
import junit.framework.TestSuite;
public class AntennaPodTestRunner extends InstrumentationTestRunner {
@Override
public TestSuite getAllTests() {
- return new TestSuiteBuilder(AntennaPodTestRunner.class).includePackages("instrumentationTest.de.test.antennapod.storage")
- //.includeAllPackagesUnderHere()
- // .excludePackages("instrumentationTest.de.test.antennapod.syndication.handler")
- // .excludePackages("instrumentationTest.de.test.antennapod.gpodnet")
+ return new TestSuiteBuilder(AntennaPodTestRunner.class)
+ .includeAllPackagesUnderHere()
+ .excludePackages("instrumentationTest.de.test.antennapod.gpodnet")
.build();
}
}
diff --git a/src/instrumentationTest/de/test/antennapod/syndication/handler/FeedHandlerTest.java b/src/instrumentationTest/de/test/antennapod/syndication/handler/FeedHandlerTest.java
index 95c3a3dba..213dac66a 100644
--- a/src/instrumentationTest/de/test/antennapod/syndication/handler/FeedHandlerTest.java
+++ b/src/instrumentationTest/de/test/antennapod/syndication/handler/FeedHandlerTest.java
@@ -1,170 +1,176 @@
package instrumentationTest.de.test.antennapod.syndication.handler;
-import java.io.BufferedOutputStream;
+import android.content.Context;
+import android.test.InstrumentationTestCase;
+import de.danoeh.antennapod.feed.*;
+import de.danoeh.antennapod.syndication.handler.FeedHandler;
+import de.danoeh.antennapod.syndication.handler.UnsupportedFeedtypeException;
+import instrumentationTest.de.test.antennapod.util.syndication.feedgenerator.AtomGenerator;
+import instrumentationTest.de.test.antennapod.util.syndication.feedgenerator.FeedGenerator;
+import instrumentationTest.de.test.antennapod.util.syndication.feedgenerator.RSS2Generator;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
+import java.util.List;
-import android.test.AndroidTestCase;
-import android.util.Log;
-import de.danoeh.antennapod.feed.Feed;
-import de.danoeh.antennapod.feed.FeedItem;
-import de.danoeh.antennapod.syndication.handler.FeedHandler;
+/**
+ * Tests for FeedHandler
+ */
+public class FeedHandlerTest extends InstrumentationTestCase {
+ private static final String FEEDS_DIR = "testfeeds";
+
+ File file = null;
+ OutputStream outputStream = null;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ Context context = getInstrumentation().getContext();
+ File destDir = context.getExternalFilesDir(FEEDS_DIR);
+ assertNotNull(destDir);
+
+ file = new File(destDir, "feed.xml");
+ file.delete();
+
+ assertNotNull(file);
+ assertFalse(file.exists());
+
+ outputStream = new FileOutputStream(file);
+ }
+
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ file.delete();
+ file = null;
+
+ outputStream.close();
+ outputStream = null;
+ }
+
+ private Feed runFeedTest(Feed feed, FeedGenerator g, String encoding, long flags) throws IOException, UnsupportedFeedtypeException, SAXException, ParserConfigurationException {
+ g.writeFeed(feed, outputStream, encoding, flags);
+ FeedHandler handler = new FeedHandler();
+ Feed parsedFeed = new Feed(feed.getDownload_url(), feed.getLastUpdate());
+ parsedFeed.setFile_url(file.getAbsolutePath());
+ parsedFeed.setDownloaded(true);
+ handler.parseFeed(parsedFeed);
+ return parsedFeed;
+ }
+
+ private void feedValid(Feed feed, Feed parsedFeed, String feedType) {
+ assertEquals(feed.getTitle(), parsedFeed.getTitle());
+ if (feedType.equals(Feed.TYPE_ATOM1)) {
+ assertEquals(feed.getFeedIdentifier(), parsedFeed.getFeedIdentifier());
+ } else {
+ assertEquals(feed.getLanguage(), parsedFeed.getLanguage());
+ }
+
+ assertEquals(feed.getLink(), parsedFeed.getLink());
+ assertEquals(feed.getDescription(), parsedFeed.getDescription());
+ assertEquals(feed.getPaymentLink(), parsedFeed.getPaymentLink());
+
+ if (feed.getImage() != null) {
+ FeedImage image = feed.getImage();
+ FeedImage parsedImage = parsedFeed.getImage();
+ assertNotNull(parsedImage);
+
+ assertEquals(image.getTitle(), parsedImage.getTitle());
+ assertEquals(image.getDownload_url(), parsedImage.getDownload_url());
+ }
-/** Enqueues a list of Feeds and tests if they are parsed correctly */
-public class FeedHandlerTest extends AndroidTestCase {
- private static final String TAG = "FeedHandlerTest";
- private static final String FEEDS_DIR = "testfeeds";
-
- private ArrayList<Feed> feeds;
-
- protected void setUp() throws Exception {
- super.setUp();
- feeds = new ArrayList<Feed>();
- for (int i = 0; i < TestFeeds.urls.length; i++) {
- Feed f = new Feed(TestFeeds.urls[i], new Date());
- f.setFile_url(new File(getContext().getExternalFilesDir(FEEDS_DIR)
- .getAbsolutePath(), "R" + i).getAbsolutePath());
- feeds.add(f);
- }
- }
-
- private InputStream getInputStream(String url)
- throws MalformedURLException, IOException {
- HttpURLConnection connection = (HttpURLConnection) (new URL(url))
- .openConnection();
- int rc = connection.getResponseCode();
- if (rc == HttpURLConnection.HTTP_OK) {
- return connection.getInputStream();
- } else {
- return null;
- }
- }
-
- private boolean downloadFeed(Feed feed) throws IOException {
- int num_retries = 20;
- boolean successful = false;
-
- for (int i = 0; i < num_retries; i++) {
- InputStream in = null;
- BufferedOutputStream out = null;
- try {
- in = getInputStream(feed.getDownload_url());
- if (in == null) {
- return false;
+ if (feed.getItems() != null) {
+ assertNotNull(parsedFeed.getItems());
+ assertEquals(feed.getItems().size(), parsedFeed.getItems().size());
+
+ for (int i = 0; i < feed.getItems().size(); i++) {
+ FeedItem item = feed.getItems().get(i);
+ FeedItem parsedItem = parsedFeed.getItems().get(i);
+
+ if (item.getItemIdentifier() != null)
+ assertEquals(item.getItemIdentifier(), parsedItem.getItemIdentifier());
+ assertEquals(item.getTitle(), parsedItem.getTitle());
+ assertEquals(item.getDescription(), parsedItem.getDescription());
+ assertEquals(item.getContentEncoded(), parsedItem.getContentEncoded());
+ assertEquals(item.getLink(), parsedItem.getLink());
+ assertEquals(item.getPubDate().getTime(), parsedItem.getPubDate().getTime());
+ assertEquals(item.getPaymentLink(), parsedItem.getPaymentLink());
+
+ if (item.hasMedia()) {
+ assertTrue(parsedItem.hasMedia());
+ FeedMedia media = item.getMedia();
+ FeedMedia parsedMedia = parsedItem.getMedia();
+
+ assertEquals(media.getDownload_url(), parsedMedia.getDownload_url());
+ assertEquals(media.getSize(), parsedMedia.getSize());
+ assertEquals(media.getMime_type(), parsedMedia.getMime_type());
+ }
+
+ if (item.hasItemImage()) {
+ assertTrue(parsedItem.hasItemImage());
+ FeedImage image = item.getImage();
+ FeedImage parsedImage = parsedItem.getImage();
+
+ assertEquals(image.getTitle(), parsedImage.getTitle());
+ assertEquals(image.getDownload_url(), parsedImage.getDownload_url());
+ }
+
+ if (item.getChapters() != null) {
+ assertNotNull(parsedItem.getChapters());
+ assertEquals(item.getChapters().size(), parsedItem.getChapters().size());
+ List<Chapter> chapters = item.getChapters();
+ List<Chapter> parsedChapters = parsedItem.getChapters();
+ for (int j = 0; j < chapters.size(); j++) {
+ Chapter chapter = chapters.get(j);
+ Chapter parsedChapter = parsedChapters.get(j);
+
+ assertEquals(chapter.getTitle(), parsedChapter.getTitle());
+ assertEquals(chapter.getLink(), parsedChapter.getLink());
+ }
}
- out = new BufferedOutputStream(new FileOutputStream(
- feed.getFile_url()));
- byte[] buffer = new byte[8 * 1024];
- int count = 0;
- while ((count = in.read(buffer)) != -1) {
- out.write(buffer, 0, count);
- }
- out.flush();
- successful = true;
- return true;
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- if (in != null) {
- in.close();
- }
- if (out != null) {
- out.close();
- }
- if (successful) {
- break;
- }
- }
- }
- if (!successful) {
- Log.e(TAG, "Download failed after " + num_retries + " retries");
- throw new IOException();
- } else {
- return true;
+ }
}
- }
-
- private boolean isFeedValid(Feed feed) {
- Log.i(TAG, "Checking if " + feed.getDownload_url() + " is valid");
- boolean result = false;
- if (feed.getTitle() == null) {
- Log.e(TAG, "Feed has no title");
- return false;
- }
- if (!hasValidFeedItems(feed)) {
- Log.e(TAG, "Feed has invalid items");
- return false;
- }
- if (feed.getLink() == null) {
- Log.e(TAG, "Feed has no link");
- return false;
- }
- if (feed.getLink() != null && feed.getLink().length() == 0) {
- Log.e(TAG, "Feed has empty link");
- return false;
- }
- if (feed.getIdentifyingValue() == null) {
- Log.e(TAG, "Feed has no identifying value");
- return false;
- }
- if (feed.getIdentifyingValue() != null
- && feed.getIdentifyingValue().length() == 0) {
- Log.e(TAG, "Feed has empty identifying value");
- return false;
- }
- return true;
- }
-
- private boolean hasValidFeedItems(Feed feed) {
- for (FeedItem item : feed.getItems()) {
- if (item.getTitle() == null) {
- Log.e(TAG, "Item has no title");
- return false;
- }
- }
- return true;
- }
-
- public void testParseFeeds() {
- Log.i(TAG, "Testing RSS feeds");
- while (!feeds.isEmpty()) {
- Feed feed = feeds.get(0);
- parseFeed(feed);
- feeds.remove(0);
- }
-
- Log.i(TAG, "RSS Test completed");
- }
-
- private void parseFeed(Feed feed) {
- try {
- Log.i(TAG, "Testing feed with url " + feed.getDownload_url());
- FeedHandler handler = new FeedHandler();
- if (downloadFeed(feed)) {
- handler.parseFeed(feed);
- assertTrue(isFeedValid(feed));
+ }
+
+ public void testRSS2Basic() throws IOException, UnsupportedFeedtypeException, SAXException, ParserConfigurationException {
+ Feed f1 = createTestFeed(10, false, true, true);
+ Feed f2 = runFeedTest(f1, new RSS2Generator(), "UTF-8", RSS2Generator.FEATURE_WRITE_GUID);
+ feedValid(f1, f2, Feed.TYPE_RSS2);
+ }
+
+ public void testAtomBasic() throws IOException, UnsupportedFeedtypeException, SAXException, ParserConfigurationException {
+ Feed f1 = createTestFeed(10, false, true, true);
+ Feed f2 = runFeedTest(f1, new AtomGenerator(), "UTF-8", 0);
+ feedValid(f1, f2, Feed.TYPE_ATOM1);
+ }
+
+ private Feed createTestFeed(int numItems, boolean withImage, boolean withFeedMedia, boolean withChapters) {
+ FeedImage image = null;
+ if (withImage) {
+ image = new FeedImage(0, "image", null, "http://example.com/picture", false);
+ }
+ Feed feed = new Feed(0, new Date(), "title", "http://example.com", "This is the description",
+ "http://example.com/payment", "Daniel", "en", null, "http://example.com/feed", image, file.getAbsolutePath(),
+ "http://example.com/feed", true);
+ feed.setItems(new ArrayList<FeedItem>());
+
+ for (int i = 0; i < numItems; i++) {
+ FeedItem item = new FeedItem(0, "item-" + i, "http://example.com/item-" + i,
+ "http://example.com/items/" + i, new Date(i*60000), false, feed);
+ feed.getItems().add(item);
+ if (withFeedMedia) {
+ item.setMedia(new FeedMedia(0, item, 4711, 0, 100, "audio/mp3", null, "http://example.com/media-" + i,
+ false, null, 0));
}
- } catch (Exception e) {
- Log.e(TAG, "Error when trying to test " + feed.getDownload_url());
- e.printStackTrace();
- }
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- for (Feed feed : feeds) {
- File f = new File(feed.getFile_url());
- f.delete();
- }
- }
+ }
+
+ return feed;
+ }
}
diff --git a/src/instrumentationTest/de/test/antennapod/syndication/handler/TestFeeds.java b/src/instrumentationTest/de/test/antennapod/syndication/handler/TestFeeds.java
deleted file mode 100644
index 61990cccb..000000000
--- a/src/instrumentationTest/de/test/antennapod/syndication/handler/TestFeeds.java
+++ /dev/null
@@ -1,346 +0,0 @@
-package instrumentationTest.de.test.antennapod.syndication.handler;
-
-public class TestFeeds {
-
- public static final String[] urls = {
- "http://savoirsenmultimedia.ens.fr/podcast.php?id=30",
- "http://bitlove.org/apollo40/ps3newsroom/feed",
- "http://bitlove.org/beapirate/hauptstadtpiraten/feed",
- "http://bitlove.org/benni/besondereumstaende/feed",
- "http://bitlove.org/bennihahn/unicast/feed",
- "http://bitlove.org/berndbloggt/wirschweifenab/feed",
- "http://bitlove.org/bildungsangst/spoiler-alert-mp3/feed",
- "http://bitlove.org/bildungsangst/spoiler-alert-ogg/feed",
- "http://bitlove.org/bildungsangst/troja-alert-mp3/feed",
- "http://bitlove.org/bildungsangst/troja-alert-ogg/feed",
- "http://bitlove.org/binaergewitter/talk/feed",
- "http://bitlove.org/binaergewitter/talk-ogg/feed",
- "http://bitlove.org/bitgamers/bitgamerscast/feed",
- "http://bitlove.org/boingsworld/boingsworld/feed",
- "http://bitlove.org/boris/bam/feed",
- "http://bitlove.org/bruhndsoweiter/anycast-aac/feed",
- "http://bitlove.org/bruhndsoweiter/anycast-mp3/feed",
- "http://bitlove.org/bruhndsoweiter/schnackennet-m4a/feed",
- "http://bitlove.org/bruhndsoweiter/schnackennet-mp3/feed",
- "http://bitlove.org/bruhndsoweiter/schnackennet-ogg/feed",
- "http://bitlove.org/byteweise/bytecast/feed",
- "http://bitlove.org/byteweise/byteweiseaac/feed",
- "http://bitlove.org/c3d2/news/feed",
- "http://bitlove.org/c3d2/pentacast/feed",
- "http://bitlove.org/c3d2/pentamedia/feed",
- "http://bitlove.org/c3d2/pentamusic/feed",
- "http://bitlove.org/c3d2/pentaradio/feed",
- "http://bitlove.org/campuscast_cc/campuscast_cc/feed",
- "http://bitlove.org/carlito/schnittmuster/feed",
- "http://bitlove.org/carlito/yaycomics/feed",
- "http://bitlove.org/cccb/chaosradio/feed",
- "http://bitlove.org/ccculm/chaosseminar-mp4-high/feed",
- "http://bitlove.org/ccculm/chaosseminar-theora/feed",
- "http://bitlove.org/channelcast/channelcast/feed",
- "http://bitlove.org/chgrasse/freequency/feed",
- "http://bitlove.org/chgrasse/kiezradio/feed",
- "http://bitlove.org/christiansteiner/secondunit/feed",
- "http://bitlove.org/cinext/cinext/feed",
- "http://bitlove.org/ckater/schoeneecken/feed",
- "http://bitlove.org/ckater/schoeneecken-mp3/feed",
- "http://bitlove.org/cocoaheads/austria/feed",
- "http://bitlove.org/compod/compod/feed",
- "http://bitlove.org/consolmedia/consolpodcast/feed",
- "http://bitlove.org/couchblog/computerfix/feed",
- "http://bitlove.org/culinaricast/podcast/feed",
- "http://bitlove.org/d3v/die-drei-vogonen/feed",
- "http://bitlove.org/danielbuechele/luftpost/feed",
- "http://bitlove.org/deimhart/mp3/feed",
- "http://bitlove.org/deimhart/ogg/feed",
- "http://bitlove.org/derbastard/podcast/feed",
- "http://bitlove.org/derpoppe/poppeandpeople/feed",
- "http://bitlove.org/derpoppe/stammtischphilosophen/feed",
- "http://bitlove.org/devradio/devradio-music-mp3/feed",
- "http://bitlove.org/devradio/devradio-music-ogg/feed",
- "http://bitlove.org/devradio/devradio-nomusic-mp3/feed",
- "http://bitlove.org/devradio/devradio-nomusic-ogg/feed",
- "http://bitlove.org/die-halde/die-halde/feed",
- "http://bitlove.org/dirtyminutesleft/m4a/feed",
- "http://bitlove.org/dirtyminutesleft/mp3/feed",
- "http://bitlove.org/dominik/knutsens/feed",
- "http://bitlove.org/dominik/schnittchen/feed",
- "http://bitlove.org/driveeo/podcast/feed",
- "http://bitlove.org/einfachben/freibeuterhafen/feed",
- "http://bitlove.org/eintr8podcast/aac/feed",
- "http://bitlove.org/eintr8podcast/eptv/feed",
- "http://bitlove.org/eintr8podcast/mp3/feed",
- "http://bitlove.org/eteubert/satoripress-m4a/feed",
- "http://bitlove.org/fabu/indie-fresse/feed",
- "http://bitlove.org/faldrian/bofh-mp3/feed",
- "http://bitlove.org/faldrian/bofh-oga/feed",
- "http://bitlove.org/faldrian/faldriansfeierabend/feed",
- "http://bitlove.org/filmtonpodcast/filmtonpodcast/feed",
- "http://bitlove.org/firmadorsch/fahrradio/feed",
- "http://bitlove.org/frequenz9/feed/feed",
- "http://bitlove.org/gamefusion/feeds/feed",
- "http://bitlove.org/gamesandmacs/podcast/feed",
- "http://bitlove.org/geekweek/techpodcast/feed",
- "http://bitlove.org/germanstudent/apfelnet/feed",
- "http://bitlove.org/germanstudent/bruellaffencouch-enhanced/feed",
- "http://bitlove.org/germanstudent/bruellaffencouch-mp3/feed",
- "http://bitlove.org/germanstudent/kauderwelschavantgarde/feed",
- "http://bitlove.org/germanstudent/podccast-enhanced/feed",
- "http://bitlove.org/germanstudent/podccast-mp3/feed",
- "http://bitlove.org/geschichtendose/love/feed",
- "http://bitlove.org/gfm/atzbach/feed",
- "http://bitlove.org/gfm/rumsendende/feed",
- "http://bitlove.org/grizze/vtlive/feed",
- "http://bitlove.org/hackerfunk/hf-mp3/feed",
- "http://bitlove.org/hackerfunk/hf-ogg/feed",
- "http://bitlove.org/hasencore/podcast/feed",
- "http://bitlove.org/hoaxmaster/hoaxilla/feed",
- "http://bitlove.org/hoaxmaster/psychotalk/feed",
- "http://bitlove.org/hoaxmaster/skeptoskop/feed",
- "http://bitlove.org/hoersuppe/vorcast/feed",
- "http://bitlove.org/holgi/wrint/feed",
- "http://bitlove.org/ich-bin-radio/fir/feed",
- "http://bitlove.org/ich-bin-radio/rsff/feed",
- "http://bitlove.org/incerio/podcast/feed",
- "http://bitlove.org/janlelis/rubykraut/feed",
- "http://bitlove.org/jed/feed1/feed",
- "http://bitlove.org/jupiterbroadcasting/coderradio/feed",
- "http://bitlove.org/jupiterbroadcasting/fauxshowhd/feed",
- "http://bitlove.org/jupiterbroadcasting/fauxshowmobile/feed",
- "http://bitlove.org/jupiterbroadcasting/lashd/feed",
- "http://bitlove.org/jupiterbroadcasting/lasmobile/feed",
- "http://bitlove.org/jupiterbroadcasting/scibytehd/feed",
- "http://bitlove.org/jupiterbroadcasting/scibytemobile/feed",
- "http://bitlove.org/jupiterbroadcasting/techsnap60/feed",
- "http://bitlove.org/jupiterbroadcasting/techsnapmobile/feed",
- "http://bitlove.org/jupiterbroadcasting/unfilterhd/feed",
- "http://bitlove.org/jupiterbroadcasting/unfiltermobile/feed",
- "http://bitlove.org/kassettenkind/trollfunk/feed",
- "http://bitlove.org/klangkammermedia/abgekuppelt/feed",
- "http://bitlove.org/klangkammermedia/derbalkoncast/feed",
- "http://bitlove.org/klangkammermedia/wortundstille/feed",
- "http://bitlove.org/kurzpod/kurzpod/feed",
- "http://bitlove.org/kurzpod/kurzpodm4a/feed",
- "http://bitlove.org/kurzpod/ogg/feed",
- "http://bitlove.org/langpod/lp/feed",
- "http://bitlove.org/legrex/videli-noch/feed",
- "http://bitlove.org/lisnewsnetcasts/listen/feed",
- "http://bitlove.org/logenzuschlag/cinecast/feed",
- "http://bitlove.org/maha/1337kultur/feed",
- "http://bitlove.org/maha/klabautercast/feed",
- "http://bitlove.org/map/fanboys/feed",
- "http://bitlove.org/map/fanboys-mp3/feed",
- "http://bitlove.org/map/retrozirkel/feed",
- "http://bitlove.org/map/retrozirkel-mp3/feed",
- "http://bitlove.org/markus/robotiklabor/feed",
- "http://bitlove.org/martinschmidt/freiklettern/feed",
- "http://bitlove.org/mespotine/mespotine_sessions/feed",
- "http://bitlove.org/meszner/aether/feed",
- "http://bitlove.org/meszner/kulturwissenschaften/feed",
- "http://bitlove.org/metaebene/cre/feed",
- "http://bitlove.org/metaebene/der-lautsprecher/feed",
- "http://bitlove.org/metaebene/kolophon/feed",
- "http://bitlove.org/metaebene/logbuch-netzpolitik/feed",
- "http://bitlove.org/metaebene/mobilemacs/feed",
- "http://bitlove.org/metaebene/newz-of-the-world/feed",
- "http://bitlove.org/metaebene/not-safe-for-work/feed",
- "http://bitlove.org/metaebene/raumzeit/feed",
- "http://bitlove.org/metaebene/raumzeit-mp3/feed",
- "http://bitlove.org/metagamer/metagamer/feed",
- "http://bitlove.org/mfromm/collaborativerockers/feed",
- "http://bitlove.org/mfromm/explorism/feed",
- "http://bitlove.org/mfromm/transientesichten/feed",
- "http://bitlove.org/mhpod/pofacs/feed",
- "http://bitlove.org/mintcast/podcast/feed",
- "http://bitlove.org/mitgezwitschert/brandung/feed",
- "http://bitlove.org/moepmoeporg/anonnewsde/feed",
- "http://bitlove.org/moepmoeporg/contentcast/feed",
- "http://bitlove.org/moepmoeporg/dieseminarren/feed",
- "http://bitlove.org/moepmoeporg/emcast/feed",
- "http://bitlove.org/moepmoeporg/fhainalex/feed",
- "http://bitlove.org/moepmoeporg/fruehstueck/feed",
- "http://bitlove.org/moepmoeporg/galanoir/feed",
- "http://bitlove.org/moepmoeporg/julespodcasts/feed",
- "http://bitlove.org/moepmoeporg/knorkpod/feed",
- "http://bitlove.org/moepmoeporg/lecast/feed",
- "http://bitlove.org/moepmoeporg/moepspezial/feed",
- "http://bitlove.org/moepmoeporg/podsprech/feed",
- "http://bitlove.org/moepmoeporg/pottcast/feed",
- "http://bitlove.org/moepmoeporg/riotburnz/feed",
- "http://bitlove.org/moepmoeporg/schachcast/feed",
- "http://bitlove.org/moepmoeporg/sundaymoaning/feed",
- "http://bitlove.org/motofunk/anekdotkast/feed",
- "http://bitlove.org/motofunk/motofunk/feed",
- "http://bitlove.org/netzpolitik/netzpolitik-podcast/feed",
- "http://bitlove.org/netzpolitik/netzpolitik-tv/feed",
- "http://bitlove.org/nischenkultur/soziopod/feed",
- "http://bitlove.org/nitramred/staatsbuergerkunde/feed",
- "http://bitlove.org/nitramred/staatsbuergerkunde-mp3/feed",
- "http://bitlove.org/nsemak/elementarfragen/feed",
- "http://bitlove.org/nsemak/mikrodilettanten/feed",
- "http://bitlove.org/oaad/oaad/feed",
- "http://bitlove.org/ohrkrampfteam/ohr/feed",
- "http://bitlove.org/omegatau/all/feed",
- "http://bitlove.org/omegatau/english-only/feed",
- "http://bitlove.org/omegatau/german-only/feed",
- "http://bitlove.org/onatcer/oal/feed",
- "http://bitlove.org/panikcast/panikcast/feed",
- "http://bitlove.org/panxatony/macnemotv/feed",
- "http://bitlove.org/pattex/megamagisch_m4a/feed",
- "http://bitlove.org/pattex/megamagisch_mp3/feed",
- "http://bitlove.org/pausengespraeche/pausengespraeche/feed",
- "http://bitlove.org/pck/ez-und-geschlecht/feed",
- "http://bitlove.org/pck/gender-kolleg-marburg/feed",
- "http://bitlove.org/pck/genderzentrum_mr/feed",
- "http://bitlove.org/pck/hh/feed",
- "http://bitlove.org/pck/hh_mp3/feed",
- "http://bitlove.org/pck/hh_ogg/feed",
- "http://bitlove.org/pck/intercast/feed",
- "http://bitlove.org/pck/peachnerdznohero/feed",
- "http://bitlove.org/pck/peachnerdznohero_mp3/feed",
- "http://bitlove.org/philip/einfach-schwul/feed",
- "http://bitlove.org/philip/faselcast2/feed",
- "http://bitlove.org/philipbanse/kuechenradio/feed",
- "http://bitlove.org/philipbanse/medienradio/feed",
- "http://bitlove.org/philipbanse/studienwahl_tv_audio/feed",
- "http://bitlove.org/philipbanse/studienwahl_tv_video/feed",
- "http://bitlove.org/podsafepilot/pmp/feed",
- "http://bitlove.org/podsafepilot/psid/feed",
- "http://bitlove.org/pratfm/strunt/feed",
- "http://bitlove.org/pressrecord/podcast/feed",
- "http://bitlove.org/qbi/datenkanal-mp3/feed",
- "http://bitlove.org/qbi/datenkanal-ogg/feed",
- "http://bitlove.org/quotidianitaet/quotidianitaet/feed",
- "http://bitlove.org/radiotux/radiotux-all/feed",
- "http://bitlove.org/randgruppenfunk/mediale_subkultur/feed",
- "http://bitlove.org/ranzzeit/ranz/feed",
- "http://bitlove.org/relet/lifeartificial_partone/feed",
- "http://bitlove.org/retinacast/pilotenpruefung/feed",
- "http://bitlove.org/retinacast/podcast/feed",
- "http://bitlove.org/retinacast/podcast-aac/feed",
- "http://bitlove.org/retinacast/retinauten/feed",
- "http://bitlove.org/retinacast/rtc/feed",
- "http://bitlove.org/revolutionarts/mehrspielerquote/feed",
- "http://bitlove.org/ronsens/machtdose/feed",
- "http://bitlove.org/rooby/fressefreiheit/feed",
- "http://bitlove.org/rundumpodcast/rundum/feed",
- "http://bitlove.org/ryuu/riesencast/feed",
- "http://bitlove.org/ryuu/ryuus_labercast/feed",
- "http://bitlove.org/schmalsprech/schmalsprech_m4a/feed",
- "http://bitlove.org/schmalsprech/schmalsprech_mp3/feed",
- "http://bitlove.org/schmidtlepp/houroflauer/feed",
- "http://bitlove.org/schmidtlepp/lauerinformiert/feed",
- "http://bitlove.org/sebastiansimon/wertungsfrei/feed",
- "http://bitlove.org/sebseb7/vimeo/feed",
- "http://bitlove.org/sirtomate/comichoehle/feed",
- "http://bitlove.org/smartphone7/windowsphonepodcast/feed",
- "http://bitlove.org/smcpodcast/feed/feed",
- "http://bitlove.org/sneakpod/cocktailpodcast/feed",
- "http://bitlove.org/sneakpod/sneakpod/feed",
- "http://bitlove.org/socialhack/hoerensagen/feed",
- "http://bitlove.org/socialhack/netzkinder/feed",
- "http://bitlove.org/socialhack/netzkinder_mp3/feed",
- "http://bitlove.org/socialhack/netzkinder_ogg/feed",
- "http://bitlove.org/socialhack/talking_anthropology/feed",
- "http://bitlove.org/sprechwaisen/sw/feed",
- "http://bitlove.org/sublab/aboutradio/feed",
- "http://bitlove.org/sysops/elektrisch/feed",
- "http://bitlove.org/sysops/hd/feed",
- "http://bitlove.org/taschencasts/taschencasts/feed",
- "http://bitlove.org/tcmanila/ae-podcast/feed",
- "http://bitlove.org/teezeit/kulturbuechse/feed",
- "http://bitlove.org/teezeit/kulturbuechse-mp3/feed",
- "http://bitlove.org/teezeit/teezeittalkradio/feed",
- "http://bitlove.org/teezeit/teezeittalkradio-mp3/feed",
- "http://bitlove.org/tinkengil/playtogether/feed",
- "http://bitlove.org/tobi_s/alleswirdgut/feed",
- "http://bitlove.org/toby/einschlafenenhanced/feed",
- "http://bitlove.org/toby/einschlafenpodcast/feed",
- "http://bitlove.org/toby/pubkameraden/feed",
- "http://bitlove.org/toby/pubkameradenaac/feed",
- "http://bitlove.org/tom/radioanstalt/feed",
- "http://bitlove.org/tvallgaeu/beitraege/feed",
- "http://bitlove.org/tvallgaeu/freizeit/feed",
- "http://bitlove.org/tvallgaeu/sendung/feed",
- "http://bitlove.org/ubahnverleih/teepodcast/feed",
- "http://bitlove.org/umunsherum/sammelcast/feed",
- "http://bitlove.org/umunsherum/spielonauten/feed",
- "http://bitlove.org/umunsherum/unteruns/feed",
- "http://bitlove.org/umunsherum/wasmachstdu/feed",
- "http://bitlove.org/uwe/nettesfrettchen/feed",
- "http://bitlove.org/webdev/wdr/feed",
- "http://bitlove.org/weezerle/brandung/feed",
- "http://bitlove.org/weezerle/guestcast/feed",
- "http://bitlove.org/weezerle/stupalog/feed",
- "http://bitlove.org/wikigeeks/mp3/feed",
- "http://bitlove.org/workingdraft/revisionen/feed",
- "http://bitlove.org/wunderlich/podcast/feed",
- "http://www.guardian.co.uk/global-development/series/global-development-podcast/rss",
- "http://rss.sciam.com/sciam/60secsciencepodcast",
- "http://rss.sciam.com/sciam/60-second-mind",
- "http://rss.sciam.com/sciam/60-second-space",
- "http://rss.sciam.com/sciam/60-second-health",
- "http://rss.sciam.com/sciam/60-second-tech",
- "http://risky.biz/feeds/risky-business",
- "http://risky.biz/feeds/rb2",
- "http://podcast.hr-online.de/lateline/podcast.xml",
- "http://bitlove.org/nsemak/mikrodilettanten/feed",
- "http://bitlove.org/moepmoeporg/riotburnz/feed",
- "http://bitlove.org/moepmoeporg/schachcast/feed",
- "http://bitlove.org/moepmoeporg/sundaymoaning/feed",
- "http://bitlove.org/motofunk/anekdotkast/feed",
- "http://bitlove.org/motofunk/motofunk/feed",
- "http://podcast.homerj.de/podcasts.xml",
- "http://www.dradio.de/rss/podcast/sendungen/wissenschaftundbildung/",
- "http://www.dradio.de/rss/podcast/sendungen/wirtschaftundverbraucher/",
- "http://www.dradio.de/rss/podcast/sendungen/literatur/",
- "http://www.dradio.de/rss/podcast/sendungen/sport/",
- "http://www.dradio.de/rss/podcast/sendungen/wirtschaftundgesellschaft/",
- "http://www.dradio.de/rss/podcast/sendungen/filmederwoche/",
- "http://www.blacksweetstories.com/feed/podcast/",
- "http://feeds.5by5.tv/buildanalyze",
- "http://bitlove.org/ranzzeit/ranz/feed",
- "http://bitlove.org/importthis/mp3/feed",
- "http://bitlove.org/astro/youtube/feed",
- "http://bitlove.org/channelcast/channelcast/feed",
- "http://bitlove.org/cccb/chaosradio/feed",
- "http://bitlove.org/astro/bitlove-show/feed",
- "http://feeds.thisamericanlife.org/talpodcast",
- "http://www.casasola.de/137b/1337motiv/1337motiv.xml",
- "http://alternativlos.org/ogg.rss", "http://www.bitsundso.de/feed",
- "http://www.gamesundso.de/feed/",
- "http://feeds.feedburner.com/cre-podcast",
- "http://feeds.feedburner.com/NotSafeForWorkPodcast",
- "http://feeds.feedburner.com/mobile-macs-podcast",
- "http://www.gamesundso.de/feed/",
- "http://feeds.feedburner.com/DerLautsprecher",
- "http://feeds.feedburner.com/raumzeit-podcast",
- "http://feeds.feedburner.com/TheLunaticFringe",
- "http://feeds.feedburner.com/Kuechenradioorg",
- "http://feeds.feedburner.com/Medienradio_Podcast_RSS",
- "http://feeds.feedburner.com/wrint/wrint",
- "http://retrozirkel.de/episodes.mp3.rss",
- "http://trackback.fritz.de/?feed=podcast",
- "http://feeds.feedburner.com/linuxoutlaws-ogg",
- "http://www.mevio.com/feeds/noagenda.xml",
- "http://podcast.hr2.de/derTag/podcast.xml",
- "http://feeds.feedburner.com/thechangelog",
- "http://leoville.tv/podcasts/floss.xml",
- "http://www.radiotux.de/index.php?/feeds/index.rss2",
- "http://megamagis.ch/episodes.mp3.rss",
- "http://www.eurogamer.net/rss/eurogamer_podcast_itunes.rss",
- "http://bobsonbob.de/?feed=rss2",
- "http://www.blacksweetstories.com/feed/podcast/",
- "http://www.eurogamer.net/rss/eurogamer_podcast_itunes.rss",
- "http://diehoppeshow.de/podcast/feed.xml",
- "http://feeds.feedburner.com/ThisIsMyNextPodcast?format=xml",
- "http://bitlove.org/343max/maerchenstunde/feed",
- "http://bitlove.org/343max/wmr-aac/feed",
- "http://bitlove.org/343max/wmr-mp3/feed",
- "http://bitlove.org/343max/wmr-oga/feed",
- "http://bitlove.org/adamc1999/noagenda/feed",
- "http://bitlove.org/alexbrueckel/normalzeit_podcast/feed",
- "http://bitlove.org/alexbrueckel/normalzeit_podcast_mp3/feed",
- "http://bitlove.org/alexbrueckel/tisch3-podcast/feed",
- "http://bitlove.org/alexolma/iphoneblog/feed",
- "http://www.cczwei.de/rss_tvissues.php" };
-}
diff --git a/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/AtomGenerator.java b/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/AtomGenerator.java
new file mode 100644
index 000000000..0e3440030
--- /dev/null
+++ b/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/AtomGenerator.java
@@ -0,0 +1,118 @@
+package instrumentationTest.de.test.antennapod.util.syndication.feedgenerator;
+
+import android.util.Xml;
+import de.danoeh.antennapod.feed.Feed;
+import de.danoeh.antennapod.feed.FeedItem;
+import de.danoeh.antennapod.feed.FeedMedia;
+import de.danoeh.antennapod.syndication.util.SyndDateUtils;
+import org.xmlpull.v1.XmlSerializer;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * Creates Atom feeds. See FeedGenerator for more information.
+ */
+public class AtomGenerator implements FeedGenerator{
+
+ private static final String NS_ATOM = "http://www.w3.org/2005/Atom";
+
+ public static final long FEATURE_USE_RFC3339LOCAL = 1;
+
+ @Override
+ public void writeFeed(Feed feed, OutputStream outputStream, String encoding, long flags) throws IOException {
+ if (feed == null) throw new IllegalArgumentException("feed = null");
+ if (outputStream == null) throw new IllegalArgumentException("outputStream = null");
+ if (encoding == null) throw new IllegalArgumentException("encoding = null");
+
+ XmlSerializer xml = Xml.newSerializer();
+ xml.setOutput(outputStream, encoding);
+ xml.startDocument(encoding, null);
+
+ xml.startTag(null, "feed");
+ xml.attribute(null, "xmlns", NS_ATOM);
+
+ // Write Feed data
+ if (feed.getIdentifyingValue() != null) {
+ xml.startTag(null, "id");
+ xml.text(feed.getIdentifyingValue());
+ xml.endTag(null, "id");
+ }
+ if (feed.getTitle() != null) {
+ xml.startTag(null, "title");
+ xml.text(feed.getTitle());
+ xml.endTag(null, "title");
+ }
+ if (feed.getLink() != null) {
+ xml.startTag(null, "link");
+ xml.attribute(null, "rel", "alternate");
+ xml.attribute(null, "href", feed.getLink());
+ xml.endTag(null, "link");
+ }
+ if (feed.getDescription() != null) {
+ xml.startTag(null, "subtitle");
+ xml.text(feed.getDescription());
+ xml.endTag(null, "subtitle");
+ }
+
+ if (feed.getPaymentLink() != null) {
+ GeneratorUtil.addPaymentLink(xml, feed.getPaymentLink(), false);
+ }
+
+ // Write FeedItem data
+ if (feed.getItems() != null) {
+ for (FeedItem item : feed.getItems()) {
+ xml.startTag(null, "entry");
+
+ if (item.getIdentifyingValue() != null) {
+ xml.startTag(null, "id");
+ xml.text(item.getIdentifyingValue());
+ xml.endTag(null, "id");
+ }
+ if (item.getTitle() != null) {
+ xml.startTag(null, "title");
+ xml.text(item.getTitle());
+ xml.endTag(null, "title");
+ }
+ if (item.getLink() != null) {
+ xml.startTag(null, "link");
+ xml.attribute(null, "rel", "alternate");
+ xml.attribute(null, "href", item.getLink());
+ xml.endTag(null, "link");
+ }
+ if (item.getPubDate() != null) {
+ xml.startTag(null, "published");
+ if ((flags & FEATURE_USE_RFC3339LOCAL) != 0) {
+ xml.text(SyndDateUtils.formatRFC3339Local(item.getPubDate()));
+ } else {
+ xml.text(SyndDateUtils.formatRFC3339UTC(item.getPubDate()));
+ }
+ xml.endTag(null, "published");
+ }
+ if (item.getDescription() != null) {
+ xml.startTag(null, "content");
+ xml.text(item.getDescription());
+ xml.endTag(null, "content");
+ }
+ if (item.getMedia() != null) {
+ FeedMedia media = item.getMedia();
+ xml.startTag(null, "link");
+ xml.attribute(null, "rel", "enclosure");
+ xml.attribute(null, "href", media.getDownload_url());
+ xml.attribute(null, "type", media.getMime_type());
+ xml.attribute(null, "length", String.valueOf(media.getSize()));
+ xml.endTag(null, "link");
+ }
+
+ if (item.getPaymentLink() != null) {
+ GeneratorUtil.addPaymentLink(xml, item.getPaymentLink(), false);
+ }
+
+ xml.endTag(null, "entry");
+ }
+ }
+
+ xml.endTag(null, "feed");
+ xml.endDocument();
+ }
+}
diff --git a/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/FeedGenerator.java b/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/FeedGenerator.java
new file mode 100644
index 000000000..e6b0f0697
--- /dev/null
+++ b/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/FeedGenerator.java
@@ -0,0 +1,28 @@
+package instrumentationTest.de.test.antennapod.util.syndication.feedgenerator;
+
+import de.danoeh.antennapod.feed.Feed;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * Generates a machine-readable, platform-independent representation of a Feed object.
+ */
+public interface FeedGenerator {
+
+ /**
+ * Creates a machine-readable, platform-independent representation of a given
+ * Feed object and writes it to the given OutputStream.
+ * <p/>
+ * The representation might not be compliant with its specification if the feed
+ * is missing certain attribute values. This is intentional because the FeedGenerator is
+ * used for creating test data.
+ *
+ * @param feed The feed that should be written. Must not be null.
+ * @param outputStream The output target that the feed will be written to. The outputStream is not closed after
+ * the method's execution Must not be null.
+ * @param encoding The encoding to use. Must not be null.
+ * @param flags Optional argument for enabling implementation-dependent features.
+ */
+ public void writeFeed(Feed feed, OutputStream outputStream, String encoding, long flags) throws IOException;
+}
diff --git a/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java b/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java
new file mode 100644
index 000000000..d8bef2354
--- /dev/null
+++ b/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java
@@ -0,0 +1,21 @@
+package instrumentationTest.de.test.antennapod.util.syndication.feedgenerator;
+
+import org.xmlpull.v1.XmlSerializer;
+
+import java.io.IOException;
+
+/**
+ * Utility methods for FeedGenerator
+ */
+public class GeneratorUtil {
+
+ public static void addPaymentLink(XmlSerializer xml, String paymentLink, boolean withNamespace) throws IOException {
+ String ns = (withNamespace) ? "http://www.w3.org/2005/Atom" : null;
+ xml.startTag(ns, "link");
+ xml.attribute(null, "rel", "payment");
+ xml.attribute(null, "title", "Flattr this!");
+ xml.attribute(null, "href", paymentLink);
+ xml.attribute(null, "type", "text/html");
+ xml.endTag(ns, "link");
+ }
+}
diff --git a/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/RSS2Generator.java b/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/RSS2Generator.java
new file mode 100644
index 000000000..824a84a66
--- /dev/null
+++ b/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/RSS2Generator.java
@@ -0,0 +1,110 @@
+package instrumentationTest.de.test.antennapod.util.syndication.feedgenerator;
+
+import android.util.Xml;
+import de.danoeh.antennapod.feed.Feed;
+import de.danoeh.antennapod.feed.FeedItem;
+import de.danoeh.antennapod.syndication.util.SyndDateUtils;
+import org.xmlpull.v1.XmlSerializer;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * Creates RSS 2.0 feeds. See FeedGenerator for more information.
+ */
+public class RSS2Generator implements FeedGenerator{
+
+ public static final long FEATURE_WRITE_GUID = 1;
+
+ @Override
+ public void writeFeed(Feed feed, OutputStream outputStream, String encoding, long flags) throws IOException {
+ if (feed == null) throw new IllegalArgumentException("feed = null");
+ if (outputStream == null) throw new IllegalArgumentException("outputStream = null");
+ if (encoding == null) throw new IllegalArgumentException("encoding = null");
+
+ XmlSerializer xml = Xml.newSerializer();
+ xml.setOutput(outputStream, encoding);
+ xml.startDocument(encoding, null);
+
+ xml.setPrefix("atom", "http://www.w3.org/2005/Atom");
+ xml.startTag(null, "rss");
+ xml.attribute(null, "version", "2.0");
+ xml.startTag(null, "channel");
+
+ // Write Feed data
+ if (feed.getTitle() != null) {
+ xml.startTag(null, "title");
+ xml.text(feed.getTitle());
+ xml.endTag(null, "title");
+ }
+ if (feed.getDescription() != null) {
+ xml.startTag(null, "description");
+ xml.text(feed.getDescription());
+ xml.endTag(null, "description");
+ }
+ if (feed.getLink() != null) {
+ xml.startTag(null, "link");
+ xml.text(feed.getLink());
+ xml.endTag(null, "link");
+ }
+ if (feed.getLanguage() != null) {
+ xml.startTag(null, "language");
+ xml.text(feed.getLanguage());
+ xml.endTag(null, "language");
+ }
+
+ if (feed.getPaymentLink() != null) {
+ GeneratorUtil.addPaymentLink(xml, feed.getPaymentLink(), true);
+ }
+
+ // Write FeedItem data
+ if (feed.getItems() != null) {
+ for (FeedItem item : feed.getItems()) {
+ xml.startTag(null, "item");
+
+ if (item.getTitle() != null) {
+ xml.startTag(null, "title");
+ xml.text(item.getTitle());
+ xml.endTag(null, "title");
+ }
+ if (item.getDescription() != null) {
+ xml.startTag(null, "description");
+ xml.text(item.getDescription());
+ xml.endTag(null, "description");
+ }
+ if (item.getLink() != null) {
+ xml.startTag(null, "link");
+ xml.text(item.getLink());
+ xml.endTag(null, "link");
+ }
+ if (item.getPubDate() != null) {
+ xml.startTag(null, "pubDate");
+ xml.text(SyndDateUtils.formatRFC822Date(item.getPubDate()));
+ xml.endTag(null, "pubDate");
+ }
+ if ((flags & FEATURE_WRITE_GUID) != 0) {
+ xml.startTag(null, "guid");
+ xml.text(item.getItemIdentifier());
+ xml.endTag(null, "guid");
+ }
+ if (item.getMedia() != null) {
+ xml.startTag(null, "enclosure");
+ xml.attribute(null, "url", item.getMedia().getDownload_url());
+ xml.attribute(null, "length", String.valueOf(item.getMedia().getSize()));
+ xml.attribute(null, "type", item.getMedia().getMime_type());
+ xml.endTag(null, "enclosure");
+ }
+ if (item.getPaymentLink() != null) {
+ GeneratorUtil.addPaymentLink(xml, item.getPaymentLink(), true);
+ }
+
+ xml.endTag(null, "item");
+ }
+ }
+
+ xml.endTag(null, "channel");
+ xml.endTag(null, "rss");
+
+ xml.endDocument();
+ }
+}