예제 #1
0
  public void testUpdateBookmark() throws Exception {
    Bookmark bm = bookmarkManager.getBookmark(301);
    bm.setTags("subscribe:this abc");
    bookmarkManager.updateBookmark(bm);
    bookmarkManager.shutdown();

    FeedSubscription feed =
        feedManager.getSubscription(new User(1), "http://rss.slashdot.org/Slashdot/slashdot");
    assertNotNull(feed);
  }
예제 #2
0
  public void testAddBookmark() throws Exception {
    Bookmark b = new Bookmark();
    b.setTitle("some feed");
    b.setLink(new Link("http://link.com/rss", MIMEType.APP_RSS_XML));
    b.setTags("123 subscribe:this foo bar");
    b.setUser(new User(1));

    int id = bookmarkManager.addBookmark(b);
    assertTrue((id > 0));
    bookmarkManager.shutdown();

    FeedSubscription sub = feedManager.getSubscription(new User(1), "http://link.com/rss");
    assertNotNull(sub);
  }
예제 #3
0
 public static SyndFeed create(
     List<Bookmark> bookmarks,
     String author,
     String title,
     String link,
     Date pubDate,
     String feedUri) {
   logger.debug("SyndFeedFactory create method called");
   logger.debug("bookmarks=" + bookmarks);
   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;
 }