public void testAddGroupToRole() { createRole(); try { roleDAO.addGroupToRole(group, role); assertTrue(roleDAO.getRolesForGroupName(group.getGroupName()).contains(role)); } catch (DataAccessException e) { rollback(); } rollback(); }
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(); }
/** Roll back if role was added */ private void rollback() { try { roleDAO.remove(role); } catch (DataAccessException e) { e.printStackTrace(); fail(); } }
public void testGetRolesForGroupName() { try { assertTrue( roleDAO.getRolesForGroupName("Everyone").contains(new RoleTO("Authenticated_users"))); } catch (DataAccessException e) { e.printStackTrace(); fail(); } }
public void testGetAllRoles() { try { assertNotNull(roleDAO.getAllRoles()); } catch (DataAccessException e) { e.printStackTrace(); fail(); } }
/** Utility method for adding a user */ private void createRole() { try { roleDAO.create(role); } catch (DataAccessException e) { rollback(); e.printStackTrace(); fail(); } }
public void testCreateAndRemove() { createRole(); try { assertTrue(roleDAO.getAllRoles().contains(role)); } catch (DataAccessException e) { e.printStackTrace(); } rollback(); }