Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.Folder


            .getResourceAsStream("/dbunit/folderdbdao/TestFolderDBDao1-input.xml"));
  }
 
  public void testListTagGroups() throws Exception{
    Map<String, List<FolderTag>> tagGroups =
      folderDao.listTagGroups(new Folder(1), 1, FolderDao.SORT_BY_ALPHA, FolderDao.ASCENDING);   
    assertEquals(3,tagGroups.size());
   
    List<FolderTag> g1 = tagGroups.get("g1");
    assertEquals(2,g1.size());
    assertEquals("cnn",g1.get(0).getLabel());
View Full Code Here


    assertEquals("media",nogrp.get(0).getLabel());
  }
 
  public void testListTagGroups1() throws Exception{
    Map<String, List<FolderTag>> tagGroups =
      folderDao.listTagGroups(new Folder(1), 1, FolderDao.SORT_BY_ALPHA, FolderDao.DESCENDING);   
    assertEquals(3,tagGroups.size());
   
    List<FolderTag> g1 = tagGroups.get("g1");
    assertEquals(2,g1.size());
    assertEquals("news",g1.get(0).getLabel());
View Full Code Here

  }

 
  public void testListTagGroups3() throws Exception{
    Map<String, List<FolderTag>> tagGroups =
      folderDao.listTagGroups(new Folder(1), 1, FolderDao.SORT_BY_USAGE_FREQ, FolderDao.DESCENDING);   
    assertEquals(3,tagGroups.size());
   
    List<FolderTag> g1 = tagGroups.get("g1");
    assertEquals(2,g1.size());
    assertEquals("news",g1.get(0).getLabel());
View Full Code Here

    assertEquals("media",nogrp.get(0).getLabel());
  }
 
  public void testListTagGroups4() throws Exception{
    Map<String, List<FolderTag>> tagGroups =
      folderDao.listTagGroups(new Folder(1), 0, FolderDao.SORT_BY_USAGE_FREQ, FolderDao.DESCENDING);   
    assertEquals(3,tagGroups.size());
   
    List<FolderTag> g1 = tagGroups.get("g1");
    assertEquals(3,g1.size());
    assertEquals("news",g1.get(0).getLabel());
View Full Code Here

    super.setUp();
    folderDao = new FolderDBDao(getDataSource());
  }

  public void testGetFolderById() throws Exception {
    Folder f1 = folderDao.getFolder(1);
    assertNotNull(f1);
    assertEquals(1, f1.getId());
    assertEquals("my folder1", f1.getName());
    assertEquals("stuff that matters", f1.getDescription());
    assertEquals("jsmith", f1.getUser().getUsername());
    assertNotNull(f1.getLastUpdated());
    assertEquals(3, f1.getSize());

    Folder f2 = folderDao.getFolder(2);
    assertNotNull(f2);
    assertEquals(1, f2.getSize());
  }
View Full Code Here

    assertNotNull(f2);
    assertEquals(1, f2.getSize());
  }

  public void testGetFolderByUserIdFolderName() throws Exception {
    Folder f1 = folderDao.getFolder(new User(2), "my folder1");
    assertNotNull(f1);
    assertEquals(1, f1.getId());
    assertEquals("my folder1", f1.getName());
    assertEquals("stuff that matters", f1.getDescription());
    assertEquals("jsmith", f1.getUser().getUsername());
    assertNotNull(f1.getLastUpdated());
    assertEquals(3, f1.getSize());
  }
View Full Code Here

    assertNotNull(f1.getLastUpdated());
    assertEquals(3, f1.getSize());
  }

  public void testCreateFolder() throws Exception {
    Folder folderX = new Folder();
    folderX.setName("X-files");
    folderX.setDescription("nothing interesting");
    folderX.setUser(new User(1));
    folderX.setLastUpdated(GregorianCalendar.getInstance().getTime());

    int id = folderDao.createFolder(folderX);
    assertTrue((id > 0));
    folderX.setId(id);

    Folder folderY = folderDao.getFolder(id);
    assertNotNull(folderY);
    assertEquals(folderX.getId(), folderY.getId());
    assertEquals(folderX.getName(), folderY.getName());
    assertEquals(folderX.getDescription(), folderY.getDescription());
    assertEquals(folderX.getUser().getId(), folderY.getUser().getId());
    assertNotNull(folderY.getUser().getUsername());
  }
View Full Code Here

    assertEquals(folderX.getUser().getId(), folderY.getUser().getId());
    assertNotNull(folderY.getUser().getUsername());
  }

  public void testDeleteFolder() throws Exception {
    Folder f1 = folderDao.getFolder(new User(2), "my folder1");
    assertNotNull(f1);

    List<FolderTag> fts = folderDao.findTagsInFolder(f1,0,FolderDao.SORT_BY_ALPHA,FolderDao.ASCENDING);
    assertEquals(3,fts.size());
   
    boolean delOkay = folderDao.deleteFolder(new User(2), "my folder1");
    assertTrue(delOkay);
   
    fts = folderDao.findTagsInFolder(f1,0,FolderDao.SORT_BY_ALPHA,FolderDao.ASCENDING);
    assertEquals(0,fts.size());
   
    f1 = folderDao.getFolder(new User(2), "my folder1");
    assertNull(f1);

    delOkay = folderDao.deleteFolder(new User(5), "my folder1");
    assertFalse(delOkay);

    Folder f3 = folderDao.getFolder(new User(2), "MY FOLDER1");
    assertNotNull(f3);
  }
View Full Code Here

    assertEquals(3, result.getSize());
    assertEquals(2, result.getResult().size());
  }

  public void testUpdateFolder() throws Exception {
    Folder f1 = folderDao.getFolder(new User(2), "my folder1");
    Date before = f1.getLastUpdated();

    f1.setDescription("important data");
    f1.setLastUpdated(GregorianCalendar.getInstance().getTime());
    f1.setName("my new folder1 name");
    boolean isOkay = folderDao.updateFolder(f1);
    assertTrue(isOkay);

    f1 = folderDao.getFolder(f1.getId());
    assertEquals("important data", f1.getDescription());
    assertEquals("my new folder1 name", f1.getName());
    assertTrue(before.before(f1.getLastUpdated()));
  }
View Full Code Here

    assertEquals("my new folder1 name", f1.getName());
    assertTrue(before.before(f1.getLastUpdated()));
  }

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

    List<Bookmark> bmarks = result.getResult();
    assertEquals(303, bmarks.get(0).getId());
    assertEquals(301, bmarks.get(1).getId());
    assertEquals(300, bmarks.get(2).getId());

    Bookmark bm303 = bmarks.get(0);
    assertTrue(bm303.getFolderList().contains("my folder1"));

    result = folderDao.pageBookmarks(new Folder(1), 1, 10);
    assertNotNull(result);
    assertEquals(3, result.getSize());
    assertEquals(2, result.getResult().size());

    result = folderDao.pageBookmarks(new Folder(1), 1, 1);
    assertNotNull(result);
    assertEquals(3, result.getSize());
    assertEquals(1, result.getResult().size());
  }
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.