use of org.apache.jackrabbit.oak.util.NodeUtil in project jackrabbit-oak by apache.
the class ValidatorNoProtectionTest method testRepExternalIdMultiple.
@Override
@Test
public void testRepExternalIdMultiple() throws Exception {
Root systemRoot = getSystemRoot();
NodeUtil n = new NodeUtil(systemRoot.getTree(testUserPath));
n.setStrings(ExternalIdentityConstants.REP_EXTERNAL_ID, "id", "id2");
systemRoot.commit();
}
use of org.apache.jackrabbit.oak.util.NodeUtil in project jackrabbit-oak by apache.
the class ExternalIdentityValidatorTest method testRemoveRepExternalIdAsSystem.
@Test
public void testRemoveRepExternalIdAsSystem() throws Exception {
Root systemRoot = getSystemRoot();
try {
NodeUtil n = new NodeUtil(systemRoot.getTree(externalUserPath));
n.removeProperty(ExternalIdentityConstants.REP_EXTERNAL_ID);
systemRoot.commit();
fail("Removing rep:externalId is not allowed if rep:externalPrincipalNames is present.");
} catch (CommitFailedException e) {
// success
assertEquals(73, e.getCode());
} finally {
systemRoot.refresh();
}
}
use of org.apache.jackrabbit.oak.util.NodeUtil in project jackrabbit-oak by apache.
the class ExternalIdentityValidatorTest method testRepExternalIdMultiple.
@Test
public void testRepExternalIdMultiple() throws Exception {
Root systemRoot = getSystemRoot();
try {
NodeUtil n = new NodeUtil(systemRoot.getTree(testUserPath));
n.setStrings(ExternalIdentityConstants.REP_EXTERNAL_ID, "id", "id2");
systemRoot.commit();
fail("Creating rep:externalId as multiple STRING property must be detected.");
} catch (CommitFailedException e) {
// success
assertEquals(75, e.getCode());
} finally {
systemRoot.refresh();
}
}
use of org.apache.jackrabbit.oak.util.NodeUtil in project jackrabbit-oak by apache.
the class AccessControlValidatorTest method testInvalidRestriction.
@Test
public void testInvalidRestriction() throws Exception {
NodeUtil restriction = createAcl().getChild(aceName).getChild(REP_RESTRICTIONS);
restriction.setString("invalid", "value");
try {
root.commit();
fail("Creating an unsupported restriction should fail.");
} catch (CommitFailedException e) {
// success
assertTrue(e.isAccessControlViolation());
assertThat(e.getMessage(), containsString("/testRoot/rep:policy"));
}
}
use of org.apache.jackrabbit.oak.util.NodeUtil in project jackrabbit-oak by apache.
the class TreeLocationTest method setUp.
@Before
public void setUp() throws Exception {
Tree tree = root.getTree("/");
tree.setProperty("a", 1);
tree.setProperty("b", 2);
tree.setProperty("c", 3);
NodeUtil n = new NodeUtil(tree);
n.addChild("x", JcrConstants.NT_UNSTRUCTURED);
n.addChild("y", JcrConstants.NT_UNSTRUCTURED);
n.addChild("z", JcrConstants.NT_UNSTRUCTURED).addChild("1", JcrConstants.NT_UNSTRUCTURED).addChild("2", JcrConstants.NT_UNSTRUCTURED).setString("p", "v");
root.commit();
nullLocation = TreeLocation.create(root).getParent();
}
Aggregations