Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.ForUser


    BookmarkDBDao bmDao = new BookmarkDBDao(getDataSource());
   
    Bookmark bookmark = bmDao.getBookmark(301);
    assertNotNull(bookmark);
   
    ForUser forUser = new ForUser (user, bookmark, "This is just a test", new Date());
   
    int fuid = fuDao.createForUser(forUser);
    assertTrue (fuid>0);
   
    int fuid2 = fuDao.createForUser(forUser);
View Full Code Here


    int fuid2 = fuDao.createForUser(forUser);
    assertEquals(fuid,fuid2);
  }

  public void testDeleteForUserForUser() {
    ForUser forUser = fuDao.getForUser(401);
    assertNotNull (forUser);
    assertTrue(fuDao.deleteForUser(forUser.getId()));
    assertFalse(fuDao.deleteForUser(forUser.getId()));
    assertFalse(fuDao.deleteForUser(forUser.getId()));
    assertFalse(fuDao.deleteForUser(forUser.getId()));
    assertNull(fuDao.getForUser(forUser.getId()));
  }
View Full Code Here

    assertFalse(fuDao.deleteForUser(forUser.getId()));
    assertNull(fuDao.getForUser(forUser.getId()));
  }

  public void testGetForUser() {
    ForUser forUser = fuDao.getForUser(400);
    assertNotNull (forUser);
    assertNotNull (forUser.getBookmark());
    assertNotNull (forUser.getForUser());
   
    User fuser = forUser.getForUser();
    assertEquals("jsmith",fuser.getUsername());
   
    Bookmark bm = forUser.getBookmark();
    assertEquals("cnn",bm.getTitle());
   
    User buser = forUser.getBookmark().getUser();
    assertEquals("jsmith",buser.getUsername());   
  }
View Full Code Here

    assertNotNull(bookmarks.get(0).getBookmark().getLink().getUrlHash());
    assertNotNull(bookmarks.get(1).getForUser().getFullname());
  }

  public void testUpdateForUser() {
    ForUser forUser = fuDao.getForUser(400);

    forUser.setMessage("I didn't like that last message");
   
    fuDao.updateForUser(forUser);
   
    ForUser newForUser = fuDao.getForUser(400);
   
    assertTrue (forUser.getMessage().equals(newForUser.getMessage()));
  }
View Full Code Here

    assertNotNull(bookmark);
   
    List<ForUser> linksForUsers = fuDao.findForUserFromBookmark(bookmark);
   
    assertTrue(linksForUsers.size()==1);
    ForUser forUser = linksForUsers.get(0);
   
    assertEquals("jsmith",forUser.getForUser().getUsername());
    assertEquals("foo",forUser.getBookmark().getTitle());
    assertEquals("hchen1",forUser.getBookmark().getUser().getUsername());   
  }
View Full Code Here

 
  public void testPageForUserBySender() throws Exception{
    DaoResult<ForUser> result = fuDao.pageForUser(new User(2), new User(2), 0, 10);
    assertEquals(1,result.getSize());
   
    ForUser forUser = result.getResult().get(0);
    assertEquals(300,forUser.getBookmark().getId());
    assertEquals("jsmith",forUser.getBookmark().getUser().getUsername());
    assertEquals("jsmith",forUser.getForUser().getUsername());
       
    result = fuDao.pageForUser(new User(2), new User(1), 0, 10);
    assertEquals(2, result.getSize());
   
    result = fuDao.pageForUser(new User(2), new User(1), 1, 10);
    assertEquals(2, result.getSize());
    assertEquals(1, result.getResult().size());
   
    forUser = result.getResult().get(0);
    assertEquals("jsmith",forUser.getForUser().getUsername());
    assertEquals("hchen1",forUser.getBookmark().getUser().getUsername());
  }
View Full Code Here

    }
    return 0;
  }
 
  public ForUser getForUser(int id) {
    ForUser forUserRec = forUserDao.getForUser(id);
    if(forUserRec != null){
      try {
        fillForUserObject(forUserRec);
        return forUserRec;
      } catch (Exception e) {
View Full Code Here

 
  public void testAddForUser() throws Exception{
    User jsmith = new User(2);
    Bookmark bm = new Bookmark(300);
    Date date = GnizrDaoUtil.getNow();
    ForUser forUser = new ForUser(jsmith,bm,"helloworld",date);
    int id = manager.addForUser(forUser);
    assertTrue((id > 0));
  }
View Full Code Here

    int cnt = manager.getForUserCount(new User(2));
    assertEquals(2,cnt);
  }
 
  public void testGetForUserById() throws Exception{
    ForUser forUser = manager.getForUser(401);
    assertNotNull(forUser);
    assertNotNull(forUser.getForUser().getUsername());
    assertNotNull(forUser.getBookmark().getLink().getUrl());
  }
View Full Code Here

    bookmarkManager.shutdown();
    super.tearDown();
  }

  public void testDeleteBookmark() throws Exception{
    ForUser record = forUserManager.getForUser(400);
    assertNotNull(record);
   
    assertTrue(bookmarkManager.deleteBookmark(new Bookmark(300)));
   
    record = forUserManager.getForUser(400);
View Full Code Here

TOP

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

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.