Search in sources :

Example 81 with PrismReferenceValue

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

the class TestOrgSync method getAndAssertReplicatedOrg.

private PrismObject<OrgType> getAndAssertReplicatedOrg(String orgName) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, DirectoryException, ExpressionEvaluationException {
    PrismObject<OrgType> org = getOrg(orgName);
    PrismAsserts.assertPropertyValue(org, OrgType.F_ORG_TYPE, "replicated");
    assertAssignedRole(org, ROLE_META_REPLICATED_ORG_OID);
    PrismReferenceValue linkRef = getSingleLinkRef(org);
    // We are bold enough to get the whole shadow
    PrismObject<ShadowType> shadow = getShadowModel(linkRef.getOid());
    display("Org " + orgName + " shadow", shadow);
    // TODO assert shadow content
    Entry ouEntry = openDJController.searchSingle("ou=" + orgName);
    assertNotNull("No ou LDAP entry for " + orgName);
    display("OU entry", ouEntry);
    openDJController.assertObjectClass(ouEntry, "organizationalUnit");
    return org;
}
Also used : Entry(org.opends.server.types.Entry) SearchResultEntry(org.opends.server.types.SearchResultEntry) PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)

Example 82 with PrismReferenceValue

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

the class AuditEventRecord method getReferenceValueFromObjectReferenceType.

private static PrismReferenceValue getReferenceValueFromObjectReferenceType(ObjectReferenceType refType) {
    if (refType == null) {
        return null;
    }
    PrismReferenceValue refVal = new PrismReferenceValue(refType.getOid());
    refVal.setTargetType(refType.getType());
    refVal.setTargetName(refType.getTargetName());
    return refVal;
}
Also used : PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue)

Example 83 with PrismReferenceValue

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

the class OrgStructTest method test009modifyOrgStructRemoveUser.

@Test
public void test009modifyOrgStructRemoveUser() throws Exception {
    OperationResult opResult = new OperationResult("test009modifyOrgStructRemoveUser");
    PrismReferenceValue prv = new PrismReferenceValue(MODIFY_USER_DELETE_REF_OID);
    prv.setTargetType(OrgType.COMPLEX_TYPE);
    ObjectDelta<UserType> delta = ObjectDelta.createModificationDeleteReference(UserType.class, ELAINE_OID, UserType.F_PARENT_ORG_REF, prismContext, prv);
    repositoryService.modifyObject(UserType.class, ELAINE_OID, delta.getModifications(), opResult);
    UserType userElaine = repositoryService.getObject(UserType.class, ELAINE_OID, null, opResult).asObjectable();
    LOGGER.trace("elaine's og refs");
    for (ObjectReferenceType ort : userElaine.getParentOrgRef()) {
        LOGGER.trace("{}", ort);
        if (ort.getOid().equals(MODIFY_USER_DELETE_REF_OID)) {
            AssertJUnit.fail("expected that elain does not have reference on the org with oid:" + MODIFY_USER_DELETE_REF_OID);
        }
    }
}
Also used : ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Example 84 with PrismReferenceValue

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

the class OrgStructTest method test100ParentOrgRefFilterNullRelation.

@Test
public void test100ParentOrgRefFilterNullRelation() throws Exception {
    final String TEST_NAME = "test100ParentOrgRefFilterNullRelation";
    TestUtil.displayTestTile(TEST_NAME);
    OperationResult opResult = new OperationResult(TEST_NAME);
    ObjectQuery query = QueryBuilder.queryFor(ObjectType.class, prismContext).item(ObjectType.F_PARENT_ORG_REF).ref(new PrismReferenceValue(ORG_F001_OID)).build();
    // WHEN
    List<PrismObject<ObjectType>> orgs = repositoryService.searchObjects(ObjectType.class, query, null, opResult);
    // THEN
    PrismAsserts.assertOids(orgs, ORG_F002_OID, ORG_F003_OID, ORG_F004_OID, ELAINE_OID);
}
Also used : ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) PrismObject(com.evolveum.midpoint.prism.PrismObject) PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test)

Example 85 with PrismReferenceValue

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

the class ModifyUser method test100ModifyUserApproverMetadata.

@Test
public void test100ModifyUserApproverMetadata() throws Exception {
    PrismObjectDefinition userDefinition = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(UserType.class);
    ReferenceDelta delta1 = ReferenceDelta.createModificationAdd(new ItemPath(UserType.F_METADATA, MetadataType.F_CREATE_APPROVER_REF), userDefinition, new PrismReferenceValue("target-oid-1", UserType.COMPLEX_TYPE));
    ReferenceDelta delta2 = ReferenceDelta.createModificationAdd(new ItemPath(UserType.F_METADATA, MetadataType.F_MODIFY_APPROVER_REF), userDefinition, // the same as in delta1
    new PrismReferenceValue("target-oid-1", UserType.COMPLEX_TYPE));
    repositoryService.modifyObject(UserType.class, userOid, Arrays.asList(delta1, delta2), new OperationResult("asdf"));
}
Also used : PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue) PrismObjectDefinition(com.evolveum.midpoint.prism.PrismObjectDefinition) ReferenceDelta(com.evolveum.midpoint.prism.delta.ReferenceDelta) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) Test(org.testng.annotations.Test)

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