use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.
the class TestRetirement method createOrg.
private PrismObject<OrgType> createOrg(String name, String parentOrgOid) throws SchemaException {
PrismObject<OrgType> org = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(OrgType.class).instantiate();
OrgType orgType = org.asObjectable();
orgType.setName(new PolyStringType(name));
orgType.getOrgType().add(ORG_TYPE_FUNCTIONAL);
AssignmentType metaRoleAssignment = new AssignmentType();
ObjectReferenceType metaRoleAssignmentTargetRef = new ObjectReferenceType();
metaRoleAssignmentTargetRef.setOid(ROLE_META_ORG_OID);
metaRoleAssignmentTargetRef.setType(RoleType.COMPLEX_TYPE);
metaRoleAssignment.setTargetRef(metaRoleAssignmentTargetRef);
orgType.getAssignment().add(metaRoleAssignment);
if (parentOrgOid != null) {
AssignmentType parentAssignment = new AssignmentType();
ObjectReferenceType parentAssignmentTargetRef = new ObjectReferenceType();
parentAssignmentTargetRef.setOid(parentOrgOid);
parentAssignmentTargetRef.setType(OrgType.COMPLEX_TYPE);
parentAssignment.setTargetRef(parentAssignmentTargetRef);
orgType.getAssignment().add(parentAssignment);
}
return org;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.
the class TestRetirement method assertGroupMembers.
private 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 TestRetirement method test100AddOrgRoyulaCarpathia.
@Test
public void test100AddOrgRoyulaCarpathia() throws Exception {
final String TEST_NAME = "test100AddOrgRoyulaCarpathia";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestRetirement.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
PrismObject<OrgType> orgBefore = createOrg(ORG_ROYULA_CARPATHIA_NAME, ORG_TOP_OID);
// WHEN
TestUtil.displayWhen(TEST_NAME);
display("Adding org", orgBefore);
addObject(orgBefore, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
dumpOrgTree();
dumpLdap();
PrismObject<OrgType> orgAfter = getAndAssertFunctionalOrg(ORG_ROYULA_CARPATHIA_NAME, ORG_TOP_OID);
orgRolyulaCarpathiaOid = orgAfter.getOid();
assertSubOrgs(orgAfter, 0);
assertSubOrgs(ORG_TOP_OID, 1);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.
the class TestOrgSync method test110AddHrAccountGuybrush.
/**
* Two-level orgpath. Both orgs should be created.
*/
@Test
public void test110AddHrAccountGuybrush() throws Exception {
final String TEST_NAME = "test110AddHrAccountGuybrush";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
DummyAccount newAccount = new DummyAccount(ACCOUNT_GUYBRUSH_USERNAME);
newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_FIRST_NAME, ACCOUNT_GUYBRUSH_FIST_NAME);
newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_LAST_NAME, ACCOUNT_GUYBRUSH_LAST_NAME);
newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_ORGPATH, ORGPATH_FREELANCE);
// WHEN
dummyResourceHr.addAccount(newAccount);
waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true);
// THEN
PrismObject<UserType> user = findUserByUsername(ACCOUNT_GUYBRUSH_USERNAME);
assertNotNull("No guybrush user", user);
display("User", user);
assertUserGuybrush(user);
assertAccount(user, RESOURCE_DUMMY_HR_OID);
dumpOrgTree();
PrismObject<OrgType> orgFreelance = getAndAssertReplicatedOrg("Freelance");
PrismObject<OrgType> orgMoR = getAndAssertReplicatedOrg("Ministry of Rum");
orgMoROid = orgMoR.getOid();
assertAssignedOrg(user, orgFreelance.getOid());
assertHasOrg(user, orgFreelance.getOid());
assertHasOrg(orgFreelance, orgMoR.getOid());
assertHasOrg(orgMoR, ORG_TOP_OID);
assertSubOrgs(orgFreelance, 0);
assertSubOrgs(orgMoR, 1);
assertSubOrgs(orgMonkeyIslandOid, 0);
assertSubOrgs(ORG_TOP_OID, 2);
assertBasicRoleAndResources(user);
assertAssignments(user, 2);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.
the class OrgStructTest method test003modifyOrgStructDeleteRef.
@SuppressWarnings("unchecked")
@Test
public void test003modifyOrgStructDeleteRef() throws Exception {
// test modification of org ref - delete org ref
OperationResult opResult = new OperationResult("test003modifyOrgStructDeleteRef");
ObjectModificationType modification = PrismTestUtil.parseAtomicValue(new File(MODIFY_ORG_DELETE_REF_FILENAME), ObjectModificationType.COMPLEX_TYPE);
ObjectDelta<OrgType> delta = DeltaConvertor.createObjectDelta(modification, OrgType.class, prismContext);
Session session = open();
try {
LOGGER.info("==>before modify - delete<==");
List<ROrgClosure> orgClosure = getOrgClosure(ORG_F003_OID, MODIFY_ORG_DELETE_REF_OID, session);
AssertJUnit.assertEquals(1, orgClosure.size());
session.getTransaction().commit();
repositoryService.modifyObject(OrgType.class, MODIFY_ORG_DELETE_REF_OID, delta.getModifications(), opResult);
session.clear();
session.beginTransaction();
LOGGER.info("==>after modify - delete<==");
orgClosure = getOrgClosure(ORG_F003_OID, MODIFY_ORG_DELETE_REF_OID, session);
AssertJUnit.assertEquals(0, orgClosure.size());
} finally {
close(session);
}
}
Aggregations