Java Code Examples for com.rometools.opml.feed.opml.Opml#getOutlines()
The following examples show how to use
com.rometools.opml.feed.opml.Opml#getOutlines() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OPMLExporterTest.java From commafeed with Apache License 2.0 | 6 votes |
@Test public void generates_OPML_correctly() { when(feedCategoryDAO.findAll(user)).thenReturn(categories); when(feedSubscriptionDAO.findAll(user)).thenReturn(subscriptions); Opml opml = new OPMLExporter(feedCategoryDAO, feedSubscriptionDAO).export(user); List<Outline> rootOutlines = opml.getOutlines(); assertEquals(2, rootOutlines.size()); assertTrue(containsCategory(rootOutlines, "cat1")); assertTrue(containsFeed(rootOutlines, "rootFeed", "rootFeed.com")); Outline cat1Outline = getCategoryOutline(rootOutlines, "cat1"); List<Outline> cat1Children = cat1Outline.getChildren(); assertEquals(2, cat1Children.size()); assertTrue(containsCategory(cat1Children, "cat2")); assertTrue(containsFeed(cat1Children, "cat1Feed", "cat1Feed.com")); Outline cat2Outline = getCategoryOutline(cat1Children, "cat2"); List<Outline> cat2Children = cat2Outline.getChildren(); assertEquals(1, cat2Children.size()); assertTrue(containsFeed(cat2Children, "cat2Feed", "cat2Feed.com")); }
Example 2
Source File: OpmlReader.java From reactor-workshop with GNU General Public License v3.0 | 5 votes |
/** * TODO Return {@link reactor.core.publisher.Flux} */ public List<Outline> allFeeds() throws FeedException, IOException { WireFeedInput input = new WireFeedInput(); try(final InputStream inputStream = OpmlReader.class.getResourceAsStream("/feed-jvm-bloggers.xml")) { final InputStreamReader streamReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8); final Reader reader = new BufferedReader(streamReader); Opml feed = (Opml) input.build(reader); return feed.getOutlines(); } }
Example 3
Source File: OpmlConverter.java From SimpleNews with Apache License 2.0 | 5 votes |
public static List<Feed> convertOpmlListToFeedList(Opml opml) { List<Feed> feeds = new ArrayList<>(); for (Outline element : opml.getOutlines()) { feeds.addAll(convertOutlineToFeedList(element)); } return feeds; }
Example 4
Source File: OPMLImporter.java From commafeed with Apache License 2.0 | 5 votes |
public void importOpml(User user, String xml) { xml = xml.substring(xml.indexOf('<')); WireFeedInput input = new WireFeedInput(); try { Opml feed = (Opml) input.build(new StringReader(xml)); List<Outline> outlines = feed.getOutlines(); for (int i = 0; i < outlines.size(); i++) { handleOutline(user, outlines.get(i), null, i); } } catch (Exception e) { log.error(e.getMessage(), e); } }