Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.Link


    assertTrue(linkDao.deleteLink(id));
    assertFalse(linkDao.deleteLink(id));   
  }
 
  public void testDeleteLink() throws Exception{
    Link link = linkDao.getLink((202));
    assertTrue(linkDao.deleteLink(link.getId()));
    assertFalse(linkDao.deleteLink(link.getId()));
  }
View Full Code Here


    assertTrue(linkDao.deleteLink(link.getId()));
    assertFalse(linkDao.deleteLink(link.getId()));
  }
 
  public void testGetLink() throws Exception{
    Link link = linkDao.getLink((202));
    assertNotNull(link);
    assertEquals(1003,link.getMimeTypeId());
    assertEquals("http://www.csee.umbc.edu/~finin/",link.getUrl());
    assertEquals("2c96b19ed544ab90b24830493a5efdd3",link.getUrlHash());
    assertEquals(link.getUrlHash(),Link.computeUrlHash(link.getUrl()));
  }
View Full Code Here

 
  public void testFindLinkUrlHash() throws Exception{
    String urlHash = Link.computeUrlHash("http://www.housingmaps.com/");
    List<Link> links = linkDao.findLinkByUrlHash(urlHash);
    assertEquals(1,links.size());
    Link l = links.get(0);
    assertEquals(3,l.getCount());
    assertEquals(0,l.getMimeTypeId());
  }
View Full Code Here

    assertEquals(0,l.getMimeTypeId());
  }
 
 
  public void testUpdateLink() throws Exception{
    Link link1 = linkDao.getLink(1);
    link1.setMimeTypeId(1003);
    link1.setUrl("http://foo.bar.com");
   
    assertTrue(linkDao.updateLink(link1));
   
    link1 = linkDao.getLink(1);
    assertEquals(1003,link1.getMimeTypeId());
    assertEquals("http://foo.bar.com",link1.getUrl());
  }
View Full Code Here

    assertNull(bmDao.getBookmark(bm.getId()));
  }
 
  public void testCreateBookmark() throws Exception{
    LinkDBDao linkDao = new LinkDBDao(getDataSource());
    Link link = linkDao.getLink((202));
    assertNotNull(link);
   
    UserDBDao userDao = new UserDBDao(getDataSource());
    User user = userDao.getUser((1));
    assertNotNull(user);
View Full Code Here

    u.setId((1));
    assertEquals((1),bmDao.getBookmarkCount(u));
  }
 
  public void testGetBookmarkCountLink() throws Exception{
    Link link = new Link();
    link.setId((202));
    assertEquals((1),bmDao.getBookmarkCount(link));
   
    link.setId((203203));
    assertEquals((0),bmDao.getBookmarkCount(link));
  }
View Full Code Here

   
   
  }
 
  public void testPageBookmarksLink() throws Exception{
    Link l = new Link();
    l.setId((203));
   
    List<Bookmark> bmarks = null;
    DaoResult<Bookmark> result = bmDao.pageBookmarks(l,(0),100);
    bmarks = result.getResult();
    assertEquals(4,bmarks.size());
   
    l.setId((3000));
    result = bmDao.pageBookmarks(l,(0),10000);
    bmarks = result.getResult();
    assertEquals(0,bmarks.size());
  }
View Full Code Here

    assertTrue(d1.after(d2));
  }
 
  public void testFindBookmark() throws Exception{
    User user = new User(2);
    Link link = new Link(202);
    List<Bookmark> bmarks = bmDao.findBookmark(user, link);
    assertEquals(1,bmarks.size());
    Bookmark bm = bmarks.get(0);
    assertEquals((2),bm.getUser().getId());
    assertEquals((202),bm.getLink().getId());
View Full Code Here

    assertEquals("cnn",t1.getTag().getLabel());
    assertEquals("news",t2.getTag().getLabel());
    assertEquals(1,t1.getCount());
    assertEquals(1,t1.getCount());
   
    tagDao.addTagCountOne(new Tag[]{new Tag(100)}, new User(1), new Link(202), new Bookmark(1));
    folderTags = folderDao.findTagsInFolder(new Folder(2), 0, FolderDao.SORT_BY_ALPHA, FolderDao.ASCENDING);
    assertEquals(3,folderTags.size());
    t1 = folderTags.get(0);
    t2 = folderTags.get(1);
    assertEquals(1,t1.getCount());
View Full Code Here

    assertEquals("cnn",t1.getTag().getLabel());
    assertEquals("news",t2.getTag().getLabel());
    assertEquals(1,t1.getCount());
    assertEquals(1,t1.getCount());
   
    tagDao.subtractTagCountOne(new Tag[]{new Tag(1)}, new User(1), new Link(202), new Bookmark(1));
    folderTags = folderDao.findTagsInFolder(new Folder(2), 1, FolderDao.SORT_BY_ALPHA, FolderDao.ASCENDING);
    assertEquals(1,folderTags.size());
    t1 = folderTags.get(0);
    assertEquals(1,t1.getCount());
    assertEquals("news",t1.getTag().getLabel());
View Full Code Here

TOP

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

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.