VirtualAttributeRuleTestCase.java revision ea1068c292e9b341af6d6b563cd8988a96be20a9
/*
* 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 2008 Sun Microsystems, Inc.
* Portions Copyright 2011-2015 ForgeRock AS
*/
/**
* This class provides a set of test cases for virtual attribute rules, which
* link a virtual attribute provider implementation with an attribute type and a
* set of criteria for identifying the entries with which that provider should
* be used.
*/
public class VirtualAttributeRuleTestCase
extends TypesTestCase
{
// The attribute type for the entryDN attribute.
private AttributeType entryDNType;
/**
* Ensures that the Directory Server is running.
*
* @throws Exception If an unexpected problem occurs.
*/
public void startServer()
throws Exception
{
}
/**
* Retrieves a set of virtual attribute rules that may be used for testing
* purposes. The return data will also include a Boolean value indicating
* whether the rule would apply to a minimal "o=test" entry.
*
* @return A set of virtual attribute rules that may be used for testing
* purposes.
*
* @throws Exception If an unexpected problem occurs.
*/
public Object[][] getVirtualAttributeRules()
throws Exception
{
return new Object[][]
{
new Object[]
{
true
},
new Object[]
{
true
},
new Object[]
{
false
},
new Object[]
{
true
},
new Object[]
{
true
},
new Object[]
{
false
},
new Object[]
{
true
},
new Object[]
{
true
},
new Object[]
{
true
},
new Object[]
{
false
},
new Object[]
{
true
},
};
}
/**
* Tests the various getter methods in the virtual attribute rule class.
*
* @param rule The rule for which to perform the test.
* @param appliesToEntry Indicates whether the provided rule applies to a
* minimal "o=test" entry.
*/
{
EntryDNVirtualAttributeProvider.class.getName());
}
/**
* Tests the {@code appliesToEntry} method.
*
* @param rule The rule for which to perform the test.
* @param appliesToEntry Indicates whether the provided rule applies to a
* minimal "o=test" entry.
*
* @throws Exception If an unexpected problem occurs.
*/
boolean appliesToEntry)
throws Exception
{
addGroups();
removeGroups();
}
/**
* Tests the {@code toString} method.
*
* @param rule The rule for which to perform the test.
* @param appliesToEntry Indicates whether the provided rule applies to a
* minimal "o=test" entry.
*/
{
}
/**
* Adds a group to the server in which the "o=test" entry is a member.
*
* @throws Exception If an unexpected problem occurs.
*/
private void addGroups()
throws Exception
{
"dn: cn=Test Group,o=test",
"objectClass: top",
"objectClass: groupOfUniqueNames",
"cn: Test Group",
"uniqueMember: o=test",
"",
"dn: cn=Example Group,o=test",
"objectClass: top",
"objectClass: groupOfUniqueNames",
"cn: Example Group",
"uniqueMember: dc=example,dc=com");
}
/**
* Removes the test group from the server.
*
* @throws Exception If an unexpected problem occurs.
*/
private void removeGroups()
throws Exception
{
}
}