use of org.apache.jackrabbit.oak.util.NodeUtil in project jackrabbit-oak by apache.
the class PermissionProviderImplTest method before.
@Override
public void before() throws Exception {
super.before();
new NodeUtil(root.getTree("/")).addChild("test", JcrConstants.NT_UNSTRUCTURED);
UserManager uMgr = getUserManager(root);
adminstrators = uMgr.createGroup(ADMINISTRATOR_GROUP);
root.commit();
config = getSecurityProvider().getConfiguration(AuthorizationConfiguration.class);
}
use of org.apache.jackrabbit.oak.util.NodeUtil in project jackrabbit-oak by apache.
the class CugValidatorTest method testChangePrimaryTypeOfCug.
@Test
public void testChangePrimaryTypeOfCug() throws Exception {
node.setNames(JcrConstants.JCR_MIXINTYPES, MIX_REP_CUG_MIXIN);
NodeUtil cug = node.addChild(REP_CUG_POLICY, NT_REP_CUG_POLICY);
cug.setStrings(REP_PRINCIPAL_NAMES, EveryonePrincipal.NAME);
root.commit();
try {
cug.setName(JcrConstants.JCR_PRIMARYTYPE, NodeTypeConstants.NT_OAK_UNSTRUCTURED);
root.commit();
fail();
} catch (CommitFailedException e) {
assertTrue(e.isAccessControlViolation());
assertEquals(21, e.getCode());
}
}
use of org.apache.jackrabbit.oak.util.NodeUtil in project jackrabbit-oak by apache.
the class CugValidatorTest method testMissingMixin.
@Test
public void testMissingMixin() throws Exception {
NodeUtil cug = node.addChild(REP_CUG_POLICY, NT_REP_CUG_POLICY);
cug.setStrings(REP_PRINCIPAL_NAMES, EveryonePrincipal.NAME);
try {
root.commit();
fail();
} catch (CommitFailedException e) {
assertTrue(e.isAccessControlViolation());
assertEquals(22, e.getCode());
} finally {
root.refresh();
}
}
use of org.apache.jackrabbit.oak.util.NodeUtil in project jackrabbit-oak by apache.
the class CugUtilTest method testHasCugNodeState.
@Test
public void testHasCugNodeState() throws Exception {
assertTrue(CugUtil.hasCug(getNodeState(root.getTree(SUPPORTED_PATH))));
assertFalse(CugUtil.hasCug((NodeState) null));
for (String path : new String[] { PathUtils.ROOT_PATH, INVALID_PATH, UNSUPPORTED_PATH, SUPPORTED_PATH + "/subtree", SUPPORTED_PATH2, SUPPORTED_PATH3 }) {
assertFalse(CugUtil.hasCug(getNodeState(root.getTree(path))));
}
new NodeUtil(root.getTree(SUPPORTED_PATH2)).addChild(REP_CUG_POLICY, NodeTypeConstants.NT_OAK_UNSTRUCTURED);
assertTrue(CugUtil.hasCug(getNodeState(root.getTree(SUPPORTED_PATH2))));
}
use of org.apache.jackrabbit.oak.util.NodeUtil in project jackrabbit-oak by apache.
the class NestedCugHookTest method testMoveToSupportedPath.
@Test
public void testMoveToSupportedPath() throws Exception {
createCug(root, SUPPORTED_PATH3, EveryonePrincipal.NAME);
Tree newTree = new NodeUtil(root.getTree(SUPPORTED_PATH3)).addChild("child", NT_OAK_UNSTRUCTURED).getTree();
String path = newTree.getPath();
createCug(path, getTestGroupPrincipal());
root.commit();
String destPath = PathUtils.concat(SUPPORTED_PATH, "moved");
root.move(path, destPath);
root.commit();
assertNestedCugs(root, SUPPORTED_PATH3, true);
assertNestedCugs(root, ROOT_PATH, false, SUPPORTED_PATH3, destPath);
}
Aggregations