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"));
}
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;
}
}
Aggregations