Repository: asterixdb Updated Branches: refs/heads/master 68f7e43d8 -> c1fbf0b48
[ING] Add RSS test using external test feed - user model changes: no - storage format changes: no - interface changes: no details: - use a simple feed from http://lorem-rss.herokuapp.com/ Change-Id: Ia020052efbe0fe0de5f78017202f3f7d61b7bff3 Reviewed-on: https://asterix-gerrit.ics.uci.edu/1897 Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Reviewed-by: Xikui Wang <xkk...@gmail.com> Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/c1fbf0b4 Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/c1fbf0b4 Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/c1fbf0b4 Branch: refs/heads/master Commit: c1fbf0b4855248c831e0140cebe9357cd8d1a1fa Parents: 68f7e43 Author: Till Westmann <ti...@apache.org> Authored: Mon Jul 24 11:21:19 2017 -0700 Committer: Till Westmann <ti...@apache.org> Committed: Mon Aug 7 08:19:53 2017 -0700 ---------------------------------------------------------------------- .../record/reader/RSSRecordReaderTest.java | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c1fbf0b4/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/input/record/reader/RSSRecordReaderTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/input/record/reader/RSSRecordReaderTest.java b/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/input/record/reader/RSSRecordReaderTest.java index ca94a3f..5033b55 100644 --- a/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/input/record/reader/RSSRecordReaderTest.java +++ b/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/input/record/reader/RSSRecordReaderTest.java @@ -18,6 +18,8 @@ */ package org.apache.asterix.external.input.record.reader; +import com.rometools.rome.feed.synd.SyndEntry; +import org.apache.asterix.external.api.IRawRecord; import org.apache.asterix.external.input.record.reader.rss.RSSRecordReader; import org.junit.Assert; import org.junit.Test; @@ -39,4 +41,25 @@ public class RSSRecordReaderTest { Assert.assertNotNull(expectedException); Assert.assertTrue(expectedException.getMessage().contains("UnknownHostException")); } + + private static final int NO_RECORDS = 10; + + @Test + public void fetchFromLoremWebsite() throws MalformedURLException { + String dummyRssFeedURL = "http://lorem-rss.herokuapp.com/feed"; + RSSRecordReader rssRecordReader = new RSSRecordReader(dummyRssFeedURL); + Exception expectedException = null; + int cnt = 0; + try { + while (rssRecordReader.hasNext() && cnt < NO_RECORDS) { + IRawRecord<SyndEntry> rec = rssRecordReader.next(); + ++cnt; + Assert.assertTrue(rec.get().getTitle().startsWith("Lorem ipsum")); + } + } catch (Exception e) { + expectedException = e; + } + Assert.assertEquals(cnt, NO_RECORDS); + Assert.assertNull(expectedException); + } }