Search in sources :

Example 86 with OrgType

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

the class TestRetirement method test200AddOrgCortuvHrad.

@Test
public void test200AddOrgCortuvHrad() throws Exception {
    final String TEST_NAME = "test200AddOrgCortuvHrad";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestRetirement.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);
    addObject(orgBefore, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    PrismObject<OrgType> orgAfter = getAndAssertFunctionalOrg(ORG_CORTUV_HRAD_NAME, orgRolyulaCarpathiaOid);
    orgCortuvHradOid = orgAfter.getOid();
    dumpOrgTree();
    dumpLdap();
    assertSubOrgs(orgAfter, 0);
    assertSubOrgs(orgRolyulaCarpathiaOid, 1);
    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) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) Test(org.testng.annotations.Test) AbstractIntegrationTest(com.evolveum.midpoint.test.AbstractIntegrationTest)

Example 87 with OrgType

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

the class TestRetirement method test220AddOrgVysneVlkodlaky.

@Test
public void test220AddOrgVysneVlkodlaky() throws Exception {
    final String TEST_NAME = "test220AddOrgVysneVlkodlaky";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestRetirement.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    PrismObject<OrgType> orgBefore = createOrg(ORG_VYSNE_VLKODLAKY_NAME, orgCortuvHradOid);
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    display("Adding org", orgBefore);
    addObject(orgBefore, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    PrismObject<OrgType> orgAfter = getAndAssertFunctionalOrg(ORG_VYSNE_VLKODLAKY_NAME, orgCortuvHradOid);
    orgVysneVlkodlakyOid = orgAfter.getOid();
    dumpOrgTree();
    dumpLdap();
    assertSubOrgs(orgAfter, 0);
    assertSubOrgs(orgRolyulaCarpathiaOid, 1);
    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) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) Test(org.testng.annotations.Test) AbstractIntegrationTest(com.evolveum.midpoint.test.AbstractIntegrationTest)

Example 88 with OrgType

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

the class TestRetirement method test050AddOrgRetired.

@Test
public void test050AddOrgRetired() throws Exception {
    final String TEST_NAME = "test050AddOrgRetired";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestRetirement.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    PrismObject<OrgType> orgBefore = PrismTestUtil.parseObject(ORG_RETIRED_FILE);
    // 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> org = getObject(OrgType.class, ORG_RETIRED_OID);
    display("org", org);
    PrismAsserts.assertPropertyValue(org, OrgType.F_ORG_TYPE, ORG_TYPE_FUNCTIONAL);
    String ouShadowOid = getLinkRefOid(org, RESOURCE_OPENDJ_OID, ShadowKindType.GENERIC, LDAP_OU_INTENT);
    PrismObject<ShadowType> ouShadow = getShadowModel(ouShadowOid);
    display("Org retired OU shadow", ouShadow);
    // TODO assert shadow content
    Entry ouEntry = openDJController.fetchEntry(ouShadow.getName().getOrig());
    assertNotNull("No ou LDAP entry for retirement (" + ouShadow.getName().getOrig() + ")", ouEntry);
    display("OU retirement entry", openDJController.toHumanReadableLdifoid(ouEntry));
    openDJController.assertObjectClass(ouEntry, "organizationalUnit");
    assertSubOrgs(org, 0);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) 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) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) Test(org.testng.annotations.Test) AbstractIntegrationTest(com.evolveum.midpoint.test.AbstractIntegrationTest)

Example 89 with OrgType

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

the class TestOrgSync method test140AddHrAccountWally.

/**
	 * Two-level orgpath, upper org is only as ou in LDAP, it is not in
	 * midpoint.
	 */
@Test
public void test140AddHrAccountWally() throws Exception {
    final String TEST_NAME = "test140AddHrAccountWally";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    DummyAccount newAccount = new DummyAccount(ACCOUNT_WALLY_USERNAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_FIRST_NAME, ACCOUNT_WALLY_FIST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_LAST_NAME, ACCOUNT_WALLY_LAST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_ORGPATH, ORGPATH_CARTOGRAPHY);
    // WHEN
    dummyResourceHr.addAccount(newAccount);
    waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true);
    // THEN
    PrismObject<UserType> user = findUserByUsername(ACCOUNT_WALLY_USERNAME);
    assertNotNull("No cobb user", user);
    display("User", user);
    assertUser(user, ACCOUNT_WALLY_USERNAME, ACCOUNT_WALLY_FIST_NAME, ACCOUNT_WALLY_LAST_NAME);
    assertAccount(user, RESOURCE_DUMMY_HR_OID);
    dumpOrgTree();
    PrismObject<OrgType> orgCartography = getAndAssertReplicatedOrg("Cartography");
    PrismObject<OrgType> orgScabb = getAndAssertReplicatedOrg(ORGPATH_SCABB_ISLAND);
    assertAssignedOrg(user, orgCartography.getOid());
    assertHasOrg(user, orgCartography.getOid());
    assertHasOrg(orgCartography, orgScabb.getOid());
    assertHasOrg(orgScabb, ORG_TOP_OID);
    assertSubOrgs(orgCartography, 0);
    assertSubOrgs(orgScabb, 1);
    assertSubOrgs(orgMonkeyIslandOid, 0);
    assertSubOrgs(ORG_TOP_OID, 4);
    assertBasicRoleAndResources(user);
    assertAssignments(user, 2);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) DummyAccount(com.evolveum.icf.dummy.resource.DummyAccount) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Example 90 with OrgType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType 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)

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