use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.
the class AbstractLdapHierarchyTest method test320AddOrgRoyulaDiabolica.
@Test
public void test320AddOrgRoyulaDiabolica() throws Exception {
final String TEST_NAME = "test320AddOrgRoyulaDiabolica";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(AbstractLdapHierarchyTest.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
PrismObject<OrgType> orgBefore = createOrg(ORG_ROYULA_DIABOLICA_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_DIABOLICA_NAME, ORG_TOP_OID);
orgRolyulaDiabolicaOid = orgAfter.getOid();
assertSubOrgs(orgAfter, 0);
assertSubOrgs(ORG_TOP_OID, 2);
assertSubOrgs(orgRolyulaDiabolicaOid, 0);
assertSubOrgs(orgRolyulaCarpathiaOid, 1);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.
the class AbstractLdapHierarchyTest method reconcileAllOrgs.
protected void reconcileAllOrgs() throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
final Task task = createTask("reconcileAllOrgs");
OperationResult result = task.getResult();
ResultHandler<OrgType> handler = new ResultHandler<OrgType>() {
@Override
public boolean handle(PrismObject<OrgType> object, OperationResult parentResult) {
try {
display("reconciling " + object);
reconcileOrg(object.getOid(), task, parentResult);
} catch (SchemaException | PolicyViolationException | ExpressionEvaluationException | ObjectNotFoundException | ObjectAlreadyExistsException | CommunicationException | ConfigurationException | SecurityViolationException e) {
throw new SystemException(e.getMessage(), e);
}
return true;
}
};
display("Reconciling all orgs");
modelService.searchObjectsIterative(OrgType.class, null, handler, null, task, result);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.
the class AbstractLdapHierarchyTest method getAndAssertFunctionalOrg.
protected PrismObject<OrgType> getAndAssertFunctionalOrg(String orgName, String directParentOrgOid) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, DirectoryException, ExpressionEvaluationException {
PrismObject<OrgType> org = getOrg(orgName);
display("org", org);
PrismAsserts.assertPropertyValue(org, OrgType.F_ORG_TYPE, ORG_TYPE_FUNCTIONAL);
assertAssignedRole(org, ROLE_META_ORG_OID);
String groupOid = getLinkRefOid(org, RESOURCE_OPENDJ_OID, ShadowKindType.ENTITLEMENT, LDAP_GROUP_INTENT);
PrismObject<ShadowType> groupShadow = getShadowModel(groupOid);
display("Org " + orgName + " group shadow", groupShadow);
// TODO assert shadow content
Entry groupEntry = openDJController.searchSingle("cn=" + orgName);
assertNotNull("No group LDAP entry for " + orgName, groupEntry);
display("OU GROUP entry", openDJController.toHumanReadableLdifoid(groupEntry));
openDJController.assertObjectClass(groupEntry, "groupOfUniqueNames");
assertHasOrg(org, directParentOrgOid);
assertAssignedOrg(org, directParentOrgOid);
return org;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.
the class AbstractLdapHierarchyTest method test322MoveOrgZblo.
@Test
public void test322MoveOrgZblo() throws Exception {
final String TEST_NAME = "test322MoveOrgZblo";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(AbstractLdapHierarchyTest.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
PrismObject<OrgType> orgBefore = getOrg(ORG_CORTUV_HRAD_NAME2);
ObjectDelta<OrgType> delta = orgBefore.createModifyDelta();
PrismContainerValue<AssignmentType> oldAssignment = null;
for (PrismContainerValue aval : orgBefore.findContainer(OrgType.F_ASSIGNMENT).getValues()) {
oldAssignment = (PrismContainerValue<AssignmentType>) aval;
if (OrgType.COMPLEX_TYPE.equals(oldAssignment.asContainerable().getTargetRef().getType())) {
break;
}
}
delta.addModificationDeleteContainer(OrgType.F_ASSIGNMENT, oldAssignment.clone());
AssignmentType newAssignmentType = new AssignmentType();
ObjectReferenceType targetRef = new ObjectReferenceType();
targetRef.setOid(orgRolyulaDiabolicaOid);
targetRef.setType(OrgType.COMPLEX_TYPE);
newAssignmentType.setTargetRef(targetRef);
delta.addModificationAddContainer(OrgType.F_ASSIGNMENT, newAssignmentType);
// WHEN
TestUtil.displayWhen(TEST_NAME);
display("Modifying " + orgBefore + "with delta", delta);
modelService.executeChanges(MiscSchemaUtil.createCollection(delta), null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
dumpOrgTree();
dumpLdap();
PrismObject<OrgType> orgAfter = getAndAssertFunctionalOrg(ORG_CORTUV_HRAD_NAME2, orgRolyulaDiabolicaOid);
assertEquals("Cortuv hrad org OID changed after rename", orgCortuvHradOid, orgAfter.getOid());
recomputeIfNeeded(orgCortuvHradOid);
dumpOrgTree();
dumpLdap();
getAndAssertUser(USER_GORC_USERNAME2, ORG_CORTUV_HRAD_NAME2, ORG_ROYULA_DIABOLICA_NAME);
getAndAssertUser(USER_DEZI_USERNAME, ORG_VYSNE_VLKODLAKY_NAME, ORG_CORTUV_HRAD_NAME2, ORG_ROYULA_DIABOLICA_NAME);
assertSubOrgs(orgAfter, 1);
assertSubOrgs(orgRolyulaCarpathiaOid, 0);
assertSubOrgs(orgRolyulaDiabolicaOid, 1);
assertSubOrgs(ORG_TOP_OID, 2);
assertSubOrgs(orgVysneVlkodlakyOid, 0);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.
the class AbstractLdapHierarchyTest method assertNoGroupMembers.
protected void assertNoGroupMembers(PrismObject<OrgType> org) throws Exception {
String groupOid = getLinkRefOid(org, RESOURCE_OPENDJ_OID, ShadowKindType.ENTITLEMENT, "org-group");
PrismObject<ShadowType> groupShadow = getShadowModel(groupOid);
assertNoAttribute(resourceOpenDj, groupShadow.asObjectable(), new QName(MidPointConstants.NS_RI, "uniqueMember"));
}
Aggregations