EntryDNVirtualAttributeProviderTestCase.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-2009 Sun Microsystems, Inc.
* Portions Copyright 2011-2015 ForgeRock AS
*/
/**
* A set of test cases for the entryDN virtual attribute provider.
*/
public class EntryDNVirtualAttributeProviderTestCase
extends ExtensionsTestCase
{
// 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 entry DNs for use in testing the entryDN virtual
* attribute.
*
* @return A set of entry DNs for use in testing the entryDN 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 entryDN 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());
}
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the entryDN 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 entryDN 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 entryDN 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 entryDN 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 entryDN attribute is included when the entryDN 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 entryDN 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 entryDN attribute is included when the entryDN attribute is
* specifically requested and the entryDN 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, "(entryDN=" + entryDN + ")")
.addAttribute("entrydn");
assertNotNull(e);
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* no entries are returned when the entryDN 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, "(entryDN=cn=Not A Match)")
.addAttribute("entrydn");
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the entryDN attribute is not included when the entryDN 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("entrydn")
assertNotNull(e);
}
/**
* Performs an internal search to retrieve the specified entry, ensuring that
* the entryDN attribute is included when the entryDN 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("entrydn")
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");
}
/**
* Tests the {@code matchesSubstring} method to ensure that it returns a
* result of "undefined".
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testMatchesSubstring()
throws Exception
{
"dn: o=test",
"objectClass: top",
"objectClass: organization",
"o: test");
}
/**
* Tests the {@code greaterThanOrEqualTo} method to ensure that it returns a
* result of "undefined".
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testGreaterThanOrEqualTo()
throws Exception
{
"dn: o=test",
"objectClass: top",
"objectClass: organization",
"o: test");
}
/**
* Tests the {@code lessThanOrEqualTo} method to ensure that it returns a
* result of "undefined".
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testLessThanOrEqualTo()
throws Exception
{
"dn: o=test",
"objectClass: top",
"objectClass: organization",
"o: test");
}
/**
* Tests the {@code approximatelyEqualTo} method to ensure that it returns a
* result of "undefined".
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testApproximatelyEqualTo()
throws Exception
{
"dn: o=test",
"objectClass: top",
"objectClass: organization",
"o: test");
}
/**
* Retrieves a set of filters for use in testing searchability. The returned
* data will actually include three elements:
* <OL>
* <LI>The string representation of the search filter to use</LI>
* <LI>An indication of whether it should be searchable</LI>
* <LI>An indication of whether a minimal o=test entry should match</LI>
* </OL>
*
* @return A set of filters for use in testing searchability.
*/
public Object[][] getTestFilters()
{
return new Object[][]
{
new Object[] { "(entryDN=o=test)", true, true },
new Object[] { "(entryDN=o=not test)", true, false },
new Object[] { "(o=test)", false, false },
new Object[] { "(entryDN=*)", false, false },
new Object[] { "(&(objectClass=*)(entryDN=o=test))", true, true },
new Object[] { "(&(entryDN=o=test)(entryDN=o=not test))", true, false },
new Object[] { "(|(objectClass=*)(entryDN=o=test))", false, false },
new Object[] { "(|(entryDN=o=test)(entryDN=o=not test))", true, true },
new Object[] { "(&(|(entryDN=o=test)(entryDN=o=not test))" +
"(&(objectClass=top)(|(objectClass=organization)" +
"(objectClass=domain)))" +
"(|(o=test)(o=not test)))", true, true }
};
}
/**
* Tests the {@code isSearchable} method with the provided information.
*
* @param filterString The string representation of the search filter to use
* for the test.
* @param isSearchable Indicates whether a search with the given filter
* should be considered searchable.
* @param shouldMatch Indicates whether the provided filter should match
* a minimal o=test entry.
*
* @throws Exception If an unexpected problem occurs.
*/
boolean shouldMatch)
throws Exception
{
SearchRequest request = newSearchRequest(DN.valueOf("o=test"), SearchScope.WHOLE_SUBTREE, filterString);
// This attribute is searchable for either pre-indexed or not
}
/**
* Tests the {@code processSearch} method with the provided information.
*
* @param filterString The string representation of the search filter to use
* for the test.
* @param isSearchable Indicates whether a search with the given filter
* should be considered searchable.
* @param shouldMatch Indicates whether the provided filter should match
* a minimal o=test entry.
*
* @throws Exception If an unexpected problem occurs.
*/
boolean shouldMatch)
throws Exception
{
if (! isSearchable)
{
return;
}
SearchRequest request = newSearchRequest(DN.valueOf("o=test"), SearchScope.WHOLE_SUBTREE, filterString);
}
}