Search in sources :

Example 51 with OrgType

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

the class TestOrgSync method test117AddHrAccountCobb.

/**
	 * Two-level orgpath, completely created. No new orgs should be created.
	 */
@Test
public void test117AddHrAccountCobb() throws Exception {
    final String TEST_NAME = "test117AddHrAccountCobb";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    DummyAccount newAccount = new DummyAccount(ACCOUNT_COBB_USERNAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_FIRST_NAME, ACCOUNT_COBB_FIST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_LAST_NAME, ACCOUNT_COBB_LAST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_ORGPATH, ORGPATH_SCUMM_BAR);
    // WHEN
    dummyResourceHr.addAccount(newAccount);
    waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true);
    // THEN
    PrismObject<UserType> user = findUserByUsername(ACCOUNT_COBB_USERNAME);
    assertNotNull("No cobb user", user);
    display("User", user);
    assertUser(user, ACCOUNT_COBB_USERNAME, ACCOUNT_COBB_FIST_NAME, ACCOUNT_COBB_LAST_NAME);
    assertAccount(user, RESOURCE_DUMMY_HR_OID);
    dumpOrgTree();
    PrismObject<OrgType> orgScummBar = getAndAssertReplicatedOrg("Scumm Bar");
    PrismObject<OrgType> orgMoR = getAndAssertReplicatedOrg("Ministry of Rum");
    assertAssignedOrg(user, orgScummBar.getOid());
    assertHasOrg(user, orgScummBar.getOid());
    assertHasOrg(orgScummBar, orgMoR.getOid());
    assertHasOrg(orgMoR, ORG_TOP_OID);
    assertEquals("MoR Org OID has changed", orgMoROid, orgMoR.getOid());
    assertEquals("Scumm bar Org OID has changed", orgScummBarOid, orgScummBar.getOid());
    assertSubOrgs(orgScummBar, 0);
    assertSubOrgs(orgMoR, 2);
    assertSubOrgs(orgMonkeyIslandOid, 0);
    assertSubOrgs(ORG_TOP_OID, 2);
    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 52 with OrgType

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

the class TestOrgSync method test115AddHrAccountMancomb.

/**
	 * Two-level orgpath, partially created. Only scumm bar should be crated.
	 * Ministry should be reused.
	 */
@Test
public void test115AddHrAccountMancomb() throws Exception {
    final String TEST_NAME = "test115AddHrAccountMancomb";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    DummyAccount newAccount = new DummyAccount(ACCOUNT_MANCOMB_USERNAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_FIRST_NAME, ACCOUNT_MANCOMB_FIST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_LAST_NAME, ACCOUNT_MANCOMB_LAST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_ORGPATH, ORGPATH_SCUMM_BAR);
    // WHEN
    dummyResourceHr.addAccount(newAccount);
    waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true);
    // THEN
    PrismObject<UserType> user = findUserByUsername(ACCOUNT_MANCOMB_USERNAME);
    assertNotNull("No mancomb user", user);
    display("User", user);
    assertUser(user, ACCOUNT_MANCOMB_USERNAME, ACCOUNT_MANCOMB_FIST_NAME, ACCOUNT_MANCOMB_LAST_NAME);
    assertAccount(user, RESOURCE_DUMMY_HR_OID);
    dumpOrgTree();
    PrismObject<OrgType> orgScummBar = getAndAssertReplicatedOrg("Scumm Bar");
    orgScummBarOid = orgScummBar.getOid();
    PrismObject<OrgType> orgMoR = getAndAssertReplicatedOrg("Ministry of Rum");
    assertAssignedOrg(user, orgScummBar.getOid());
    assertHasOrg(user, orgScummBar.getOid());
    assertHasOrg(orgScummBar, orgMoR.getOid());
    assertHasOrg(orgMoR, ORG_TOP_OID);
    assertSubOrgs(orgScummBar, 0);
    assertSubOrgs(orgMoR, 2);
    assertSubOrgs(orgMonkeyIslandOid, 0);
    assertSubOrgs(ORG_TOP_OID, 2);
    assertEquals("MoR Org OID has changed", orgMoROid, orgMoR.getOid());
    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 53 with OrgType

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

the class TestOrgSync method test142AddHrAccountAugustus.

/**
	 * Two-level orgpath, both orgs are only as ou in LDAP, not in midpoint.
	 */
@Test
public void test142AddHrAccountAugustus() throws Exception {
    final String TEST_NAME = "test142AddHrAccountAugustus";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    DummyAccount newAccount = new DummyAccount(ACCOUNT_AUGUSTUS_USERNAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_FIRST_NAME, ACCOUNT_AUGUSTUS_FIST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_LAST_NAME, ACCOUNT_AUGUSTUS_LAST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_ORGPATH, ORGPATH_BOOTY_ISLAND_LOOKOUT);
    // WHEN
    dummyResourceHr.addAccount(newAccount);
    waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true);
    // THEN
    PrismObject<UserType> user = findUserByUsername(ACCOUNT_AUGUSTUS_USERNAME);
    assertNotNull("No cobb user", user);
    display("User", user);
    assertUser(user, ACCOUNT_AUGUSTUS_USERNAME, ACCOUNT_AUGUSTUS_FIST_NAME, ACCOUNT_AUGUSTUS_LAST_NAME);
    assertAccount(user, RESOURCE_DUMMY_HR_OID);
    dumpOrgTree();
    PrismObject<OrgType> orgLookout = getAndAssertReplicatedOrg("Lookout");
    PrismObject<OrgType> orgBooty = getAndAssertReplicatedOrg(ORGPATH_BOOTY_ISLAND);
    assertAssignedOrg(user, orgLookout.getOid());
    assertHasOrg(user, orgLookout.getOid());
    assertHasOrg(orgLookout, orgBooty.getOid());
    assertHasOrg(orgBooty, ORG_TOP_OID);
    assertSubOrgs(orgLookout, 0);
    assertSubOrgs(orgBooty, 1);
    assertSubOrgs(orgMonkeyIslandOid, 0);
    assertSubOrgs(ORG_TOP_OID, 5);
    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 54 with OrgType

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

the class TestOrgSync method test186AddHrAccountCapsize.

/**
	 * Commas in the org structure.
	 */
@Test
public void test186AddHrAccountCapsize() throws Exception {
    final String TEST_NAME = "test186AddHrAccountCapsize";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    DummyAccount newAccount = new DummyAccount(ACCOUNT_CAPSIZE_USERNAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_FIRST_NAME, ACCOUNT_CAPSIZE_FIST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_LAST_NAME, ACCOUNT_CAPSIZE_LAST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_ORGPATH, ORGPATH_CAPSIZE);
    // WHEN
    dummyResourceHr.addAccount(newAccount);
    waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true);
    // THEN
    PrismObject<UserType> user = findUserByUsername(ACCOUNT_CAPSIZE_USERNAME);
    assertNotNull("No largo user", user);
    display("User", user);
    assertUser(user, ACCOUNT_CAPSIZE_USERNAME, ACCOUNT_CAPSIZE_FIST_NAME, ACCOUNT_CAPSIZE_LAST_NAME);
    assertAccount(user, RESOURCE_DUMMY_HR_OID);
    dumpOrgTree();
    PrismObject<OrgType> orgCapsize = getAndAssertReplicatedOrg("Cruises, Charter and Capsize");
    PrismObject<OrgType> orgTour = getAndAssertReplicatedOrg("Tourist Industries, Tri-Island Area");
    assertAssignedOrg(user, orgCapsize.getOid());
    assertHasOrg(user, orgCapsize.getOid());
    assertHasOrg(orgCapsize, orgTour.getOid());
    assertHasOrg(orgTour, ORG_TOP_OID);
    assertSubOrgs(orgCapsize, 0);
    assertSubOrgs(orgTour, 1);
    assertSubOrgs(orgScummBarOid, 0);
    assertSubOrgs(orgMoROid, 2);
    assertSubOrgs(orgMonkeyIslandOid, 0);
    assertSubOrgs(ORG_TOP_OID, 7);
    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 55 with OrgType

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

the class TestOrgSync method test187AddHrAccountRogersSr.

/**
	 * Comma in username
	 */
@Test
public void test187AddHrAccountRogersSr() throws Exception {
    final String TEST_NAME = "test187AddHrAccountRogersSr";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    DummyAccount newAccount = new DummyAccount(ACCOUNT_ROGERSSR_USERNAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_FIRST_NAME, ACCOUNT_ROGERSSR_FIST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_LAST_NAME, ACCOUNT_ROGERSSR_LAST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_ORGPATH, ORGPATH_SCUMM_BAR);
    // WHEN
    dummyResourceHr.addAccount(newAccount);
    waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true);
    // THEN
    PrismObject<UserType> user = findUserByUsername(ACCOUNT_ROGERSSR_USERNAME);
    assertNotNull("No largo user", user);
    display("User", user);
    assertUser(user, ACCOUNT_ROGERSSR_USERNAME, ACCOUNT_ROGERSSR_FIST_NAME, ACCOUNT_ROGERSSR_LAST_NAME);
    assertAccount(user, RESOURCE_DUMMY_HR_OID);
    dumpOrgTree();
    PrismObject<OrgType> orgScummBar = getAndAssertReplicatedOrg("Scumm Bar");
    PrismObject<OrgType> orgMoR = getAndAssertReplicatedOrg("Ministry of Rum");
    assertAssignedOrg(user, orgScummBar.getOid());
    assertHasOrg(user, orgScummBar.getOid());
    assertHasOrg(orgScummBar, orgMoR.getOid());
    assertHasOrg(orgMoR, ORG_TOP_OID);
    assertEquals("MoR Org OID has changed", orgMoROid, orgMoR.getOid());
    assertEquals("Scumm bar Org OID has changed", orgScummBarOid, orgScummBar.getOid());
    assertSubOrgs(orgScummBarOid, 0);
    assertSubOrgs(orgMoROid, 2);
    assertSubOrgs(orgMonkeyIslandOid, 0);
    assertSubOrgs(ORG_TOP_OID, 7);
    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