Java Code Examples for com.rometools.rome.feed.synd.SyndEntry#getWireEntry()

The following examples show how to use com.rometools.rome.feed.synd.SyndEntry#getWireEntry() . 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: TestSyndFeedRSS20.java    From rome with Apache License 2.0 5 votes vote down vote up
/**
 * Test we can get to RSS attributes which aren't exposed in the SyndEntry object
 *
 * @throws Exception
 */
public void testPreservedWireItems() throws Exception {
    final SyndEntry syndEntry1 = this.getCachedSyndFeed(true).getEntries().get(0);
    final Object o = syndEntry1.getWireEntry();
    assertNotNull(o);
    assertTrue(o instanceof Item);
    if (o instanceof Item) {
        final Item item = (Item) o;
        assertEquals("rss_2.0.channel.item[0].comments", item.getComments());
    }
}
 
Example 2
Source File: TestSyndFeedAtom10.java    From rome with Apache License 2.0 5 votes vote down vote up
public void testPreservedWireItems() throws Exception {
    final SyndEntry syndEntry1 = this.getCachedSyndFeed(true).getEntries().get(0);
    final Object o = syndEntry1.getWireEntry();
    assertNotNull(o);
    assertTrue(o instanceof Entry);
    if (o instanceof Entry) {
        final Entry entry = (Entry) o;
        assertEquals("atom_1.0.feed.entry[0].rights", entry.getRights());
    }
}
 
Example 3
Source File: AbstractJettyTest.java    From rome with Apache License 2.0 5 votes vote down vote up
public void testPreserveWireFeed() throws Exception {
    final FeedFetcher feedFetcher = getFeedFetcher();

    // first check we the WireFeed is not preserved by default
    SyndFeed feed = feedFetcher.retrieveFeed(new URL("http://localhost:" + testPort + "/rome/FetcherTestServlet/"));
    assertNotNull(feed);
    assertEquals("atom_1.0.feed.title", feed.getTitle());
    assertNull(feed.originalWireFeed());

    SyndEntry syndEntry = feed.getEntries().get(0);
    assertNotNull(syndEntry);
    assertNull(syndEntry.getWireEntry());

    // now turn on WireFeed preservation
    feedFetcher.setPreserveWireFeed(true);
    try {
        feed = feedFetcher.retrieveFeed(new URL("http://localhost:" + testPort + "/rome/FetcherTestServlet/"));
        assertNotNull(feed);
        assertEquals("atom_1.0.feed.title", feed.getTitle());
        assertNotNull(feed.originalWireFeed());

        syndEntry = feed.getEntries().get(0);
        assertNotNull(syndEntry);
        assertNotNull(syndEntry.getWireEntry());

        final Entry entry = (Entry) syndEntry.getWireEntry();
        assertEquals("atom_1.0.feed.entry[0].rights", entry.getRights());

    } finally {
        feedFetcher.setPreserveWireFeed(false); // reset
    }

}