Search in sources :

Example 16 with OrgType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.

the class TestUniversity method assertGroupMembers.

private void assertGroupMembers(PrismObject<OrgType> org, String... members) throws Exception {
    String groupOid = getLinkRefOid(org, RESOURCE_OPENDJ_OID, ShadowKindType.ENTITLEMENT, "org-group");
    PrismObject<ShadowType> groupShadow = getShadowModel(groupOid);
    assertAttribute(resourceOpenDj, groupShadow.asObjectable(), new QName(MidPointConstants.NS_RI, "uniqueMember"), members);
}
Also used : ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) QName(javax.xml.namespace.QName)

Example 17 with OrgType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.

the class TestUniversity method test100AddComeniusUniversity.

@Test
public void test100AddComeniusUniversity() throws Exception {
    final String TEST_NAME = "test100AddComeniusUniversity";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestUniversity.class.getName() + "." + TEST_NAME);
    DummyPrivilege comenius = new DummyPrivilege("UK");
    // WHEN
    dummyResourceHr.addPrivilege(comenius);
    waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true);
    // THEN
    PrismObject<OrgType> org = getAndAssertFunctionalOrg("UK");
    assertNotNull("Comenius University was not found", org);
    display("Org", org);
    dumpOrgTree();
    assertHasOrg(org, ORG_TOP_OID);
    assertAssignedOrg(org, ORG_TOP_OID);
    assertSubOrgs(org, 0);
    assertSubOrgs(ORG_TOP_OID, 1);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) DummyPrivilege(com.evolveum.icf.dummy.resource.DummyPrivilege) Test(org.testng.annotations.Test)

Example 18 with OrgType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.

the class TestUniversity method test120MoveComputingCentre.

@Test
public void test120MoveComputingCentre() throws Exception {
    final String TEST_NAME = "test120MoveComputingCentre";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestUniversity.class.getName() + "." + TEST_NAME);
    DummyPrivilege srcVc = dummyResourceHr.getPrivilegeByName("VC");
    // WHEN
    srcVc.replaceAttributeValue(DUMMY_PRIVILEGE_ATTRIBUTE_HR_ORGPATH, "UK:PRIF");
    waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true, 999999999);
    // THEN
    dumpOrgTree();
    PrismObject<OrgType> uk = getAndAssertFunctionalOrg("UK");
    assertNotNull("UK was not found", uk);
    display("Org UK", uk);
    assertHasOrg(uk, ORG_TOP_OID);
    assertAssignedOrg(uk, ORG_TOP_OID);
    assertSubOrgs(uk, 2);
    assertSubOrgs(ORG_TOP_OID, 1);
    assertGroupMembers(uk, "cn=DL-FMFI,ou=FMFI,ou=UK,dc=example,dc=com", "cn=DL-PRIF,ou=PRIF,ou=UK,dc=example,dc=com");
    PrismObject<OrgType> fmfi = getAndAssertFunctionalOrg("FMFI");
    assertNotNull("FMFI was not found", fmfi);
    display("Org FMFI", fmfi);
    assertHasOrg(fmfi, uk.getOid());
    assertAssignedOrg(fmfi, uk.getOid());
    assertSubOrgs(fmfi, 0);
    assertNoGroupMembers(fmfi);
    PrismObject<OrgType> prif = getAndAssertFunctionalOrg("PRIF");
    assertNotNull("PRIF was not found", prif);
    display("Org PRIF", prif);
    assertHasOrg(prif, uk.getOid());
    assertAssignedOrg(prif, uk.getOid());
    assertSubOrgs(prif, 1);
    assertGroupMembers(prif, "cn=DL-VC,ou=VC,ou=PRIF,ou=UK,dc=example,dc=com");
    PrismObject<OrgType> vc = getAndAssertFunctionalOrg("VC");
    assertNotNull("VC was not found", vc);
    display("Org VC", vc);
    assertHasOrg(vc, prif.getOid());
    assertAssignedOrg(vc, prif.getOid());
    assertSubOrgs(vc, 0);
    assertNoGroupMembers(vc);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) DummyPrivilege(com.evolveum.icf.dummy.resource.DummyPrivilege) Test(org.testng.annotations.Test)

Example 19 with OrgType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.

the class TestRetirement method assertNoGroupMembers.

private void assertNoGroupMembers(PrismObject<OrgType> org) throws Exception {
    String groupOid = getLinkRefOid(org, RESOURCE_OPENDJ_OID, ShadowKindType.ENTITLEMENT, "org-group");
    PrismObject<ShadowType> groupShadow = getShadowModel(groupOid);
    assertNoAttribute(resourceOpenDj, groupShadow.asObjectable(), new QName(MidPointConstants.NS_RI, "uniqueMember"));
}
Also used : ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) QName(javax.xml.namespace.QName) PolyString(com.evolveum.midpoint.prism.polystring.PolyString)

Example 20 with OrgType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.

the class TestRetirement method reconcileAllOrgs.

private void reconcileAllOrgs() throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
    final Task task = createTask("reconcileAllOrgs");
    OperationResult result = task.getResult();
    ResultHandler<OrgType> handler = new ResultHandler<OrgType>() {

        @Override
        public boolean handle(PrismObject<OrgType> object, OperationResult parentResult) {
            try {
                display("reconciling " + object);
                reconcileOrg(object.getOid(), task, parentResult);
            } catch (SchemaException | PolicyViolationException | ExpressionEvaluationException | ObjectNotFoundException | ObjectAlreadyExistsException | CommunicationException | ConfigurationException | SecurityViolationException e) {
                throw new SystemException(e.getMessage(), e);
            }
            return true;
        }
    };
    display("Reconciling all orgs");
    modelService.searchObjectsIterative(OrgType.class, null, handler, null, task, result);
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) Task(com.evolveum.midpoint.task.api.Task) ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ResultHandler(com.evolveum.midpoint.schema.ResultHandler) PrismObject(com.evolveum.midpoint.prism.PrismObject) SystemException(com.evolveum.midpoint.util.exception.SystemException) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) PolicyViolationException(com.evolveum.midpoint.util.exception.PolicyViolationException) ObjectAlreadyExistsException(com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)

Aggregations

OrgType (com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType)123 Test (org.testng.annotations.Test)70 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)69 Task (com.evolveum.midpoint.task.api.Task)69 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)31 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)26 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)23 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)22 DummyAccount (com.evolveum.icf.dummy.resource.DummyAccount)15 PrismObject (com.evolveum.midpoint.prism.PrismObject)13 ArrayList (java.util.ArrayList)13 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)11 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)11 Entry (org.opends.server.types.Entry)10 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)9 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)8 PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)8 QName (javax.xml.namespace.QName)8 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)7 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)7