VirtualStaticGroupTestCase.java revision ea1068c292e9b341af6d6b563cd8988a96be20a9
2852N/A * The contents of this file are subject to the terms of the 2852N/A * Common Development and Distribution License, Version 1.0 only 2852N/A * (the "License"). You may not use this file except in compliance 2852N/A * See the License for the specific language governing permissions 2852N/A * and limitations under the License. 2852N/A * When distributing Covered Code, include this CDDL HEADER in each 2852N/A * If applicable, add the following below this CDDL HEADER, with the 2852N/A * fields enclosed by brackets "[]" replaced with your own identifying 2852N/A * Portions Copyright [yyyy] [name of copyright owner] 2852N/A * Copyright 2008-2010 Sun Microsystems, Inc. 2852N/A * Portions Copyright 2012-2015 ForgeRock AS 4618N/A * A set of test cases for the virtual static group implementation and the 4865N/A * member virtual attribute provider. 4618N/A * The lines comprising the LDIF test data. 4618N/A "objectClass: organizationalUnit",
4618N/A "dn: uid=test.1,ou=People,o=test",
4618N/A "objectClass: organizationalPerson",
4865N/A "objectClass: inetOrgPerson",
4618N/A "dn: uid=test.2,ou=People,o=test",
4618N/A "objectClass: organizationalPerson",
4618N/A "objectClass: inetOrgPerson",
4618N/A "dn: uid=test.3,ou=People,o=test",
4618N/A "objectClass: organizationalPerson",
4618N/A "objectClass: inetOrgPerson",
4618N/A "dn: uid=test.4,ou=People,o=test",
4618N/A "objectClass: organizationalPerson",
4618N/A "objectClass: inetOrgPerson",
4865N/A "objectClass: organizationalUnit",
4865N/A "dn: cn=Dynamic All Users,ou=Groups,o=test",
4618N/A "objectClass: groupOfURLs",
4618N/A "memberURL: ldap:///ou=People,o=test??sub?(objectClass=person)",
4618N/A "dn: cn=Dynamic One User,ou=Groups,o=test",
4618N/A "objectClass: groupOfURLs",
4618N/A "memberURL: ldap:///ou=People,o=test??sub?(&(objectClass=person)(sn=4))",
4618N/A "dn: cn=Static member List,ou=Groups,o=test",
4618N/A "objectClass: groupOfNames",
4618N/A "member: uid=test.1,ou=People,o=test",
4865N/A "member: uid=test.3,ou=People,o=test",
4618N/A "dn: cn=Static uniqueMember List,ou=Groups,o=test",
4618N/A "objectClass: groupOfUniqueNames",
3175N/A "cn: Static uniqueMember List",
4618N/A "uniqueMember: uid=test.2,ou=People,o=test",
4618N/A "uniqueMember: uid=test.3,ou=People,o=test",
4618N/A "uniqueMember: uid=no-such-user,ou=People,o=test",
4618N/A "dn: cn=Virtual member All Users,ou=Groups,o=test",
4618N/A "objectClass: groupOfNames",
4618N/A "objectClass: ds-virtual-static-group",
4618N/A "cn: Virtual member All Users",
4618N/A "ds-target-group-dn: cn=Dynamic All Users,ou=Groups,o=test",
4618N/A "dn: cn=Virtual uniqueMember All Users,ou=Groups,o=test",
4618N/A "objectClass: groupOfUniqueNames",
4618N/A "objectClass: ds-virtual-static-group",
4618N/A "cn: Virtual uniqueMember All Users",
4865N/A "ds-target-group-dn: cn=Dynamic All Users,ou=Groups,o=test",
4865N/A "dn: cn=Virtual member One User,ou=Groups,o=test",
4618N/A "objectClass: groupOfNames",
4618N/A "objectClass: ds-virtual-static-group",
4618N/A "cn: Virtual member One User",
4618N/A "ds-target-group-dn: cn=Dynamic One User,ou=Groups,o=test",
4618N/A "dn: cn=Virtual uniqueMember One User,ou=Groups,o=test",
4618N/A "objectClass: groupOfUniqueNames",
4713N/A "objectClass: ds-virtual-static-group",
4713N/A "cn: Virtual uniqueMember One User",
4713N/A "ds-target-group-dn: cn=Dynamic One User,ou=Groups,o=test",
4713N/A "dn: cn=Virtual Static member List,ou=Groups,o=test",
4713N/A "objectClass: groupOfNames",
4713N/A "objectClass: ds-virtual-static-group",
4713N/A "cn: Virtual Static member List",
4713N/A "ds-target-group-dn: cn=Static member List,ou=Groups,o=test",
4713N/A "dn: cn=Virtual Static uniqueMember List,ou=Groups,o=test",
4713N/A "objectClass: groupOfUniqueNames",
4713N/A "objectClass: ds-virtual-static-group",
4713N/A "cn: Virtual Static uniqueMember List",
4713N/A "ds-target-group-dn: cn=Static uniqueMember List,ou=Groups,o=test",
4713N/A "dn: cn=Crossover member Static Group,ou=Groups,o=test",
4713N/A "objectClass: groupOfUniqueNames",
4713N/A "objectClass: ds-virtual-static-group",
4713N/A "cn: Crossover member Static Group",
4713N/A "ds-target-group-dn: cn=Static member List,ou=Groups,o=test",
4713N/A "dn: cn=Crossover uniqueMember Static Group,ou=Groups,o=test",
4713N/A "objectClass: groupOfNames",
4713N/A "objectClass: ds-virtual-static-group",
4713N/A "cn: Crossover uniqueMember Static Group",
4865N/A "ds-target-group-dn: cn=Static uniqueMember List,ou=Groups,o=test",
4865N/A "dn: cn=Virtual Nonexistent,ou=Groups,o=test",
4713N/A "objectClass: groupOfNames",
4713N/A "objectClass: ds-virtual-static-group",
4618N/A "ds-target-group-dn: cn=Nonexistent,ou=Groups,o=test" 4618N/A // The attribute type for the member attribute. 4618N/A // The attribute type for the uniqueMember attribute. 4865N/A // The server group manager. 4618N/A // The DNs of the various entries in the data set. 4618N/A * Ensures that the Directory Server is running. 4618N/A * @throws Exception If an unexpected problem occurs. 4618N/A * Tests creating a new instance of a virtual static group from a valid entry. 4618N/A * @throws Exception If an unexpected problem occurs. 4618N/A "dn: cn=Valid Virtual Static Group,ou=Groups,o=test",
4618N/A "objectClass: groupOfNames",
4618N/A "objectClass: ds-virtual-static-group",
4618N/A "cn: Valid Virtual Static Group",
4618N/A "ds-target-group-dn: cn=Static member List,ou=Groups,o=test");
4618N/A * Retrieves a set of invalid vittual static group definition entries. 4618N/A * @return A set of invalid virtul static group definition entries. 4618N/A * @throws Exception If an unexpected problem occurs. 4618N/A "dn: cn=Not a Virtual Static Group,ou=Groups,o=test",
4618N/A "objectClass: groupOfNames",
4618N/A "cn: Not a Virtual Static Group",
4618N/A "member: uid=test.1,ou=People,o=test",
4618N/A "dn: cn=No Target,ou=Groups,o=test",
4618N/A "objectClass: groupOfNames",
4618N/A "objectClass: ds-virtual-static-group",
4618N/A "dn: cn=Invalid Target,ou=Groups,o=test",
4618N/A "objectClass: groupOfNames",
4618N/A "objectClass: ds-virtual-static-group",
4618N/A "ds-target-group-dn: invalid");
4618N/A * Tests creating a new instance of a virtual static group from an invalid 4618N/A * @throws Exception If an unexpected problem occurs. 4618N/A * Performs general tests of the group API for virtual static groups with a 4618N/A * group that has a real target group. 4618N/A * @throws Exception If an unexpected problem occurs. 2938N/A fail(
"Expected an exception from addNestedGroupDN");
2852N/A fail(
"Expected an exception from removeNestedGroupDN");
fail(
"Expected an exception from addMember");
fail(
"Expected an exception from removeMember");
* Performs general tests of the group API for virtual static groups with a * group that has a nonexistent target group. * @throws Exception If an unexpected problem occurs. fail(
"Expected an exception from isMember(DN)");
fail(
"Expected an exception from isMember(Entry)");
fail(
"Expected an exception from getMembers()");
fail(
"Expected an exception from getMembers(base, scope, filter)");
fail(
"Expected an exception from addNestedGroupDN");
fail(
"Expected an exception from removeNestedGroupDN");
fail(
"Expected an exception from addMember");
fail(
"Expected an exception from removeMember");
* Tests the behavior of the virtual static group with a dynamic group. * @throws Exception If an unexpected problem occurs. * Tests the behavior of the virtual static group with a static group based on * @throws Exception If an unexpected problem occurs. * Tests the behavior of the virtual static group with a static group based on * the uniqueMember attribute. * @throws Exception If an unexpected problem occurs. * Performs general tests of the virtual attribute provider API for the member * virtual attribute with a target group that exists. * @throws Exception If an unexpected problem occurs. * Performs general tests of the virtual attribute provider API for the member * virtual attribute with a target group that does not exist. * @throws Exception If an unexpected problem occurs. * Tests the behavior of the member virtual attribute with a dynamic group. * @throws Exception If an unexpected problem occurs. * Tests the behavior of the member virtual attribute with a dynamic group. * The target dynamic group will initially have only one memberURL which * matches only one user, but will then be updated on the fly to contain a * second URL that matches all users. * @throws Exception If an unexpected problem occurs. "ldap:///o=test??sub?(objectClass=person)")));
* Tests the behavior of the member virtual attribute with different settings * for the "allow retrieving membership" attribute. * @throws Exception If an unexpected problem occurs. DN.
valueOf(
"cn=Virtual Static member,cn=Virtual Attributes,cn=config");
* Removes all of the groups that have been added to the server. * @throws Exception If an unexpected problem occurs.