Examples of FeedFetcher


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

Examples of com.sun.syndication.fetcher.FeedFetcher

  /**
   * 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

Examples of com.sun.syndication.fetcher.FeedFetcher

    }     
  }
 
  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

Examples of com.sun.syndication.fetcher.FeedFetcher

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

Examples of org.apache.roller.planet.business.fetcher.FeedFetcher

    }
   
   
    public void testFetchSubscription() throws Exception {
       
        FeedFetcher feedFetcher = PlanetFactory.getPlanet().getFeedFetcher();
       
        // first fetch non-conditionally so we know we should get a Sub
        Subscription sub = feedFetcher.fetchSubscription(feed_url);
        assertNotNull(sub);
        assertEquals(feed_url, sub.getFeedURL());
        assertNotNull(sub.getLastUpdated());
       
        // now do a conditional fetch and we should get back null
        Subscription updatedSub = feedFetcher.fetchSubscription(feed_url, sub.getLastUpdated());
        assertNull(updatedSub);
    }
View Full Code Here

Examples of org.apache.roller.planet.business.fetcher.FeedFetcher

    }
   
   
    public void testFetchFeed() throws Exception {
       
        FeedFetcher feedFetcher = PlanetFactory.getPlanet().getFeedFetcher();

        // fetch feed
        Subscription sub = feedFetcher.fetchSubscription(feed_url);
        assertNotNull(sub);
        assertEquals(feed_url, sub.getFeedURL());
        assertEquals("http://rollerweblogger.org/roller/", sub.getSiteURL());
        assertEquals("Blogging Roller", sub.getTitle());
        assertNotNull(sub.getLastUpdated());
View Full Code Here

Examples of org.apache.roller.planet.business.fetcher.FeedFetcher

    }
   
   
    public void testFetchFeedConditionally() throws Exception {
       
        FeedFetcher feedFetcher = PlanetFactory.getPlanet().getFeedFetcher();

        // fetch feed
        Subscription sub = feedFetcher.fetchSubscription(feed_url);
        assertNotNull(sub);
        assertEquals(feed_url, sub.getFeedURL());
        assertEquals("http://rollerweblogger.org/roller/", sub.getSiteURL());
        assertEquals("Blogging Roller", sub.getTitle());
        assertNotNull(sub.getLastUpdated());
        assertTrue(sub.getEntries().size() > 0);
       
        // now do a conditional fetch and we should get back null
        Subscription updatedSub = feedFetcher.fetchSubscription(feed_url, sub.getLastUpdated());
        assertNull(updatedSub);
    }
View Full Code Here

Examples of org.apache.roller.planet.business.fetcher.FeedFetcher

        long subStartTime = System.currentTimeMillis();
       
        Subscription updatedSub;
        try {
            // fetch the latest version of the subscription
            FeedFetcher fetcher = PlanetFactory.getPlanet().getFeedFetcher();
            updatedSub = fetcher.fetchSubscription(sub.getFeedURL(), sub.getLastUpdated());
        } catch (FetcherException ex) {
            throw new UpdaterException("Error fetching updated subscription", ex);
        }
       
        // if sub was unchanged then we are done
View Full Code Here

Examples of org.apache.roller.planet.business.fetcher.FeedFetcher

            Subscription sub = pmgr.getSubscription(getSubUrl());
            if(sub == null) {
                log.debug("Adding New Subscription - "+getSubUrl());
               
                // sub doesn't exist yet, so we need to fetch it
                FeedFetcher fetcher = PlanetFactory.getPlanet().getFeedFetcher();
                sub = fetcher.fetchSubscription(getSubUrl());
               
                // save new sub
                pmgr.saveSubscription(sub);
            } else {
                log.debug("Adding Existing Subscription - "+getSubUrl());
View Full Code Here

Examples of org.apache.roller.planet.business.fetcher.FeedFetcher

       
        Subscription updatedSub;
        try {
            // fetch the latest version of the subscription
            log.debug("Getting fetcher");
            FeedFetcher fetcher = PlanetFactory.getPlanet().getFeedFetcher();
            log.debug("Using fetcher class: " + fetcher.getClass().getName());
            updatedSub = fetcher.fetchSubscription(sub.getFeedURL(), sub.getLastUpdated());
           
        } catch (FetcherException ex) {
            throw new UpdaterException("Error fetching updated subscription", ex);
        }
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.