use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.
the class PrismReferenceArrayList method remove.
@Override
public T remove(int i) {
testIndex(i);
PrismReferenceValue value = reference.getValues().get(i);
reference.getValues().remove(i);
return createItem(value);
}
use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.
the class EvaluatedAssignmentImpl method dumpRefList.
private void dumpRefList(int indent, StringBuilder sb, String label, Collection<PrismReferenceValue> referenceValues) {
if (!referenceValues.isEmpty()) {
sb.append("\n");
DebugUtil.debugDumpLabel(sb, label, indent + 1);
for (PrismReferenceValue refVal : referenceValues) {
sb.append("\n");
DebugUtil.indentDebugDump(sb, indent + 2);
sb.append(refVal.toString());
}
}
}
use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.
the class TestRoleEntitlement method test110GetRoleResolveEntitlement.
@Test
public void test110GetRoleResolveEntitlement() throws Exception {
final String TEST_NAME = "test110GetRoleResolveEntitlement";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestRoleEntitlement.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.POSITIVE);
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(UserType.F_LINK, GetOperationOptions.createResolve());
// WHEN
PrismObject<RoleType> role = modelService.getObject(RoleType.class, ROLE_PIRATE_OID, options, task, result);
RoleType roleType = role.asObjectable();
assertLinks(role, 1);
PrismReferenceValue linkRef = getSingleLinkRef(role);
assertEquals("OID mismatch in linkRefValue", groupOid, linkRef.getOid());
assertNotNull("Missing account object in linkRefValue", linkRef.getObject());
ShadowType shadow = roleType.getLink().get(0);
assertDummyGroupShadowModel(shadow.asPrismObject(), groupOid, GROUP_PIRATE_DUMMY_NAME);
result.computeStatus();
TestUtil.assertSuccess("getObject result", result);
}
use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.
the class TestRoleEntitlement method test111GetRoleResolveEntitlement.
@Test
public void test111GetRoleResolveEntitlement() throws Exception {
final String TEST_NAME = "test111GetRoleResolveEntitlement";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestRoleEntitlement.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.POSITIVE);
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createResolve(), new ItemPath(UserType.F_LINK), new ItemPath(UserType.F_LINK, ShadowType.F_RESOURCE));
// WHEN
PrismObject<RoleType> role = modelService.getObject(RoleType.class, ROLE_PIRATE_OID, options, task, result);
RoleType roleType = role.asObjectable();
assertLinks(role, 1);
PrismReferenceValue linkRef = getSingleLinkRef(role);
assertEquals("OID mismatch in linkRefValue", groupOid, linkRef.getOid());
assertNotNull("Missing account object in linkRefValue", linkRef.getObject());
ShadowType shadow = roleType.getLink().get(0);
assertDummyGroupShadowModel(shadow.asPrismObject(), groupOid, GROUP_PIRATE_DUMMY_NAME);
assertNotNull("Resource in account was not resolved", shadow.getResource());
result.computeStatus();
TestUtil.assertSuccess("getObject result", result);
}
use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.
the class TestRoleEntitlement method test100ModifyRoleAddEntitlement.
@Test
public void test100ModifyRoleAddEntitlement() throws Exception {
final String TEST_NAME = "test100ModifyRoleAddEntitlement";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestRoleEntitlement.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.POSITIVE);
PrismObject<ShadowType> group = PrismTestUtil.parseObject(GROUP_PIRATE_DUMMY_FILE);
ObjectDelta<RoleType> roleDelta = ObjectDelta.createEmptyModifyDelta(RoleType.class, ROLE_PIRATE_OID, prismContext);
PrismReferenceValue linkRefVal = new PrismReferenceValue();
linkRefVal.setObject(group);
ReferenceDelta groupDelta = ReferenceDelta.createModificationAdd(RoleType.F_LINK_REF, getRoleDefinition(), linkRefVal);
roleDelta.addModification(groupDelta);
Collection<ObjectDelta<? extends ObjectType>> deltas = (Collection) MiscUtil.createCollection(roleDelta);
dummyAuditService.clear();
prepareNotifications();
dummyTransport.clearMessages();
notificationManager.setDisabled(false);
XMLGregorianCalendar startTime = clock.currentTimeXMLGregorianCalendar();
// WHEN
modelService.executeChanges(deltas, null, task, result);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
XMLGregorianCalendar endTime = clock.currentTimeXMLGregorianCalendar();
// Check accountRef
PrismObject<RoleType> rolePirate = modelService.getObject(RoleType.class, ROLE_PIRATE_OID, null, task, result);
display("Role pirate after", rolePirate);
assertRolePirate(rolePirate);
assertLinks(rolePirate, 1);
groupOid = getSingleLinkOid(rolePirate);
assertFalse("No linkRef oid", StringUtils.isBlank(groupOid));
// Check shadow
PrismObject<ShadowType> accountShadow = repositoryService.getObject(ShadowType.class, groupOid, null, result);
assertDummyGroupShadowRepo(accountShadow, groupOid, GROUP_PIRATE_DUMMY_NAME);
// Check account
PrismObject<ShadowType> accountModel = modelService.getObject(ShadowType.class, groupOid, null, task, result);
assertDummyGroupShadowModel(accountModel, groupOid, GROUP_PIRATE_DUMMY_NAME);
// Check account in dummy resource
assertDummyGroup(GROUP_PIRATE_DUMMY_NAME, GROUP_PIRATE_DUMMY_DESCRIPTION);
// Check audit
display("Audit", dummyAuditService);
dummyAuditService.assertRecords(2);
dummyAuditService.assertSimpleRecordSanity();
dummyAuditService.assertAnyRequestDeltas();
dummyAuditService.assertExecutionDeltas(3);
dummyAuditService.assertHasDelta(ChangeType.MODIFY, RoleType.class);
dummyAuditService.assertHasDelta(ChangeType.ADD, ShadowType.class);
dummyAuditService.assertTarget(ROLE_PIRATE_OID);
dummyAuditService.assertExecutionSuccess();
notificationManager.setDisabled(true);
}
Aggregations