Search in sources :

Example 51 with Entry

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());
}
Also used : Task(com.evolveum.midpoint.task.api.Task) Entry(org.opends.server.types.Entry) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) File(java.io.File) Test(org.testng.annotations.Test)

Example 52 with Entry

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);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) Entry(org.opends.server.types.Entry) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) QName(javax.xml.namespace.QName) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PrismObject(com.evolveum.midpoint.prism.PrismObject) Test(org.testng.annotations.Test)

Example 53 with Entry

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;
}
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) PolyString(com.evolveum.midpoint.prism.polystring.PolyString)

Example 54 with Entry

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);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) 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) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) Test(org.testng.annotations.Test) AbstractIntegrationTest(com.evolveum.midpoint.test.AbstractIntegrationTest)

Example 55 with Entry

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

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