Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.Link


 
  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(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);
View Full Code Here

    forUser.setId (rs.getInt(ForUserSchema.ID));
    forUser.setMessage(rs.getString(ForUserSchema.MESSAGE));
    forUser.setCreatedOn(rs.getTimestamp(ForUserSchema.CREATED_ON));
   
    Bookmark bm = BookmarkDBDao.createBookmarkObject(rs);
    Link bmLink = LinkDBDao.createLinkObject(rs);
    User buser = UserDBDao.createUserObject("buser", rs);
    bm.setLink(bmLink);
    bm.setUser(buser);
 
    User fuser = UserDBDao.createUserObject("fuser", rs);
View Full Code Here

    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

    return new FlatXmlDataSet(TestBookmarkManager.class
        .getResourceAsStream("/TestLinkHistory-input.xml"));
  }
 
  public void testGetInfo() throws Exception{
    Link link = linkHistory.getInfo("97014960532642d4a2038b7f7361efab");
    assertEquals("http://www.springframework.org/docs/reference/beans.html",link.getUrl());
    //assertEquals(1,link.getUser().getId());
    //assertEquals("springframework java programming",link.getTags());
  }
View Full Code Here

    //assertEquals(1,link.getUser().getId());
    //assertEquals("springframework java programming",link.getTags());
  }
 
  public void testGetHistory() throws Exception{
    Link link = new Link(208);
    List<Bookmark> result = linkHistory.getHistory(link);
    assertEquals(1,result.size());
    Bookmark bm = result.get(0);
    assertEquals("Wii Play: Cow Racing",bm.getTitle());
  }
View Full Code Here

    Map<Tag,Integer> cloud = tagCloud.getPopularTagCloudSortAlph();
    assertEquals(6,cloud.size());
  }
 
  public void testGetCommonTagCloud() throws Exception{
    List<LinkTag> cloud = tagCloud.getCommonTagCloud(new Link(101),100);
    assertEquals(3,cloud.size());
    assertEquals(100,cloud.get(0).getCount());
    assertNotNull(cloud.get(0).getLink().getUrl());
    assertEquals(87,cloud.get(1).getCount());
    assertEquals(16,cloud.get(2).getCount());
View Full Code Here

  }

  public static void fillId(LinkDao linkDao, Link link)
      throws NoSuchLinkException {
    if (hasMissingId(link) == true) {
      Link obj = null;
      if (link.getUrl() != null) {
        obj = getLink(linkDao, link.getUrl());
      } else if (link.getUrlHash() != null) {
        obj = getLinkByUrlHash(linkDao, link.getUrlHash());
      }
      if (obj == null) {
        throw new NoSuchLinkException("no such link=" + link.getUrl());
      }
      link.setId(obj.getId());
    }
  }
View Full Code Here

  public static Link getLinkByUrlHash(LinkDao linkDao, String urlHash) {
    if (urlHash == null) {
      throw new NullPointerException("urlHash is NULL");
    }
    Link link = null;
    List<Link> links = linkDao.findLinkByUrlHash(urlHash);
    if (links.isEmpty() == false) {
      link = links.get(0);
    }
    return link;
View Full Code Here

    if (hasMissingId(bmark) == true) {
      User user = bmark.getUser();
      if (hasMissingId(user) == true) {
        fillId(userDao, user);
      }
      Link link = bmark.getLink();
      if (hasMissingId(link) == true) {
        fillId(linkDao, link);
      }
      Bookmark obj = getBookmark(bmarkDao, user, link);
      if (obj == null) {
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.