SubentryManagerTestCase.java revision 9aa1482c49865483f798f91ef7d16f03cc3ec811
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2009-2010 Sun Microsystems, Inc.
* Portions Copyright 2011-2015 ForgeRock AS
*/
@SuppressWarnings("javadoc")
public class SubentryManagerTestCase extends CoreTestCase
{
private Entry ldapSubentry;
private Entry legacyLdapSubentry;
private Entry collectiveSubentry;
{
}
{
}
public void setUpQuiesceServer()
{
}
@Test
public void testSubentryManager() throws Exception
{
assertThat(getDns(subentryList)).containsExactly(ldapSubentry.getName(), legacyLdapSubentry.getName());
// Other unit tests may have modified the sub-entry causing it to contain
// modify timestamps, etc, so get a fresh copy.
}
{
{
}
return results;
}
{
{
}
return results;
}
@Test
public void testCollectiveAttributes() throws Exception
{
try
{
}
finally
{
}
}
/**
* Tests that collective attributes can be applied to entries which match
* subtree specification using virtual attributes.
*
* @throws Exception
* If an unexpected problem occurs.
*/
@Test
public void testCollectiveAttributesWorkWithVirtualAttributes()
throws Exception
{
"dn: ou=people,o=test",
"objectClass: top",
"objectClass: organizationalUnit",
"ou: people",
"",
"dn: cn=description collective attribute,ou=people,o=test",
"objectClass: top",
"objectClass: subentry",
"objectClass: collectiveAttributeSubentry",
"objectClass: extensibleObject",
"subtreeSpecification: {base \"\", specificationFilter \"(isMemberOf=cn=collective users,ou=people,o=test)\"}",
"cn: description collective attribute",
"description;collective: inherited description",
"",
"dn: cn=collective users,ou=people,o=test",
"objectClass: top",
"objectClass: groupOfNames",
"cn: ca users",
"member: uid=collective user,ou=people,o=test",
"",
"dn: uid=collective user,ou=people,o=test",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: collective user",
"givenName: collective",
"sn: user",
"cn: collective user",
"userPassword: password",
"",
"dn: uid=normal user,ou=people,o=test",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: normal user",
"givenName: normal",
"sn: user",
"cn: normal user",
"userPassword: password"
);
try
{
// Normal user will not inherit the collective description attribute.
assertNotNull(e);
// Collective user will inherit the collective description attribute.
assertNotNull(e);
}
finally
{
// Clear sub-entry and groups from test backend.
}
}
@Test
public void testInheritedCollectiveAttributes() throws Exception
{
// Add test inherited from DN collective subentry.
"dn: cn=Inherited From DN Collective Subentry," + SUFFIX,
"objectClass: top",
"objectclass: subentry",
"objectClass: inheritedCollectiveAttributeSubentry",
"objectClass: inheritedFromDNCollectiveAttributeSubentry",
"inheritFromDNAttribute: manager",
"inheritAttribute: postalAddress",
"subtreeSpecification: {base \"ou=Test SubEntry Manager\"}",
"cn: Inherited From DN Collective Subentry");
// Add test inherited from RDN collective subentry.
"dn: cn=Inherited From RDN Collective Subentry," + SUFFIX,
"objectClass: top",
"objectclass: subentry",
"objectClass: inheritedCollectiveAttributeSubentry",
"objectClass: inheritedFromRDNCollectiveAttributeSubentry",
"inheritFromBaseRDN: " + BASE_RDN,
"inheritFromRDNAttribute: title",
"inheritFromRDNType: cn",
"inheritAttribute: telephoneNumber",
"subtreeSpecification: {base \"ou=Test SubEntry Manager\"}",
"cn: Inherited From RDN Collective Subentry");
// Test Inherited Collective Attributes on test entry.
// Cleanup.
}
@Test
public void testCollectiveAttributeConflict() throws Exception
{
try
{
// real-overrides-virtual.
// virtual-overrides-real.
// merge-real-and-virtual.
}
finally
{
// cleanup.
}
}
{
{
}
}
private void doesNotHaveValues(DN dn, String attrTypeLower, String... values) throws DirectoryException
{
{
}
}
{
}
@Test
public void testCollectiveAttributeSubentries() throws Exception
{
.addAttribute("collectiveAttributeSubentries");
}
@Test
public void testCollectiveExclusions() throws Exception
{
try
{
}
finally
{
// cleanup.
}
}
{
ModifyOperation modifyOperation = conn.processModify(ByteString.valueOfUtf8(e.getName().toString()), mods);
}
{
ModifyOperation modifyOperation = conn.processModify(ByteString.valueOfUtf8(e.getName().toString()), mods);
}
{
}
@Test
public void testSubtreeDelete() throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--noPropertiesFile",
};
// Re-add entries.
}
@Test
public void testSubtreeModify() throws Exception
{
"dn: " + BASE,
"changetype: moddn",
"newRDN: " + NEWBASE,
"deleteOldRDN: 1");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--noPropertiesFile",
"-f", newPath
};
// The legacyLdapSubentry should still apply.
// Move it back.
"changetype: moddn",
"newRDN: " + OLDBASE,
"deleteOldRDN: 1");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--noPropertiesFile",
"-f", oldPath
};
}
@Test
public void testExtendedSubtreeSpecification() throws Exception
{
// This one should have been added during test setup so just
// do a quick check here to make sure it is available there.
// RFC3672 Spec test subentry.
{
{
}
}
// Add Relative Spec test subentry.
"dn: cn=Relative Subentry," + SUFFIX,
"objectClass: top",
"objectclass: subentry",
"subtreeSpecification: {base \"ou=Test SubEntry Manager\", specificationFilter \"(objectClass=*)\"}",
"cn: Subentry");
{
{
}
}
// Remove Relative Spec test subentry.
}
private void addTestEntries() throws Exception
{
// Add suffix entry.
{
}
// Add base entry.
{
}
// Add role entry.
"dn: cn=Sales," + BASE,
"objectclass: top",
"objectclass: organizationalRole",
"postalAddress: Sub City, Collective Street, AK 47",
"telephoneNumber: +1 999 999 9999",
"cn: Sales"
);
// Add test entry.
"dn: uid=rogasawara," + BASE,
"objectclass: top",
"objectclass: person",
"objectclass: organizationalPerson",
"objectclass: inetOrgPerson",
"uid: rogasawara",
"userpassword: password",
"mail: rogasawara@example.com",
"givenname: Rodney",
"sn: Ogasawara",
"cn: Rodney Ogasawara",
"manager: cn=Sales," + BASE,
"title: Sales"
);
// Add test subentry.
"dn: cn=Subentry," + SUFFIX,
"objectClass: top",
"objectclass: subentry",
"subtreeSpecification: {base \"ou=Test SubEntry Manager\"}",
"cn: Subentry");
// Add test legacy subentry.
"dn: cn=Legacy Subentry," + SUFFIX,
"objectClass: top",
"objectclass: ldapSubentry",
"cn: Legacy Subentry");
// Add test collective subentry.
"dn: cn=Collective Subentry," + SUFFIX,
"objectClass: top",
"objectclass: subentry",
"objectClass: collectiveAttributeSubentry",
"objectClass: extensibleObject",
"c-l: Savoie",
"preferredLanguage;collective: fr",
"subtreeSpecification: {base \"ou=Test SubEntry Manager\"}",
"cn: Collective Subentry");
}
}