TestObjectClass.java revision e8cead474d5ce2b933d931f0c4743a78e68d9cfc
/*
* 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 2006-2010 Sun Microsystems, Inc.
* Portions Copyright 2013-2015 ForgeRock AS
*/
/**
* This class defines a set of tests for the
* {@link org.opends.server.types.ObjectClass} class.
*/
public final class TestObjectClass extends TestCommonSchemaElements {
/**
* Internal class to simplify construction of object classes.
*/
private static final class ObjectClassBuilder extends
/** The superior object class from which this object class inherits. */
/** The type of object class. */
private ObjectClassType objectClassType;
/** The set of required attribute types. */
/** The set of optional attribute types. */
/** {@inheritDoc} */
protected void resetBuilder() {
this.requiredAttributeTypes = null;
this.optionalAttributeTypes = null;
}
/**
* Create a new object class builder.
*/
public ObjectClassBuilder() {
super();
}
/**
* Create a new object class builder.
*
* @param primaryName
* The object class primary name.
* @param oid
* The object class OID.
*/
super(primaryName, oid);
}
/** {@inheritDoc} */
if (primaryName != null)
{
}
{
}
{
{
}
else
{
}
}
if (description != null)
{
}
if (isObsolete)
{
}
{
{
{
}
}
else
{
}
}
if (objectClassType != null)
{
}
if (extraProperties != null)
{
{
{
continue;
}
{
}
else
{
{
}
}
}
}
}
{
{
{
}
else
{
{
}
}
}
}
/**
* Set the objectClassType.
*
* @param objectClassType
* The objectClassType.
*/
this.objectClassType = objectClassType;
}
/**
* Set the superior.
*
* @param superior
* The superior.
*/
}
/**
* Add required attribute types.
*
* @param types
* The required attribute type(s) to add.
*/
throw new NullPointerException("Null types");
}
if (this.requiredAttributeTypes == null) {
this.requiredAttributeTypes = new LinkedHashSet<>();
}
}
/**
* Add optional attribute types.
*
* @param types
* The optional attribute type(s) to add.
*/
throw new NullPointerException("Null types");
}
if (this.optionalAttributeTypes == null) {
this.optionalAttributeTypes = new LinkedHashSet<>();
}
}
}
/** Array of attribute types to use in tests. */
private AttributeType[] types;
/**
* Once-only initialization.
*
* @throws Exception
* If an unexpected error occurred.
*/
public final void setUpTypes() throws Exception {
}
}
/**
* Check that the constructor throws an NPE when mandatory
* parameters are not specified.
*
* @throws Exception
* If the test failed unexpectedly.
*/
public void testConstructorNPE() throws Exception {
}
/**
* Check that the constructor does not throw an exception when all
* optional parameters are not specified.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testConstructorDefault() throws Exception {
}
/**
* Create test data for testing the
* {@link AttributeType#isOperational()} method.
*
* @return Returns the array of test data.
*/
public Object[][] createGetObjectClassTypeTestData() {
}
/**
* Check that the {@link ObjectClass#getObjectClassType()} method.
*
* @param type
* The object class type.
* @param result
* Expected result.
* @throws Exception
* If the test failed unexpectedly.
*/
"1.2.3");
}
/**
* Check the {@link ObjectClass#getOptionalAttributeChain()} method
* with no superior and no optional attributes.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetOptionalAttributeChainNoSuperiorEmpty()
throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getOptionalAttributeChain()} method
* with no superior and some optional attributes.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetOptionalAttributeChainNoSuperior()
throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getOptionalAttributeChain()} method
* with a superior but no optional attributes of its own.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetOptionalAttributeChainEmpty() throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getOptionalAttributeChain()} method
* with multiple superiors but no optional attributes of its own.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetOptionalAttributeChainEmptyMS() throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getOptionalAttributeChain()} method
* with a superior and some optional attributes of its own.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetOptionalAttributeChain() throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getOptionalAttributeChain()} method
* with multiple superiors and some optional attributes of its own.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetOptionalAttributeChainMS() throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getOptionalAttributes()} method with
* no superior and no optional attributes.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetOptionalAttributesNoSuperiorEmpty()
throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getOptionalAttributes()} method with
* no superior and some optional attributes.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetOptionalAttributesNoSuperior() throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getOptionalAttributes()} method with
* a superior but no optional attributes of its own.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetOptionalAttributesEmpty() throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getOptionalAttributes()} method with
* a superior and some optional attributes of its own.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetOptionalAttributes() throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getRequiredAttributeChain()} method
* with no superior and no optional attributes.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetRequiredAttributeChainNoSuperiorEmpty()
throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getRequiredAttributeChain()} method
* with no superior and some optional attributes.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetRequiredAttributeChainNoSuperior()
throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getRequiredAttributeChain()} method
* with a superior but no optional attributes of its own.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetRequiredAttributeChainEmpty() throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getRequiredAttributeChain()} method
* with multiple superiors but no optional attributes of its own.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetRequiredAttributeChainEmptyMS() throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getRequiredAttributeChain()} method
* with a superior and some optional attributes of its own.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetRequiredAttributeChain() throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getRequiredAttributeChain()} method
* with multiple superiors and some optional attributes of its own.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetRequiredAttributeChainMS() throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getRequiredAttributes()} method with
* no superior and no optional attributes.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetRequiredAttributesNoSuperiorEmpty()
throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getRequiredAttributes()} method with
* no superior and some optional attributes.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetRequiredAttributesNoSuperior() throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getRequiredAttributes()} method with
* a superior but no optional attributes of its own.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetRequiredAttributesEmpty() throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getRequiredAttributes()} method with
* a superior and some optional attributes of its own.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetRequiredAttributes() throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getSuperiorClasses()} method with no
* superior.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetSuperiorClassNoSuperior() throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getSuperiorClasses()} method with a
* superior.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetSuperiorClassWithSuperior() throws Exception {
"1.2.3");
}
/**
* Check the {@link ObjectClass#getSuperiorClasses()} method with multiple
* superiors.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testGetSuperiorClassWithSuperiors() throws Exception {
"1.2.3");
"2.3.4");
}
/**
* Check the {@link ObjectClass#isDescendantOf(ObjectClass)} method
* with no superior.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testIsDescendantOfNoSuperior() throws Exception {
"1.2.1");
}
/**
* Check the {@link ObjectClass#isDescendantOf(ObjectClass)} method
* with a superior.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testIsDescendantOfWithSuperior() throws Exception {
"grandParent", "1.2.1");
}
/**
* Check the {@link ObjectClass#isDescendantOf(ObjectClass)} method
* with multiple superiors.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testIsDescendantOfWithMultipleSuperiors() throws Exception {
"grandParent", "1.2.1");
}
/**
* Create test data for testing the
* {@link ObjectClass#isExtensibleObject()} method.
*
* @return Returns the array of test data.
*/
public Object[][] createIsExtensibleObjectTestData() {
{ "extensibleObject", "1.2.3", true },
{ "test", "1.3.6.1.4.1.1466.101.120.111", true },
{ "extensibleObject", "1.3.6.1.4.1.1466.101.120.111", true } };
}
/**
* Check that the {@link ObjectClass#getObjectClassType()} method.
*
* @param name
* The object class name.
* @param oid
* The object class oid.
* @param result
* Expected result.
* @throws Exception
* If the test failed unexpectedly.
*/
}
/**
* Check that the {@link ObjectClass#isOptional(AttributeType)}
* method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testIsOptionalEmpty() throws Exception {
"1.2.3");
}
/**
* Check that the {@link ObjectClass#isOptional(AttributeType)}
* method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testIsOptionalNoSuperior() throws Exception {
"1.2.3");
}
/**
* Check that the {@link ObjectClass#isOptional(AttributeType)}
* method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testIsOptionalEmptyWithSuperior() throws Exception {
"1.2.3");
}
/**
* Check that the {@link ObjectClass#isOptional(AttributeType)}
* method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testIsOptionalWithSuperior() throws Exception {
"1.2.3");
}
/**
* Check that the {@link ObjectClass#isOptional(AttributeType)}
* method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
public void testIsOptionalExtensible() throws Exception {
"extensibleObject", "1.2.3");
}
/**
* Check that the {@link ObjectClass#isOptional(AttributeType)}
* method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
public void testIsOptionalExtensibleRequired() throws Exception {
"extensibleObject", "1.2.3");
}
/**
* Check that the {@link ObjectClass#isOptional(AttributeType)}
* method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
public void testIsOptionalExtensibleRequiredSuperior()
throws Exception {
"1.2.3");
}
/**
* Check that the {@link ObjectClass#isRequired(AttributeType)}
* method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testIsRequiredEmpty() throws Exception {
"1.2.3");
}
/**
* Check that the {@link ObjectClass#isRequired(AttributeType)}
* method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testIsRequiredNoSuperior() throws Exception {
"1.2.3");
}
/**
* Check that the {@link ObjectClass#isRequired(AttributeType)}
* method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testIsRequiredEmptyWithSuperior() throws Exception {
"1.2.3");
}
/**
* Check that the {@link ObjectClass#isRequired(AttributeType)}
* method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testIsRequiredWithSuperior() throws Exception {
"1.2.3");
}
/**
* Check that the
* {@link ObjectClass#isRequiredOrOptional(AttributeType)} method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testIsRequiredOrOptionalEmpty() throws Exception {
"1.2.3");
}
/**
* Check that the
* {@link ObjectClass#isRequiredOrOptional(AttributeType)} method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testIsRequiredOrOptionalNoSuperior() throws Exception {
"1.2.3");
}
/**
* Check that the
* {@link ObjectClass#isRequiredOrOptional(AttributeType)} method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testIsRequiredOrOptionalEmptyWithSuperior()
throws Exception {
"1.2.3");
}
/**
* Check that the
* {@link ObjectClass#isRequiredOrOptional(AttributeType)} method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testIsRequiredOrOptionalWithSuperior() throws Exception {
"1.2.3");
}
/**
* Check that the
* {@link ObjectClass#isRequiredOrOptional(AttributeType)} method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
public void testIsRequiredOrOptionalExtensible() throws Exception {
"extensibleObject", "1.2.3");
}
/**
* Check that the
* {@link ObjectClass#isRequiredOrOptional(AttributeType)} method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
public void testIsRequiredOrOptionalExtensibleRequired()
throws Exception {
"extensibleObject", "1.2.3");
}
/**
* Check that the
* {@link ObjectClass#isRequiredOrOptional(AttributeType)} method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
public void testIsRequiredOrOptionalExtensibleRequiredSuperior()
throws Exception {
"1.2.3");
}
/**
* Create test data for testing different combinations of superiors.
*
* @return Returns the array of test data.
*/
public Object[][] createSuperiorData() {
builder = new ObjectClassBuilder(
"parent2", "1.2");
builder = new ObjectClassBuilder(
"parent3", "1.3");
builder = new ObjectClassBuilder(
"parent4", "1.4");
builder = new ObjectClassBuilder(
"parent5", "1.5");
builder = new ObjectClassBuilder(
"parent6", "1.6");
};
}
/**
* Check incompatible superiors.
*
* @param parent1
* First superior
* @param parent2
* Second superior
* @param type
* The object class type.
* @param isValid
* Whether the superior combination is valid.
*/
}
/** {@inheritDoc} */
}
}