EntryUUIDVirtualAttributeProviderTestCase.java revision d25372dc8e65a9ed019a88fdf659ca61313f1b31
/*
* 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
* 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
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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.
*/
/**
* A set of test cases for the entryUUID virtual attribute provider.
*/
public class EntryUUIDVirtualAttributeProviderTestCase
extends ExtensionsTestCase
{
// The attribute type for the entryUUID attribute.
private AttributeType entryUUIDType;
/**
* Ensures that the Directory Server is running.
*
* @throws Exception If an unexpected problem occurs.
*/
@BeforeClass()
public void startServer()
throws Exception
{
}
/**
* Retrieves a set of entry DNs for use in testing the entryUUID virtual
* attribute.
*
* @return A set of entry DNs for use in testing the entryUUID virtual
* attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
public Object[][] getTestEntryDNs()
throws Exception
{
return new Object[][]
{
};
}
/**
* Tests the {@code getEntry} method for the specified entry to ensure that
* the entry returned includes the entryUUID operational attribute
* with the correct value.
*
* @param entryDN The DN of the entry to retrieve and verify.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
assertNotNull(e);
{
assertTrue(!a.isEmpty());
}
}
/**
* Tests the {@code getEntry} method for a user entry that should have a real
* entryUUID value added by a plugin. In this case, the entryUUID value
* should be a random UUID and not one generated based on the entry's DN.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testGetUserEntry()
throws Exception
{
"dn: dc=example,dc=com",
"objectClass: top",
"objectClass: domain",
"dc: example");
assertNotNull(e);
{
assertTrue(!a.isEmpty());
}
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the entryUUID 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
{
assertNotNull(e);
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the entryUUID 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
{
assertNotNull(e);
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the entryUUID 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
{
assertNotNull(e);
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the entryUUID 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
{
assertNotNull(e);
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the entryUUID 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
{
assertNotNull(e);
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the entryUUID 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
{
assertNotNull(e);
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the entryUUID attribute is included when that attribute is specifically
* requested and the entryUUID 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
{
assertNotNull(e);
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* no entries are returned when the entryUUID 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
{
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the entryUUID 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
{
assertNotNull(e);
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the entryUUID 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
{
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");
uuidString)));
}
/**
* 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");
}
/**
* Tests the {@code hasAnyValue} method with an empty set of values.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testHasAnyValueEmptySet()
throws Exception
{
"dn: o=test",
"objectClass: top",
"objectClass: organization",
"o: test");
}
/**
* Tests the {@code hasAnyValue} method with a set of values containing only
* the correct value.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testHasAnyValueOnlyCorrect()
throws Exception
{
"dn: o=test",
"objectClass: top",
"objectClass: organization",
"o: test");
}
/**
* Tests the {@code hasAnyValue} method with a set of values containing only
* an incorrect value.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testHasAnyValueOnlyIncorrect()
throws Exception
{
"dn: o=test",
"objectClass: top",
"objectClass: organization",
"o: test");
}
/**
* Tests the {@code hasAnyValue} method with a set of values containing the
* correct value as well as multiple incorrect values.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testHasAnyValueIncludesCorrect()
throws Exception
{
"dn: o=test",
"objectClass: top",
"objectClass: organization",
"o: test");
}
/**
* Tests the {@code hasAnyValue} method with a set of multiple values, none of
* which are correct.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testHasAnyValueMissingCorrect()
throws Exception
{
"dn: o=test",
"objectClass: top",
"objectClass: organization",
"o: test");
}
}