Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.BookmarkTag


    assertEquals(1,ltag1.getCount());
   
    LinkTag ltag2 = tagDao.getLinkTag(2);
    assertEquals(1,ltag2.getCount());
   
    BookmarkTag bmtag10 = tagDao.getBookmarkTag(10);
    assertEquals(1,bmtag10.getCount());
   
    BookmarkTag bmtag11 = tagDao.getBookmarkTag(11);
    assertEquals(1,bmtag11.getCount());
   
    BookmarkTag bmtagQ = tagDao.getBookmarkTag(12);
    assertEquals(0,bmtagQ.getCount());
   
    folderTags = folderDao.findTagsInFolder(new Folder(2), 0, FolderDao.SORT_BY_ALPHA, FolderDao.ASCENDING);
    assertEquals(2,folderTags.size());
   
    t1 = folderTags.get(0);
    assertEquals("cnn",t1.getTag().getLabel());
    assertEquals(1,t1.getCount());
    t2 = folderTags.get(1);
    assertEquals("news",t2.getTag().getLabel());
    assertEquals(1,t2.getTag().getCount());
   
    List<Bookmark> chngBmarks = tagDao.expandTag(new User(1), new Tag(1), new Tag[]{new Tag(4)});
    assertEquals(1,chngBmarks.size());
    for(Bookmark c : chngBmarks){
      assertTrue(c.getTagList().contains("questions"));
      assertTrue(c.getTagList().contains("cnn"));
    }
       
    cnnTag = tagDao.getTag(1);
    assertEquals(1,cnnTag.getCount());
   
    newsTag = tagDao.getTag(2);
    assertEquals(1,newsTag.getCount());
   
    ltag1 = tagDao.getLinkTag(1);
    assertEquals(1,ltag1.getCount());
   
    ltag2 = tagDao.getLinkTag(2);
    assertEquals(1,ltag2.getCount());
   
    bmtag10 = tagDao.getBookmarkTag(10);
    assertEquals(1,bmtag10.getCount());
   
    bmtag11 = tagDao.getBookmarkTag(11);
    assertEquals(1,bmtag11.getCount());
 
    bmtagQ = tagDao.getBookmarkTag(12);
    assertEquals(1,bmtagQ.getCount());
   
    folderTags = folderDao.findTagsInFolder(new Folder(2), 0, FolderDao.SORT_BY_ALPHA, FolderDao.ASCENDING);
    assertEquals(3,folderTags.size());
   
    t1 = folderTags.get(0);
View Full Code Here


    assertEquals(1,changeBookmarks.size());
    for(Bookmark c : changeBookmarks){
      assertFalse(c.getTagList().contains("cnn"));
    }
   
    BookmarkTag bm11 = tagDao.getBookmarkTag(11);
    assertEquals("cnn",bm11.getTag().getLabel());
    assertEquals(0,bm11.getCount());
    assertEquals(0,bm11.getTag().getCount());
 
    LinkTag ln1 = tagDao.getLinkTag(1);
    assertEquals(202,ln1.getLink().getId());
    assertEquals(0,ln1.getCount());
    assertEquals(0,ln1.getTag().getCount());
View Full Code Here

  }
 
  public void testSearchTag() throws Exception{
    BookmarkTagSearchResult r = new BookmarkTagSearchResult(getGnizrDao(),"tags4 tags");
    assertEquals(5,r.length());
    BookmarkTag bt = r.getResult(4);
    assertNotNull(bt.getBookmark().getLink().getUrlHash());
    assertEquals("gnizr",bt.getBookmark().getUser().getUsername());
  }
View Full Code Here

    assertEquals(0,uTag4.getCount());
   
    LinkTag lTag4 = tagDao.getLinkTag(400);
    assertEquals(0,lTag4.getCount());
   
    BookmarkTag bTag4 = tagDao.getBookmarkTag(40);
    assertEquals(0,bTag4.getCount());
       
    User user1 = new User(1);
    Link link1 = new Link(1);
    Bookmark bmark1 = new Bookmark(1);
       
    boolean[] opOkay = tagDao.addTagCountOne(new Tag[]{tag4}, user1, link1, bmark1);
    assertTrue(opOkay[0]);
   
    tag4 = tagDao.getTag(4);
    assertEquals(1,tag4.getCount());
   
    uTag4 = tagDao.getUserTag(4000);
    assertEquals(1,uTag4.getCount());
   
    lTag4 = tagDao.getLinkTag(400);
    assertEquals(1,lTag4.getCount());
   
    bTag4 = tagDao.getBookmarkTag(40);
    assertEquals(1,bTag4.getCount());
  }
View Full Code Here

    bTag4 = tagDao.getBookmarkTag(40);
    assertEquals(1,bTag4.getCount());
  }
 
  public void testAddTagCountOne2() throws Exception{
    BookmarkTag btag1 = tagDao.getBookmarkTag(1);
    assertEquals(1,btag1.getCount());
   
    boolean[] opOkay = tagDao.addTagCountOne(new Tag[]{new Tag(1)}, new User(1), new Link(1), new Bookmark(1));
    assertTrue(opOkay[0]);
   
    btag1 = tagDao.getBookmarkTag(1);
    assertEquals(1,btag1.getCount());
  }
View Full Code Here

    assertEquals(1,btag1.getCount());
  }
 
  public void testSubtractTagCountOne() throws Exception{
    Tag tag = tagDao.getTag(2);
    BookmarkTag btag = tagDao.getBookmarkTag(2);
    LinkTag ltag = tagDao.getLinkTag(2);
    UserTag utag = tagDao.getUserTag(2);
   
    assertEquals(100,tag.getCount());
    assertEquals(1,btag.getCount());
    assertEquals(1,ltag.getCount());
    assertEquals(1,utag.getCount());
   
    boolean[] opOkay = tagDao.subtractTagCountOne(new Tag[]{tag}, new User(1), new Link(1), new Bookmark(1));
    assertTrue(opOkay[0]);
   
    tag = tagDao.getTag(2);
    btag = tagDao.getBookmarkTag(2);
    ltag = tagDao.getLinkTag(2);
    utag = tagDao.getUserTag(2);
   
    assertEquals(99,tag.getCount());
    assertEquals(0,btag.getCount());
    assertEquals(0,ltag.getCount());
    assertEquals(0,utag.getCount());
  }
View Full Code Here

  public void testFindBookmarkTagByFolderId() throws Exception{
    List<BookmarkTag> bookmarkTags = tagDao.findBookmarkTag(new Folder(1));
    assertEquals(0,bookmarkTags.size());
    bookmarkTags = tagDao.findBookmarkTag(new Folder(2));
    assertEquals(6,bookmarkTags.size());
    BookmarkTag bmTag = bookmarkTags.get(0);
    assertNotNull(bmTag.getBookmark());
    assertNotNull(bmTag.getTag());
    assertNotNull(bmTag.getBookmark().getLink());
    assertNotNull(bmTag.getBookmark().getUser());
    assertEquals(0,bmTag.getId());
  }
View Full Code Here

  protected IDataSet getDataSet() throws Exception {
    return new FlatXmlDataSet(TestTagDBDao1.class.getResourceAsStream("/dbunit/tagdbdao/TestTagDBDao1-input.xml"));
  }
 
  public void testGetBookmarkTag() throws Exception{
    BookmarkTag bmTag = tagDao.getBookmarkTag(10);
    assertNotNull(bmTag);
    assertEquals(1,bmTag.getCount());
   
    Bookmark bm = bmTag.getBookmark();
    assertEquals(1,bm.getId());
    assertEquals("CNN",bm.getTitle());
    assertNotNull(bm.getCreatedOn());
    User user = bm.getUser();
    assertEquals(1,user.getId());
    assertEquals("hchen1",user.getUsername());
    assertNotNull(user.getCreatedOn());
    Link link = bm.getLink();
    assertEquals(202,link.getId());
    assertEquals(1003,link.getMimeTypeId());
    assertEquals("c50252f4f24784b5d368926df781ede9",link.getUrlHash());
   
    Tag tag = bmTag.getTag();
    assertEquals(2,tag.getId());
    assertEquals("news",tag.getLabel());
    assertEquals(10,tag.getCount());
  }
View Full Code Here

    assertEquals("news",tag.getLabel());
    assertEquals(10,tag.getCount());
  }
 
  public void testCreateBookmarkTag() throws Exception{
    BookmarkTag bmTag = new BookmarkTag();
    bmTag.setBookmark(new Bookmark(1));
    bmTag.setTag(new Tag(1))
   
    int id = tagDao.createBookmarkTag(bmTag);
    assertTrue((id > 0));
   
    BookmarkTag bmTag2 = tagDao.getBookmarkTag(id);
    assertEquals(bmTag.getBookmark().getId(),bmTag2.getBookmark().getId());
    assertEquals(bmTag.getTag().getId(),bmTag2.getTag().getId());
   
    BookmarkTag bmFoo = new BookmarkTag();
    bmFoo.setBookmark(new Bookmark(1));
    bmFoo.setTag(new Tag(100));
    bmFoo.setPosition(40);
   
    id = tagDao.createBookmarkTag(bmFoo);
    assertTrue((id > 0));
    bmTag2 = tagDao.getBookmarkTag(id);
    assertEquals(40,bmTag2.getPosition());
View Full Code Here

    bmTag2 = tagDao.getBookmarkTag(id);
    assertEquals(40,bmTag2.getPosition());
  }
 
  public void testDeleteBookmarkTag() throws Exception{
    BookmarkTag bmTag = tagDao.getBookmarkTag(10);
    assertNotNull(bmTag);
    assertTrue(tagDao.deleteBookmarkTag(10));
    bmTag = tagDao.getBookmarkTag(10);
    assertNull(bmTag);
  }
View Full Code Here

TOP

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

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.