Examples of FeedIF


Examples of de.nava.informa.core.FeedIF

      String url = new Feed(channel).getLocation().toString();
      FM.removeFeed(url);
      FM.addFeed(url);
      assertTrue("feed not in cache !!", FM.hasFeed(url));
      FeedIF feedRef1 = FM.getFeed(url);

      assertNotNull("feed read null", feedRef1);

      t1 = feedRef1.getLastUpdated().getTime();
      t2 = FM.getFeed(url).getLastUpdated().getTime();
      assertTrue("same  date for feeds read in cache " + t1, t1 == t2);

      try {
        Thread.sleep(4000);
View Full Code Here

Examples of de.nava.informa.core.FeedIF

      ChannelIF channel = FeedParser.parse(new ChannelBuilder(), "http://www.intertwingly.net/blog/index.rss");//inpFile);

      String url = new Feed(channel).getLocation().toString();
      FM.removeFeed(url);
      FM.addFeed(url);
      FeedIF feedRef1 = FM.getFeed(url);

      t1 = feedRef1.getLastUpdated().getTime();
      t2 = FM.getFeed(url).getLastUpdated().getTime();
      assertTrue("same  date for feeds read in cache " + t1, t1 == t2);

      try {
        Thread.sleep(4000);
View Full Code Here

Examples of de.nava.informa.core.FeedIF

      FM.removeFeed(url);

      channel = FeedParser.parse(new ChannelBuilder(), inpFile);
      //System.err.println("channel:"+channel);
      url = new Feed(channel).getLocation().toString();
      FeedIF feedRef1 = FM.addFeed(url);
      t1 = feedRef1.getLastUpdated().getTime();
      try {
        Thread.sleep(4000);
      } catch (Exception e) {
        System.err.println("Error in Wait..." + e);
      }
View Full Code Here

Examples of de.nava.informa.core.FeedIF

 
  public void testReadInFeeds() {
    Iterator<FeedIF> it = feeds.iterator();
    boolean found = false;
    while (it.hasNext()) {
      FeedIF feed = it.next();
      if (feed.getTitle().startsWith("Google Weblog")) {
        assertEquals("Google Weblog", feed.getTitle());
        assertEquals("rss", feed.getContentType());
        assertEquals("http://google.blogspace.com/index.xml",
                     feed.getLocation().toString());
        assertEquals("http://google.blogspace.com/",
                     feed.getSite().toString());
        found = true;
        break;
      }
    }
    assertTrue("Couldn't find item looked for.", found);
View Full Code Here

Examples of de.nava.informa.core.FeedIF

      Attribute attrTitle = feedElem.getAttribute("title");
      String strTitle = "[No Title]";
      if (attrTitle != null) {
        strTitle = attrTitle.getValue();
      }
      FeedIF feed = new Feed(strTitle);
      if (logger.isDebugEnabled()) {
        logger.debug("Feed element found (" + strTitle + ").");
      }
      // get text attribute
      Attribute attrText = feedElem.getAttribute("text");
      String strText = "[No Text]";
      if (attrText != null) {
        strText = attrText.getValue();
      }
      feed.setText(strText);
      // get attribute type (for example: 'rss')
      Attribute attrType = feedElem.getAttribute("type");
      String strType = "text/xml";
      if (attrType != null) {
        strType = attrType.getValue();
      }
      feed.setContentType(strType);
     
      // TODO: handle attribute version (for example: 'RSS')
     
      // get attribute xmlUrl
      Attribute attrXmlUrl = feedElem.getAttribute("xmlUrl");
      if (attrXmlUrl != null && attrXmlUrl.getValue() != null) {
        feed.setLocation(ParserUtils.getURL(attrXmlUrl.getValue()));
      }     
      // get attribute htmllUrl
      Attribute attrHtmlUrl = feedElem.getAttribute("htmlUrl");
      if (attrHtmlUrl != null && attrHtmlUrl.getValue() != null) {
        feed.setSite(ParserUtils.getURL(attrHtmlUrl.getValue()));
      }
      // set current date
      feed.setDateFound(dateParsed);
      // add feed to collection
      feedColl.add(feed);
    }

    return feedColl;
View Full Code Here

Examples of de.nava.informa.core.FeedIF

    try {
      Collection feedsColl = OPMLParser.parse(opmlFeedUri);
      retFeeds = new ArrayList<FeedIF>();

      for (Iterator iter = feedsColl.iterator(); iter.hasNext();) {
        FeedIF element = (FeedIF) iter.next();
        retFeeds.add(addFeed(element));
      }
    } catch (IOException e) {
      throw new FeedManagerException(e);
    } catch (ParseException e) {
View Full Code Here

Examples of de.nava.informa.core.FeedIF

    try {
      Collection feedsColl = OPMLParser.parse(opmlFeedUri);
      retFeeds = new ArrayList<FeedIF>();

      for (Iterator iter = feedsColl.iterator(); iter.hasNext();) {
        FeedIF element = (FeedIF) iter.next();
        retFeeds.add(addFeed(element, ttl));
      }
    } catch (IOException e) {
      throw new FeedManagerException(e);
    } catch (ParseException e) {
View Full Code Here

Examples of de.nava.informa.core.FeedIF

   * @return The feed being managed, or null if the feed is not present
   * @throws FeedManagerException
   *           If the feed specified is invalid
   */
  public FeedIF getFeed(String feedUri) throws FeedManagerException {
    FeedIF feed = null;

    if (hasFeed(feedUri)) {
      FeedManagerEntry entry = feeds.get(feedUri);
      feed = entry.getFeed();
    }
View Full Code Here

Examples of de.nava.informa.core.FeedIF

    FeedManager FM = new FeedManager();

    File inpFile = new File(getDataDir(), "xmlhack-0.91.xml");
    ChannelIF channel = FeedParser.parse(new ChannelBuilder(), inpFile);
    String url = new Feed(channel).getLocation().toString();
    FeedIF feed = FM.addFeed(url);
    assertEquals(feed, FM.addFeed(url)); // same reference
  }
View Full Code Here

Examples of de.nava.informa.core.FeedIF

    Iterator it = feeds.iterator();

    // no feed present in FM
    while (it.hasNext()) {
      FeedIF opmlFeed = (FeedIF) it.next();
      assertFalse(FM.hasFeed(opmlFeed.getLocation().toString()));
    }

    Collection feeds2 = FM.addFeeds(opmlUri);
    assertEquals(19, feeds2.size());

    it = feeds2.iterator();

    while (it.hasNext()) {
      FeedIF opmlFeed = (FeedIF) it.next();
      assertTrue(FM.hasFeed(opmlFeed.getLocation().toString()));
    }

    // compare with collection returned by opml parser
    it = feeds.iterator();
    while (it.hasNext()) {
      FeedIF opmlFeed = (FeedIF) it.next();
      assertTrue(FM.hasFeed(opmlFeed.getLocation().toString()));
    }

    // / just one more test ...
    assertTrue(FM
        .hasFeed("http://www.bbc.co.uk/syndication/feeds/news/ukfs_news/world/rss091.xml"));
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.