Search in sources :

Example 16 with SyndFeedImpl

use of com.rometools.rome.feed.synd.SyndFeedImpl in project coffeenet-frontpage-plugin-rss by coffeenet.

the class BlogParserTest method parseBlog.

@Test
public void parseBlog() throws FeedException, IOException {
    SyndContentImpl description = new SyndContentImpl();
    description.setValue("description");
    SyndEntryImpl syndEntry = new SyndEntryImpl();
    syndEntry.setDescription(description);
    syndEntry.setLink("link");
    syndEntry.setAuthor("author");
    syndEntry.setTitle("title");
    syndEntry.setPublishedDate(Date.from(Instant.parse("2014-12-03T10:15:30.00Z")));
    SyndFeed result = new SyndFeedImpl();
    result.setEntries(singletonList(syndEntry));
    when(feedFactory.build(any(URL.class))).thenReturn(result);
    List<BlogEntry> blogEntries = sut.parse("http://blog/feed/", 10, 150);
    assertThat(blogEntries, hasSize(1));
    assertThat(blogEntries.get(0).getDescription(), is("description"));
    assertThat(blogEntries.get(0).getLink(), is("link"));
    assertThat(blogEntries.get(0).getPublishDate(), is("3. December 2014"));
    assertThat(blogEntries.get(0).getAuthor(), is("author"));
    assertThat(blogEntries.get(0).getTitle(), is("title"));
}
Also used : SyndFeed(com.rometools.rome.feed.synd.SyndFeed) SyndContentImpl(com.rometools.rome.feed.synd.SyndContentImpl) SyndEntryImpl(com.rometools.rome.feed.synd.SyndEntryImpl) SyndFeedImpl(com.rometools.rome.feed.synd.SyndFeedImpl) URL(java.net.URL) Test(org.junit.Test)

Example 17 with SyndFeedImpl

use of com.rometools.rome.feed.synd.SyndFeedImpl in project onebusaway-application-modules by camsys.

the class AlertsAction method execute.

@Override
public String execute() {
    try {
        _feed = new SyndFeedImpl();
        List<ServiceAlertRssBean> beans = new ArrayList<>();
        String baseUrl = createBaseUrl(ServletActionContext.getRequest());
        setServiceAlerts(beans, baseUrl);
        for (Object objBean : beans) {
            ServiceAlertRssBean rssBean = (ServiceAlertRssBean) objBean;
            _feed.getModules().add(rssBean);
        }
        _feed.setTitle("OneBusAway Service Alerts");
        _feed.setLink("");
        _feed.setDescription("Service Information - Service Alerts");
        return SUCCESS;
    } catch (Throwable t) {
        _log.error("Exception in execute: ", t);
        return ERROR;
    }
}
Also used : ArrayList(java.util.ArrayList) SyndFeedImpl(com.rometools.rome.feed.synd.SyndFeedImpl) ServiceAlertRssBean(org.onebusaway.rss.model.ServiceAlertRssBean)

Aggregations

SyndFeedImpl (com.rometools.rome.feed.synd.SyndFeedImpl)17 ArrayList (java.util.ArrayList)15 SyndEntry (com.rometools.rome.feed.synd.SyndEntry)14 SyndEntryImpl (com.rometools.rome.feed.synd.SyndEntryImpl)13 SyndFeed (com.rometools.rome.feed.synd.SyndFeed)12 SyndContentImpl (com.rometools.rome.feed.synd.SyndContentImpl)10 SyndContent (com.rometools.rome.feed.synd.SyndContent)9 SyndFeedOutput (com.rometools.rome.io.SyndFeedOutput)4 SQLException (java.sql.SQLException)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)3 SProject (org.bimserver.interfaces.objects.SProject)3 StatusGroup (org.onebusaway.enterprise.webapp.actions.status.model.StatusGroup)3 StatusItem (org.onebusaway.enterprise.webapp.actions.status.model.StatusItem)3 Date (java.util.Date)2 SRevision (org.bimserver.interfaces.objects.SRevision)2 SUser (org.bimserver.interfaces.objects.SUser)2 ServiceException (org.bimserver.shared.exceptions.ServiceException)2 OnmsSeverity (org.opennms.netmgt.model.OnmsSeverity)2 Filter (org.opennms.web.filter.Filter)2 Pager (com.willshex.blogwt.shared.api.Pager)1