public ITunesChannelInfo getITunesInfo() { if (this.iTunesChannelInfo != null) { return this.iTunesChannelInfo; } return this.iTunesChannelInfo = new ITunesChannelInfo(this.channelElement); }
public ITunesItemInfo getITunesInfo() { if (this.iTunesItemInfo != null) { return this.iTunesItemInfo; } return this.iTunesItemInfo = new ITunesItemInfo(this.itemElement); }
public TextInputInfo getTextInput() { if (this.textInputInfo != null) return this.textInputInfo; Element textInputElement = this.channelElement.element("textInput"); if (textInputElement == null) { return null; } return this.textInputInfo = new TextInputInfo(textInputElement); }
@Test public void testEpisode() throws MalformedFeedException, MalformedURLException, DateFormatException { List<Episode> episodes = podcast.getEpisodes(); Episode episode = episodes.get(0); assertEquals("Episode 1: Are you not getting bored yet?", episode.getTitle()); assertEquals("Our hosts start getting bored of running a testing podcast feed. There's probably some moaning about Apple too. This is a technology podcast after all.", episode.getDescription()); assertEquals("https://podcast-feed-library.owl.im/episodes/1", episode.getLink().toString()); assertEquals("Icosillion", episode.getAuthor()); Set<String> categories = episode.getCategories(); assertTrue(categories.contains("Technology")); assertTrue(categories.contains("Testing")); assertEquals("https://podcast-feed-library.owl.im/episodes/1/comments", episode.getComments().toString()); assertEquals("https://podcast-feed-library.owl.im/episodes/1", episode.getGUID()); assertEquals(DateUtils.stringToDate("Mon, 28 Nov 2016 13:30:00 GMT"), episode.getPubDate()); assertEquals("Master Feed", episode.getSourceName()); assertEquals("http://podcast-feed-library.owl.im/feed.rss", episode.getSourceURL().toString()); assertEquals("Our hosts start getting bored of running a testing podcast feed. There's probably some moaning about Apple too. This is a technology podcast after all.\n" + " The show notes live in this section, but we have nothing else interesting to say.\n" + " ", episode.getContentEncoded()); Episode.Enclosure enclosure = episode.getEnclosure(); assertEquals("https://podcast-feed-library.owl.im/audio/episode-1.mp3", enclosure.getURL().toString()); assertEquals(1234000L, (long) enclosure.getLength()); assertEquals("audio/mp3", enclosure.getType()); ITunesItemInfo iTunesInfo = episode.getITunesInfo(); assertEquals("Icosillion", iTunesInfo.getAuthor()); assertEquals("Our hosts start getting bored of running a testing podcast feed. There's probably some moaning about Apple too. This is a technology podcast after all.", iTunesInfo.getSubtitle()); assertEquals("Our hosts start getting bored of running a testing podcast feed. There's probably some moaning about Apple too. This is a technology podcast after all.", iTunesInfo.getSummary());
@Test public void testITunesInfo() throws Exception { ITunesChannelInfo iTunesInfo = podcast.getITunesInfo(); assertEquals("Icosillion", iTunesInfo.getAuthor()); assertEquals("A dummy podcast feed for testing the Podcast Feed Library.", iTunesInfo.getSubtitle()); assertEquals("This podcast brings testing capabilities to the Podcast Feed Library", iTunesInfo.getSummary()); assertEquals(false, iTunesInfo.isBlocked()); assertEquals(ITunesInfo.ExplicitLevel.CLEAN, iTunesInfo.getExplicit()); assertEquals("https://podcast-feed-library.owl.im/images/artwork.png", iTunesInfo.getImage().toString()); assertEquals(ITunesChannelInfo.FeedType.SERIAL, iTunesInfo.getType()); }
@Test public void testCloudInfo() { CloudInfo cloudInfo = podcast.getCloud(); assertEquals("rpc.owl.im", cloudInfo.getDomain()); assertEquals(8080, (int) cloudInfo.getPort()); assertEquals("/rpc", cloudInfo.getPath()); assertEquals("owl.register", cloudInfo.getRegisterProcedure()); assertEquals("xml-rpc", cloudInfo.getProtocol()); } }
@Test public void testTextInput() throws MalformedURLException { TextInputInfo textInput = podcast.getTextInput(); assertEquals("Feedback", textInput.getTitle()); assertEquals("Feedback for the Testing Feed", textInput.getDescription()); assertEquals("feedback", textInput.getName()); assertEquals("https://podcast-feed-library.owl.im/feedback/submit", textInput.getLink().toString()); }
@Test public void testITunesOwnerInfo() { ITunesOwner iTunesOwner = podcast.getITunesInfo().getOwner(); assertEquals("Icosillion", iTunesOwner.getName()); assertEquals("hello@icosillion.com", iTunesOwner.getEmail()); }
public Date getLastBuildDate() throws DateFormatException { if (this.lastBuildDate != null) { return this.lastBuildDate; } String lastBuildDateString = getLastBuildDateString(); if (lastBuildDateString == null) { return null; } return this.lastBuildDate = DateUtils.stringToDate(lastBuildDateString); }
public Date getPubDate() throws DateFormatException { if (this.pubDate != null) { return this.pubDate; } String pubDateString = getPubDateString(); if (pubDateString == null) { return null; } return this.pubDate = DateUtils.stringToDate(pubDateString.trim()); }
@Before public void setup() throws IOException, InvalidFeedException, MalformedFeedException { String source = new String(Files.readAllBytes(Paths.get("feed.rss"))); podcast = new Podcast(source); }
public CloudInfo getCloud() { if (this.cloudInfo != null) { return this.cloudInfo; } Element cloudElement = this.channelElement.element("cloud"); if (cloudElement == null) { return null; } return this.cloudInfo = new CloudInfo(cloudElement); }
public Enclosure getEnclosure() { if (this.enclosure != null) { return this.enclosure; } Element enclosureElement = this.itemElement.element("enclosure"); if (enclosureElement == null) { return null; } return this.enclosure = new Enclosure(enclosureElement); }
public URL getImage() throws MalformedURLException { String imageString = this.getImageString(); if (imageString == null) { return null; } return this.image = new URL(imageString); }
public URL getDocs() throws MalformedURLException { if (this.docs != null) { return this.docs; } String docsString = this.getDocsString(); if (docsString == null) { return null; } return this.docs = new URL(docsString); }
public ITunesOwner getOwner() { if (this.owner != null) { return this.owner; } Element ownerElement = this.parent.element(QName.get("owner", this.iTunesNamespace)); if (ownerElement == null) { return null; } return this.owner = new ITunesOwner(ownerElement); }
public List<Episode> getEpisodes() { if (this.episodes != null) { return this.episodes; } List<Episode> episodes = new ArrayList<>(); for (Object itemObject : this.channelElement.elements("item")) { if (!(itemObject instanceof Element)) { continue; } episodes.add(new Episode((Element) itemObject)); } if (episodes.size() == 0) { return null; } return this.episodes = Collections.unmodifiableList(episodes); }
@Before public void setup() throws IOException, InvalidFeedException, MalformedFeedException { String source = new String(Files.readAllBytes(Paths.get("feed.rss"))); podcast = new Podcast(source); }