use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.
the class TestMapping method test100ModifyUserAssignAccountDummyBlue.
/**
* Blue dummy has WEAK mappings. Let's play a bit with that.
*/
@Test
public void test100ModifyUserAssignAccountDummyBlue() throws Exception {
final String TEST_NAME = "test100ModifyUserJackAssignAccountDummyBlue";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestMapping.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
dummyAuditService.clear();
// WHEN
TestUtil.displayWhen(TEST_NAME);
assignAccount(USER_JACK_OID, RESOURCE_DUMMY_BLUE_OID, null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess("executeChanges result", result);
PrismObject<UserType> userJack = getUser(USER_JACK_OID);
display("User after change execution", userJack);
assertUserJack(userJack);
String accountOid = getSingleLinkOid(userJack);
// Check shadow
PrismObject<ShadowType> accountShadow = repositoryService.getObject(ShadowType.class, accountOid, null, result);
assertAccountShadowRepo(accountShadow, accountOid, ACCOUNT_JACK_DUMMY_USERNAME, resourceDummyBlueType);
// Check account
PrismObject<ShadowType> accountModel = modelService.getObject(ShadowType.class, accountOid, null, task, result);
assertAccountShadowModel(accountModel, accountOid, ACCOUNT_JACK_DUMMY_USERNAME, resourceDummyBlueType);
// Check account in dummy resource
assertDummyAccount(RESOURCE_DUMMY_BLUE_NAME, ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true);
assertDummyAccountAttribute(RESOURCE_DUMMY_BLUE_NAME, ACCOUNT_JACK_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, "SystemConfiguration");
DummyAccount accountJackBlue = dummyResourceBlue.getAccountByUsername(ACCOUNT_JACK_DUMMY_USERNAME);
String drinkBlue = accountJackBlue.getAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME);
assertNotNull("No blue drink", drinkBlue);
UUID drinkUuidBlue = UUID.fromString(drinkBlue);
assertNotNull("No drink UUID", drinkUuidBlue);
display("Drink UUID", drinkUuidBlue.toString());
assertAccountShip(userJack, ACCOUNT_JACK_DUMMY_FULLNAME, null, dummyResourceCtlBlue, task);
assertDummyAccountAttribute(RESOURCE_DUMMY_BLUE_NAME, USER_JACK_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_QUOTE_NAME, "Where's the rum? -- Jack Sparrow");
// Check audit
display("Audit", dummyAuditService);
dummyAuditService.assertRecords(2);
dummyAuditService.assertSimpleRecordSanity();
dummyAuditService.assertAnyRequestDeltas();
dummyAuditService.assertExecutionDeltas(3);
dummyAuditService.assertHasDelta(ChangeType.MODIFY, UserType.class);
dummyAuditService.assertHasDelta(ChangeType.ADD, ShadowType.class);
dummyAuditService.assertExecutionSuccess();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.
the class TestMapping method test139DeleteAccountRed.
/**
* Note: red resource disables account on unsassign, does NOT delete it
* So let's delete the account explicitly to make room for the following tests
*/
@Test
public void test139DeleteAccountRed() throws Exception {
final String TEST_NAME = "test139DeleteAccountRed";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestMapping.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
dummyAuditService.clear();
PrismObject<UserType> userJack = getUser(USER_JACK_OID);
String acccountRedOid = getLinkRefOid(userJack, RESOURCE_DUMMY_RED_OID);
Collection<ObjectDelta<? extends ObjectType>> deltas = new ArrayList<ObjectDelta<? extends ObjectType>>();
ObjectDelta<ShadowType> shadowDelta = ObjectDelta.createDeleteDelta(ShadowType.class, acccountRedOid, prismContext);
deltas.add(shadowDelta);
// WHEN
modelService.executeChanges(deltas, null, task, result);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
userJack = getUser(USER_JACK_OID);
assertUserJack(userJack, "Captain Jack Sparrow", "Jack", "Sparrow");
assertNoLinkedAccount(userJack);
// Check if dummy resource accounts are gone
assertNoDummyAccount("jack");
assertNoDummyAccount(RESOURCE_DUMMY_RED_NAME, "jack");
// Check audit
display("Audit", dummyAuditService);
dummyAuditService.assertSimpleRecordSanity();
dummyAuditService.assertRecords(2);
dummyAuditService.assertAnyRequestDeltas();
dummyAuditService.assertExecutionDeltas(2);
dummyAuditService.assertHasDelta(ChangeType.MODIFY, UserType.class);
dummyAuditService.assertHasDelta(ChangeType.DELETE, ShadowType.class);
dummyAuditService.assertExecutionSuccess();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.
the class TestMapping method test102ModifyUserFullNameRecon.
@Test
public void test102ModifyUserFullNameRecon() throws Exception {
final String TEST_NAME = "test102ModifyUserFullNameRecon";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestMapping.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
dummyAuditService.clear();
// WHEN
TestUtil.displayWhen(TEST_NAME);
ObjectDelta<UserType> objectDelta = createModifyUserReplaceDelta(USER_JACK_OID, UserType.F_FULL_NAME, PrismTestUtil.createPolyString("Captain Jack Sparrow"));
Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(objectDelta);
modelService.executeChanges(deltas, ModelExecuteOptions.createReconcile(), task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
PrismObject<UserType> userJack = getUser(USER_JACK_OID);
display("User after change execution", userJack);
assertUserJack(userJack, "Captain Jack Sparrow", "Jack", "Sparrow");
assertAccountShip(userJack, "Jack Sparrow", null, dummyResourceCtlBlue, task);
// The quote attribute was empty before this operation. So the weak mapping kicks in
// and sets a new value.
assertDummyAccountAttribute(RESOURCE_DUMMY_BLUE_NAME, USER_JACK_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_QUOTE_NAME, "Where's the rum? -- Captain Jack Sparrow");
// Check audit
display("Audit", dummyAuditService);
dummyAuditService.assertSimpleRecordSanity();
dummyAuditService.assertRecords(2);
dummyAuditService.assertAnyRequestDeltas();
dummyAuditService.assertExecutionDeltas(2);
dummyAuditService.assertHasDelta(ChangeType.MODIFY, UserType.class);
dummyAuditService.assertExecutionSuccess();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.
the class TestMapping method test200ModifyUserAssignAccountDummyCrimson.
@Test
public void test200ModifyUserAssignAccountDummyCrimson() throws Exception {
final String TEST_NAME = "test200ModifyUserAssignAccountDummyCrimson";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestMapping.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN
TestUtil.displayWhen(TEST_NAME);
assignAccount(USER_GUYBRUSH_OID, RESOURCE_DUMMY_CRIMSON_OID, null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess("executeChanges result", result);
PrismObject<UserType> userAfter = getUser(USER_GUYBRUSH_OID);
display("User after", userAfter);
assertUser(userAfter, USER_GUYBRUSH_OID, USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_FULL_NAME, USER_GUYBRUSH_GIVEN_NAME, USER_GUYBRUSH_FAMILY_NAME);
// Check account in dummy resource
DummyAccount dummyAccount = assertDummyAccount(RESOURCE_DUMMY_CRIMSON_NAME, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, ACCOUNT_GUYBRUSH_DUMMY_FULLNAME, true);
display("Dummy account", dummyAccount);
assertDummyAccountAttribute(RESOURCE_DUMMY_CRIMSON_NAME, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, ACCOUNT_GUYBRUSH_DUMMY_LOCATION);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.
the class TestMapping method test309UnassignGuybrushDummyYellow.
@Test
public void test309UnassignGuybrushDummyYellow() throws Exception {
final String TEST_NAME = "test309UnassignGuybrushDummyYellow";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestMapping.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN
TestUtil.displayWhen(TEST_NAME);
unassignAccount(USER_GUYBRUSH_OID, RESOURCE_DUMMY_YELLOW_OID, null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess("executeChanges result", result);
PrismObject<UserType> userAfter = getUser(USER_GUYBRUSH_OID);
display("User after", userAfter);
assertUser(userAfter, USER_GUYBRUSH_OID, USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_FULL_NAME, USER_GUYBRUSH_GIVEN_NAME, USER_GUYBRUSH_FAMILY_NAME);
assertNoAssignments(userAfter);
assertLinks(userAfter, 0);
// Check account in dummy resource
assertNoDummyAccount(RESOURCE_DUMMY_YELLOW_NAME, ACCOUNT_GUYBRUSH_DUMMY_USERNAME);
}
Aggregations