Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.Tag


  }
 
 
  public void testFindLinkTag() throws Exception{
    Link link = new Link(1);
    Tag tag = new Tag(1);
    List<LinkTag> linkTags = tagDao.findLinkTag(link, tag);
    assertEquals(1,linkTags.size());
   
    LinkTag linkTag = linkTags.get(0);
    assertEquals((1),linkTag.getLink().getId());
View Full Code Here


 
 
  public void testFindTag() throws Exception{
    List<Tag> tags = tagDao.findTag("news");
    assertEquals(1,tags.size());
    Tag t = tags.get(0);
    assertEquals((2),t.getId());
    assertEquals("news", t.getLabel());
    assertEquals((100),t.getCount());
   
    // matching should be case-insensitive
    tags = tagDao.findTag("NEWS");
    assertEquals(0,tags.size());
  }
View Full Code Here

  }
 
 
  public void testFindUserTag() throws Exception{
    User user = new User(1);
    Tag tag = new Tag(1);
    List<UserTag> userTags = tagDao.findUserTag(user, tag);
    assertEquals(1,userTags.size());
   
    UserTag ut = userTags.get(0);
    assertEquals((1),ut.getUser().getId());
View Full Code Here

    assertEquals((1),linkTag.getLink().getId());
    assertEquals((1),linkTag.getTag().getId());
  }

  public void testGetTag() throws Exception{
    Tag tag = tagDao.getTag((2));
    assertEquals("news",tag.getLabel());
    assertEquals((100),tag.getCount());
  }
View Full Code Here

    assertEquals((938),tag.getCount());
  }
 
  public void testUpdateTag() throws Exception{
    int id = (1);
    Tag tag = tagDao.getTag(id);
    tag.setLabel("foo");
    tag.setCount((1000));
    assertTrue(tagDao.updateTag(tag));
    tag = tagDao.getTag(id);
    assertEquals("foo",tag.getLabel());
    assertEquals((1000),tag.getCount());
  }
View Full Code Here

    assertEquals((938),tag.getCount());
  }
 
 
  public void testAddTagCountOne() throws Exception{
    Tag tag4 = tagDao.getTag(4);
    assertEquals(0,tag4.getCount());
   
    UserTag uTag4 = tagDao.getUserTag(4000);
    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);
View Full Code Here

 
  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

    btag1 = tagDao.getBookmarkTag(1);
    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

      skosNarrowerProperty = tagPrptDao
          .getTagProperty("skos", "narrower");
      skosRelatedProperty = tagPrptDao.getTagProperty("skos", "related");

      User gnizrUser = new User(UserSchema.GNIZR_USER);
      Tag placeTag = new Tag(PLACE_TAG);
      GnizrDaoUtil.fillId(userDao, gnizrUser);
      GnizrDaoUtil.fillId(tagDao, placeTag);
      gnizrPlaceTag = GnizrDaoUtil
          .getUserTag(tagDao, gnizrUser, placeTag);
    } catch (Exception e) {
View Full Code Here

 
  public UserTag createUserTag(User user, String tag) {
    UserTag ut = null;
    try {
      int id = tagDao.createTag(new Tag(tag));
      Tag tagObj = tagDao.getTag(id);
      id = tagDao.createUserTag(new UserTag(user, tagObj));
      ut = tagDao.getUserTag(id);
    } catch (Exception e) {
      logger.debug(e);
    }
View Full Code Here

TOP

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

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.