Search in sources :

Example 21 with Entry

use of org.opends.server.types.Entry in project midpoint by Evolveum.

the class TestLdapDeeplyHierarchical 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;
}
Also used : Entry(org.opends.server.types.Entry) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)

Example 22 with Entry

use of org.opends.server.types.Entry in project midpoint by Evolveum.

the class TestLdapDependency method assertLdapObjectsFunctionalOrg.

private void assertLdapObjectsFunctionalOrg(PrismObject<OrgType> org) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, DirectoryException, ExpressionEvaluationException {
    String orgName = org.getName().toString();
    display("assert org", org.getName());
    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");
}
Also used : Entry(org.opends.server.types.Entry) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)

Example 23 with Entry

use of org.opends.server.types.Entry in project midpoint by Evolveum.

the class TestOrgSync method assertResponsibility.

private String assertResponsibility(PrismObject<UserType> user, String respName) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, DirectoryException, ExpressionEvaluationException {
    String respRoleName = "R_" + respName;
    PrismObject<RoleType> respRole = searchObjectByName(RoleType.class, respRoleName);
    assertNotNull("No role for responsibility " + respName);
    display("Responsibility role for " + respName, respRole);
    assertAssignedRole(user, respRole.getOid());
    PrismReferenceValue linkRef = getSingleLinkRef(respRole);
    PrismObject<ShadowType> shadow = getShadowModel(linkRef.getOid());
    display("Role " + respRoleName + " shadow", shadow);
    // TODO assert shadow content
    String groupDn = "cn=" + respRoleName + ",ou=groups," + openDJController.getSuffix();
    Entry groupEntry = openDJController.fetchAndAssertEntry(groupDn, "groupOfUniqueNames");
    display("Group entry", groupEntry);
    PrismReferenceValue accountLinkRef = getLinkRef(user, RESOURCE_OPENDJ_OID);
    PrismObject<ShadowType> accountShadow = getShadowModel(accountLinkRef.getOid());
    String accountDn = IntegrationTestTools.getSecondaryIdentifier(accountShadow);
    openDJController.assertUniqueMember(groupEntry, accountDn);
    IntegrationTestTools.assertAssociation(accountShadow, OPENDJ_ASSOCIATION_GROUP_NAME, shadow.getOid());
    return respRole.getOid();
}
Also used : Entry(org.opends.server.types.Entry) SearchResultEntry(org.opends.server.types.SearchResultEntry) PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue) RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)

Example 24 with Entry

use of org.opends.server.types.Entry in project midpoint by Evolveum.

the class TestLdap method createEntry.

private Entry createEntry(String uid, String name) throws IOException, LDIFException {
    StringBuilder sb = new StringBuilder();
    String dn = "uid=" + uid + "," + openDJController.getSuffixPeople();
    sb.append("dn: ").append(dn).append("\n");
    sb.append("objectClass: inetOrgPerson\n");
    sb.append("uid: ").append(uid).append("\n");
    sb.append("cn: ").append(name).append("\n");
    sb.append("sn: ").append(name).append("\n");
    LDIFImportConfig importConfig = new LDIFImportConfig(IOUtils.toInputStream(sb.toString(), "utf-8"));
    LDIFReader ldifReader = new LDIFReader(importConfig);
    Entry ldifEntry = ldifReader.readEntry();
    return ldifEntry;
}
Also used : Entry(org.opends.server.types.Entry) LDIFImportConfig(org.opends.server.types.LDIFImportConfig) LDIFReader(org.opends.server.util.LDIFReader)

Example 25 with Entry

use of org.opends.server.types.Entry in project midpoint by Evolveum.

the class TestLdapComplex method createEntry.

private Entry createEntry(String uid, String name) throws IOException, LDIFException {
    StringBuilder sb = new StringBuilder();
    String dn = "uid=" + uid + "," + openDJController.getSuffixPeople();
    sb.append("dn: ").append(dn).append("\n");
    sb.append("objectClass: inetOrgPerson\n");
    sb.append("uid: ").append(uid).append("\n");
    sb.append("cn: ").append(name).append("\n");
    sb.append("sn: ").append(name).append("\n");
    LDIFImportConfig importConfig = new LDIFImportConfig(IOUtils.toInputStream(sb.toString(), "utf-8"));
    LDIFReader ldifReader = new LDIFReader(importConfig);
    Entry ldifEntry = ldifReader.readEntry();
    return ldifEntry;
}
Also used : Entry(org.opends.server.types.Entry) LDIFImportConfig(org.opends.server.types.LDIFImportConfig) LDIFReader(org.opends.server.util.LDIFReader)

Aggregations

Entry (org.opends.server.types.Entry)87 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)45 Test (org.testng.annotations.Test)44 Task (com.evolveum.midpoint.task.api.Task)43 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)40 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)29 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)14 QName (javax.xml.namespace.QName)11 SearchResultEntry (org.opends.server.types.SearchResultEntry)11 LDIFImportConfig (org.opends.server.types.LDIFImportConfig)10 LDIFReader (org.opends.server.util.LDIFReader)10 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)9 OrgType (com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType)8 PrismObject (com.evolveum.midpoint.prism.PrismObject)6 JarEntry (java.util.jar.JarEntry)6 ChangeRecordEntry (org.opends.server.util.ChangeRecordEntry)6 ModifyChangeRecordEntry (org.opends.server.util.ModifyChangeRecordEntry)6 ModifyDNChangeRecordEntry (org.opends.server.util.ModifyDNChangeRecordEntry)6 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)5 PrismReferenceValue (com.evolveum.midpoint.prism.PrismReferenceValue)4