use of org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class ImpersonationImplTest method testModifyOwnImpersonation.
public void testModifyOwnImpersonation() throws RepositoryException, NotExecutableException {
User u = (User) uMgr.getAuthorizable(uID);
if (!uSession.hasPermission(((UserImpl) u).getNode().getPath(), "set_property")) {
throw new NotExecutableException("Users should be able to modify their properties -> Check repository config.");
}
Principal otherP = uMgr.getAuthorizable(otherUID).getPrincipal();
Impersonation impers = u.getImpersonation();
assertFalse(impers.allows(buildSubject(otherP)));
assertTrue(impers.grantImpersonation(otherP));
save(uSession);
assertTrue(impers.allows(buildSubject(otherP)));
assertTrue(impers.revokeImpersonation(otherP));
save(uSession);
assertFalse(impers.allows(buildSubject(otherP)));
}
use of org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class NodeResolverTest method createNodeResolver.
protected NodeResolver createNodeResolver(Session session) throws NotExecutableException, RepositoryException {
if (!(session instanceof SessionImpl)) {
throw new NotExecutableException();
}
NodeResolver resolver = createNodeResolver((SessionImpl) session);
UserManager umr = ((SessionImpl) session).getUserManager();
if (umr instanceof UserManagerImpl) {
UserManagerImpl uImpl = (UserManagerImpl) umr;
resolver.setSearchRoots(uImpl.getUsersPath(), uImpl.getGroupsPath());
}
return resolver;
}
use of org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class NodeResolverTest method testFindNodesWithNonExistingSearchRoot.
public void testFindNodesWithNonExistingSearchRoot() throws NotExecutableException, RepositoryException {
String searchRoot = nodeResolver.getSearchRoot(UserConstants.NT_REP_AUTHORIZABLE);
if (superuser.nodeExists(searchRoot)) {
throw new NotExecutableException();
}
NodeIterator result = nodeResolver.findNodes(UserConstants.P_PRINCIPAL_NAME, "anyValue", UserConstants.NT_REP_AUTHORIZABLE, true);
assertNotNull(result);
assertFalse(result.hasNext());
}
use of org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class NodeResolverTest method testFindNodeWithNonExistingSearchRoot.
public void testFindNodeWithNonExistingSearchRoot() throws NotExecutableException, RepositoryException {
String searchRoot = nodeResolver.getSearchRoot(UserConstants.NT_REP_AUTHORIZABLE_FOLDER);
SessionImpl sImpl = (SessionImpl) superuser;
if (sImpl.nodeExists(searchRoot)) {
throw new NotExecutableException();
}
Node result = nodeResolver.findNode(sImpl.getQName(UserConstants.GROUP_ADMIN_GROUP_NAME), UserConstants.NT_REP_AUTHORIZABLE);
assertNull(result);
}
use of org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class LockTest method setUpSameNameSiblings.
/**
* Create three child nodes with identical names
*/
private Node setUpSameNameSiblings() throws RepositoryException, NotExecutableException {
// create three lockable nodes with same name
try {
Node testNode = testRootNode.addNode(nodeName1, testNodeType);
ensureMixinType(testNode, mixLockable);
testNode = testRootNode.addNode(nodeName1, testNodeType);
ensureMixinType(testNode, mixLockable);
testNode = testRootNode.addNode(nodeName1, testNodeType);
ensureMixinType(testNode, mixLockable);
testRootNode.getSession().save();
return testNode;
} catch (ItemExistsException ex) {
// repository does not seem to support same name siblings on this node type
throw new NotExecutableException("Node type " + testNodeType + " does not support same-name-siblings");
}
}
Aggregations