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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations