public void testSetSpecialPropertiesDirectly() throws NotExecutableException, RepositoryException {
AuthorizableImpl user = (AuthorizableImpl) getTestUser(superuser);
NodeImpl n = user.getNode();
try {
String pName = user.getPrincipalName();
n.setProperty(UserConstants.P_PRINCIPAL_NAME, new StringValue("any-value"));
// should have failed => change value back.
n.setProperty(UserConstants.P_PRINCIPAL_NAME, new StringValue(pName));
fail("Attempt to change protected property rep:principalName should fail.");
} catch (ConstraintViolationException e) {
// ok.
}
try {
String imperson = "anyimpersonator";
n.setProperty(
UserConstants.P_IMPERSONATORS,
new Value[] {new StringValue(imperson)},
PropertyType.STRING);
fail("Attempt to change protected property rep:impersonators should fail.");
} catch (ConstraintViolationException e) {
// ok.
}