public void testCreateUserWithEmptyPassword() throws RepositoryException, NotExecutableException { Principal p = getTestPrincipal(); User user = createUser(p.getName(), ""); createdUsers.add(user); }
/** * Test for changed behavior that allows creating of users with 'null' password. * * @since Jackrabbit 2.7 */ public void testCreateUserWithNullPassword() throws RepositoryException, NotExecutableException { Principal p = getTestPrincipal(); User user = createUser(p.getName(), null); createdUsers.add(user); }
public void testCreateUserWithNullPrincipal() throws RepositoryException { try { Principal p = getTestPrincipal(); String uid = p.getName(); User user = createUser(uid, buildPassword(uid), null, "/a/b/c"); createdUsers.add(user); fail("A User cannot be built with 'null' Principal"); } catch (Exception e) { // ok } }
public void testCreateTwiceWithSamePrincipal() throws RepositoryException, NotExecutableException { Principal p = getTestPrincipal(); String uid = p.getName(); User user = createUser(uid, buildPassword(uid), p, "a/b/c"); createdUsers.add(user); try { uid = getTestPrincipal().getName(); User user2 = createUser(uid, buildPassword(uid), p, null); createdUsers.add(user2); fail("Creating 2 users with the same Principal should throw AuthorizableExistsException."); } catch (AuthorizableExistsException e) { // success. } }
public void testCreateUserWithDifferentPrincipalName() throws RepositoryException, NotExecutableException { Principal p = getTestPrincipal(); String uid = getTestPrincipal().getName(); User user = createUser(uid, buildPassword(uid), p, "/any/path/to/the/new/user"); createdUsers.add(user); assertNotNull(user.getID()); assertEquals(p.getName(), user.getPrincipal().getName()); }
public void testCreateUserWithPath2() throws RepositoryException, NotExecutableException { Principal p = getTestPrincipal(); String uid = p.getName(); User user = createUser(uid, buildPassword(uid), p, "any/path"); createdUsers.add(user); assertNotNull(user.getID()); assertEquals(p.getName(), user.getPrincipal().getName()); }
public void testCreateTwiceWithSameUserID() throws RepositoryException, NotExecutableException { String uid = getTestPrincipal().getName(); User user = createUser(uid, buildPassword(uid)); createdUsers.add(user); try { User user2 = createUser(uid, buildPassword("anyPW")); createdUsers.add(user2); fail("Creating 2 users with the same UserID should throw AuthorizableExistsException."); } catch (AuthorizableExistsException e) { // success. } }
public void testCreateUserWithEmptyPrincipal() throws RepositoryException { try { Principal p = getTestPrincipal(""); String uid = p.getName(); User user = createUser(uid, buildPassword(uid), p, "/a/b/c"); createdUsers.add(user); fail("A User cannot be built with ''-named Principal"); } catch (Exception e) { // ok } try { Principal p = getTestPrincipal(null); String uid = p.getName(); User user = createUser(uid, buildPassword(uid), p, "/a/b/c"); createdUsers.add(user); fail("A User cannot be built with ''-named Principal"); } catch (Exception e) { // ok } }
public void testCreateUser() throws RepositoryException, NotExecutableException { Principal p = getTestPrincipal(); String uid = p.getName(); User user = createUser(uid, buildPassword(uid)); createdUsers.add(user); assertNotNull(user.getID()); assertEquals(p.getName(), user.getPrincipal().getName()); }
public void testCreateUserWithPath() throws RepositoryException, NotExecutableException { Principal p = getTestPrincipal(); String uid = p.getName(); User user = createUser(uid, buildPassword(uid), p, "/any/path/to/the/new/user"); createdUsers.add(user); assertNotNull(user.getID()); assertEquals(p.getName(), user.getPrincipal().getName()); }
public void testCreateUserWithEmptyUserID() throws RepositoryException { try { User user = createUser("", "anyPW"); createdUsers.add(user); fail("A User cannot be built with \"\" userID"); } catch (Exception e) { // ok } try { User user = createUser("", "anyPW", getTestPrincipal(), null); createdUsers.add(user); fail("A User cannot be built with \"\" userID"); } catch (Exception e) { // ok } }
public void testGetUserAfterCreation() throws RepositoryException, NotExecutableException { Principal p = getTestPrincipal(); String uid = p.getName(); User user = createUser(uid, buildPassword(uid)); createdUsers.add(user); assertNotNull(userMgr.getAuthorizable(user.getID())); assertNotNull(userMgr.getAuthorizable(p)); }
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(); String uid = p.getName(); User user = userMgr.createUser(uid, buildPassword(uid)); superuser.refresh(false); if (!autosave) { // transient changes must be gone after the refresh-call. assertNull(userMgr.getAuthorizable(uid)); assertNull(userMgr.getAuthorizable(p)); } else { // changes are persisted automatically -> must not be gone. createdUsers.add(user); assertNotNull(userMgr.getAuthorizable(uid)); assertNotNull(userMgr.getAuthorizable(p)); } } }