use of org.opends.server.types.Entry in project midpoint by Evolveum.
the class TestOpenDj method test121RenameAccountWillOnResource.
@Test
public void test121RenameAccountWillOnResource() throws Exception {
String TEST_NAME = "test121RenameAccountWillOnResource";
TestUtil.displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
openDJController.executeRenameChange(new File(TEST_DIR, "rename.ldif").getPath());
Entry entry = openDJController.fetchEntry("uid=will123,ou=People,dc=example,dc=com");
assertNotNull("Entry with dn uid=will123,ou=People,dc=example,dc=com does not exist", entry);
ShadowType repoShadowType = repositoryService.getObject(ShadowType.class, ACCOUNT_WILL_OID, null, result).asObjectable();
PrismAsserts.assertEqualsPolyString("Name not equal (repo)", "uid=will,ou=People,dc=example,dc=com", repoShadowType.getName());
assertAttribute(repoShadowType, getSecondaryIdentifierQName(), StringUtils.lowerCase(ACCOUNT_WILL_DN));
ShadowType provisioningAccountType = provisioningService.getObject(ShadowType.class, ACCOUNT_WILL_OID, null, task, result).asObjectable();
PrismAsserts.assertEqualsPolyString("Name not equal.", "uid=will123,ou=People,dc=example,dc=com", provisioningAccountType.getName());
assertAttribute(provisioningAccountType, getSecondaryIdentifierQName(), "uid=will123,ou=People,dc=example,dc=com");
repoShadowType = repositoryService.getObject(ShadowType.class, ACCOUNT_WILL_OID, null, result).asObjectable();
PrismAsserts.assertEqualsPolyString("Name not equal (repo after provisioning)", "uid=will123,ou=People,dc=example,dc=com", repoShadowType.getName());
assertAttribute(repoShadowType, getSecondaryIdentifierQName(), "uid=will123,ou=people,dc=example,dc=com");
assertShadows(1 + getNumberOfBaseContextShadows());
}
use of org.opends.server.types.Entry in project midpoint by Evolveum.
the class TestOpenDj method test456AddGroupSpecialists.
@Test
public void test456AddGroupSpecialists() throws Exception {
final String TEST_NAME = "test456AddGroupSpecialists";
TestUtil.displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
ShadowType object = parseObjectType(GROUP_SPECIALISTS_FILE, ShadowType.class);
IntegrationTestTools.display("Adding object", object);
// WHEN
TestUtil.displayWhen(TEST_NAME);
String addedObjectOid = provisioningService.addObject(object.asPrismObject(), null, null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
assertEquals(GROUP_SPECIALISTS_OID, addedObjectOid);
ShadowType shadowType = repositoryService.getObject(ShadowType.class, GROUP_SPECIALISTS_OID, null, result).asObjectable();
PrismAsserts.assertEqualsPolyString("Wrong ICF name (repo)", GROUP_SPECIALISTS_DN, shadowType.getName());
PrismObject<ShadowType> provisioningShadow = provisioningService.getObject(ShadowType.class, GROUP_SPECIALISTS_OID, null, taskManager.createTaskInstance(), result);
ShadowType provisioningShadowType = provisioningShadow.asObjectable();
assertEquals("Wrong ICF name (provisioning)", dnMatchingRule.normalize(GROUP_SPECIALISTS_DN), dnMatchingRule.normalize(provisioningShadowType.getName().getOrig()));
String uid = ShadowUtil.getSingleStringAttributeValue(shadowType, getPrimaryIdentifierQName());
assertNotNull(uid);
ResourceAttribute<Object> memberAttr = ShadowUtil.getAttribute(provisioningShadow, new QName(RESOURCE_OPENDJ_NS, GROUP_MEMBER_ATTR_NAME));
assertNull("Member attribute sneaked in", memberAttr);
Entry ldapEntry = openDJController.searchAndAssertByEntryUuid(uid);
display("LDAP group", ldapEntry);
assertNotNull("No LDAP group entry");
String groupDn = ldapEntry.getDN().toString();
assertEquals("Wrong group DN", dnMatchingRule.normalize(GROUP_SPECIALISTS_DN), dnMatchingRule.normalize(groupDn));
assertShadows(23);
}
use of org.opends.server.types.Entry in project midpoint by Evolveum.
the class TestRetirement method getAndAssertFunctionalOrg.
private 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 org.opends.server.types.Entry in project midpoint by Evolveum.
the class TestRetirement method test050AddOrgRetired.
@Test
public void test050AddOrgRetired() throws Exception {
final String TEST_NAME = "test050AddOrgRetired";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestRetirement.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
PrismObject<OrgType> orgBefore = PrismTestUtil.parseObject(ORG_RETIRED_FILE);
// 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> org = getObject(OrgType.class, ORG_RETIRED_OID);
display("org", org);
PrismAsserts.assertPropertyValue(org, OrgType.F_ORG_TYPE, ORG_TYPE_FUNCTIONAL);
String ouShadowOid = getLinkRefOid(org, RESOURCE_OPENDJ_OID, ShadowKindType.GENERIC, LDAP_OU_INTENT);
PrismObject<ShadowType> ouShadow = getShadowModel(ouShadowOid);
display("Org retired OU shadow", ouShadow);
// TODO assert shadow content
Entry ouEntry = openDJController.fetchEntry(ouShadow.getName().getOrig());
assertNotNull("No ou LDAP entry for retirement (" + ouShadow.getName().getOrig() + ")", ouEntry);
display("OU retirement entry", openDJController.toHumanReadableLdifoid(ouEntry));
openDJController.assertObjectClass(ouEntry, "organizationalUnit");
assertSubOrgs(org, 0);
}
use of org.opends.server.types.Entry in project midpoint by Evolveum.
the class TestOrgSync method getAndAssertReplicatedOrg.
private PrismObject<OrgType> getAndAssertReplicatedOrg(String orgName) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, DirectoryException, ExpressionEvaluationException {
PrismObject<OrgType> org = getOrg(orgName);
PrismAsserts.assertPropertyValue(org, OrgType.F_ORG_TYPE, "replicated");
assertAssignedRole(org, ROLE_META_REPLICATED_ORG_OID);
PrismReferenceValue linkRef = getSingleLinkRef(org);
// We are bold enough to get the whole shadow
PrismObject<ShadowType> shadow = getShadowModel(linkRef.getOid());
display("Org " + orgName + " shadow", shadow);
// TODO assert shadow content
Entry ouEntry = openDJController.searchSingle("ou=" + orgName);
assertNotNull("No ou LDAP entry for " + orgName);
display("OU entry", ouEntry);
openDJController.assertObjectClass(ouEntry, "organizationalUnit");
return org;
}
Aggregations