public void testCreateDuplicateGroup() throws RepositoryException, NotExecutableException { Principal p = getTestPrincipal(); Group gr = createGroup(p); createdGroups.add(gr); try { Group gr2 = createGroup(p); createdGroups.add(gr2); fail("Creating 2 groups with the same Principal should throw AuthorizableExistsException."); } catch (AuthorizableExistsException e) { // success. } }
public void testCreateGroup() throws RepositoryException, NotExecutableException { Principal p = getTestPrincipal(); Group gr = createGroup(p); createdGroups.add(gr); assertNotNull(gr.getID()); assertEquals(p.getName(), gr.getPrincipal().getName()); assertFalse("A new group must not have members.",gr.getMembers().hasNext()); }
public void testCreateGroupWithPath() throws RepositoryException, NotExecutableException { Principal p = getTestPrincipal(); Group gr = createGroup(p, "/any/path/to/the/new/group"); createdGroups.add(gr); assertNotNull(gr.getID()); assertEquals(p.getName(), gr.getPrincipal().getName()); assertFalse("A new group must not have members.",gr.getMembers().hasNext()); }
public void testAutoSave() throws RepositoryException { boolean autosave = userMgr.isAutoSave(); if (autosave) { try { userMgr.autoSave(false); autosave = false; } catch (RepositoryException e) { // cannot change autosave behavior // ignore -> test will behave differently. } } Principal p = getTestPrincipal(); Group gr = userMgr.createGroup(p); String id = gr.getID(); superuser.refresh(false); if (!autosave) { // transient changes must be gone after the refresh-call. assertNull(userMgr.getAuthorizable(id)); assertNull(userMgr.getAuthorizable(p)); } else { // no transient changes as autosave could not be disabled. createdGroups.add(gr); assertNotNull(userMgr.getAuthorizable(id)); assertNotNull(userMgr.getAuthorizable(p)); } } }