Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.Tag


    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


   
    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);
    assertEquals(1,tag2.getCount());
   
    assertEquals(0,tagDao.findTag("\\").size());
   
    Tag tag4 = tagDao.findTag("(").get(0);
    assertEquals(1,tag4.getCount());
   
    Tag tag5 = tagDao.findTag("019").get(0);
    assertEquals(1,tag5.getCount());
  }
View Full Code Here

    // 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());
    assertEquals(0,newsTag.getCount());
   
    UserTag cnnUserTag = tagDao.findUserTag(new User(1),cnnTag).get(0);
    assertEquals(1,cnnUserTag.getCount());
    assertEquals(1,tagDao.findUserTag(new User(1),newsTag).size());
     
    // rename "cnn" to "news"
    boolean okay = manager.renameTag(new User(1),"cnn",new String[]{"news"});
    assertTrue(okay);
   
    // should differ from the baseline data
    cnnTag = tagDao.findTag("cnn").get(0);
    assertEquals(0,cnnTag.getCount());
   
    newsTag = tagDao.findTag("news").get(0);
    assertEquals(1,newsTag.getCount());
   
    UserTag ut = GnizrDaoUtil.getUserTag(tagDao,new User(1), new Tag(4));
    assertNull(ut);
    ut = GnizrDaoUtil.getUserTag(tagDao, new User(1), new Tag(5));
    assertNotNull(ut);
  }
View Full Code Here

    // 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());
    assertEquals(0,newsTag.getCount());
   
    UserTag cnnUserTag = tagDao.findUserTag(new User(1),cnnTag).get(0);
    assertEquals(1,cnnUserTag.getCount());
    assertEquals(0,tagDao.findUserTag(new User(1),newsTag).size());
     
    // rename "cnn" to "news"
    boolean okay =  manager.renameTag(new User(1),"cnn",new String[]{"breakingnews","cnn","headlines"});
    assertTrue(okay);
   
    cnnTag = tagDao.findTag("cnn").get(0);
    assertEquals(1,cnnTag.getCount());
   
    Tag breakingnewsTag = tagDao.findTag("breakingnews").get(0);
    assertEquals(1,breakingnewsTag.getCount());
   
    Tag headlinesTag = tagDao.findTag("headlines").get(0);
    assertEquals(1,headlinesTag.getCount());
 
    cnnUserTag = tagDao.findUserTag(new User(1),cnnTag).get(0);
    assertEquals(1,cnnUserTag.getCount());
   
    UserTag breakingnewsUserTag = tagDao.findUserTag(new User(1),breakingnewsTag).get(0);
View Full Code Here

    assertTrue((bmId >0));
   
    boolean okay = manager.renameTag(new User(1),"cnn",new String[]{"cnn_news"});
    assertTrue(okay);
   
    Tag cnn_newsTag = tagDao.findTag("cnn_news").get(0);
    assertEquals(2,cnn_newsTag.getCount());
  }
View Full Code Here

    assertTrue((id > 0));
   
    boolean okay = manager.renameTag(new User(1),"java.logging",new String[]{"java","logging"});
    assertTrue(okay);
   
    Tag javaLoggingTag = tagDao.findTag("java.logging").get(0);
    assertEquals(0,javaLoggingTag.getCount());
   
    Tag javaTag = tagDao.findTag("java").get(0);
    assertEquals(1,javaTag.getCount());
   
    Tag loggingTag = tagDao.findTag("logging").get(0);
    assertEquals(1,loggingTag.getCount());
  }
View Full Code Here

    MyTestBookmarkListener listener = new MyTestBookmarkListener();
    manager.addBookmarkListener(listener);
    boolean okay =  manager.deleteTag(new User(1),"cnn");
    assertTrue(okay);
   
    Tag cnnTag = tagDao.findTag("cnn").get(0);     
    assertEquals(0,cnnTag.getCount());
   
    Bookmark bm = manager.getBookmark(300);
    assertEquals("",bm.getTags());
   
    manager.shutdown();
View Full Code Here

    assertEquals("cnn",bm.getTags());
  }
 
 
  public void testDeleteTag2() throws Exception{
    UserTag ut = GnizrDaoUtil.getUserTag(tagDao,new User(1),new Tag(5));
    assertEquals(0,ut.getCount());
    boolean okay =  manager.deleteTag(new User(1),"news");
    assertTrue(okay);
    ut = GnizrDaoUtil.getUserTag(tagDao, new User(1), new Tag(5));
    assertNull(ut);
  }
View Full Code Here

    bm300.setTags("CNN");
    assertTrue(manager.updateBookmark(bm300));
    bm300 = manager.getBookmark(300);
    assertEquals("CNN",bm300.getTags());
   
    Tag CNN = tagDao.findTag("CNN").get(0);
    assertEquals(1,CNN.getCount());
   
    Tag cnn = tagDao.findTag("cnn").get(0);
    assertEquals(0,cnn.getCount());
  }
View Full Code Here

      }
    }else if(tag != null){
      User u = getUser();
      if(u != null){     
        try {
          userTag = tagManager.getUserTag(u,new Tag(tag));
        } 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.