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 refereeName = "anyreferee";
n.setProperty(UserConstants.P_REFEREES, new Value[] {new StringValue(refereeName)});
fail("Attempt to change protected property rep:referees should fail.");
} catch (ConstraintViolationException e) {
// ok.
}
try {
String imperson = "anyimpersonator";
n.setProperty(UserConstants.P_IMPERSONATORS, new Value[] {new StringValue(imperson)});
fail("Attempt to change protected property rep:impersonators should fail.");
} catch (ConstraintViolationException e) {
// ok.
}
}