Examples of SyndFeed


Examples of com.rometools.rome.feed.synd.SyndFeed

      URL feedUrl = new URL(url);
      URLConnection openConnection = feedUrl.openConnection();
          openConnection.addRequestProperty("User-Agent", "RSS River for Elasticsearch (https://github.com/dadoonet/rssriver)");
      SyndFeedInput input = new SyndFeedInput();
            input.setPreserveWireFeed(true);
      SyndFeed feed = input.build(new XmlReader(openConnection));
      return feed;
    } catch (MalformedURLException e) {
      logger.error("RSS Url is incorrect : [{}].", url);
    } catch (IllegalArgumentException e) {
      logger.error("Feed from [{}] is incorrect.", url);
View Full Code Here

Examples of com.sun.syndication.feed.synd.SyndFeed

            }

            for(String url : urls){
                URL feedSource = new URL(url);
                SyndFeedInput input = new SyndFeedInput();
                SyndFeed feed = input.build(new XmlReader(feedSource));
                feeds.add(feed);
            }

            manager.completeWorkItem(workItem.getId(), null);
        } catch (IOException ex) {
View Full Code Here

Examples of com.sun.syndication.feed.synd.SyndFeed

    }

    private void checkTestDocumentIsOnFeed(String author, String feedTitle, Feed feed, int existingEntries) {
        FeedServlet feedServlet = new FeedServlet();
        SyndFeed syndFeed =
                feedServlet.createSyndFeed(
                    "http://foo.bar/atom.seam",
                    FeedServlet.SyndFeedType.ATOM,
                    feed,
                    0
                );
        assert syndFeed.getTitle().equals("LaceWiki - " +feedTitle);
        assert syndFeed.getEntries().size() == existingEntries + 1;
        assert ((SyndEntry)syndFeed.getEntries().get(0)).getTitle().equals("Test Name");
        assert ((SyndEntry)syndFeed.getEntries().get(0)).getAuthor().equals(author);
        assert ((SyndEntry)syndFeed.getEntries().get(0)).getDescription().getValue().equals("<p class=\"wikiPara\">\nTest Content</p>\n");
    }
View Full Code Here

Examples of com.sun.syndication.feed.synd.SyndFeed

        assert ((SyndEntry)syndFeed.getEntries().get(0)).getDescription().getValue().equals("<p class=\"wikiPara\">\nTest Content</p>\n");
    }

    private void checkFeedHasEntries(Feed feed, int existingEntries) {
        FeedServlet feedServlet = new FeedServlet();
        SyndFeed syndFeed =
                feedServlet.createSyndFeed(
                    "http://foo.bar/atom.seam",
                    FeedServlet.SyndFeedType.ATOM,
                    feed,
                    0
                );
        assert syndFeed.getEntries().size() == existingEntries;
    }
View Full Code Here

Examples of com.sun.syndication.feed.synd.SyndFeed

    action.setQueryString("Category WordPress Group Wiki");
   
    String code = action.execute();
    assertEquals(ActionSupport.SUCCESS,code);
   
    SyndFeed syndFeed = action.getOpenSearchResult();
    assertNotNull(syndFeed);
   
    assertEquals("gnizr",syndFeed.getAuthor());
    assertNotNull(syndFeed.getTitle());
    assertNotNull(syndFeed.getUri());
    assertNotNull(syndFeed.getPublishedDate());
    assertNotNull(syndFeed.getEntries());
    assertNotNull(syndFeed.getLink());
   
    @SuppressWarnings("unchecked")
    List<SyndEntry> entries = syndFeed.getEntries();
    assertEquals(1,entries.size());
   
    OpenSearchModule mod = (OpenSearchModule)syndFeed.getModule(OpenSearchModule.URI);
    assertNotNull(mod);
    assertEquals(10,mod.getItemsPerPage());
    assertEquals(0,mod.getStartIndex());
    assertEquals(1,mod.getTotalResults());
  }
View Full Code Here

Examples of com.sun.syndication.feed.synd.SyndFeed

    return new FlatXmlDataSet(TestSyndFeedFactory.class.getResourceAsStream("/TestSyndFeedFactory-input.xml"));
  }

  @SuppressWarnings("unchecked")
  public void testGetFeed() throws Exception{       
    SyndFeed syndFeed = SyndFeedFactory.create(bmarks,author,title,link,pubDate,feedUri);
   
    assertEquals(author,syndFeed.getAuthor());
    assertEquals(title,syndFeed.getTitle());
    assertEquals(pubDate,syndFeed.getPublishedDate());
    assertEquals(feedUri,syndFeed.getUri());
    assertEquals(link,syndFeed.getLink());
   
    List<SyndEntry> entries = syndFeed.getEntries();
    assertEquals(1,entries.size());
   
    SyndEntry entry = entries.get(0);
    assertEquals("http://zirr.us/",entry.getLink());
    assertEquals("zirrus",entry.getTitle());
View Full Code Here

Examples of com.sun.syndication.feed.synd.SyndFeed

    assertEquals("cnn",cat.getName());
  }
 
  @SuppressWarnings("unchecked")
  public void testAddOpenSearchModule() throws Exception{
    SyndFeed syndFeed = SyndFeedFactory.create(bmarks,author,title,link,pubDate,feedUri);
    assertNotNull(syndFeed);
   
    syndFeed = SyndFeedFactory.addOpenSearchModule(syndFeed, itemsPerPage,
        startIndex, totalResult, searchDescriptionUrl);
 
    OpenSearchModule osm = (OpenSearchModule) syndFeed.getModule(OpenSearchModule.URI);
    assertEquals(itemsPerPage,osm.getItemsPerPage());
    assertEquals(totalResult,osm.getTotalResults());
    assertEquals(startIndex,osm.getStartIndex());
    assertEquals(searchDescriptionUrl,osm.getLink().getHref());
  }
View Full Code Here

Examples of com.sun.syndication.feed.synd.SyndFeed

    String feedUrl = "http://foo.com/feed?id=1&p=3";
    Date pubDate = GregorianCalendar.getInstance().getTime();
    String title = "a feed of bookmark docs";
    String feedAuthor = "john s";
   
    SyndFeed syndFeed = SyndFeedFactory.createFromBookmarkDoc(docs,feedAuthor, title, feedUrl, pubDate, null);
    assertNotNull(syndFeed);
    assertEquals(1,syndFeed.getEntries().size());
 
    syndFeed.setFeedType("atom_1.0");
   
    SyndFeedOutput output = new SyndFeedOutput();
    String feedData = output.outputString(syndFeed);   
   
    StringReader sreader = new StringReader(feedData);
    SyndFeedInput input = new SyndFeedInput(true);
    SyndFeed copyFeed = input.build(sreader);
    assertNotNull(copyFeed);
  }
View Full Code Here

Examples of com.sun.syndication.feed.synd.SyndFeed

    logger.debug("author="+author);
    logger.debug("title="+title);
    logger.debug("link="+link);
    logger.debug("pubDate="+pubDate);
    logger.debug("feedUri="+feedUri);
    SyndFeed syndFeed = new SyndFeedImpl();
    syndFeed.setAuthor(author);
    syndFeed.setTitle(title);
    syndFeed.setUri(feedUri);
    syndFeed.setLink(link);
    syndFeed.setPublishedDate(pubDate);
    List<SyndEntry> entries = new ArrayList<SyndEntry>();
    for(BookmarkDoc bmark : bookmarks){
      SyndEntry entry = new SyndEntryImpl();
      entry.setTitle(bmark.getTitle());
      entry.setAuthor(bmark.getUsername());
      entry.setLink(bmark.getUrl());
      entry.setUri("urn-x:gnizr:bookmark:"+bmark.getBookmarkId());   
      SyndContent cnt = new SyndContentImpl();
      cnt.setType("text/html");
      if(bmark.getNotes() != null){
        cnt.setValue(bmark.getNotes());
        entry.setDescription(cnt);
      }   
      entries.add(entry);     
    }
    syndFeed.setEntries(entries);
    syndFeed.setEncoding("UTF-8");
    logger.debug("done initializing syndFeed object");
    return syndFeed;
  }
View Full Code Here

Examples of com.sun.syndication.feed.synd.SyndFeed

    logger.debug("author="+author);
    logger.debug("title="+title);
    logger.debug("link="+link);
    logger.debug("pubDate="+pubDate);
    logger.debug("feedUri="+feedUri);
    SyndFeed syndFeed = new SyndFeedImpl();
    syndFeed.setAuthor(author);
    syndFeed.setTitle(title);
    syndFeed.setUri(feedUri);
    syndFeed.setLink(link);
    syndFeed.setPublishedDate(pubDate);
    List<SyndEntry> entries = new ArrayList<SyndEntry>();
    for(Bookmark bmark : bookmarks){
      SyndEntry entry = new SyndEntryImpl();
      entry.setTitle(bmark.getTitle());
      entry.setAuthor(bmark.getUser().getUsername());
      entry.setLink(bmark.getLink().getUrl());
      entry.setUri("urn:bookmark:"+bmark.getId());
      entry.setUpdatedDate(bmark.getLastUpdated());
      List<String> tags = bmark.getTagList();
      List<SyndCategory> cats = new ArrayList<SyndCategory>();
      for(String aTag : tags){
        SyndCategory aCat = new SyndCategoryImpl();
        aCat.setName(aTag);
        cats.add(aCat);
      }
      if(cats.isEmpty() == false){
        entry.setCategories(cats);
      }
      SyndContent cnt = new SyndContentImpl();
      cnt.setType("text/html");
      cnt.setValue(bmark.getNotes());
      entry.setDescription(cnt);
      entries.add(entry);     
    }
    syndFeed.setEntries(entries);
    syndFeed.setEncoding("UTF-8");
    logger.debug("done initializing syndFeed object");
    return syndFeed;
  }
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.