Search in sources :

Example 36 with OrgType

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

the class AbstractLdapHierarchyTest method test320AddOrgRoyulaDiabolica.

@Test
public void test320AddOrgRoyulaDiabolica() throws Exception {
    final String TEST_NAME = "test320AddOrgRoyulaDiabolica";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(AbstractLdapHierarchyTest.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    PrismObject<OrgType> orgBefore = createOrg(ORG_ROYULA_DIABOLICA_NAME, ORG_TOP_OID);
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    display("Adding org", orgBefore);
    addObject(orgBefore, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    dumpOrgTree();
    dumpLdap();
    PrismObject<OrgType> orgAfter = getAndAssertFunctionalOrg(ORG_ROYULA_DIABOLICA_NAME, ORG_TOP_OID);
    orgRolyulaDiabolicaOid = orgAfter.getOid();
    assertSubOrgs(orgAfter, 0);
    assertSubOrgs(ORG_TOP_OID, 2);
    assertSubOrgs(orgRolyulaDiabolicaOid, 0);
    assertSubOrgs(orgRolyulaCarpathiaOid, 1);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) Test(org.testng.annotations.Test)

Example 37 with OrgType

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

the class AbstractLdapHierarchyTest method reconcileAllOrgs.

protected 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)

Example 38 with OrgType

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

the class AbstractLdapHierarchyTest method getAndAssertFunctionalOrg.

protected PrismObject<OrgType> getAndAssertFunctionalOrg(String orgName, String directParentOrgOid) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, DirectoryException, ExpressionEvaluationException {
    PrismObject<OrgType> org = getOrg(orgName);
    display("org", org);
    PrismAsserts.assertPropertyValue(org, OrgType.F_ORG_TYPE, ORG_TYPE_FUNCTIONAL);
    assertAssignedRole(org, ROLE_META_ORG_OID);
    String groupOid = getLinkRefOid(org, RESOURCE_OPENDJ_OID, ShadowKindType.ENTITLEMENT, LDAP_GROUP_INTENT);
    PrismObject<ShadowType> groupShadow = getShadowModel(groupOid);
    display("Org " + orgName + " group shadow", groupShadow);
    // TODO assert shadow content
    Entry groupEntry = openDJController.searchSingle("cn=" + orgName);
    assertNotNull("No group LDAP entry for " + orgName, groupEntry);
    display("OU GROUP entry", openDJController.toHumanReadableLdifoid(groupEntry));
    openDJController.assertObjectClass(groupEntry, "groupOfUniqueNames");
    assertHasOrg(org, directParentOrgOid);
    assertAssignedOrg(org, directParentOrgOid);
    return org;
}
Also used : Entry(org.opends.server.types.Entry) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) PolyString(com.evolveum.midpoint.prism.polystring.PolyString)

Example 39 with OrgType

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

the class AbstractLdapHierarchyTest method test322MoveOrgZblo.

@Test
public void test322MoveOrgZblo() throws Exception {
    final String TEST_NAME = "test322MoveOrgZblo";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(AbstractLdapHierarchyTest.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    PrismObject<OrgType> orgBefore = getOrg(ORG_CORTUV_HRAD_NAME2);
    ObjectDelta<OrgType> delta = orgBefore.createModifyDelta();
    PrismContainerValue<AssignmentType> oldAssignment = null;
    for (PrismContainerValue aval : orgBefore.findContainer(OrgType.F_ASSIGNMENT).getValues()) {
        oldAssignment = (PrismContainerValue<AssignmentType>) aval;
        if (OrgType.COMPLEX_TYPE.equals(oldAssignment.asContainerable().getTargetRef().getType())) {
            break;
        }
    }
    delta.addModificationDeleteContainer(OrgType.F_ASSIGNMENT, oldAssignment.clone());
    AssignmentType newAssignmentType = new AssignmentType();
    ObjectReferenceType targetRef = new ObjectReferenceType();
    targetRef.setOid(orgRolyulaDiabolicaOid);
    targetRef.setType(OrgType.COMPLEX_TYPE);
    newAssignmentType.setTargetRef(targetRef);
    delta.addModificationAddContainer(OrgType.F_ASSIGNMENT, newAssignmentType);
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    display("Modifying " + orgBefore + "with delta", delta);
    modelService.executeChanges(MiscSchemaUtil.createCollection(delta), null, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    dumpOrgTree();
    dumpLdap();
    PrismObject<OrgType> orgAfter = getAndAssertFunctionalOrg(ORG_CORTUV_HRAD_NAME2, orgRolyulaDiabolicaOid);
    assertEquals("Cortuv hrad org OID changed after rename", orgCortuvHradOid, orgAfter.getOid());
    recomputeIfNeeded(orgCortuvHradOid);
    dumpOrgTree();
    dumpLdap();
    getAndAssertUser(USER_GORC_USERNAME2, ORG_CORTUV_HRAD_NAME2, ORG_ROYULA_DIABOLICA_NAME);
    getAndAssertUser(USER_DEZI_USERNAME, ORG_VYSNE_VLKODLAKY_NAME, ORG_CORTUV_HRAD_NAME2, ORG_ROYULA_DIABOLICA_NAME);
    assertSubOrgs(orgAfter, 1);
    assertSubOrgs(orgRolyulaCarpathiaOid, 0);
    assertSubOrgs(orgRolyulaDiabolicaOid, 1);
    assertSubOrgs(ORG_TOP_OID, 2);
    assertSubOrgs(orgVysneVlkodlakyOid, 0);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) PrismContainerValue(com.evolveum.midpoint.prism.PrismContainerValue) ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) Test(org.testng.annotations.Test)

Example 40 with OrgType

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

the class AbstractLdapHierarchyTest method assertNoGroupMembers.

protected 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)

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