use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.
the class TestOrgStruct method test410AddJackWithOrgUnit.
/**
* Add new user Jack with an assignments as an manager and also a member of ministry of offense.
* (copied from test400)
*/
@Test
public void test410AddJackWithOrgUnit() throws Exception {
final String TEST_NAME = "test400AddJackWithOrgUnit";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
OrgType minOffense = getObject(OrgType.class, ORG_MINISTRY_OF_OFFENSE_OID).asObjectable();
PrismObject<UserType> userJack = prismContext.parseObject(USER_JACK_FILE);
userJack.asObjectable().getOrganizationalUnit().add(minOffense.getName());
Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(userJack.createAddDelta());
// WHEN
modelService.executeChanges(deltas, null, task, result);
// THEN
userJack = getUser(USER_JACK_OID);
display("User jack after", userJack);
assertAssignedOrgs(userJack, ORG_MINISTRY_OF_OFFENSE_OID);
assertHasOrgs(userJack, ORG_MINISTRY_OF_OFFENSE_OID);
assertAssignedOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, null);
assertHasOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, null);
// Postcondition
assertMonkeyIslandOrgSanity();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.
the class TestMachineIntelligence method test010importActiveUserRUR.
/**
*
* WHEN: Create account in the HR, import this acount to the midPoint
* THEN: User is imported to midPoint, new Organization is created,
* user is assigned to the organization, assignment is active/inactive
* according to the setting in the resource
*/
@Test
public void test010importActiveUserRUR() throws Exception {
final String TEST_NAME = "test010importActiveUserRUR";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN
PrismObject<ShadowType> shadow = addObject(SHADOW_RUR_FILE, task, result);
assertEquals(SHADOW_RUR_OID, shadow.getOid());
//AND
modelService.importFromResource(SHADOW_RUR_OID, task, result);
//THEN
//assert created organization
SearchResultList<PrismObject<OrgType>> orgs = modelService.searchObjects(OrgType.class, QueryBuilder.queryFor(OrgType.class, prismContext).item(OrgType.F_NAME).eq("Universe").matching(PolyStringNormMatchingRule.NAME).build(), null, task, result);
assertEquals("Found unexpected number of organizations, expected 1, found " + orgs.size(), 1, orgs.size());
//assert created owner of shadow
PrismObject<UserType> userRur = assertShadowOwner(SHADOW_RUR_OID, "R.U.R", "Rossum", "Universal Robots", "Rossum's Universal Robots", task, result);
//assert assignment of org
assertAssignedOrg(userRur, orgs.iterator().next());
//assert assignment of or in more depth
assertAssignment(userRur.asObjectable(), ActivationStatusType.ENABLED, null);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.
the class AbstractLdapHierarchyTest method assertGroupMembers.
protected void assertGroupMembers(PrismObject<OrgType> org, String... members) throws Exception {
String groupOid = getLinkRefOid(org, RESOURCE_OPENDJ_OID, ShadowKindType.ENTITLEMENT, "org-group");
PrismObject<ShadowType> groupShadow = getShadowModel(groupOid);
assertAttribute(resourceOpenDj, groupShadow.asObjectable(), new QName(MidPointConstants.NS_RI, "uniqueMember"), members);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.
the class TestEntertainment method test001AddParentOrg.
@Test
public void test001AddParentOrg() throws Exception {
final String TEST_NAME = "test001AddParentOrg";
displayTestTile(TEST_NAME);
Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN
addObject(ORG_GAMES_TOP_FILE);
// THEN
PrismObject<OrgType> orgGames = modelService.getObject(OrgType.class, ORG_GAMES_TOP_OID, null, task, result);
assertNotNull("No top org for games found", orgGames);
result.computeStatus();
assertSuccess("Error while getting top games org", result);
OrgType orgGamesType = orgGames.asObjectable();
assertLinks(orgGames, 2);
List<ObjectReferenceType> linkRefs = orgGamesType.getLinkRef();
// SHADOW 1
ShadowType shadowType1 = getAndAssertShadowSuccess(linkRefs.get(0), task, result);
// SHADOW 2
ShadowType shadowType2 = getAndAssertShadowSuccess(linkRefs.get(1), task, result);
assertIntents(shadowType1, shadowType2);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.
the class TestEntertainment method test002AddChildOrg.
@Test
public void test002AddChildOrg() throws Exception {
final String TEST_NAME = "test002AddChildOrg";
displayTestTile(TEST_NAME);
Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN
addObject(ORG_POKER_FILE);
// THEN
Collection<String> uniqueMembers = openDJController.getGroupUniqueMembers("cn=Games,ou=groups,dc=example,dc=com");
assertNotNull("null unique members", uniqueMembers);
assertEquals("Expected exactly one member", 1, uniqueMembers.size());
openDJController.assertUniqueMember("cn=Games,ou=groups,dc=example,dc=com", "cn=Poker,ou=groups,dc=example,dc=com");
PrismObject<OrgType> orgGames = modelService.getObject(OrgType.class, ORG_POKER_OID, null, task, result);
assertNotNull("No top org for games found", orgGames);
result.computeStatus();
assertSuccess("Error while getting top games org", result);
OrgType orgGamesType = orgGames.asObjectable();
assertLinks(orgGames, 2);
List<ObjectReferenceType> linkRefs = orgGamesType.getLinkRef();
// SHADOW 1
ShadowType shadowType1 = getAndAssertShadowSuccess(linkRefs.get(0), task, result);
// SHADOW 2
ShadowType shadowType2 = getAndAssertShadowSuccess(linkRefs.get(1), task, result);
assertIntents(shadowType1, shadowType2);
}
Aggregations