use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.
the class TestOpenDj method test170DisableAccount.
@Test
public void test170DisableAccount() throws Exception {
final String TEST_NAME = "test170DisableAccount";
TestUtil.displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
ShadowType object = parseObjectType(ACCOUNT_DISABLE_SIMULATED_FILE, ShadowType.class);
System.out.println(SchemaDebugUtil.prettyPrint(object));
System.out.println(object.asPrismObject().debugDump());
String addedObjectOid = provisioningService.addObject(object.asPrismObject(), null, null, taskManager.createTaskInstance(), result);
assertEquals(ACCOUNT_DISABLE_SIMULATED_OID, addedObjectOid);
ObjectModificationType objectChange = PrismTestUtil.parseAtomicValue(REQUEST_DISABLE_ACCOUNT_SIMULATED_FILE, ObjectModificationType.COMPLEX_TYPE);
ObjectDelta<ShadowType> delta = DeltaConvertor.createObjectDelta(objectChange, object.asPrismObject().getDefinition());
display("Object change", delta);
// WHEN
TestUtil.displayWhen(TEST_NAME);
provisioningService.modifyObject(ShadowType.class, objectChange.getOid(), delta.getModifications(), null, null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
ShadowType accountType = provisioningService.getObject(ShadowType.class, ACCOUNT_DISABLE_SIMULATED_OID, null, taskManager.createTaskInstance(), result).asObjectable();
display("Object after change", accountType);
assertEquals("The account was not disabled in the shadow", ActivationStatusType.DISABLED, accountType.getActivation().getAdministrativeStatus());
String uid = ShadowUtil.getSingleStringAttributeValue(accountType, getPrimaryIdentifierQName());
assertNotNull(uid);
// Check if object was modified in LDAP
Entry response = openDJController.searchAndAssertByEntryUuid(uid);
display("LDAP account", response);
String disabled = openDJController.getAttributeValue(response, "ds-pwp-account-disabled");
assertNotNull("no ds-pwp-account-disabled attribute in account " + uid, disabled);
display("ds-pwp-account-disabled after change: " + disabled);
assertEquals("ds-pwp-account-disabled not set to \"TRUE\"", "TRUE", disabled);
PrismObject<ShadowType> repoShadow = repositoryService.getObject(ShadowType.class, ACCOUNT_DISABLE_SIMULATED_OID, null, result);
ActivationType repoActivation = repoShadow.asObjectable().getActivation();
assertNotNull("No activation in repo", repoActivation);
XMLGregorianCalendar repoDisableTimestamp = repoActivation.getDisableTimestamp();
assertNotNull("No activation disableTimestamp in repo", repoDisableTimestamp);
assertEquals("Wrong activation disableTimestamp in repo", XmlTypeConverter.createXMLGregorianCalendar(2001, 2, 3, 4, 5, 6), repoDisableTimestamp);
}
Aggregations