Search in sources :

Example 46 with OrgType

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

the class TestLdapDependency method assertLdapObjectsFunctionalOrg.

private void assertLdapObjectsFunctionalOrg(PrismObject<OrgType> org) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, DirectoryException, ExpressionEvaluationException {
    String orgName = org.getName().toString();
    display("assert org", org.getName());
    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");
}
Also used : Entry(org.opends.server.types.Entry) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)

Example 47 with OrgType

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

the class TestOrgSync method test109HrDeleteRedskull.

/**
	 * Vegetarian cannibal? Not really!
	 */
@Test
public void test109HrDeleteRedskull() throws Exception {
    final String TEST_NAME = "test109HrDeleteRedskull";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    dummyResourceHr.deleteAccountByName(ACCOUNT_REDSKULL_USERNAME);
    waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    PrismObject<UserType> user = findUserByUsername(ACCOUNT_REDSKULL_USERNAME);
    display("User", user);
    assertNull("Redskull user not gone", user);
    dumpOrgTree();
    PrismObject<OrgType> org = getAndAssertReplicatedOrg(ORGPATH_MONKEY_ISLAND);
    assertHasOrg(org, ORG_TOP_OID);
    assertSubOrgs(org, 0);
    assertSubOrgs(ORG_TOP_OID, 1);
    assertEquals("Monkey island Org OID has changed", orgMonkeyIslandOid, org.getOid());
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Example 48 with OrgType

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

the class TestOrgSync method test185AddHrAccountStan.

/**
	 * Some national characters there.
	 */
@Test
public void test185AddHrAccountStan() throws Exception {
    final String TEST_NAME = "test185AddHrAccountStan";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    DummyAccount newAccount = new DummyAccount(ACCOUNT_STAN_USERNAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_FIRST_NAME, ACCOUNT_STAN_FIST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_LAST_NAME, ACCOUNT_STAN_LAST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_ORGPATH, ORGPATH_DOCKS);
    // WHEN
    dummyResourceHr.addAccount(newAccount);
    waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true);
    // THEN
    PrismObject<UserType> user = findUserByUsername(ACCOUNT_STAN_USERNAME);
    assertNotNull("No largo user", user);
    display("User", user);
    assertUser(user, ACCOUNT_STAN_USERNAME, ACCOUNT_STAN_FIST_NAME, ACCOUNT_STAN_LAST_NAME);
    assertAccount(user, RESOURCE_DUMMY_HR_OID);
    dumpOrgTree();
    PrismObject<OrgType> orgDocks = getAndAssertReplicatedOrg("Docks");
    PrismObject<OrgType> orgMelee = getAndAssertReplicatedOrg(ORGPATH_MELEE_ISLAND);
    assertAssignedOrg(user, orgDocks.getOid());
    assertHasOrg(user, orgDocks.getOid());
    assertHasOrg(orgDocks, orgMelee.getOid());
    assertHasOrg(orgMelee, ORG_TOP_OID);
    assertSubOrgs(orgDocks, 0);
    assertSubOrgs(orgMelee, 1);
    assertSubOrgs(orgScummBarOid, 0);
    assertSubOrgs(orgMoROid, 2);
    assertSubOrgs(orgMonkeyIslandOid, 0);
    assertSubOrgs(ORG_TOP_OID, 6);
    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 49 with OrgType

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

the class TestOrgSync method test190AddHrAccountTeleke.

/**
	 * Lot of national characters here.
	 */
@Test
public void test190AddHrAccountTeleke() throws Exception {
    final String TEST_NAME = "test190AddHrAccountTeleke";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    DummyAccount newAccount = new DummyAccount(ACCOUNT_TELEKE_USERNAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_FIRST_NAME, ACCOUNT_TELEKE_FIST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_LAST_NAME, ACCOUNT_TELEKE_LAST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_ORGPATH, ORGPATH_HRAD);
    // WHEN
    dummyResourceHr.addAccount(newAccount);
    waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true);
    // THEN
    PrismObject<UserType> user = findUserByUsername(ACCOUNT_TELEKE_USERNAME);
    assertNotNull("No largo user", user);
    display("User", user);
    assertUser(user, ACCOUNT_TELEKE_USERNAME, ACCOUNT_TELEKE_FIST_NAME, ACCOUNT_TELEKE_LAST_NAME);
    assertAccount(user, RESOURCE_DUMMY_HR_OID);
    dumpOrgTree();
    PrismObject<OrgType> orgHrad = getAndAssertReplicatedOrg(HRAD);
    PrismObject<OrgType> orgKarpatula = getAndAssertReplicatedOrg(ORGPATH_KARPATULA);
    assertAssignedOrg(user, orgHrad.getOid());
    assertHasOrg(user, orgHrad.getOid());
    assertHasOrg(orgHrad, orgKarpatula.getOid());
    assertHasOrg(orgKarpatula, ORG_TOP_OID);
    assertSubOrgs(orgHrad, 0);
    assertSubOrgs(orgKarpatula, 1);
    assertSubOrgs(orgScummBarOid, 0);
    assertSubOrgs(orgMoROid, 2);
    assertSubOrgs(orgMonkeyIslandOid, 0);
    assertSubOrgs(ORG_TOP_OID, 8);
    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 50 with OrgType

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

the class TestOrgSync method test130AddHrAccountLargo.

/**
	 * Four-level orgpath, completely new.
	 */
@Test
public void test130AddHrAccountLargo() throws Exception {
    final String TEST_NAME = "test130AddHrAccountLargo";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    DummyAccount newAccount = new DummyAccount(ACCOUNT_LARGO_USERNAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_FIRST_NAME, ACCOUNT_LARGO_FIST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_LAST_NAME, ACCOUNT_LARGO_LAST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_ORGPATH, ORGPATH_BRUTE);
    // WHEN
    dummyResourceHr.addAccount(newAccount);
    waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true);
    // THEN
    PrismObject<UserType> user = findUserByUsername(ACCOUNT_LARGO_USERNAME);
    assertNotNull("No largo user", user);
    display("User", user);
    assertUser(user, ACCOUNT_LARGO_USERNAME, ACCOUNT_LARGO_FIST_NAME, ACCOUNT_LARGO_LAST_NAME);
    assertAccount(user, RESOURCE_DUMMY_HR_OID);
    dumpOrgTree();
    PrismObject<OrgType> orgMoO = getAndAssertReplicatedOrg("Ministry of Offense");
    PrismObject<OrgType> orgDoM = getAndAssertReplicatedOrg("Department of Mischief");
    PrismObject<OrgType> orgVSec = getAndAssertReplicatedOrg("Violence Section");
    PrismObject<OrgType> orgBOff = getAndAssertReplicatedOrg("Brute Office");
    assertAssignedOrg(user, orgBOff.getOid());
    assertHasOrg(user, orgBOff.getOid());
    assertHasOrg(orgBOff, orgVSec.getOid());
    assertHasOrg(orgVSec, orgDoM.getOid());
    assertHasOrg(orgDoM, orgMoO.getOid());
    assertHasOrg(orgMoO, ORG_TOP_OID);
    assertSubOrgs(orgBOff, 0);
    assertSubOrgs(orgVSec, 1);
    assertSubOrgs(orgDoM, 1);
    assertSubOrgs(orgMoO, 1);
    assertSubOrgs(orgScummBarOid, 0);
    assertSubOrgs(orgMoROid, 2);
    assertSubOrgs(orgMonkeyIslandOid, 0);
    assertSubOrgs(ORG_TOP_OID, 3);
    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)

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