GoverningStructureRuleVirtualAttributeProviderTestCase.java revision 530e312594f469609337996570cf0ea504554a68
/*
* 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 Sun Microsystems, Inc.
* Portions Copyright 2011-2014 ForgeRock AS
*/
/**
* A set of test cases for the governing structure rule virtual attribute
* provider.
*/
extends ExtensionsTestCase
{
// The attribute type for the governingStructureRule attribute.
private AttributeType governingStructureRuleType;
/**
* Ensures that the Directory Server is running.
*
* @throws Exception If an unexpected problem occurs.
*/
@BeforeClass()
public void startServer()
throws Exception
{
"dn: cn=schema",
"changetype: modify",
"add: nameForms",
"nameForms: ( domainNameForm-oid NAME 'domainNameForm' OC domain MUST ( dc ) )",
"nameForms: ( organizationalNameForm-oid NAME 'organizationalNameForm' OC organization MUST ( o ) )",
"-",
"add: ditStructureRules",
"dITStructureRules: ( 21 NAME 'domainStructureRule' FORM domainNameForm )",
"dITStructureRules: ( 22 NAME 'organizationalStructureRule' FORM organizationalNameForm SUP 21 )"
);
}
/**
* Ensures that the schema is cleaned up.
*
* @throws Exception If an unexpected problem occurs.
*/
@AfterClass()
{
"dn: cn=schema",
"changetype: modify",
"delete: ditStructureRules",
"dITStructureRules: ( 22 NAME 'organizationalStructureRule' FORM organizationalNameForm SUP 21 )",
"dITStructureRules: ( 21 NAME 'domainStructureRule' FORM domainNameForm )",
"-",
"delete: nameForms",
"nameForms: ( domainNameForm-oid NAME 'domainNameForm' OC domain MUST ( dc ) )",
"nameForms: ( organizationalNameForm-oid NAME 'organizationalNameForm' OC organization MUST ( o ) )"
);
}
/**
* Retrieves a set of entry DNs for use in testing the
* governingStructureRule virtual attribute.
*
* @return A set of entry DNs for use in testing the governingStructureRule
* virtual attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
public Object[][] getTestEntryDNs()
throws Exception
{
return new Object[][]
{
};
}
/**
* Retrieves a set of entry DNs and corresponding governing structure rule
* ids for use in testing the governingStructureRule virtual attribute.
*
* @return A set of entry DNs and id for use in testing the
* governingStructureRule virtual attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
public Object[][] getTestEntryDNRuleID()
throws Exception
{
return new Object[][] {
};
}
/**
* Tests the {@code getEntry} method for the specified entry to ensure that
* the entry returned includes the governingStructureRule operational
* attribute with the correct value.
*
* @param entryDN The DN of the entry to retrieve and verify.
* @param ruleId The rule id of the DITStructureRule.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
assertNotNull(e);
{
assertTrue(!a.isEmpty());
}
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the governingStructureRule attribute is not included when the list of attributes
* requested is empty (defaulting to all user attributes).
*
* @param entryDN The DN of the entry to retrieve and verify.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the governingStructureRule attribute is not included when the list of requested
* attributes is "1.1", meaning no attributes.
*
* @param entryDN The DN of the entry to retrieve and verify.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the governingStructureRule attribute is not included when all user attributes
* are requested.
*
* @param entryDN The DN of the entry to retrieve and verify.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the governingStructureRuleType attribute is included when all operational attributes
* are requested.
*
* @param entryDN The DN of the entry to retrieve and verify.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the governingStructureRule attribute is included when that attribute is
* specifically requested.
*
* @param entryDN The DN of the entry to retrieve and verify.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the governingStructureRule attribute is not included when it is not in the list
* of attributes that is explicitly requested.
*
* @param entryDN The DN of the entry to retrieve and verify.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the governingStructureRule attribute is included when that attribute is
* specifically requested and the governingStructureRule attribute is used in the
* search filter with a matching value.
*
* @param entryDN The DN of the entry to retrieve and verify.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
final SearchRequest request = newSearchRequest(entryDN, SearchScope.BASE_OBJECT, "governingstructurerule=" + oc)
.addAttribute("governingStructureRule");
assertNotNull(e);
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* no entries are returned when the governingStructureRule attribute is used in the
* search filter with a non-matching value.
*
* @param entryDN The DN of the entry to retrieve and verify.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
final SearchRequest request = newSearchRequest(entryDN, SearchScope.BASE_OBJECT, "(governingStructureRule=1)")
.addAttribute("governingStructureRuleType");
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the governingStructureRule attribute is not included when that attribute is
* specifically requested and the real attributes only control is included in
* the request.
*
* @param entryDN The DN of the entry to retrieve and verify.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
.addAttribute("governingStructureRuleType")
assertNotNull(e);
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the governingStructureRule attribute is included when that attribute is
* specifically requested and the virtual attributes only control is included
* in the request.
*
* @param entryDN The DN of the entry to retrieve and verify.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
.addAttribute("governingStructureRule")
assertNotNull(e);
}
/**
* Tests the {@code isMultiValued} method.
*/
@Test()
public void testIsMultiValued()
{
}
/**
* Tests the {@code getValues} method for an entry.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testGetValues()
throws Exception
{
"dn: o=test",
"objectClass: top",
"objectclass: organization",
"o: test");
}
/**
* Tests the {@code hasValue} method variant that doesn't take a specific
* value.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testHasAnyValue()
throws Exception
{
"dn: o=test",
"objectClass: top",
"objectClass: organization",
"o: test");
}
/**
* Tests the {@code hasValue} method variant that takes a specific value when
* the provided value is a match.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testHasMatchingValue()
throws Exception
{
"dn: o=test",
"objectClass: top",
"objectclass: organization",
"o: test");
}
/**
* Tests the {@code hasValue} method variant that takes a specific value when
* the provided value is not a match.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testHasNonMatchingValue()
throws Exception
{
"dn: o=test",
"objectClass: top",
"objectClass: organization",
"o: test");
}
{
}
}