Package de.nava.informa.impl.basic

Examples of de.nava.informa.impl.basic.Feed


           return new CmdResult(CmdResult.FAIL_CODE, null);
        }
        // we now have a collection of FeedIF objects;
        Iterator i = feedCollection.iterator();
        while (i.hasNext()) {
               Feed f = (Feed) i.next();
               // add this feed
               CmdResult addResult = addLinkCmd(Category, f.getLocation().toString());
               String resStr = "Feed "+f.getLocation().toString()+" import";
               if (addResult.getReturnCode() == CmdResult.SUCESS_CODE) {
                   System.out.println(resStr+" succeeded");
                   resStr += " succeeded\n";
               }
               else {
View Full Code Here


      ChannelIF channel = FeedParser.parse(new ChannelBuilder(), inpFile);

      //test RSS0.91 behavior
      assertEquals(2000, cs.getTtl(channel, -1L));

      String url = new Feed(channel).getLocation().toString();
      FM.addFeed(url);

      // test RSS0.91 behavior
      assertEquals(2000, cs.getTtl(FM.getFeed(url).getChannel(), -1L));
    } catch (Exception e) {
View Full Code Here

      //test RSS0.91 behavior
      assertEquals(2000L, cs.getTtl(channel, 10000L)); // ttl < MINIMAL_TTL
      assertEquals(360000L, cs.getTtl(channel, 360000L)); // ttl > MINIMAL_TTL

      String url = new Feed(channel).getLocation().toString();
      FM.addFeed(url);

      // test RSS0.91 behavior
      assertEquals(2000L, cs.getTtl(FM.getFeed(url).getChannel(), 10000L));
      assertEquals(360000L, cs.getTtl(FM.getFeed(url).getChannel(), 360000L)); // ttl > MINIMAL_TTL
View Full Code Here

      //test RSS1.00 behavior
      assertEquals(2000, cs.getTtl(channel, -1L));
      assertEquals(2000L, cs.getTtl(channel, 10000L)); // ttl < MINIMAL_TTL
      assertEquals(360000L, cs.getTtl(channel, 360000L)); // ttl > MINIMAL_TTL
     
      String url = new Feed(channel).getLocation().toString();
      FM.addFeed(url);

      // test RSS1.00 behavior with FM
      assertEquals(2000, cs.getTtl(FM.getFeed(url).getChannel(), -1L));
      assertEquals(2000L, cs.getTtl(FM.getFeed(url).getChannel(), 10000L));
View Full Code Here

      //UpdatePeriod/UpdateFrequency = hourly/1 in feed
      assertEquals(3600000, cs.getTtl(channel, -1L));
      assertEquals(3600000, cs.getTtl(channel, 10000L));
      assertEquals(3600005, cs.getTtl(channel, 3600005)); // > ttl of the feed
      // cache verification
      String url = new Feed(channel).getLocation().toString();
      FM.addFeed(url);
      assertEquals(3600000, cs.getTtl(FM.getFeed(url).getChannel(), -1L));
      assertEquals(3600000, cs.getTtl(FM.getFeed(url).getChannel(), 10000L));
    } catch (Exception e) {
      System.err.println("testRSS100SettingsUpdatePeriodInFeed error " + e);
View Full Code Here

      // < ttl of feed && > MINIMAL_TTL
      assertEquals((60*60*1000), cs.getTtl(channel, (30*60*1000))); // 30 mins
      // > ttl of the feed
      assertEquals((120*60*1000), cs.getTtl(channel, (120*60*1000))); // > feed ttd feed
     
      String url = new Feed(channel).getLocation().toString();
      FM.addFeed(url);

      assertEquals( (60*60*1000), cs.getTtl(FM.getFeed(url).getChannel(), -1L));
      assertEquals( (60*60*1000), cs.getTtl(FM.getFeed(url).getChannel(), 10000L));
    } catch (Exception e) {
View Full Code Here

      //test RSS0.91 behavior
      // default ttl used
      assertEquals(3000, cs.getTtl(channel, -1L));

      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);
View Full Code Here

    cs.setDefaultTtl(3000);

    try {
      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();
View Full Code Here

      //test RSS0.91 behavior
      // default ttl used
      assertEquals(60 * 60 * 1000, cs.getTtl(channel, -1L));

      String url = new Feed(channel).getLocation().toString();
      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) {
View Full Code Here

      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

TOP

Related Classes of de.nava.informa.impl.basic.Feed

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.