use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType in project midpoint by Evolveum.
the class TestFunctions method test110ResolveReference.
/**
* MID-6133
*/
@Test
public void test110ResolveReference() throws Exception {
given();
Task task = getTestTask();
OperationResult result = task.getResult();
ObjectReferenceType broken = ObjectTypeUtil.createObjectRef(TestUtil.NON_EXISTENT_OID, ObjectTypes.USER);
when();
try {
execute(task, result, () -> libraryMidpointFunctions.resolveReference(broken));
fail("unexpected success");
} catch (ObjectNotFoundException e) {
System.out.println("expected failure: " + e.getMessage());
}
then();
assertFailure(result);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method fillinUserAssignmentAccountConstruction.
protected void fillinUserAssignmentAccountConstruction(PrismObject<UserType> user, String resourceOid) {
AssignmentType assignmentType = new AssignmentType();
ConstructionType accountConstruntion = new ConstructionType();
ObjectReferenceType resourceRef = new ObjectReferenceType();
resourceRef.setOid(resourceOid);
resourceRef.setType(ResourceType.COMPLEX_TYPE);
accountConstruntion.setResourceRef(resourceRef);
accountConstruntion.setKind(ShadowKindType.ACCOUNT);
assignmentType.setConstruction(accountConstruntion);
user.asObjectable().getAssignment().add(assignmentType);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method checkApprovers.
protected void checkApprovers(List<String> expectedApprovers, List<ObjectReferenceType> realApprovers) {
HashSet<String> realApproversSet = new HashSet<>();
for (ObjectReferenceType approver : realApprovers) {
realApproversSet.add(approver.getOid());
assertEquals("Unexpected target type in approverRef", UserType.COMPLEX_TYPE, approver.getType());
}
assertEquals("Mismatch in approvers in metadata", new HashSet<>(expectedApprovers), realApproversSet);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method modifyRoleAddInducementTarget.
protected void modifyRoleAddInducementTarget(String roleOid, String targetOid, boolean recomputeMembers, ModelExecuteOptions defaultOptions) throws CommonException {
OperationResult result = createSubresult("modifyRoleAddInducementTarget");
AssignmentType inducement = new AssignmentType();
ObjectReferenceType targetRef = new ObjectReferenceType();
targetRef.setOid(targetOid);
inducement.setTargetRef(targetRef);
ObjectDelta<RoleType> roleDelta = prismContext.deltaFactory().object().createModificationAddContainer(RoleType.class, roleOid, RoleType.F_INDUCEMENT, inducement);
ModelExecuteOptions options = setRecomputeMembers(defaultOptions, recomputeMembers);
executeChanges(roleDelta, options, getTestTask(), result);
result.computeStatus();
if (recomputeMembers) {
TestUtil.assertInProgressOrSuccess(result);
} else {
TestUtil.assertSuccess(result);
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method getUserAssignment.
protected AssignmentType getUserAssignment(String userOid, String roleOid, QName relation) throws ObjectNotFoundException, SchemaException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
PrismObject<UserType> user = getUser(userOid);
List<AssignmentType> assignments = user.asObjectable().getAssignment();
for (AssignmentType assignment : assignments) {
ObjectReferenceType targetRef = assignment.getTargetRef();
if (targetRef != null && roleOid.equals(targetRef.getOid()) && prismContext.relationMatches(relation, targetRef.getRelation())) {
return assignment;
}
}
return null;
}
Aggregations