use of com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType in project midpoint by Evolveum.
the class AbstractConfiguredModelIntegrationTest method assertLastRecomputeTimestamp.
protected void assertLastRecomputeTimestamp(String taskOid, XMLGregorianCalendar startCal, XMLGregorianCalendar endCal) throws ObjectNotFoundException, SchemaException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
PrismObject<TaskType> task = getTask(taskOid);
display("Task", task);
PrismContainer<?> taskExtension = task.getExtension();
assertNotNull("No task extension", taskExtension);
PrismProperty<XMLGregorianCalendar> lastRecomputeTimestampProp = taskExtension.findProperty(SchemaConstants.MODEL_EXTENSION_LAST_SCAN_TIMESTAMP_PROPERTY_NAME);
assertNotNull("no lastRecomputeTimestamp property", lastRecomputeTimestampProp);
XMLGregorianCalendar lastRecomputeTimestamp = lastRecomputeTimestampProp.getRealValue();
assertNotNull("null lastRecomputeTimestamp", lastRecomputeTimestamp);
TestUtil.assertBetween("lastRecomputeTimestamp", startCal, endCal, lastRecomputeTimestamp);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType in project midpoint by Evolveum.
the class TestImportRecon method test310ReconcileDummyAzureAgain.
@Test
public void test310ReconcileDummyAzureAgain() throws Exception {
final String TEST_NAME = "test310ReconcileDummyAzureAgain";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(TestImportRecon.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE);
getDummyResource().setBreakMode(BreakMode.NONE);
dummyResourceAzure.setBreakMode(BreakMode.NONE);
PrismObject<TaskType> reconTask = getTask(TASK_RECONCILE_DUMMY_AZURE_OID);
display("Recon task", reconTask);
dummyResourceAzure.purgeScriptHistory();
dummyAuditService.clear();
reconciliationTaskResultListener.clear();
// WHEN
TestUtil.displayWhen(TEST_NAME);
restartTask(TASK_RECONCILE_DUMMY_AZURE_OID);
// THEN
TestUtil.displayThen(TEST_NAME);
waitForTaskFinish(TASK_RECONCILE_DUMMY_AZURE_OID, false);
TestUtil.displayThen(TEST_NAME);
reconciliationTaskResultListener.assertResult(RESOURCE_DUMMY_AZURE_OID, 0, 1, 0, 0);
List<PrismObject<UserType>> users = modelService.searchObjects(UserType.class, null, null, task, result);
display("Users after reconcile", users);
assertImportedUserByOid(USER_ADMINISTRATOR_OID);
assertImportedUserByOid(USER_JACK_OID);
assertImportedUserByOid(USER_BARBOSSA_OID);
assertImportedUserByOid(USER_RAPP_OID, RESOURCE_DUMMY_OID, RESOURCE_DUMMY_LIME_OID);
assertImportedUserByUsername(ACCOUNT_HERMAN_DUMMY_USERNAME);
assertImportedUserByUsername(ACCOUNT_HTM_NAME, RESOURCE_DUMMY_OID);
// Otis
assertNoImporterUserByUsername(ACCOUNT_OTIS_NAME);
assertDummyAccount(RESOURCE_DUMMY_AZURE_NAME, ACCOUNT_OTIS_NAME, ACCOUNT_OTIS_FULLNAME, false);
PrismObject<UserType> userRappAfter = getUser(USER_RAPP_OID);
display("User rapp after", userRappAfter);
PrismAsserts.assertPropertyValue(userRappAfter, UserType.F_ORGANIZATIONAL_UNIT, PrismTestUtil.createPolyString("The crew of The Elaine"));
// These are protected accounts, they should not be imported
assertNoImporterUserByUsername(ACCOUNT_DAVIEJONES_DUMMY_USERNAME);
assertNoImporterUserByUsername(ACCOUNT_CALYPSO_DUMMY_USERNAME);
// Calypso is protected account. Reconciliation should not touch it
assertDummyAccountAttribute(null, ACCOUNT_CALYPSO_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, "Calypso");
assertEquals("Unexpected number of users", 11, users.size());
display("Dummy resource (azure)", dummyResourceAzure.debugDump());
assertReconAuditModifications(0, TASK_RECONCILE_DUMMY_AZURE_OID);
assertShadows(16);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType in project midpoint by Evolveum.
the class TestImportRecon method test220ReconcileDummyBrokenGuybrush.
/**
* The resource itself works, just the guybrush account is broken.
*/
@Test
public void test220ReconcileDummyBrokenGuybrush() throws Exception {
final String TEST_NAME = "test220ReconcileDummyBrokenGuybrush";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(TestImportRecon.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE);
// Lets do some local changes on dummy resource ...
DummyAccount guybrushDummyAccount = getDummyResource().getAccountByUsername(ACCOUNT_GUYBRUSH_DUMMY_USERNAME);
// location has strong outbound mapping, this change should be corrected
guybrushDummyAccount.replaceAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, "Forbidden Dodecahedron");
// BREAK it!
getDummyResource().setBreakMode(BreakMode.NONE);
guybrushDummyAccount.setModifyBreakMode(BreakMode.NETWORK);
getDummyResource().purgeScriptHistory();
dummyAuditService.clear();
reconciliationTaskResultListener.clear();
// WHEN
TestUtil.displayWhen(TEST_NAME);
restartTask(TASK_RECONCILE_DUMMY_OID);
waitForTaskFinish(TASK_RECONCILE_DUMMY_OID, false, DEFAULT_TASK_WAIT_TIMEOUT, true);
// THEN
TestUtil.displayThen(TEST_NAME);
List<PrismObject<UserType>> users = modelService.searchObjects(UserType.class, null, null, task, result);
display("Users after reconciliation (broken resource)", users);
reconciliationTaskResultListener.assertResult(RESOURCE_DUMMY_OID, 0, 7, 1, 0);
assertImportedUserByOid(USER_ADMINISTRATOR_OID);
assertImportedUserByOid(USER_JACK_OID);
assertImportedUserByOid(USER_BARBOSSA_OID);
assertImportedUserByOid(USER_GUYBRUSH_OID, RESOURCE_DUMMY_OID);
assertImportedUserByOid(USER_RAPP_OID, RESOURCE_DUMMY_OID, RESOURCE_DUMMY_LIME_OID);
assertImportedUserByUsername(ACCOUNT_HERMAN_DUMMY_USERNAME, RESOURCE_DUMMY_OID);
assertNoImporterUserByUsername(ACCOUNT_DAVIEJONES_DUMMY_USERNAME);
assertNoImporterUserByUsername(ACCOUNT_CALYPSO_DUMMY_USERNAME);
assertEquals("Unexpected number of users", 10, users.size());
display("Dummy resource", getDummyResource().debugDump());
display("Script history", getDummyResource().getScriptHistory());
ArrayList<ProvisioningScriptSpec> scripts = new ArrayList<ProvisioningScriptSpec>();
addReconScripts(scripts, ACCOUNT_HERMAN_DUMMY_USERNAME, "Herman Toothrot", false);
// Guybrush is broken.
addReconScripts(scripts, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, "Guybrush Threepwood", true, false);
addReconScripts(scripts, ACCOUNT_ELAINE_DUMMY_USERNAME, "Elaine Marley", false);
addReconScripts(scripts, USER_RAPP_USERNAME, USER_RAPP_FULLNAME, false);
addReconScripts(scripts, ACCOUNT_STAN_NAME, ACCOUNT_STAN_FULLNAME, false);
IntegrationTestTools.assertScripts(getDummyResource().getScriptHistory(), scripts.toArray(new ProvisioningScriptSpec[0]));
// Task result
PrismObject<TaskType> reconTaskAfter = getTask(TASK_RECONCILE_DUMMY_OID);
OperationResultType reconTaskResult = reconTaskAfter.asObjectable().getResult();
display("Recon task result", reconTaskResult);
TestUtil.assertStatus(reconTaskResult, OperationResultStatusType.PARTIAL_ERROR);
assertTrue("Errors not mentioned in the task message", reconTaskResult.getMessage().contains("got 1 error"));
// Check audit
display("Audit", dummyAuditService);
assertReconAuditModifications(1, TASK_RECONCILE_DUMMY_OID);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType in project midpoint by Evolveum.
the class TestUuid method test230ReconcileDummyUuidDeleteAugustusAddAugustina.
/**
* Augustus is deleted and Augustina re-added. They correlate to the same user.
* New shadow needs to be created.
*/
@Test
public void test230ReconcileDummyUuidDeleteAugustusAddAugustina() throws Exception {
final String TEST_NAME = "test230ReconcileDummyUuidDeleteAugustusAddAugustina";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(TestUuid.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE);
DummyAccount oldAccount = dummyResourceUuid.getAccountByUsername(ACCOUNT_AUGUSTUS_NAME);
dummyResourceUuid.deleteAccountByName(ACCOUNT_AUGUSTUS_NAME);
assertNoDummyAccount(ACCOUNT_AUGUSTUS_NAME, ACCOUNT_AUGUSTUS_NAME);
DummyAccount account = new DummyAccount(ACCOUNT_AUGUSTINA_NAME);
account.setEnabled(true);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, ACCOUNT_AUGUSTINA_FULLNAME);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_SHIP_NAME, USER_AUGUSTUS_NAME);
dummyResourceUuid.addAccount(account);
account = dummyResourceUuid.getAccountByUsername(ACCOUNT_AUGUSTINA_NAME);
assertFalse("Account IDs not changed", oldAccount.getId().equals(account.getId()));
display("Old shadow OID", augustusShadowOid);
display("Account ID " + oldAccount.getId() + " -> " + account.getId());
Task taskBefore = taskManager.getTask(TASK_RECONCILE_DUMMY_UUID_OID, result);
getDummyResource().purgeScriptHistory();
dummyAuditService.clear();
rememberShadowFetchOperationCount();
reconciliationTaskResultListener.clear();
// WHEN
TestUtil.displayWhen(TEST_NAME);
restartTask(TASK_RECONCILE_DUMMY_UUID_OID);
// THEN
TestUtil.displayThen(TEST_NAME);
waitForTaskNextRunAssertSuccess(taskBefore, true);
// THEN
TestUtil.displayThen(TEST_NAME);
reconciliationTaskResultListener.assertResult(RESOURCE_DUMMY_UUID_OID, 0, 1, 0, 0);
List<PrismObject<UserType>> users = modelService.searchObjects(UserType.class, null, null, task, result);
display("Users after import", users);
assertImportedUserByOid(USER_ADMINISTRATOR_OID);
assertImportedUserByOid(USER_JACK_OID);
assertImportedUserByOid(USER_BARBOSSA_OID);
assertImportedUserByUsername(USER_AUGUSTUS_NAME, RESOURCE_DUMMY_UUID_OID);
assertDummyAccountAttribute(RESOURCE_DUMMY_UUID_NAME, ACCOUNT_AUGUSTINA_NAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, ACCOUNT_AUGUSTINA_FULLNAME);
assertEquals("Unexpected number of users", 6, users.size());
display("Dummy resource", getDummyResource().debugDump());
assertReconAuditModifications(1, TASK_RECONCILE_DUMMY_UUID_OID);
// Task result
PrismObject<TaskType> reconTaskAfter = getTask(TASK_RECONCILE_DUMMY_UUID_OID);
OperationResultType reconTaskResult = reconTaskAfter.asObjectable().getResult();
display("Recon task result", reconTaskResult);
TestUtil.assertSuccess(reconTaskResult);
PrismObject<UserType> user = findUserByUsername(USER_AUGUSTUS_NAME);
display("Augustus after recon", user);
String newAugustusShadowOid = getSingleLinkOid(user);
PrismObject<ShadowType> repoShadow = repositoryService.getObject(ShadowType.class, newAugustusShadowOid, null, result);
assertFalse("Shadow OID is not changed", augustusShadowOid.equals(newAugustusShadowOid));
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType in project midpoint by Evolveum.
the class TestUuid method test200ReconcileDummyUuid.
@Test
public void test200ReconcileDummyUuid() throws Exception {
final String TEST_NAME = "test200ReconcileDummyUuid";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(TestUuid.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE);
// TODO
getDummyResource().purgeScriptHistory();
dummyAuditService.clear();
rememberShadowFetchOperationCount();
reconciliationTaskResultListener.clear();
// WHEN
TestUtil.displayWhen(TEST_NAME);
importObjectFromFile(TASK_RECONCILE_DUMMY_UUID_FILE);
// THEN
TestUtil.displayThen(TEST_NAME);
waitForTaskFinish(TASK_RECONCILE_DUMMY_UUID_OID, false);
// THEN
TestUtil.displayThen(TEST_NAME);
reconciliationTaskResultListener.assertResult(RESOURCE_DUMMY_UUID_OID, 0, 0, 0, 0);
List<PrismObject<UserType>> users = modelService.searchObjects(UserType.class, null, null, task, result);
display("Users after import", users);
assertImportedUserByOid(USER_ADMINISTRATOR_OID);
assertImportedUserByOid(USER_JACK_OID);
assertImportedUserByOid(USER_BARBOSSA_OID);
assertEquals("Unexpected number of users", 5, users.size());
display("Dummy resource", getDummyResource().debugDump());
assertReconAuditModifications(0, TASK_RECONCILE_DUMMY_UUID_OID);
// Task result
PrismObject<TaskType> reconTaskAfter = getTask(TASK_RECONCILE_DUMMY_UUID_OID);
OperationResultType reconTaskResult = reconTaskAfter.asObjectable().getResult();
display("Recon task result", reconTaskResult);
TestUtil.assertSuccess(reconTaskResult);
}
Aggregations