Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.Bookmark


    assertEquals(0,ut.getCount());
  }
 

  public void testGetBookmark() throws Exception{
    Bookmark bm = manager.getBookmark(300);
    assertNotNull(bm.getTitle());
    assertNotNull(bm.getUser().getUsername());
    assertNotNull(bm.getLink().getUrl());
    assertEquals("gnizr", bm.getUser().getFullname());
  }
View Full Code Here


    id = manager.getBookmarkId(new User(1), url);
    assertEquals(300,id);
  }
 
  public void testUpdateBookmark3() throws Exception{
    Bookmark bm1 = new Bookmark(new User(2),new Link(204));
    bm1.setTitle("bookmark_1_title");
    bm1.setTags("tag1 tag2");
   
    Bookmark bm2 = new Bookmark(new User(3),new Link(204));
    bm2.setTitle("bookmark_2_title");
    bm2.setTags("tag1");
   
    int id1 = manager.addBookmark(bm1);
    int id2 = manager.addBookmark(bm2);
    assertTrue((id1 > 0));
    assertTrue((id2 > 0));
   
    bm1 = manager.getBookmark(id1);
    bm2 = manager.getBookmark(id2);
   
    bm1.setTags("tag1");
    assertTrue(manager.updateBookmark(bm1));
     
    Tag tag1 = tagDao.findTag("tag1").get(0);
    assertEquals(2,tag1.getCount());
   
    UserTag user1tag1 = tagDao.findUserTag(new User(2), tag1).get(0);
    assertEquals(1,user1tag1.getCount());
 
    bm2.setTags("");;
    assertTrue(manager.updateBookmark(bm2));
    Tag tag2 = tagDao.findTag("tag2").get(0);
    assertEquals(0,tag2.getCount());
  }
View Full Code Here

    Tag tag2 = tagDao.findTag("tag2").get(0);
    assertEquals(0,tag2.getCount());
  }
 
  public void testUpdateBookmark4() throws Exception{
    Bookmark bm1 = new Bookmark(new User(2),new Link(204));
    bm1.setTitle("bookmark_1_title");
    bm1.setTags("loc:columbia,md locality:baltimore,maryland");
   
    Bookmark bm2 = new Bookmark(new User(3),new Link(204));
    bm2.setTitle("bookmark_2_title");
    bm2.setTags("loc:columbia,md");
   
    int id1 = manager.addBookmark(bm1);
    int id2 = manager.addBookmark(bm2);
    assertTrue((id1 > 0));
    assertTrue((id2 > 0));
   
    bm1 = manager.getBookmark(id1);
    bm2 = manager.getBookmark(id2);
   
    bm1.setTags("locality:baltimore,maryland");
    assertTrue(manager.updateBookmark(bm1));
     
    Tag tag1 = tagDao.findTag("loc:columbia,md").get(0);
    assertEquals(1,tag1.getCount());
   
    UserTag user1tag1 = tagDao.findUserTag(new User(2), tag1).get(0);
    assertEquals(0,user1tag1.getCount());
 
    bm2.setTags("");;
    assertTrue(manager.updateBookmark(bm2));
    tag1 = tagDao.findTag("loc:columbia,md").get(0);
    assertEquals(0,tag1.getCount());
  }
View Full Code Here

    tag1 = tagDao.findTag("loc:columbia,md").get(0);
    assertEquals(0,tag1.getCount());
  }
 
  public void testUpdateBookmark5() throws Exception{
    Bookmark bm300 = manager.getBookmark(300);
    bm300.setTags("abc.df 12/13 \\019 ..ppp [0-x] | ?11?? *** p+ (.*)");
    assertTrue(manager.updateBookmark(bm300));
   
    bm300 = manager.getBookmark(300);
    assertEquals("abc.df 12/13 019 ..ppp [0-x] | 11 *** p+ (.*)",bm300.getTags());
    assertEquals(10,bm300.getTagList().size());
   
    bm300.setTags("abc df abc 12 13 \\ 019 ppp ppp [ 0-x ] | ?11 ?? * ** p + ( .* )");
    assertTrue(manager.updateBookmark(bm300));
   
    bm300 = manager.getBookmark(300);
    assertEquals("abc df 12 13 019 ppp [ 0-x ] | 11 * ** p + ( )",bm300.getTags());   
    assertEquals(17,bm300.getTagList().size());
   
    Tag tag1 = tagDao.findTag("abc").get(0);
    assertEquals(1,tag1.getCount());
   
    Tag tag2 = tagDao.findTag("df").get(0);
View Full Code Here

 
 
 
  public void testRenameTag() throws Exception {
    // get an existing bookmark
    Bookmark bmark300 = manager.getBookmark(300);
    assertEquals("cnn",bmark300.getTags());
   
    // verify the baseline data
    Tag cnnTag = tagDao.findTag("cnn").get(0)
    Tag newsTag = tagDao.findTag("news").get(0);
    assertEquals(1,cnnTag.getCount());
View Full Code Here

    assertNotNull(ut);
  }
 
  public void testRenameTag2() throws Exception{
    // get an existing bookmark
    Bookmark bmark300 = manager.getBookmark(300);
    assertEquals("cnn",bmark300.getTags());
   
    // verify the baseline data
    Tag cnnTag = tagDao.findTag("cnn").get(0)
    Tag newsTag = tagDao.findTag("news2").get(0);
    assertEquals(1,cnnTag.getCount());
View Full Code Here

    UserTag headlinesUserTag = tagDao.findUserTag(new User(1),headlinesTag).get(0);
    assertEquals(1,headlinesUserTag.getCount());
  }
 
  public void testRenameTag3() throws Exception{
    Bookmark bm = new Bookmark(new User(1),new Link(204));
    bm.setTags("cnn");
    int bmId = manager.addBookmark(bm);
    assertTrue((bmId >0));
   
    boolean okay = manager.renameTag(new User(1),"cnn",new String[]{"cnn_news"});
    assertTrue(okay);
View Full Code Here

    Tag cnn_newsTag = tagDao.findTag("cnn_news").get(0);
    assertEquals(2,cnn_newsTag.getCount());
  }
 
  public void testRenameTag4() throws Exception{
    Bookmark bm = new Bookmark(new User(1),new Link(204));
    bm.setTags("java.logging");
    bm.setTitle("foio");
    int id = manager.addBookmark(bm);
    assertTrue((id > 0));
   
    boolean okay = manager.renameTag(new User(1),"java.logging",new String[]{"java","logging"});
    assertTrue(okay);
View Full Code Here

    Tag loggingTag = tagDao.findTag("logging").get(0);
    assertEquals(1,loggingTag.getCount());
  }
 
  public void testRenameTag5() throws Exception{
    Bookmark bm300 = manager.getBookmark(300);
    bm300.setTags("tag1 tag2 tag3");
    assertTrue(manager.updateBookmark(bm300));
    bm300 = manager.getBookmark(300);
    assertTrue(bm300.getTagList().contains("tag1"));
    assertTrue(bm300.getTagList().contains("tag2"));
    assertTrue(bm300.getTagList().contains("tag3"));
   
    List<FolderTag> fTags = folderDao.findTagsInFolder(new Folder(1), 0, FolderDao.SORT_BY_ALPHA, FolderDao.ASCENDING);
    assertEquals(0,fTags.size());
   
   
View Full Code Here

 
  public void testRenameTags6() throws Exception{
    MyTestBookmarkListener listener = new MyTestBookmarkListener();
    manager.addBookmarkListener(listener);
   
    Bookmark bm300 = manager.getBookmark(300);
    List<String> tags = bm300.getTagList();
    assertTrue(tags.contains("cnn"));
    assertEquals(1,tags.size());
   
    boolean isOkay = manager.renameTag(bm300.getUser(), "cnn", new String[]{"gn:geonames=USA","foobar_1"});
    assertTrue(isOkay);
   
    manager.shutdown();
   
    List<Bookmark> notifiedNew = listener.getNotifiedBookmarks();
View Full Code Here

TOP

Related Classes of com.gnizr.db.dao.Bookmark

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.