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);
  }
  public void testDeleteBookmark() throws Exception {
    FeedSubscription sub = feedManager.getSubscription(400);
    assertNotNull(sub);

    boolean deleted = bookmarkManager.deleteBookmark(new Bookmark(300));
    assertTrue(deleted);

    bookmarkManager.shutdown();

    sub = feedManager.getSubscription(400);
    assertNull(sub);
  }
  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);
  }
  protected void setUp() throws Exception {
    super.setUp();
    bookmarkManager = new BookmarkManager(getGnizrDao());
    feedManager = new FeedSubscriptionManager(getGnizrDao());

    listener = new FeedSubscribeListener(feedManager);
    bookmarkManager.addBookmarkListener(listener);
  }
 /**
  * Adds all server defined bookmarks to the users requested bookmarks.
  *
  * @param jid the jid of the user requesting the bookmark(s)
  * @param storageElement the JEP-0048 compliant storage element.
  */
 private void addBookmarks(JID jid, Element storageElement) {
   final Collection<Bookmark> bookmarks = BookmarkManager.getBookmarks();
   for (Bookmark bookmark : bookmarks) {
     // Check to see if the bookmark should be appended for this
     // particular user.
     boolean addBookmarkForUser = bookmark.isGlobalBookmark() || isBookmarkForJID(jid, bookmark);
     if (addBookmarkForUser) {
       // Add bookmark element.
       addBookmarkElement(jid, bookmark, storageElement);
     }
   }
 }
 protected void tearDown() throws Exception {
   super.tearDown();
   bookmarkManager.shutdown();
 }