public void testSetSpecialPropertiesDirectly() throws NotExecutableException, RepositoryException {
AuthorizableImpl user = (AuthorizableImpl) getTestUser(superuser);
Node n = user.getNode();
try {
String pName = user.getPrincipalName();
n.setProperty(UserConstants.REP_PRINCIPAL_NAME, new StringValue("any-value"));
// should have failed => change value back.
n.setProperty(UserConstants.REP_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.REP_IMPERSONATORS,
new Value[] {new StringValue(imperson)},
PropertyType.STRING);
fail("Attempt to change protected property rep:impersonators should fail.");
} catch (ConstraintViolationException e) {
// ok.
}