Search in sources :

Example 26 with PrismReferenceValue

use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.

the class AbstractModelIntegrationTest method createModifyUserUnlinkAccount.

protected ObjectDelta<UserType> createModifyUserUnlinkAccount(String userOid, PrismObject<ResourceType> resource) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
    String accountOid = getLinkRefOid(userOid, resource.getOid());
    ObjectDelta<UserType> userDelta = ObjectDelta.createEmptyModifyDelta(UserType.class, userOid, prismContext);
    PrismReferenceValue accountRefVal = new PrismReferenceValue();
    accountRefVal.setOid(accountOid);
    ReferenceDelta accountDelta = ReferenceDelta.createModificationDelete(UserType.F_LINK_REF, getUserDefinition(), accountRefVal);
    userDelta.addModification(accountDelta);
    return userDelta;
}
Also used : PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue) ReferenceDelta(com.evolveum.midpoint.prism.delta.ReferenceDelta) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)

Example 27 with PrismReferenceValue

use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.

the class AbstractModelIntegrationTest method assertPrismRefValues.

protected void assertPrismRefValues(String contextDesc, Collection<PrismReferenceValue> real, String... expected) {
    List<String> refOids = new ArrayList<>();
    for (PrismReferenceValue ref : real) {
        refOids.add(ref.getOid());
        assertNotNull("Missing type in " + ref.getOid() + " in " + contextDesc, ref.getTargetType());
        assertNotNull("Missing name in " + ref.getOid() + " in " + contextDesc, ref.getTargetName());
    }
    PrismAsserts.assertSets("Wrong values in " + contextDesc, refOids, expected);
}
Also used : PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue) ArrayList(java.util.ArrayList) PolyString(com.evolveum.midpoint.prism.polystring.PolyString)

Example 28 with PrismReferenceValue

use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.

the class AbstractModelIntegrationTest method assertAuditTarget.

protected void assertAuditTarget(AuditEventRecord event, String oid, QName type, String name) {
    PrismReferenceValue target = event.getTarget();
    assertNotNull("No target", target);
    assertEquals("Wrong OID", oid, target.getOid());
    assertEquals("Wrong type", type, target.getTargetType());
    assertEquals("Wrong name", name, PolyString.getOrig(target.getTargetName()));
}
Also used : PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue)

Example 29 with PrismReferenceValue

use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.

the class AbstractModelIntegrationTest method createModifyUserAddAccount.

protected ObjectDelta<UserType> createModifyUserAddAccount(String userOid, PrismObject<ResourceType> resource) throws SchemaException {
    PrismObject<ShadowType> account = getAccountShadowDefinition().instantiate();
    ObjectReferenceType resourceRef = new ObjectReferenceType();
    resourceRef.setOid(resource.getOid());
    account.asObjectable().setResourceRef(resourceRef);
    RefinedResourceSchema refinedSchema = RefinedResourceSchemaImpl.getRefinedSchema(resource);
    account.asObjectable().setObjectClass(refinedSchema.getDefaultRefinedDefinition(ShadowKindType.ACCOUNT).getObjectClassDefinition().getTypeName());
    ObjectDelta<UserType> userDelta = ObjectDelta.createEmptyModifyDelta(UserType.class, userOid, prismContext);
    PrismReferenceValue accountRefVal = new PrismReferenceValue();
    accountRefVal.setObject(account);
    ReferenceDelta accountDelta = ReferenceDelta.createModificationAdd(UserType.F_LINK_REF, getUserDefinition(), accountRefVal);
    userDelta.addModification(accountDelta);
    return userDelta;
}
Also used : ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) ReferenceDelta(com.evolveum.midpoint.prism.delta.ReferenceDelta) RefinedResourceSchema(com.evolveum.midpoint.common.refinery.RefinedResourceSchema) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)

Example 30 with PrismReferenceValue

use of com.evolveum.midpoint.prism.PrismReferenceValue in project midpoint by Evolveum.

the class TestOrgSync method assertNoResponsibility.

private String assertNoResponsibility(PrismObject<UserType> user, String respName) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, DirectoryException, ExpressionEvaluationException {
    String respRoleName = "R_" + respName;
    PrismObject<RoleType> respRole = searchObjectByName(RoleType.class, respRoleName);
    assertNotNull("No role for responsibility " + respName);
    display("Responsibility role for " + respName, respRole);
    assertNotAssignedRole(user, respRole.getOid());
    PrismReferenceValue linkRef = getSingleLinkRef(respRole);
    PrismObject<ShadowType> shadow = getShadowModel(linkRef.getOid());
    display("Role " + respRoleName + " shadow", shadow);
    // TODO assert shadow content
    String groupDn = "cn=" + respRoleName + ",ou=groups," + openDJController.getSuffix();
    Entry groupEntry = openDJController.fetchAndAssertEntry(groupDn, "groupOfUniqueNames");
    display("Group entry", groupEntry);
    PrismReferenceValue accountLinkRef = getLinkRef(user, RESOURCE_OPENDJ_OID);
    PrismObject<ShadowType> accountShadow = getShadowModel(accountLinkRef.getOid());
    String accountDn = IntegrationTestTools.getSecondaryIdentifier(accountShadow);
    openDJController.assertNoUniqueMember(groupEntry, accountDn);
    IntegrationTestTools.assertNoAssociation(accountShadow, OPENDJ_ASSOCIATION_GROUP_NAME, shadow.getOid());
    return respRole.getOid();
}
Also used : Entry(org.opends.server.types.Entry) SearchResultEntry(org.opends.server.types.SearchResultEntry) PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue) RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)

Aggregations

PrismReferenceValue (com.evolveum.midpoint.prism.PrismReferenceValue)126 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)64 Test (org.testng.annotations.Test)47 Task (com.evolveum.midpoint.task.api.Task)45 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)32 ReferenceDelta (com.evolveum.midpoint.prism.delta.ReferenceDelta)27 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)26 PrismObject (com.evolveum.midpoint.prism.PrismObject)25 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)25 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)24 ArrayList (java.util.ArrayList)22 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)21 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)20 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)16 PrismReference (com.evolveum.midpoint.prism.PrismReference)15 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)15 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)15 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)12 Collection (java.util.Collection)12 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)11