asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Till Westmann (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: [ING] Add RSS test using external test feed
Date Mon, 07 Aug 2017 15:19:53 GMT
Till Westmann has submitted this change and it was merged.

Change subject: [ING] Add RSS test using external test feed
......................................................................


[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 <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Xikui Wang <xkkwww@gmail.com>
---
M asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/input/record/reader/RSSRecordReaderTest.java
1 file changed, 23 insertions(+), 0 deletions(-)

Approvals:
  Xikui Wang: Looks good to me, approved
  Jenkins: Verified; No violations found; Verified



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 @@
         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);
+    }
 }

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1897
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia020052efbe0fe0de5f78017202f3f7d61b7bff3
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Till Westmann <tillw@apache.org>
Gerrit-Reviewer: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <tillw@apache.org>
Gerrit-Reviewer: Xikui Wang <xkkwww@gmail.com>

Mime
View raw message