use of org.opends.server.types.Entry in project midpoint by Evolveum.
the class TestLdapUniversity method loadEntries.
private void loadEntries(String prefix) throws LDIFException, IOException {
long ldapPopStart = System.currentTimeMillis();
final int BATCH = 200;
final int TICK = 1000;
// List<String> namesToAdd = new ArrayList<>(BATCH);
for (int i = 0; i < NUM_LDAP_ENTRIES; i++) {
String name = "user" + i;
Entry entry = createEntry(prefix + i, "e" + i, name);
openDJController.addEntry(entry);
// }
if ((i + 1) % TICK == 0 && (i + 1) < NUM_LDAP_ENTRIES) {
display("Loaded " + (i + 1) + " LDAP entries in " + ((System.currentTimeMillis() - ldapPopStart) / 1000) + " seconds, continuing...");
}
}
// if (!namesToAdd.isEmpty()) {
// addToGroups(namesToAdd);
// }
long ldapPopEnd = System.currentTimeMillis();
display("Loaded " + NUM_LDAP_ENTRIES + " LDAP entries in " + ((ldapPopEnd - ldapPopStart) / 1000) + " seconds");
}
use of org.opends.server.types.Entry in project midpoint by Evolveum.
the class ConsistencyTest method test150RecomputeUserAccountNotFound.
/**
* Recompute user => account not found => reaction: Re-create account
* MID-3093
*/
@Test
public void test150RecomputeUserAccountNotFound() throws Exception {
final String TEST_NAME = "test150RecomputeUserAccountNotFound";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userGuybrushFromFile = PrismTestUtil.parseObject(new File(USER_GUYBRUSH_FILENAME));
userGuybrushFromFile.asObjectable().getLinkRef().clear();
repoAddObject(userGuybrushFromFile, result);
assignAccount(USER_GUYBRUSH_OID, RESOURCE_OPENDJ_OID, null);
PrismObject<UserType> userBefore = getUser(USER_GUYBRUSH_OID);
display("User before", userBefore);
String accountShadowOid = assertOneAccountRef(userBefore);
PrismObject<ShadowType> shadowBefore = getShadowModel(accountShadowOid);
display("Model Shadow before", shadowBefore);
String dn = ShadowUtil.getAttributeValue(shadowBefore, RESOURCE_OPENDJ_SECONDARY_IDENTIFIER);
openDJController.delete(dn);
PrismObject<ShadowType> repoShadowBefore = repositoryService.getObject(ShadowType.class, accountShadowOid, null, result);
assertNotNull("Repo shadow is gone!", repoShadowBefore);
display("Repository shadow before", repoShadowBefore);
assertTrue("Oh my! Shadow is dead!", repoShadowBefore.asObjectable().isDead() != Boolean.TRUE);
// WHEN
TestUtil.displayWhen(TEST_NAME);
recomputeUser(USER_GUYBRUSH_OID, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_GUYBRUSH_OID);
display("User after", userAfter);
String accountShadowOidAfter = assertOneAccountRef(userAfter);
PrismObject<ShadowType> shadowAfter = getShadowModel(accountShadowOidAfter);
display("Shadow after", shadowAfter);
Entry entryAfter = openDJController.fetchEntry(dn);
display("Entry after", entryAfter);
}
use of org.opends.server.types.Entry in project midpoint by Evolveum.
the class TestLdapFlat method getAndAssertUser.
@Override
protected PrismObject<UserType> getAndAssertUser(String username, String directOrgGroupname, String... indirectGroupNames) throws SchemaException, CommonException, SecurityViolationException, CommunicationException, ConfigurationException, DirectoryException {
PrismObject<UserType> user = super.getAndAssertUser(username, directOrgGroupname, indirectGroupNames);
Entry accountEntry = openDJController.searchSingle("uid=" + username);
Entry groupEntry = openDJController.searchSingle("cn=" + directOrgGroupname);
assertNotNull("No group LDAP entry for " + directOrgGroupname, groupEntry);
openDJController.assertUniqueMember(groupEntry, accountEntry.getDN().toString());
if (indirectGroupNames != null) {
for (String expectedGroupName : indirectGroupNames) {
groupEntry = openDJController.searchSingle("cn=" + expectedGroupName);
assertNotNull("No group LDAP entry for " + expectedGroupName, groupEntry);
openDJController.assertUniqueMember(groupEntry, accountEntry.getDN().toString());
}
}
return user;
}
use of org.opends.server.types.Entry in project midpoint by Evolveum.
the class TestLdapHierarchical method getAndAssertFunctionalOrg.
@Override
protected PrismObject<OrgType> getAndAssertFunctionalOrg(String orgName, String directParentOrgOid) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, DirectoryException, ExpressionEvaluationException {
PrismObject<OrgType> org = super.getAndAssertFunctionalOrg(orgName, directParentOrgOid);
if (directParentOrgOid != null && !ORG_TOP_OID.equals(directParentOrgOid)) {
Entry groupEntry = openDJController.searchSingle("cn=" + orgName);
PrismObject<OrgType> parentOrg = getObject(OrgType.class, directParentOrgOid);
Entry parentGroupEntry = openDJController.searchSingle("cn=" + parentOrg.getName());
assertNotNull("No group LDAP entry for " + parentOrg.getName(), parentGroupEntry);
display("parent group entry", openDJController.toHumanReadableLdifoid(parentGroupEntry));
openDJController.assertUniqueMember(parentGroupEntry, groupEntry.getDN().toString());
}
String ouOid = getLinkRefOid(org, RESOURCE_OPENDJ_OID, ShadowKindType.GENERIC, LDAP_OU_INTENT);
PrismObject<ShadowType> ouShadow = getShadowModel(ouOid);
display("Org " + orgName + " ou shadow", ouShadow);
Entry groupEntry = openDJController.searchSingle("ou=" + orgName);
assertNotNull("No UO LDAP entry for " + orgName, groupEntry);
display("OU entry", openDJController.toHumanReadableLdifoid(groupEntry));
openDJController.assertObjectClass(groupEntry, "organizationalUnit");
String expectedDn = getOuDn(org);
assertEquals("Wrong OU DN", expectedDn, groupEntry.getDN().toString().toLowerCase());
return org;
}
use of org.opends.server.types.Entry in project midpoint by Evolveum.
the class TestLdapNested method getAndAssertFunctionalOrg.
@Override
protected PrismObject<OrgType> getAndAssertFunctionalOrg(String orgName, String directParentOrgOid) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, DirectoryException, ExpressionEvaluationException {
PrismObject<OrgType> org = super.getAndAssertFunctionalOrg(orgName, directParentOrgOid);
if (directParentOrgOid != null && !ORG_TOP_OID.equals(directParentOrgOid)) {
Entry groupEntry = openDJController.searchSingle("cn=" + orgName);
PrismObject<OrgType> parentOrg = getObject(OrgType.class, directParentOrgOid);
Entry parentGroupEntry = openDJController.searchSingle("cn=" + parentOrg.getName());
assertNotNull("No group LDAP entry for " + parentOrg.getName(), parentGroupEntry);
openDJController.assertUniqueMember(parentGroupEntry, groupEntry.getDN().toString());
}
return org;
}
Aggregations