Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.Folder


    cnt = folderDao.removeAllBookmarks(f1);
    assertEquals(0, cnt);
  }
 
  public void testRemoveAllBookmarks2() throws Exception {
    int cnt = folderDao.removeAllBookmarks(new Folder(1));
    assertEquals(3, cnt);
   
    List<FolderTag> folderTags = folderDao.findTagsInFolder(new Folder(1), 0, FolderDao.SORT_BY_ALPHA, FolderDao.ASCENDING);
    assertEquals(0,folderTags.size());
  }
View Full Code Here


    assertEquals(0,folderTags.size());
  }
 

  public void testRemoveBookmarks() throws Exception {
    Folder f1 = folderDao.getFolder(1);
    assertEquals(3, f1.getSize());

    List<Bookmark> bmarks = new ArrayList<Bookmark>();
    bmarks.add(new Bookmark(300));
    bmarks.add(new Bookmark(303));

    boolean[] opOkay = folderDao.removeBookmarks(f1, bmarks);
    for(boolean b: opOkay){
      assertTrue(b);
    }
   
    f1 = folderDao.getFolder(1);
    assertEquals(1, f1.getSize());

    DaoResult<Bookmark> result = folderDao.pageBookmarks(f1, 0, 10);
    assertEquals(1, result.getSize());
    assertEquals(1, result.getResult().size());
    assertEquals(301, result.getResult().get(0).getId());
View Full Code Here

    assertEquals(1, result.getResult().size());
    assertEquals(301, result.getResult().get(0).getId());
  }
 
  public void testRemoveBookmarks2() throws Exception {
    List<FolderTag> folderTags = folderDao.findTagsInFolder(new Folder(1), 0,FolderDao.SORT_BY_ALPHA,FolderDao.ASCENDING);
    assertEquals(3,folderTags.size());
   
    Folder f1 = folderDao.getFolder(1);
    assertEquals(3, f1.getSize());

    List<Bookmark> bmarks = new ArrayList<Bookmark>();
    bmarks.add(new Bookmark(300));
    bmarks.add(new Bookmark(303));
    bmarks.add(new Bookmark(300));
    bmarks.add(new Bookmark(303)); // remove multiple times should cause no error

    boolean[] opOkay = folderDao.removeBookmarks(f1, bmarks);
    for(boolean b: opOkay){
      assertTrue(b);
    }

    f1 = folderDao.getFolder(1);
    assertEquals(1, f1.getSize());

    folderTags = folderDao.findTagsInFolder(new Folder(1), 1,FolderDao.SORT_BY_ALPHA,FolderDao.ASCENDING);
    assertEquals(2,folderTags.size());
    assertEquals(1,folderTags.get(0).getCount());
    assertEquals(1,folderTags.get(1).getCount());
   
    bmarks = new ArrayList<Bookmark>();
    bmarks.add(new Bookmark(301));
    opOkay = folderDao.removeBookmarks(f1, bmarks);
    for(boolean b: opOkay){
      assertTrue(b);
    }
    folderTags = folderDao.findTagsInFolder(new Folder(1), 1,FolderDao.SORT_BY_ALPHA,FolderDao.ASCENDING);
    assertEquals(0,folderTags.size());
  }
View Full Code Here

    assertEquals(1, result.getSize());
    assertEquals("my folder1", result.getResult().get(0).getName());
  }

  public void testPageBookmarksWithTag() throws Exception {
    DaoResult<Bookmark> result = folderDao.pageBookmarks(new Folder(1),
        new Tag(1), 0, 10);
    assertEquals(3, result.getSize());

    result = folderDao.pageBookmarks(new Folder(1), new Tag(4), 0, 10);
    assertEquals(1, result.getSize());
    assertEquals(303, result.getResult().get(0).getId());
  }
View Full Code Here

    List<Bookmark> bmarks = null;
    Date d1 = null;
    Date d2 = null;
    Date d3 = null;

    result = folderDao.pageBookmarks(new Folder(1), new Tag(1), 0, 3,
        FolderDao.SORT_BY_BMRK_CREATED_ON, FolderDao.ASCENDING);
    bmarks = result.getResult();
    d1 = bmarks.get(0).getCreatedOn();
    d2 = bmarks.get(1).getCreatedOn();
    d3 = bmarks.get(2).getCreatedOn();
    assertTrue(d1.before(d2));
    assertTrue(d2.before(d3));

    result = folderDao.pageBookmarks(new Folder(1), new Tag(1), 0, 3,
        FolderDao.SORT_BY_BMRK_CREATED_ON, FolderDao.DESCENDING);
    bmarks = result.getResult();
    d1 = bmarks.get(0).getCreatedOn();
    d2 = bmarks.get(1).getCreatedOn();
    d3 = bmarks.get(2).getCreatedOn();
View Full Code Here

    List<Bookmark> bmarks = null;
    Date d1 = null;
    Date d2 = null;
    Date d3 = null;

    result = folderDao.pageBookmarks(new Folder(1), new Tag(1), 0, 3,
        FolderDao.SORT_BY_BMRK_LAST_UPDATED, FolderDao.DESCENDING);
    bmarks = result.getResult();
    d1 = bmarks.get(0).getLastUpdated();
    d2 = bmarks.get(1).getLastUpdated();
    d3 = bmarks.get(2).getLastUpdated();
    assertTrue(d1.after(d2));
    assertTrue(d2.after(d3));

    result = folderDao.pageBookmarks(new Folder(1), new Tag(1), 0, 3,
        FolderDao.SORT_BY_BMRK_LAST_UPDATED, FolderDao.ASCENDING);
    bmarks = result.getResult();
    d1 = bmarks.get(0).getLastUpdated();
    d2 = bmarks.get(1).getLastUpdated();
    d3 = bmarks.get(2).getLastUpdated();
View Full Code Here

  public void testPageBookmarksWithTag4() throws Exception {
    DaoResult<Bookmark> result = null;
    List<Bookmark> bmarks = null;

    result = folderDao.pageBookmarks(new Folder(1), new Tag(1), 0, 3,
        FolderDao.SORT_BY_BMRK_FLDR_LAST_UPDATED, FolderDao.DESCENDING);
    bmarks = result.getResult();
    assertEquals(303, bmarks.get(0).getId());
    assertEquals(301, bmarks.get(1).getId());
    assertEquals(300, bmarks.get(2).getId());

    result = folderDao.pageBookmarks(new Folder(1), new Tag(1), 0, 3,
        FolderDao.SORT_BY_BMRK_FLDR_LAST_UPDATED, FolderDao.ASCENDING);
    bmarks = result.getResult();
    assertEquals(300, bmarks.get(0).getId());
    assertEquals(301, bmarks.get(1).getId());
    assertEquals(303, bmarks.get(2).getId());
View Full Code Here

    assertEquals(303, bmarks.get(2).getId());
  }

 
  public void testHasFolderTag() throws Exception{
    assertTrue(folderDao.hasFolderTag(new Folder(1), new Tag(1)));
    assertTrue(folderDao.hasFolderTag(new Folder(1), new Tag(3)));
    assertTrue(folderDao.hasFolderTag(new Folder(1), new Tag(4)));
   
    assertFalse(folderDao.hasFolderTag(new Folder(1), new Tag(2)));
    assertFalse(folderDao.hasFolderTag(new Folder(2), new Tag(2)));
  }
View Full Code Here

    assertFalse(folderDao.hasFolderTag(new Folder(1), new Tag(2)));
    assertFalse(folderDao.hasFolderTag(new Folder(2), new Tag(2)));
  }
 
  public void testFindTagsInFolder() throws Exception{
    List<FolderTag> fldrTgs = folderDao.findTagsInFolder(new Folder(1),
        0, FolderDao.SORT_BY_ALPHA, FolderDao.ASCENDING);
    assertEquals(3,fldrTgs.size());
    assertNotNull(fldrTgs.get(0).getFolder().getUser());
    assertNotNull(fldrTgs.get(1).getFolder().getLastUpdated());
    assertEquals(3,fldrTgs.get(0).getCount());
View Full Code Here

    assertEquals("news",fldrTgs.get(2).getTag().getLabel());
    assertEquals(2,fldrTgs.get(2).getTag().getCount());
  }
 
  public void testFindTagsInFolder2() throws Exception{
    List<FolderTag> fldrTgs = folderDao.findTagsInFolder(new Folder(1),
        0, FolderDao.SORT_BY_ALPHA, FolderDao.DESCENDING);
    assertEquals(3,fldrTgs.size());
   
    assertEquals(3,fldrTgs.get(0).getCount());
    assertEquals(1,fldrTgs.get(1).getCount());
View Full Code Here

TOP

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

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.