use of com.evolveum.midpoint.schema.processor.ResourceAttributeDefinition in project midpoint by Evolveum.
the class AbstractEDirTest method test240ModifyAccountBarbossaPasswordAllowChangeFalse.
/**
* passwordAllowChange is a boolean attribute
*/
@Test
public void test240ModifyAccountBarbossaPasswordAllowChangeFalse() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
ObjectDelta<ShadowType> delta = prismContext.deltaFactory().object().createEmptyModifyDelta(ShadowType.class, accountBarbossaOid);
QName attrQName = new QName(MidPointConstants.NS_RI, "passwordAllowChange");
// noinspection unchecked
ResourceAttributeDefinition<Boolean> attrDef = (ResourceAttributeDefinition<Boolean>) accountDefinition.findAttributeDefinition(attrQName);
PropertyDelta<Boolean> attrDelta = prismContext.deltaFactory().property().createModificationReplaceProperty(ItemPath.create(ShadowType.F_ATTRIBUTES, attrQName), attrDef, Boolean.FALSE);
delta.addModification(attrDelta);
// WHEN
when();
modelService.executeChanges(MiscSchemaUtil.createCollection(delta), null, task, result);
// THEN
then();
result.computeStatus();
TestUtil.assertSuccess(result);
Entry entry = assertLdapAccount(USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME);
assertAttribute(entry, "passwordAllowChange", "FALSE");
PrismObject<UserType> user = getUser(USER_BARBOSSA_OID);
String shadowOid = getSingleLinkOid(user);
assertEquals("Shadows have moved", accountBarbossaOid, shadowOid);
PrismObject<ShadowType> shadow = getObject(ShadowType.class, shadowOid);
display("Shadow after", shadow);
assertPasswordAllowChange(shadow, false);
}
use of com.evolveum.midpoint.schema.processor.ResourceAttributeDefinition in project midpoint by Evolveum.
the class AbstractLdapConnTest method test213ModifyAccountBarbossaAddTitleDuplicateCapitalized.
/**
* Make another duplicate modification. Add a title value that is already there,
* but with a different capitalization.
*/
@Test
public void test213ModifyAccountBarbossaAddTitleDuplicateCapitalized() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
ObjectDelta<ShadowType> delta = prismContext.deltaFactory().object().createEmptyModifyDelta(ShadowType.class, accountBarbossaOid);
QName attrQName = new QName(MidPointConstants.NS_RI, "title");
// noinspection unchecked
ResourceAttributeDefinition<String> attrDef = (ResourceAttributeDefinition<String>) accountDefinition.findAttributeDefinition(attrQName);
PropertyDelta<String> attrDelta = prismContext.deltaFactory().property().createModificationAddProperty(ItemPath.create(ShadowType.F_ATTRIBUTES, attrQName), attrDef, "CAPTAIN");
delta.addModification(attrDelta);
// WHEN
when();
modelService.executeChanges(MiscSchemaUtil.createCollection(delta), null, task, result);
// THEN
then();
result.computeStatus();
TestUtil.assertSuccess(result);
Entry entry = assertLdapAccount(USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME);
assertAttribute(entry, "title", "Captain");
PrismObject<UserType> user = getUser(USER_BARBOSSA_OID);
String shadowOid = getSingleLinkOid(user);
assertEquals("Shadows have moved", accountBarbossaOid, shadowOid);
assertLdapConnectorReasonableInstances();
}
Aggregations