Package com.sun.syndication.fetcher

Examples of com.sun.syndication.fetcher.FeedFetcher


   * Test events fired when there is a cache in use
   *
   */
  public void testFetchEventsWithCache() {
    FeedFetcherCache feedInfoCache = new HashMapFeedInfoCache();
    FeedFetcher feedFetcher = getFeedFetcher(feedInfoCache);
    FetcherEventListenerImpl listener = new FetcherEventListenerImpl();
    feedFetcher.addFetcherEventListener(listener);
    try {
      SyndFeed feed = feedFetcher.retrieveFeed(new URL("http://localhost:"+testPort+"/rome/FetcherTestServlet/"));
      assertNotNull(feed);
      assertTrue(listener.polled);
      assertTrue(listener.retrieved);
      assertFalse(listener.unchanged);
      listener.reset();
 
      // Since the feed is cached, the second request should not
      // actually retrieve the feed
      feed = feedFetcher.retrieveFeed(new URL("http://localhost:"+testPort+"/rome/FetcherTestServlet/"));
      assertNotNull(feed);
      assertTrue(listener.polled);
      assertFalse(listener.retrieved);
      assertTrue(listener.unchanged);
      listener.reset();
 
      // now simulate getting the feed after it has changed
      feed = feedFetcher.retrieveFeed(new URL("http://localhost:"+testPort+"/rome/FetcherTestServlet?refreshfeed=TRUE"));
      assertNotNull(feed);
      assertTrue(listener.polled);
      assertTrue(listener.retrieved);
      assertFalse(listener.unchanged);
      listener.reset();
View Full Code Here


  /**
   * Test handling of GZipped feed
   *
   */
  public void testGZippedFeed() {
      FeedFetcher feedFetcher = getFeedFetcher();
    try {
      SyndFeed feed = feedFetcher.retrieveFeed(new URL("http://localhost:"+testPort+"/rome/FetcherTestServlet?gzipfeed=TRUE"));
      assertNotNull(feed);
      assertEquals("atom_0.3.feed.title", feed.getTitle());
    } catch (Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
View Full Code Here

    }     
  }
 
  public void testDeltaEncoding() {
      FeedFetcherCache feedInfoCache = new HashMapFeedInfoCache();
    FeedFetcher feedFetcher = getFeedFetcher(feedInfoCache);         
    try {
        feedFetcher.setUsingDeltaEncoding(true);
       
        // first retrieval should just grab the default feed
      SyndFeed feed1 = feedFetcher.retrieveFeed(new URL("http://localhost:"+testPort+"/rome/FetcherTestServlet?deltaencode=TRUE&refreshfeed=TRUE"));
      assertNotNull(feed1);
      assertEquals("atom_0.3.feed.title", feed1.getTitle());
      assertEquals(2, feed1.getEntries().size());
      SyndEntry entry1 = (SyndEntry) feed1.getEntries().get(0);
      assertEquals("atom_0.3.feed.entry[0].title", entry1.getTitle());
     
      // second retrieval should get only the new item
      /*
       * This is breaking with Rome 0.5 ??
       */
      SyndFeed feed2 = feedFetcher.retrieveFeed(new URL("http://localhost:"+testPort+"/rome/FetcherTestServlet?deltaencode=TRUE&refreshfeed=TRUE"));         
      assertNotNull(feed2);
      assertEquals(FetcherTestServlet.DELTA_FEED_TITLE, feed2.getTitle());
      assertEquals(3, feed2.getEntries().size());
      entry1 = (SyndEntry) feed2.getEntries().get(0);
      assertEquals(FetcherTestServlet.DELTA_FEED_ENTRY_TITLE, entry1.getTitle());
View Full Code Here

     */
    public FeedFetcher getAuthenticatedFeedFetcher() {
        // setup the authenticator
        java.net.Authenticator.setDefault(new TestBasicAuthenticator());
       
        FeedFetcher feedFetcher = getFeedFetcher()
       
        return feedFetcher;
    }
View Full Code Here

TOP

Related Classes of com.sun.syndication.fetcher.FeedFetcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.