use of de.danoeh.antennapod.model.feed.FeedItem in project AntennaPod by AntennaPod.
the class DbReaderTest method testGetQueueIdList.
@Test
public void testGetQueueIdList() {
final int numItems = 10;
List<FeedItem> queue = saveQueue(numItems);
LongList ids = DBReader.getQueueIDList();
assertNotNull(ids);
assertEquals(ids.size(), queue.size());
for (int i = 0; i < queue.size(); i++) {
assertTrue(ids.get(i) != 0);
assertEquals(ids.get(i), queue.get(i).getId());
}
}
use of de.danoeh.antennapod.model.feed.FeedItem in project AntennaPod by AntennaPod.
the class DbReaderTest method testGetItemByGuid.
@Test
public void testGetItemByGuid() {
List<Feed> feeds = saveFeedlist(1, 1, true);
FeedItem item1 = feeds.get(0).getItems().get(0);
FeedItem feedItemByGuid = DBReader.getFeedItemByGuidOrEpisodeUrl(item1.getItemIdentifier(), item1.getMedia().getDownload_url());
assertEquals(item1.getItemIdentifier(), feedItemByGuid.getItemIdentifier());
}
use of de.danoeh.antennapod.model.feed.FeedItem in project AntennaPod by AntennaPod.
the class ExceptFavoriteCleanupAlgorithmTest method testPerformAutoCleanupSavesFavorited.
@Test
public void testPerformAutoCleanupSavesFavorited() throws IOException {
Feed feed = new Feed("url", null, "title");
List<FeedItem> items = new ArrayList<>();
feed.setItems(items);
List<File> files = new ArrayList<>();
populateItems(numberOfItems, feed, items, files, FeedItem.UNPLAYED, false, true);
DBTasks.performAutoCleanup(context);
for (int i = 0; i < files.size(); i++) {
assertTrue("Favorite episodes should should not be deleted", files.get(i).exists());
}
}
use of de.danoeh.antennapod.model.feed.FeedItem in project AntennaPod by AntennaPod.
the class ExceptFavoriteCleanupAlgorithmTest method testPerformAutoCleanupHandleUnplayed.
@Test
public void testPerformAutoCleanupHandleUnplayed() throws IOException {
Feed feed = new Feed("url", null, "title");
List<FeedItem> items = new ArrayList<>();
feed.setItems(items);
List<File> files = new ArrayList<>();
populateItems(numberOfItems, feed, items, files, FeedItem.UNPLAYED, false, false);
DBTasks.performAutoCleanup(context);
for (int i = 0; i < files.size(); i++) {
if (i < EPISODE_CACHE_SIZE) {
assertTrue("Only enough items should be deleted", files.get(i).exists());
} else {
assertFalse("Expected episode to be deleted", files.get(i).exists());
}
}
}
use of de.danoeh.antennapod.model.feed.FeedItem in project AntennaPod by AntennaPod.
the class ItemEnqueuePositionCalculatorTest method createFeedItem.
static FeedItem createFeedItem(long id) {
FeedItem item = new FeedItem(id, "Item" + id, "ItemId" + id, "url", new Date(), FeedItem.PLAYED, FeedMother.anyFeed());
FeedMedia media = new FeedMedia(item, "http://download.url.net/" + id, 1234567, "audio/mpeg");
media.setId(item.getId());
item.setMedia(media);
return item;
}
Aggregations