Search in sources :

Example 91 with OrgType

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

the class TestOrgSync method test108RedskullGoesVegeratian.

/**
	 * Remove "canibalism" responsibility from redskull.
	 */
@Test
public void test108RedskullGoesVegeratian() throws Exception {
    final String TEST_NAME = "test108RedskullGoesVegeratian";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    DummyAccount account = dummyResourceHr.getAccountByUsername(ACCOUNT_REDSKULL_USERNAME);
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    account.removeAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_RESPONSIBILITIES, RESP_CANIBALISM);
    waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    PrismObject<UserType> user = findUserByUsername(ACCOUNT_REDSKULL_USERNAME);
    assertNotNull("No redskull user", user);
    display("User", user);
    assertUser(user, ACCOUNT_REDSKULL_USERNAME, ACCOUNT_REDSKULL_FIST_NAME, ACCOUNT_REDSKULL_LAST_NAME);
    assertAccount(user, RESOURCE_DUMMY_HR_OID);
    dumpOrgTree();
    PrismObject<OrgType> org = getAndAssertReplicatedOrg(ORGPATH_MONKEY_ISLAND);
    assertAssignedOrg(user, org.getOid());
    assertHasOrg(user, org.getOid());
    assertHasOrg(org, ORG_TOP_OID);
    assertSubOrgs(org, 0);
    assertSubOrgs(ORG_TOP_OID, 1);
    assertEquals("Monkey island Org OID has changed", orgMonkeyIslandOid, org.getOid());
    assertBasicRoleAndResources(user);
    roleCanibalismOid = assertNoResponsibility(user, RESP_CANIBALISM);
    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 92 with OrgType

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

the class TestOrgSync method test105AddHrAccountLemonhead.

/**
	 * Second account on Monkey Island. The existing org should be reused.
	 */
@Test
public void test105AddHrAccountLemonhead() throws Exception {
    final String TEST_NAME = "test105AddHrAccountLemonhead";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    DummyAccount newAccount = new DummyAccount(ACCOUNT_LEMONHEAD_USERNAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_FIRST_NAME, ACCOUNT_LEMONHEAD_FIST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_LAST_NAME, ACCOUNT_LEMONHEAD_LAST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_ORGPATH, ORGPATH_MONKEY_ISLAND);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_RESPONSIBILITIES, RESP_CANIBALISM);
    // WHEN
    dummyResourceHr.addAccount(newAccount);
    waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true);
    // THEN
    PrismObject<UserType> user = findUserByUsername(ACCOUNT_LEMONHEAD_USERNAME);
    assertNotNull("No lemonhead user", user);
    display("User", user);
    assertUser(user, ACCOUNT_LEMONHEAD_USERNAME, ACCOUNT_LEMONHEAD_FIST_NAME, ACCOUNT_LEMONHEAD_LAST_NAME);
    assertAccount(user, RESOURCE_DUMMY_HR_OID);
    dumpOrgTree();
    PrismObject<OrgType> org = getAndAssertReplicatedOrg(ORGPATH_MONKEY_ISLAND);
    assertAssignedOrg(user, org.getOid());
    assertHasOrg(user, org.getOid());
    assertHasOrg(org, ORG_TOP_OID);
    assertSubOrgs(org, 0);
    assertSubOrgs(ORG_TOP_OID, 1);
    assertEquals("Monkey island Org OID has changed", orgMonkeyIslandOid, org.getOid());
    assertBasicRoleAndResources(user);
    roleCanibalismOid = assertResponsibility(user, RESP_CANIBALISM);
    assertAssignments(user, 3);
}
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 93 with OrgType

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

the class TestOrgSync method test107AddHrAccountRedskull.

/**
	 * Yet another canibal to play with.
	 */
@Test
public void test107AddHrAccountRedskull() throws Exception {
    final String TEST_NAME = "test107AddHrAccountRedskull";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    DummyAccount newAccount = new DummyAccount(ACCOUNT_REDSKULL_USERNAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_FIRST_NAME, ACCOUNT_REDSKULL_FIST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_LAST_NAME, ACCOUNT_REDSKULL_LAST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_ORGPATH, ORGPATH_MONKEY_ISLAND);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_RESPONSIBILITIES, RESP_CANIBALISM);
    // WHEN
    dummyResourceHr.addAccount(newAccount);
    waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true);
    // THEN
    PrismObject<UserType> user = findUserByUsername(ACCOUNT_REDSKULL_USERNAME);
    assertNotNull("No redskull user", user);
    display("User", user);
    assertUser(user, ACCOUNT_REDSKULL_USERNAME, ACCOUNT_REDSKULL_FIST_NAME, ACCOUNT_REDSKULL_LAST_NAME);
    assertAccount(user, RESOURCE_DUMMY_HR_OID);
    dumpOrgTree();
    PrismObject<OrgType> org = getAndAssertReplicatedOrg(ORGPATH_MONKEY_ISLAND);
    assertAssignedOrg(user, org.getOid());
    assertHasOrg(user, org.getOid());
    assertHasOrg(org, ORG_TOP_OID);
    assertEquals("Monkey island Org OID has changed", orgMonkeyIslandOid, org.getOid());
    assertSubOrgs(org, 0);
    assertSubOrgs(ORG_TOP_OID, 1);
    assertBasicRoleAndResources(user);
    String thisRoleCanibalismOid = assertResponsibility(user, RESP_CANIBALISM);
    assertEquals("Canibalism role OID has changed", roleCanibalismOid, thisRoleCanibalismOid);
    assertAssignments(user, 3);
}
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 94 with OrgType

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

the class TestOrgSync method test106AddHrAccountSharptooth.

/**
	 * Yet another canibal. Same org, same responsibility. Make sure everything
	 * is reused and not created again.
	 */
@Test
public void test106AddHrAccountSharptooth() throws Exception {
    final String TEST_NAME = "test106AddHrAccountSharptooth";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    DummyAccount newAccount = new DummyAccount(ACCOUNT_SHARPTOOTH_USERNAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_FIRST_NAME, ACCOUNT_SHARPTOOTH_FIST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_LAST_NAME, ACCOUNT_SHARPTOOTH_LAST_NAME);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_ORGPATH, ORGPATH_MONKEY_ISLAND);
    newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_RESPONSIBILITIES, RESP_CANIBALISM);
    // WHEN
    dummyResourceHr.addAccount(newAccount);
    waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true);
    // THEN
    PrismObject<UserType> user = findUserByUsername(ACCOUNT_SHARPTOOTH_USERNAME);
    assertNotNull("No sharptooth user", user);
    display("User", user);
    assertUser(user, ACCOUNT_SHARPTOOTH_USERNAME, ACCOUNT_SHARPTOOTH_FIST_NAME, ACCOUNT_SHARPTOOTH_LAST_NAME);
    assertAccount(user, RESOURCE_DUMMY_HR_OID);
    dumpOrgTree();
    PrismObject<OrgType> org = getAndAssertReplicatedOrg(ORGPATH_MONKEY_ISLAND);
    assertAssignedOrg(user, org.getOid());
    assertHasOrg(user, org.getOid());
    assertHasOrg(org, ORG_TOP_OID);
    assertEquals("Monkey island Org OID has changed", orgMonkeyIslandOid, org.getOid());
    assertSubOrgs(org, 0);
    assertSubOrgs(ORG_TOP_OID, 1);
    assertBasicRoleAndResources(user);
    String thisRoleCanibalismOid = assertResponsibility(user, RESP_CANIBALISM);
    assertEquals("Canibalism role OID has changed", roleCanibalismOid, thisRoleCanibalismOid);
    assertAssignments(user, 3);
}
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 95 with OrgType

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

the class OrgPhotoTest method test099DeleteOrg.

/**
     * Checks that after removing an org the photo is removed as well.
     */
@Test
public void test099DeleteOrg() throws Exception {
    OperationResult result = new OperationResult(OrgPhotoTest.class.getName() + ".test099DeleteOrg");
    repositoryService.deleteObject(OrgType.class, orgOid, result);
    PrismObject<OrgType> org = PrismTestUtil.parseObject(ORG_FILE);
    org.asObjectable().setJpegPhoto(null);
    String oid = repositoryService.addObject(org, null, result);
    assertEquals("Oid was changed", orgOid, oid);
    // there should be no photo there
    checkObject(orgOid, org, true, result);
}
Also used : 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