Search in sources :

Example 6 with SyndEntryImpl

use of com.rometools.rome.feed.synd.SyndEntryImpl in project rssriver by dadoonet.

the class RssToJsonTest method shouldHaveRawContent.

@Test
public void shouldHaveRawContent() throws Exception {
    SyndFeedInput input = new SyndFeedInput();
    SyndFeed feed = input.build(new XmlReader(getClass().getResource("/dcrainmaker/rss.xml")));
    assertThat(feed.getEntries().size(), greaterThan(0));
    for (Object o : feed.getEntries()) {
        SyndEntryImpl message = (SyndEntryImpl) o;
        XContentBuilder xcb = toJson(message, null, null, true);
        assertThat(xcb, notNullValue());
        assertThat(xcb.string(), containsString("<p>"));
        logger.info(xcb.string());
    }
}
Also used : SyndFeed(com.rometools.rome.feed.synd.SyndFeed) SyndFeedInput(com.rometools.rome.io.SyndFeedInput) SyndEntryImpl(com.rometools.rome.feed.synd.SyndEntryImpl) XmlReader(com.rometools.rome.io.XmlReader) XContentBuilder(org.elasticsearch.common.xcontent.XContentBuilder) Test(org.junit.Test)

Example 7 with SyndEntryImpl

use of com.rometools.rome.feed.synd.SyndEntryImpl in project asterixdb by apache.

the class RSSFeedServlet method getFeed.

protected SyndFeed getFeed(IServletRequest req) throws IOException, FeedException, ParseException {
    SyndFeed feed = new SyndFeedImpl();
    feed.setTitle("Sample Feed (created with ROME)");
    feed.setLink("http://rome.dev.java.net");
    feed.setDescription("This feed has been created using ROME (Java syndication utilities");
    List<SyndEntry> entries = new ArrayList<>();
    SyndEntry entry;
    SyndContent description;
    entry = new SyndEntryImpl();
    entry.setTitle("AsterixDB 0.8.7");
    entry.setLink("http://http://asterixdb.apache.org/docs/0.8.7-incubating/index.html");
    entry.setPublishedDate(DATE_PARSER.parse("2012-06-08"));
    description = new SyndContentImpl();
    description.setType("text/plain");
    description.setValue("AsterixDB 0.8.7 Release");
    entry.setDescription(description);
    entries.add(entry);
    entry = new SyndEntryImpl();
    entry.setTitle("Couchbase 4.1");
    entry.setLink("http://blog.couchbase.com/2015/december/introducing-couchbase-server-4.1");
    entry.setPublishedDate(DATE_PARSER.parse("2015-12-09"));
    description = new SyndContentImpl();
    description.setType("text/plain");
    description.setValue("Couchbase Server 4.1 Release. Bug fixes, minor API changes and some new features");
    entry.setDescription(description);
    entries.add(entry);
    entry = new SyndEntryImpl();
    entry.setTitle("ROME v0.3");
    entry.setLink("http://wiki.java.net/bin/view/Javawsxml/rome03");
    entry.setPublishedDate(DATE_PARSER.parse("2004-07-27"));
    description = new SyndContentImpl();
    description.setType("text/html");
    description.setValue("<p>Bug fixes, API changes, some new features and some Unit testing</p>" + "<p>For details check the <a href=\"https://rometools.jira.com/wiki/display/ROME/Change+Log#" + "ChangeLog-Changesmadefromv0.3tov0.4\">Changes Log for 0.3</a></p>");
    entry.setDescription(description);
    entries.add(entry);
    entry = new SyndEntryImpl();
    entry.setTitle("ROME v0.4");
    entry.setLink("http://wiki.java.net/bin/view/Javawsxml/rome04");
    entry.setPublishedDate(DATE_PARSER.parse("2004-09-24"));
    description = new SyndContentImpl();
    description.setType("text/html");
    description.setValue("<p>Bug fixes, API changes, some new features, Unit testing completed</p>" + "<p>For details check the <a href=\"https://rometools.jira.com/wiki/display/ROME/Change+Log#" + "ChangeLog-Changesmadefromv0.4tov0.5\">Changes Log for 0.4</a></p>");
    entry.setDescription(description);
    entries.add(entry);
    feed.setEntries(entries);
    return feed;
}
Also used : SyndFeed(com.rometools.rome.feed.synd.SyndFeed) SyndContent(com.rometools.rome.feed.synd.SyndContent) SyndEntry(com.rometools.rome.feed.synd.SyndEntry) SyndContentImpl(com.rometools.rome.feed.synd.SyndContentImpl) SyndEntryImpl(com.rometools.rome.feed.synd.SyndEntryImpl) ArrayList(java.util.ArrayList) SyndFeedImpl(com.rometools.rome.feed.synd.SyndFeedImpl)

Aggregations

SyndEntryImpl (com.rometools.rome.feed.synd.SyndEntryImpl)7 SyndFeed (com.rometools.rome.feed.synd.SyndFeed)6 SyndFeedInput (com.rometools.rome.io.SyndFeedInput)5 XmlReader (com.rometools.rome.io.XmlReader)5 Test (org.junit.Test)5 XContentBuilder (org.elasticsearch.common.xcontent.XContentBuilder)4 GeoRSSModule (com.rometools.modules.georss.GeoRSSModule)1 Position (com.rometools.modules.georss.geometries.Position)1 SyndContent (com.rometools.rome.feed.synd.SyndContent)1 SyndContentImpl (com.rometools.rome.feed.synd.SyndContentImpl)1 SyndEntry (com.rometools.rome.feed.synd.SyndEntry)1 SyndFeedImpl (com.rometools.rome.feed.synd.SyndFeedImpl)1 ArrayList (java.util.ArrayList)1 SubstringMatcher (org.hamcrest.core.SubstringMatcher)1