public void testDeclaredMemberOf() throws NotExecutableException, RepositoryException { Authorizable auth = getTestUser(superuser); Iterator<Group> it = auth.declaredMemberOf(); while (it.hasNext()) { Object group = it.next(); assertTrue(group instanceof Group); } }
public void testMemberOf() throws NotExecutableException, RepositoryException { Authorizable auth = getTestUser(superuser); Iterator<Group> it = auth.memberOf(); while (it.hasNext()) { Object group = it.next(); assertTrue(group instanceof Group); } }
found = propName.equals(it.next()); assertTrue(found); found = propName.equals(it.next()); assertTrue(found); assertTrue(auth.hasProperty(propName)); assertTrue(auth.hasProperty("./" + propName)); assertTrue(auth.removeProperty(propName)); assertFalse(auth.hasProperty(propName));
found = propName.equals(it.next()); assertTrue(found); found = propName.equals(it.next()); assertTrue(found); assertTrue(auth.hasProperty(propName)); assertTrue(auth.hasProperty("./" + propName)); assertTrue(auth.getProperty(propName).length == 1); assertTrue(auth.removeProperty(propName)); assertFalse(auth.hasProperty(propName));
public void testSetPropertyByRelPath() throws NotExecutableException, RepositoryException { Authorizable auth = getTestUser(superuser); Value[] v = new Value[] {superuser.getValueFactory().createValue("Super User")}; List<String> relPaths = new ArrayList<String>(); relPaths.add("testing/Fullname"); relPaths.add("testing/Email"); relPaths.add("testing/testing/testing/Fullname"); relPaths.add("testing/testing/testing/Email"); for (String relPath : relPaths) { try { auth.setProperty(relPath, v); save(superuser); assertTrue(auth.hasProperty(relPath)); String propName = Text.getName(relPath); assertFalse(auth.hasProperty(propName)); } finally { // try to remove the property even if previous calls failed. auth.removeProperty(relPath); save(superuser); } } }
assertNull(auth.getProperty(name)); assertTrue(auth.hasProperty(rp)); assertNotNull(auth.getProperty(rp)); assertNull(auth.getProperty(name)); assertTrue(auth.hasProperty(rp)); assertNotNull(auth.getProperty(rp));
public void testGetPropertyNames() throws NotExecutableException, RepositoryException { Authorizable auth = getTestUser(superuser); // TODO: retrieve propname and value from config String propName = "Fullname"; Value v = superuser.getValueFactory().createValue("Super User"); try { auth.setProperty(propName, v); save(superuser); } catch (RepositoryException e) { throw new NotExecutableException("Cannot test 'Authorizable.setProperty'."); } try { for (Iterator<String> it = auth.getPropertyNames(); it.hasNext();) { String name = it.next(); assertTrue(auth.hasProperty(name)); assertNotNull(auth.getProperty(name)); } } finally { // try to remove the property again even if previous calls failed. auth.removeProperty(propName); save(superuser); } }