Search in sources :

Example 41 with OrgType

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

the class AbstractLdapHierarchyTest method test300RenameOrgCortuvHrad.

@Test
public void test300RenameOrgCortuvHrad() throws Exception {
    final String TEST_NAME = "test300RenameOrgCortuvHrad";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(AbstractLdapHierarchyTest.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    PrismObject<OrgType> orgBefore = createOrg(ORG_CORTUV_HRAD_NAME, orgRolyulaCarpathiaOid);
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    display("Adding org", orgBefore);
    modifyObjectReplaceProperty(OrgType.class, orgCortuvHradOid, OrgType.F_NAME, task, result, new PolyString(ORG_CORTUV_HRAD_NAME2));
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    dumpOrgTree();
    dumpLdap();
    PrismObject<OrgType> orgAfter = getAndAssertFunctionalOrg(ORG_CORTUV_HRAD_NAME2, orgRolyulaCarpathiaOid);
    assertEquals("Cortuv hrad org OID changed after rename", orgCortuvHradOid, orgAfter.getOid());
    getAndAssertUser(USER_DEZI_USERNAME, ORG_VYSNE_VLKODLAKY_NAME, ORG_CORTUV_HRAD_NAME2, ORG_ROYULA_CARPATHIA_NAME);
    assertSubOrgs(orgAfter, 1);
    assertSubOrgs(orgRolyulaCarpathiaOid, 1);
    assertSubOrgs(ORG_TOP_OID, 1);
    assertSubOrgs(orgVysneVlkodlakyOid, 0);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) Test(org.testng.annotations.Test)

Example 42 with OrgType

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

the class TestLdapDeeplyHierarchical method getAndAssertFunctionalOrg.

@Override
protected PrismObject<OrgType> getAndAssertFunctionalOrg(String orgName, String directParentOrgOid) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, DirectoryException, ExpressionEvaluationException {
    PrismObject<OrgType> org = super.getAndAssertFunctionalOrg(orgName, directParentOrgOid);
    if (directParentOrgOid != null && !ORG_TOP_OID.equals(directParentOrgOid)) {
        Entry groupEntry = openDJController.searchSingle("cn=" + orgName);
        PrismObject<OrgType> parentOrg = getObject(OrgType.class, directParentOrgOid);
        Entry parentGroupEntry = openDJController.searchSingle("cn=" + parentOrg.getName());
        assertNotNull("No group LDAP entry for " + parentOrg.getName(), parentGroupEntry);
        display("parent group entry", openDJController.toHumanReadableLdifoid(parentGroupEntry));
        openDJController.assertUniqueMember(parentGroupEntry, groupEntry.getDN().toString());
    }
    String ouOid = getLinkRefOid(org, RESOURCE_OPENDJ_OID, ShadowKindType.GENERIC, LDAP_OU_INTENT);
    PrismObject<ShadowType> ouShadow = getShadowModel(ouOid);
    display("Org " + orgName + " ou shadow", ouShadow);
    Entry groupEntry = openDJController.searchSingle("ou=" + orgName);
    assertNotNull("No UO LDAP entry for " + orgName, groupEntry);
    display("OU entry", openDJController.toHumanReadableLdifoid(groupEntry));
    openDJController.assertObjectClass(groupEntry, "organizationalUnit");
    String expectedDn = getOuDn(org);
    assertEquals("Wrong OU DN", expectedDn, groupEntry.getDN().toString().toLowerCase());
    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)

Example 43 with OrgType

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

the class TestLdapDependency method test200AddOrgHR.

@Test
public void test200AddOrgHR() throws Exception {
    final String TEST_NAME = "test200AddOrgHR";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestLdapDependency.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    PrismObject<OrgType> orgBefore = createOrg(ORG_HR_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 = getOrg(ORG_HR_NAME);
    orgHrOid = orgAfter.getOid();
    assertSubOrgs(orgAfter, 0);
    assertSubOrgs(ORG_TOP_OID, 2);
}
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) Test(org.testng.annotations.Test)

Example 44 with OrgType

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

the class TestLdapDependency method test100AddOrgIT.

@Test
public void test100AddOrgIT() throws Exception {
    final String TEST_NAME = "test100AddOrgIT";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestLdapDependency.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    PrismObject<OrgType> orgBefore = createOrg(ORG_IT_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 = getOrg(ORG_IT_NAME);
    orgItOid = orgAfter.getOid();
    assertSubOrgs(orgAfter, 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) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test)

Example 45 with OrgType

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

the class TestLdapDependency method test270UnassignVipRoleFromHROrg.

@Test
public void test270UnassignVipRoleFromHROrg() throws Exception {
    final String TEST_NAME = "test270UnassignVipRoleFromHROrg";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestLdapDependency.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    PrismObject<OrgType> orgBefore = getOrg(ORG_HR_NAME);
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    display("unassigning vip role org", orgBefore);
    unassignRoleFromOrg(orgHrOid, ROLE_META_ORG_VIP_OID, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    dumpOrgTree();
    dumpLdap();
    PrismObject<OrgType> orgAfter = getOrg(ORG_HR_NAME);
    display("AFTER unassigning vip role org", orgAfter);
    assertSubOrgs(orgAfter, 0);
    assertSubOrgs(ORG_TOP_OID, 2);
    assertRoleMembershipRef(orgAfter, ROLE_META_ORG_OID, ORG_TOP_OID);
    assertNotAssignedRole(orgAfter, ROLE_META_ORG_VIP_OID);
    assertLdapObject(orgAfter, ShadowKindType.ENTITLEMENT, LDAP_GROUP_INTENT);
    assertLdapObject(orgAfter, ShadowKindType.GENERIC, LDAP_OU_INTENT);
//TODO: assert ldap vip objects deleted...
}
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) Test(org.testng.annotations.Test)

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