use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestValueMetadata method test340DeleteBlaiseFromGases.
/**
* Deleting Blaise from Gases (in CRM).
*
* Before:
* - name: blaise (hr, crm)
* - givenName: Blaise (hr, admin/jim, crm)
* - familyName: Pascal (hr, admin, crm)
* - fullName: Blaise Pascal (m:hr+admin+crm)
* - org: Department of Hydrostatics (hr, crm)
* - org: Binomial Club (hr)
* - org: Gases (crm)
*
* Delta: org should lose Gases value.
*
* After:
* - name: blaise (hr, crm)
* - givenName: Blaise (hr, admin/jim, crm)
* - familyName: Pascal (hr, admin, crm)
* - fullName: Blaise Pascal (m:hr+admin+crm)
* - org: Department of Hydrostatics (hr, crm)
* - org: Binomial Club (hr)
*/
@Test
public void test340DeleteBlaiseFromGases() throws Exception {
given();
Task task = getTestTask();
OperationResult result = task.getResult();
DummyAccount crmAccount = Objects.requireNonNull(RESOURCE_CRM.controller.getDummyResource().getAccountByUsername(USER_BLAISE_NAME));
crmAccount.removeAttributeValue(ATTR_ORGANIZATION, "Gases");
when();
XMLGregorianCalendar before = clock.currentTimeXMLGregorianCalendar();
rerunTask(TASK_CRM_IMPORT.oid, result);
then();
assertUserAfterByUsername(USER_BLAISE_NAME).displayXml().assertName("blaise").valueMetadata(UserType.F_NAME).assertSize(2).valueForOrigin(ORIGIN_HR_FEED.oid).provenance().singleAcquisition().assertResourceRef(RESOURCE_HR.oid).assertTimestampBefore(before).end().end().end().valueForOrigin(ORIGIN_CRM_FEED.oid).provenance().singleAcquisition().assertResourceRef(RESOURCE_CRM.oid).assertTimestampBefore(before).end().end().end().end().assertGivenName("Blaise").valueMetadata(UserType.F_GIVEN_NAME).assertSize(3).valueForOrigin(ORIGIN_HR_FEED.oid).provenance().singleAcquisition().assertOriginRef(ORIGIN_HR_FEED.ref()).assertResourceRef(RESOURCE_HR.oid).assertTimestampBefore(before).end().end().end().valueForOrigin(ORIGIN_ADMIN_ENTRY.oid).provenance().singleAcquisition().assertOriginRef(ORIGIN_ADMIN_ENTRY.ref()).assertChannel(SchemaConstants.CHANNEL_USER_LOCAL).assertActorRef(USER_JIM.oid).assertTimestampBefore(before).end().end().end().valueForOrigin(ORIGIN_CRM_FEED.oid).provenance().singleAcquisition().assertResourceRef(RESOURCE_CRM.oid).assertTimestampBefore(before).end().end().end().end().assertFamilyName("Pascal").valueMetadata(UserType.F_FAMILY_NAME).assertSize(3).valueForOrigin(ORIGIN_HR_FEED.oid).provenance().singleAcquisition().assertOriginRef(ORIGIN_HR_FEED.ref()).assertResourceRef(RESOURCE_HR.oid).assertTimestampBefore(before).end().end().end().valueForOrigin(ORIGIN_ADMIN_ENTRY.oid).provenance().singleAcquisition().assertOriginRef(ORIGIN_ADMIN_ENTRY.ref()).assertChannel(SchemaConstants.CHANNEL_USER_LOCAL).assertActorRef(USER_ADMINISTRATOR_OID).assertTimestampBefore(before).end().end().end().valueForOrigin(ORIGIN_CRM_FEED.oid).provenance().singleAcquisition().assertResourceRef(RESOURCE_CRM.oid).assertTimestampBefore(before).end().end().end().end().assertFullName("Blaise Pascal").valueMetadataSingle(UserType.F_FULL_NAME).provenance().assertMappingSpec(TEMPLATE_PROVENANCE_METADATA_RECORDING.oid).assertAcquisitions(3).singleAcquisition(ORIGIN_HR_FEED.oid).assertResourceRef(RESOURCE_HR.oid).assertTimestampBefore(before).end().singleAcquisition(ORIGIN_CRM_FEED.oid).assertResourceRef(RESOURCE_CRM.oid).assertTimestampBefore(before).end().singleAcquisition(ORIGIN_ADMIN_ENTRY.oid).assertChannel(SchemaConstants.CHANNEL_USER_LOCAL).end().end().end().assertOrganizations("Department of Hydrostatics", "Binomial Club").valueMetadata(UserType.F_ORGANIZATION, ValueSelector.origEquals("Department of Hydrostatics")).assertSize(2).valueForOrigin(ORIGIN_HR_FEED.oid).provenance().singleAcquisition().assertOriginRef(ORIGIN_HR_FEED.oid).assertResourceRef(RESOURCE_HR.oid).assertTimestampBefore(before).end().end().end().valueForOrigin(ORIGIN_CRM_FEED.oid).provenance().singleAcquisition().assertOriginRef(ORIGIN_CRM_FEED.oid).assertResourceRef(RESOURCE_CRM.oid).assertTimestampBefore(before).end().end().end().end().valueMetadataSingle(UserType.F_ORGANIZATION, ValueSelector.origEquals("Binomial Club")).provenance().singleAcquisition().assertOriginRef(ORIGIN_HR_FEED.oid).assertResourceRef(RESOURCE_HR.oid).assertTimestampBefore(before).end().end().end();
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestUserTemplate method test302ModifyStanAccountAndReimport.
/**
* Modify stan accoutn and reimport from the emerald resource. Make sure that
* the normal mapping for locality in the object template is properly activated (as there is
* an delta from inbound mapping in the emerald resource).
* MID-3186
*/
@Test
public void test302ModifyStanAccountAndReimport() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = getTestOperationResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE);
DummyAccount dummyAccountBefore = dummyResourceEmerald.getAccountByUsername(ACCOUNT_STAN_USERNAME);
dummyAccountBefore.replaceAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, "Booty Island");
PrismObject<ShadowType> shadowBefore = findAccountByUsername(ACCOUNT_STAN_USERNAME, resourceDummyEmerald);
display("Shadow before", shadowBefore);
// WHEN
when();
modelService.importFromResource(shadowBefore.getOid(), task, result);
// THEN
then();
result.computeStatus();
display(result);
TestUtil.assertSuccess(result);
PrismObject<UserType> userAfter = findUserByUsername(ACCOUNT_STAN_USERNAME);
display("User after", userAfter);
assertNotNull("No stan user", userAfter);
PrismAsserts.assertPropertyValue(userAfter, UserType.F_FULL_NAME, PrismTestUtil.createPolyString(ACCOUNT_STAN_FULLNAME));
PrismAsserts.assertPropertyValue(userAfter, UserType.F_LOCALITY, PrismTestUtil.createPolyString("Booty Island"));
PrismAsserts.assertPropertyValue(userAfter, UserType.F_TIMEZONE, "High Seas/Booty Island");
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestValueMetadata method test300ImportBlaiseFromHr.
/**
* Blaise is imported from HR anew.
*
* After:
* - name: blaise (m:hr/2)
* - givenName: Blaise (m:hr/2)
* - familyName: Pascal (m:hr/2)
* - fullName: Blaise Pascal (m:hr/2)
* - org: Department of Hydrostatics (m:hr/2)
* - org: Binomial Club (m:hr/2)
*
* Note: /2 means LoA of 2.
*/
@Test
public void test300ImportBlaiseFromHr() throws Exception {
given();
Task task = getTestTask();
OperationResult result = task.getResult();
// This is necessary because when inbounds start the user has no archetype, therefore no template.
setDefaultObjectTemplate(UserType.COMPLEX_TYPE, TEMPLATE_PROVENANCE_METADATA_RECORDING.oid);
DummyAccount pascal = RESOURCE_HR.controller.addAccount(USER_BLAISE_NAME);
pascal.addAttributeValue(ATTR_FIRSTNAME, "Blaise");
pascal.addAttributeValue(ATTR_LASTNAME, "Pascal");
pascal.addAttributeValue(ATTR_ORGANIZATION, "Department of Hydrostatics");
pascal.addAttributeValue(ATTR_ORGANIZATION, "Binomial Club");
when();
XMLGregorianCalendar start = clock.currentTimeXMLGregorianCalendar();
rerunTask(TASK_HR_IMPORT.oid, result);
XMLGregorianCalendar end = clock.currentTimeXMLGregorianCalendar();
then();
assertUserAfterByUsername(USER_BLAISE_NAME).displayXml().assertName("blaise").valueMetadataSingle(UserType.F_NAME).display().provenance().assertMappingSpec(RESOURCE_HR.oid).singleAcquisition().assertOriginRef(ORIGIN_HR_FEED.oid).assertResourceRef(RESOURCE_HR.oid).assertTimestampBetween(start, end).end().end().assertPropertyValuesEqual(LOA_PATH, 2).end().assertGivenName("Blaise").valueMetadataSingle(UserType.F_GIVEN_NAME).provenance().assertMappingSpec(RESOURCE_HR.oid).singleAcquisition().assertOriginRef(ORIGIN_HR_FEED.oid).assertResourceRef(RESOURCE_HR.oid).assertTimestampBetween(start, end).end().end().assertPropertyValuesEqual(LOA_PATH, 2).end().assertFamilyName("Pascal").valueMetadataSingle(UserType.F_FAMILY_NAME).provenance().assertMappingSpec(RESOURCE_HR.oid).singleAcquisition().assertOriginRef(ORIGIN_HR_FEED.oid).assertResourceRef(RESOURCE_HR.oid).assertTimestampBetween(start, end).end().end().assertPropertyValuesEqual(LOA_PATH, 2).end().assertFullName("Blaise Pascal").valueMetadataSingle(UserType.F_FULL_NAME).provenance().assertMappingSpec(TEMPLATE_PROVENANCE_METADATA_RECORDING.oid).singleAcquisition().assertOriginRef(ORIGIN_HR_FEED.oid).assertResourceRef(RESOURCE_HR.oid).assertTimestampBetween(start, end).end().end().assertPropertyValuesEqual(LOA_PATH, 2).end().assertOrganizations("Department of Hydrostatics", "Binomial Club").valueMetadataSingle(UserType.F_ORGANIZATION, ValueSelector.origEquals("Department of Hydrostatics")).provenance().assertMappingSpec(RESOURCE_HR.oid).singleAcquisition().assertOriginRef(ORIGIN_HR_FEED.oid).assertResourceRef(RESOURCE_HR.oid).assertTimestampBetween(start, end).end().end().assertPropertyValuesEqual(LOA_PATH, 2).end().valueMetadataSingle(UserType.F_ORGANIZATION, ValueSelector.origEquals("Binomial Club")).provenance().assertMappingSpec(RESOURCE_HR.oid).singleAcquisition().assertOriginRef(ORIGIN_HR_FEED.oid).assertResourceRef(RESOURCE_HR.oid).assertTimestampBetween(start, end).end().end().assertPropertyValuesEqual(LOA_PATH, 2).end().assertCostCenter("CC000").valueMetadata(UserType.F_COST_CENTER).assertSize(// there should be none, because the processing of MD for costCenter is disabled
0).end().assertLocality("Bratislava").valueMetadataSingle(UserType.F_LOCALITY).assertInternalOrigin().provenance().assertMappingSpec(TEMPLATE_PROVENANCE_METADATA_RECORDING.oid).end().assertNoItem(// LoA handling is turned off for "locality" mapping
LOA_PATH).end().valueMetadataSingle(UserType.F_TITLE).assertInternalOrigin().end().valueMetadataSingle(// there should be only a single assignment
UserType.F_ASSIGNMENT).display().provenance().assertMappingSpec(RESOURCE_HR.oid).singleAcquisition().assertOriginRef(ORIGIN_HR_FEED.oid).assertResourceRef(RESOURCE_HR.oid).assertTimestampBetween(start, end).end().end().assertNoItem(// LoA handling is turned off for assignments
LOA_PATH).end();
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestStrangeCases method test610GetAccountGuybrushRogueAttribute.
/**
* Set attribute that is not in the schema directly into dummy resource.
* Get that account. Make sure that the operations does not die.
*/
// MID-2880
@Test(enabled = false)
public void test610GetAccountGuybrushRogueAttribute() throws Exception {
given();
Task task = getTestTask();
OperationResult result = getTestOperationResult();
getDummyResource().setEnforceSchema(false);
DummyAccount dummyAccount = getDummyAccount(null, USER_GUYBRUSH_USERNAME);
dummyAccount.addAttributeValues("rogue", "habakuk");
getDummyResource().setEnforceSchema(true);
when();
PrismObject<ShadowType> shadow = modelService.getObject(ShadowType.class, accountGuybrushOid, null, task, result);
then();
assertSuccess(result);
display("Shadow after", shadow);
assertDummyAccountShadowModel(shadow, accountGuybrushOid, USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_FULL_NAME);
assertDummyAccountAttribute(null, USER_GUYBRUSH_USERNAME, "rogue", "habakuk");
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestVolatility method test402ModifyHermanMonster.
/**
* Monsterized resource is volatile: Monster has eaten the cookie. But we still
* want the cookie to be in the values. The volatility=explosive should fix it.
* MID-3727
*/
@Test
public void test402ModifyHermanMonster() throws Exception {
given();
Task task = getTestTask();
OperationResult result = task.getResult();
when();
modifyUserAdd(USER_HERMAN_OID, UserType.F_ORGANIZATION, task, result, createPolyString(DummyResource.VALUE_MONSTER));
then();
result.computeStatus();
TestUtil.assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_HERMAN_OID);
display("User after", userAfter);
assertNotNull("User not there", userAfter);
assertLiveLinks(userAfter, 1);
DummyAccount dummyAccount = assertDummyAccount(RESOURCE_DUMMY_MONSTERIZED_NAME, USER_HERMAN_USERNAME);
displayDumpable("Dummy account", dummyAccount);
assertDummyAccountAttribute(RESOURCE_DUMMY_MONSTERIZED_NAME, USER_HERMAN_USERNAME, DummyAccount.ATTR_INTERESTS_NAME, "foo", "bar", DummyResource.VALUE_COOKIE, DummyResource.VALUE_MONSTER);
}
Aggregations