Exemplo n.º 1
0
 public void testAddGroupToRole() {
   createRole();
   try {
     roleDAO.addGroupToRole(group, role);
     assertTrue(roleDAO.getRolesForGroupName(group.getGroupName()).contains(role));
   } catch (DataAccessException e) {
     rollback();
   }
   rollback();
 }
Exemplo n.º 2
0
  public void testRemoveGroupFromRole() {
    System.out.println("one");
    createRole();

    try {
      roleDAO.addGroupToRole(group, role);
      assertTrue(roleDAO.getRolesForGroupName(group.getGroupName()).contains(role));
      roleDAO.removeGroupFromRole(group, role);
      assertFalse(roleDAO.getRolesForGroupName(group.getGroupName()).contains(role));
    } catch (DataAccessException e) {
      e.printStackTrace();
      rollback();
      fail();
    }
    rollback();
  }
Exemplo n.º 3
0
 /** Roll back if role was added */
 private void rollback() {
   try {
     roleDAO.remove(role);
   } catch (DataAccessException e) {
     e.printStackTrace();
     fail();
   }
 }
Exemplo n.º 4
0
 public void testGetRolesForGroupName() {
   try {
     assertTrue(
         roleDAO.getRolesForGroupName("Everyone").contains(new RoleTO("Authenticated_users")));
   } catch (DataAccessException e) {
     e.printStackTrace();
     fail();
   }
 }
Exemplo n.º 5
0
  public void testGetAllRoles() {
    try {

      assertNotNull(roleDAO.getAllRoles());
    } catch (DataAccessException e) {
      e.printStackTrace();
      fail();
    }
  }
Exemplo n.º 6
0
 /** Utility method for adding a user */
 private void createRole() {
   try {
     roleDAO.create(role);
   } catch (DataAccessException e) {
     rollback();
     e.printStackTrace();
     fail();
   }
 }
Exemplo n.º 7
0
  public void testCreateAndRemove() {

    createRole();
    try {
      assertTrue(roleDAO.getAllRoles().contains(role));
    } catch (DataAccessException e) {
      e.printStackTrace();
    }
    rollback();
  }