Package com.unboundid.util
Class LDAPTestUtils
- java.lang.Object
-
- com.unboundid.util.LDAPTestUtils
-
@ThreadSafety(level=COMPLETELY_THREADSAFE) public final class LDAPTestUtils extends java.lang.Object
This class provides a number of convenience methods that can be used to help write test cases for directory-enabled applications.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
assertAttributeExists(LDAPInterface conn, java.lang.String dn, java.lang.String... attributeNames)
Ensures that the specified entry exists in the directory with all of the specified attributes.static void
assertAttributeExists(LDAPInterface conn, java.lang.String dn, java.util.Collection<java.lang.String> attributeNames)
Ensures that the specified entry exists in the directory with all of the specified attributes.static void
assertAttributeMissing(LDAPInterface conn, java.lang.String dn, java.lang.String... attributeNames)
Ensures that the specified entry exists in the directory but does not contain any of the specified attributes.static void
assertAttributeMissing(LDAPInterface conn, java.lang.String dn, java.util.Collection<java.lang.String> attributeNames)
Ensures that the specified entry exists in the directory but does not contain any of the specified attributes.static void
assertContainsDiagnosticMessage(LDAPException exception)
Ensures that the provided LDAP exception contains a diagnostic message.static void
assertContainsDiagnosticMessage(LDAPResult result)
Ensures that the provided LDAP result contains a diagnostic message.static void
assertContainsMatchedDN(LDAPException exception)
Ensures that the provided LDAP exception contains a matched DN value.static void
assertContainsMatchedDN(LDAPResult result)
Ensures that the provided LDAP result contains a matched DN value.static void
assertDiagnosticMessageEquals(LDAPException exception, java.lang.String diagnosticMessage)
Ensures that the provided LDAP exception has the given diagnostic message.static void
assertDiagnosticMessageEquals(LDAPResult result, java.lang.String diagnosticMessage)
Ensures that the provided LDAP result has the given diagnostic message.static void
assertDNsEqual(java.lang.String s1, java.lang.String s2)
Ensures that the two provided strings represent the same DN.static void
assertEntriesExist(LDAPInterface conn, java.lang.String... dns)
Ensures that all of the entries with the provided DNs exist in the directory.static void
assertEntriesExist(LDAPInterface conn, java.util.Collection<java.lang.String> dns)
Ensures that all of the entries with the provided DNs exist in the directory.static void
assertEntriesReturnedEquals(LDAPSearchException exception, int expectedEntryCount)
Ensures that the provided search exception indicates that the expected number of entries were returned.static void
assertEntriesReturnedEquals(SearchResult result, int expectedEntryCount)
Ensures that the provided search result indicates that the expected number of entries were returned.static void
assertEntryExists(LDAPInterface conn, Entry entry)
Ensures that an entry exists in the directory with the same DN and all attribute values contained in the provided entry.static void
assertEntryExists(LDAPInterface conn, java.lang.String dn)
Ensures that an entry with the provided DN exists in the directory.static void
assertEntryExists(LDAPInterface conn, java.lang.String dn, java.lang.String filter)
Ensures that an entry with the provided DN exists in the directory.static void
assertEntryMissing(LDAPInterface conn, java.lang.String dn)
Ensures that the specified entry does not exist in the directory.static int
assertEntryReturned(LDAPSearchException exception)
Ensures that the provided search exception indicates that at least one search result entry was returned.static SearchResultEntry
assertEntryReturned(LDAPSearchException exception, java.lang.String dn)
Ensures that the specified search result entry was included in provided search exception.static int
assertEntryReturned(SearchResult result)
Ensures that the provided search result indicates that at least one search result entry was returned.static SearchResultEntry
assertEntryReturned(SearchResult result, java.lang.String dn)
Ensures that the specified search result entry was included in provided search result.static Control
assertHasControl(LDAPException exception, java.lang.String oid)
Ensures that the provided LDAP exception includes at least one control with the specified OID.static Control
assertHasControl(LDAPResult result, java.lang.String oid)
Ensures that the provided LDAP result includes at least one control with the specified OID.static Control
assertHasControl(SearchResultEntry entry, java.lang.String oid)
Ensures that the provided search result entry includes at least one control with the specified OID.static Control
assertHasControl(SearchResultReference reference, java.lang.String oid)
Ensures that the provided search result reference includes at least one control with the specified OID.static void
assertHasReferral(LDAPException exception)
Ensures that the provided LDAP exception has one or more referral URLs.static void
assertHasReferral(LDAPResult result)
Ensures that the provided LDAP result has one or more referral URLs.static void
assertMatchedDNEquals(LDAPException exception, java.lang.String matchedDN)
Ensures that the provided LDAP exception has the given matched DN value.static void
assertMatchedDNEquals(LDAPResult result, java.lang.String matchedDN)
Ensures that the provided LDAP result has the given matched DN value.static void
assertMissingControl(LDAPException exception, java.lang.String oid)
Ensures that the provided LDAP exception does not include any control with the specified OID.static void
assertMissingControl(LDAPResult result, java.lang.String oid)
Ensures that the provided LDAP result does not include any control with the specified OID.static void
assertMissingControl(SearchResultEntry entry, java.lang.String oid)
Ensures that the provided search result entry does not includes any control with the specified OID.static void
assertMissingControl(SearchResultReference reference, java.lang.String oid)
Ensures that the provided search result reference does not includes any control with the specified OID.static void
assertMissingDiagnosticMessage(LDAPException exception)
Ensures that the provided LDAP exception does not contain a diagnostic message.static void
assertMissingDiagnosticMessage(LDAPResult result)
Ensures that the provided LDAP result does not contain a diagnostic message.static void
assertMissingMatchedDN(LDAPException exception)
Ensures that the provided LDAP exception does not contain a matched DN value.static void
assertMissingMatchedDN(LDAPResult result)
Ensures that the provided LDAP result does not contain a matched DN value.static void
assertMissingReferral(LDAPException exception)
Ensures that the provided LDAP exception does not have any referral URLs.static void
assertMissingReferral(LDAPResult result)
Ensures that the provided LDAP result does not have any referral URLs.static void
assertNoEntriesReturned(LDAPSearchException exception)
Ensures that the provided search exception indicates that no search result entries were returned.static void
assertNoEntriesReturned(SearchResult result)
Ensures that the provided search result indicates that no search result entries were returned.static void
assertNoReferencesReturned(LDAPSearchException exception)
Ensures that the provided search exception indicates that no search result references were returned.static void
assertNoReferencesReturned(SearchResult result)
Ensures that the provided search result indicates that no search result references were returned.static int
assertReferenceReturned(LDAPSearchException exception)
Ensures that the provided search exception indicates that at least one search result reference was returned.static int
assertReferenceReturned(SearchResult result)
Ensures that the provided search result indicates that at least one search result reference was returned.static void
assertReferencesReturnedEquals(LDAPSearchException exception, int expectedReferenceCount)
Ensures that the provided search exception indicates that the expected number of references were returned.static void
assertReferencesReturnedEquals(SearchResult result, int expectedReferenceCount)
Ensures that the provided search result indicates that the expected number of references were returned.static LDAPResult
assertResultCodeEquals(LDAPConnection conn, LDAPRequest request, ResultCode... acceptableResultCodes)
Processes the provided request using the given connection and ensures that the result code matches one of the provided acceptable values.static void
assertResultCodeEquals(LDAPException exception, ResultCode... acceptableResultCodes)
Ensures that the result code for the provided LDAP exception matches one of the given acceptable result codes.static void
assertResultCodeEquals(LDAPResult result, ResultCode... acceptableResultCodes)
Ensures that the result code for the provided result matches one of the given acceptable result codes.static LDAPResult
assertResultCodeNot(LDAPConnection conn, LDAPRequest request, ResultCode... unacceptableResultCodes)
Processes the provided request using the given connection and ensures that the result code does not match any of the given unacceptable values.static void
assertResultCodeNot(LDAPException exception, ResultCode... unacceptableResultCodes)
Ensures that the result code for the provided result does not match any of the given unacceptable result codes.static void
assertResultCodeNot(LDAPResult result, ResultCode... unacceptableResultCodes)
Ensures that the result code for the provided result does not match any of the given unacceptable result codes.static void
assertValueExists(LDAPInterface conn, java.lang.String dn, java.lang.String attributeName, java.lang.String... attributeValues)
Ensures that the specified entry exists in the directory with all of the specified values for the given attribute.static void
assertValueExists(LDAPInterface conn, java.lang.String dn, java.lang.String attributeName, java.util.Collection<java.lang.String> attributeValues)
Ensures that the specified entry exists in the directory with all of the specified values for the given attribute.static void
assertValueMissing(LDAPInterface conn, java.lang.String dn, java.lang.String attributeName, java.lang.String... attributeValues)
Ensures that the specified entry exists in the directory but does not contain any of the specified attribute values.static void
assertValueMissing(LDAPInterface conn, java.lang.String dn, java.lang.String attributeName, java.util.Collection<java.lang.String> attributeValues)
Ensures that the specified entry exists in the directory but does not contain any of the specified attribute values.static boolean
entryExists(LDAPInterface conn, Entry entry)
Indicates whether the specified entry exists in the server.static boolean
entryExists(LDAPInterface conn, java.lang.String dn)
Indicates whether the specified entry exists in the server.static boolean
entryExists(LDAPInterface conn, java.lang.String dn, java.lang.String filter)
Indicates whether the specified entry exists in the server and matches the given filter.static Entry
generateCountryEntry(java.lang.String name, java.lang.String parentDN, Attribute... additionalAttributes)
Generates a country entry with the provided information.static Entry
generateCountryEntry(java.lang.String name, java.lang.String parentDN, java.util.Collection<Attribute> additionalAttributes)
Generates a country entry with the provided information.static Entry
generateDomainEntry(java.lang.String name, java.lang.String parentDN, Attribute... additionalAttributes)
Generates a domain entry with the provided information.static Entry
generateDomainEntry(java.lang.String name, java.lang.String parentDN, java.util.Collection<Attribute> additionalAttributes)
Generates a domain entry with the provided information.static Entry
generateGroupOfNamesEntry(java.lang.String name, java.lang.String parentDN, java.lang.String... memberDNs)
Generates a group entry with the provided information.static Entry
generateGroupOfNamesEntry(java.lang.String name, java.lang.String parentDN, java.util.Collection<java.lang.String> memberDNs)
Generates a group entry with the provided information.static Entry
generateGroupOfUniqueNamesEntry(java.lang.String name, java.lang.String parentDN, java.lang.String... memberDNs)
Generates a group entry with the provided information.static Entry
generateGroupOfUniqueNamesEntry(java.lang.String name, java.lang.String parentDN, java.util.Collection<java.lang.String> memberDNs)
Generates a group entry with the provided information.static Entry
generateOrgEntry(java.lang.String name, java.lang.String parentDN, Attribute... additionalAttributes)
Generates an organization entry with the provided information.static Entry
generateOrgEntry(java.lang.String name, java.lang.String parentDN, java.util.Collection<Attribute> additionalAttributes)
Generates an organization entry with the provided information.static Entry
generateOrgUnitEntry(java.lang.String name, java.lang.String parentDN, Attribute... additionalAttributes)
Generates an organizationalUnit entry with the provided information.static Entry
generateOrgUnitEntry(java.lang.String name, java.lang.String parentDN, java.util.Collection<Attribute> additionalAttributes)
Generates an organizationalUnit entry with the provided information.static Entry
generateUserEntry(java.lang.String uid, java.lang.String parentDN, java.lang.String firstName, java.lang.String lastName, java.lang.String password, Attribute... additionalAttributes)
Generates a user entry with the provided information.static Entry
generateUserEntry(java.lang.String uid, java.lang.String parentDN, java.lang.String firstName, java.lang.String lastName, java.lang.String password, java.util.Collection<Attribute> additionalAttributes)
Generates a user entry with the provided information.static java.util.List<java.lang.String>
getMissingAttributeNames(LDAPInterface conn, java.lang.String dn, java.lang.String... attributeNames)
Retrieves a list containing all of the named attributes which do not exist in the target entry.static java.util.List<java.lang.String>
getMissingAttributeNames(LDAPInterface conn, java.lang.String dn, java.util.Collection<java.lang.String> attributeNames)
Retrieves a list containing all of the named attributes which do not exist in the target entry.static java.util.List<java.lang.String>
getMissingAttributeValues(LDAPInterface conn, java.lang.String dn, java.lang.String attributeName, java.lang.String... attributeValues)
Retrieves a list of all provided attribute values which are missing from the specified entry.static java.util.List<java.lang.String>
getMissingAttributeValues(LDAPInterface conn, java.lang.String dn, java.lang.String attributeName, java.util.Collection<java.lang.String> attributeValues)
Retrieves a list of all provided attribute values which are missing from the specified entry.static java.util.List<java.lang.String>
getMissingEntryDNs(LDAPInterface conn, java.lang.String... dns)
Retrieves a list containing the DNs of the entries which are missing from the directory server.static java.util.List<java.lang.String>
getMissingEntryDNs(LDAPInterface conn, java.util.Collection<java.lang.String> dns)
Retrieves a list containing the DNs of the entries which are missing from the directory server.
-
-
-
Method Detail
-
generateDomainEntry
public static Entry generateDomainEntry(java.lang.String name, java.lang.String parentDN, Attribute... additionalAttributes)
Generates a domain entry with the provided information. It will include the top and domain object classes and will use dc as the RDN attribute. It may optionally include additional attributes.- Parameters:
name
- The name for the domain, which will be used as the value of the "dc" attribute. It must not benull
.parentDN
- The DN of the entry below which the new entry should be placed. It may benull
if the new entry should not have a parent.additionalAttributes
- A set of additional attributes to include in the generated entry. It may benull
or empty if no additional attributes should be included.- Returns:
- The generated entry.
-
generateDomainEntry
public static Entry generateDomainEntry(java.lang.String name, java.lang.String parentDN, java.util.Collection<Attribute> additionalAttributes)
Generates a domain entry with the provided information. It will include the top and domain object classes and will use dc as the RDN attribute. It may optionally include additional attributes.- Parameters:
name
- The name for the domain, which will be used as the value of the "dc" attribute. It must not benull
.parentDN
- The DN of the entry below which the new entry should be placed. It may benull
if the new entry should not have a parent.additionalAttributes
- A set of additional attributes to include in the generated entry. It may benull
or empty if no additional attributes should be included.- Returns:
- The generated entry.
-
generateOrgEntry
public static Entry generateOrgEntry(java.lang.String name, java.lang.String parentDN, Attribute... additionalAttributes)
Generates an organization entry with the provided information. It will include the top and organization object classes and will use o as the RDN attribute. It may optionally include additional attributes.- Parameters:
name
- The name for the organization, which will be used as the value of the "o" attribute. It must not benull
.parentDN
- The DN of the entry below which the new entry should be placed. It may benull
if the new entry should not have a parent.additionalAttributes
- A set of additional attributes to include in the generated entry. It may benull
or empty if no additional attributes should be included.- Returns:
- The generated entry.
-
generateOrgEntry
public static Entry generateOrgEntry(java.lang.String name, java.lang.String parentDN, java.util.Collection<Attribute> additionalAttributes)
Generates an organization entry with the provided information. It will include the top and organization object classes and will use o as the RDN attribute. It may optionally include additional attributes.- Parameters:
name
- The name for the organization, which will be used as the value of the "o" attribute. It must not benull
.parentDN
- The DN of the entry below which the new entry should be placed. It may benull
if the new entry should not have a parent.additionalAttributes
- A set of additional attributes to include in the generated entry. It may benull
or empty if no additional attributes should be included.- Returns:
- The generated entry.
-
generateOrgUnitEntry
public static Entry generateOrgUnitEntry(java.lang.String name, java.lang.String parentDN, Attribute... additionalAttributes)
Generates an organizationalUnit entry with the provided information. It will include the top and organizationalUnit object classes and will use ou as the RDN attribute. It may optionally include additional attributes.- Parameters:
name
- The name for the organizationalUnit, which will be used as the value of the "ou" attribute. It must not benull
.parentDN
- The DN of the entry below which the new entry should be placed. It may benull
if the new entry should not have a parent.additionalAttributes
- A set of additional attributes to include in the generated entry. It may benull
or empty if no additional attributes should be included.- Returns:
- The generated entry.
-
generateOrgUnitEntry
public static Entry generateOrgUnitEntry(java.lang.String name, java.lang.String parentDN, java.util.Collection<Attribute> additionalAttributes)
Generates an organizationalUnit entry with the provided information. It will include the top and organizationalUnit object classes and will use ou as the RDN attribute. It may optionally include additional attributes.- Parameters:
name
- The name for the organizationalUnit, which will be used as the value of the "ou" attribute. It must not benull
.parentDN
- The DN of the entry below which the new entry should be placed. It may benull
if the new entry should not have a parent.additionalAttributes
- A set of additional attributes to include in the generated entry. It may benull
or empty if no additional attributes should be included.- Returns:
- The generated entry.
-
generateCountryEntry
public static Entry generateCountryEntry(java.lang.String name, java.lang.String parentDN, Attribute... additionalAttributes)
Generates a country entry with the provided information. It will include the top and country object classes and will use c as the RDN attribute. It may optionally include additional attributes.- Parameters:
name
- The name for the country (typically a two-character country code), which will be used as the value of the "c" attribute. It must not benull
.parentDN
- The DN of the entry below which the new entry should be placed. It may benull
if the new entry should not have a parent.additionalAttributes
- A set of additional attributes to include in the generated entry. It may benull
or empty if no additional attributes should be included.- Returns:
- The generated entry.
-
generateCountryEntry
public static Entry generateCountryEntry(java.lang.String name, java.lang.String parentDN, java.util.Collection<Attribute> additionalAttributes)
Generates a country entry with the provided information. It will include the top and country object classes and will use c as the RDN attribute. It may optionally include additional attributes.- Parameters:
name
- The name for the country (typically a two-character country code), which will be used as the value of the "c" attribute. It must not benull
.parentDN
- The DN of the entry below which the new entry should be placed. It may benull
if the new entry should not have a parent.additionalAttributes
- A set of additional attributes to include in the generated entry. It may benull
or empty if no additional attributes should be included.- Returns:
- The generated entry.
-
generateUserEntry
public static Entry generateUserEntry(java.lang.String uid, java.lang.String parentDN, java.lang.String firstName, java.lang.String lastName, java.lang.String password, Attribute... additionalAttributes)
Generates a user entry with the provided information. It will include the top, person, organizationalPerson, and inetOrgPerson object classes, will use uid as the RDN attribute, and will have givenName, sn, and cn attributes. It may optionally include additional attributes.- Parameters:
uid
- The value to use for the "uid: attribute. It must not benull
.parentDN
- The DN of the entry below which the new entry should be placed. It may benull
if the new entry should not have a parent.firstName
- The first name for the user. It must not benull
.lastName
- The last name for the user. It must not benull
.password
- The password for the user. It may benull
if the user should not have a password.additionalAttributes
- A set of additional attributes to include in the generated entry. It may benull
or empty if no additional attributes should be included.- Returns:
- The generated entry.
-
generateUserEntry
public static Entry generateUserEntry(java.lang.String uid, java.lang.String parentDN, java.lang.String firstName, java.lang.String lastName, java.lang.String password, java.util.Collection<Attribute> additionalAttributes)
Generates a user entry with the provided information. It will include the top, person, organizationalPerson, and inetOrgPerson object classes, will use uid as the RDN attribute, and will have givenName, sn, and cn attributes. It may optionally include additional attributes.- Parameters:
uid
- The value to use for the "uid: attribute. It must not benull
.parentDN
- The DN of the entry below which the new entry should be placed. It may benull
if the new entry should not have a parent.firstName
- The first name for the user. It must not benull
.lastName
- The last name for the user. It must not benull
.password
- The password for the user. It may benull
if the user should not have a password.additionalAttributes
- A set of additional attributes to include in the generated entry. It may benull
or empty if no additional attributes should be included.- Returns:
- The generated entry.
-
generateGroupOfNamesEntry
public static Entry generateGroupOfNamesEntry(java.lang.String name, java.lang.String parentDN, java.lang.String... memberDNs)
Generates a group entry with the provided information. It will include the top and groupOfNames object classes and will use cn as the RDN attribute.- Parameters:
name
- The name for the group, which will be used as the value of the "cn" attribute. It must not benull
.parentDN
- The DN of the entry below which the new entry should be placed. It may benull
if the new entry should not have a parent.memberDNs
- The DNs of the users that should be listed as members of the group.- Returns:
- The generated entry.
-
generateGroupOfNamesEntry
public static Entry generateGroupOfNamesEntry(java.lang.String name, java.lang.String parentDN, java.util.Collection<java.lang.String> memberDNs)
Generates a group entry with the provided information. It will include the top and groupOfNames object classes and will use cn as the RDN attribute.- Parameters:
name
- The name for the group, which will be used as the value of the "cn" attribute. It must not benull
.parentDN
- The DN of the entry below which the new entry should be placed. It may benull
if the new entry should not have a parent.memberDNs
- The DNs of the users that should be listed as members of the group.- Returns:
- The generated entry.
-
generateGroupOfUniqueNamesEntry
public static Entry generateGroupOfUniqueNamesEntry(java.lang.String name, java.lang.String parentDN, java.lang.String... memberDNs)
Generates a group entry with the provided information. It will include the top and groupOfUniqueNames object classes and will use cn as the RDN attribute.- Parameters:
name
- The name for the group, which will be used as the value of the "cn" attribute. It must not benull
.parentDN
- The DN of the entry below which the new entry should be placed. It may benull
if the new entry should not have a parent.memberDNs
- The DNs of the users that should be listed as members of the group.- Returns:
- The generated entry.
-
generateGroupOfUniqueNamesEntry
public static Entry generateGroupOfUniqueNamesEntry(java.lang.String name, java.lang.String parentDN, java.util.Collection<java.lang.String> memberDNs)
Generates a group entry with the provided information. It will include the top and groupOfUniqueNames object classes and will use cn as the RDN attribute.- Parameters:
name
- The name for the group, which will be used as the value of the "cn" attribute. It must not benull
.parentDN
- The DN of the entry below which the new entry should be placed. It may benull
if the new entry should not have a parent.memberDNs
- The DNs of the users that should be listed as members of the group.- Returns:
- The generated entry.
-
entryExists
public static boolean entryExists(LDAPInterface conn, java.lang.String dn) throws LDAPException
Indicates whether the specified entry exists in the server.- Parameters:
conn
- The connection to use to communicate with the directory server.dn
- The DN of the entry for which to make the determination.- Returns:
true
if the entry exists, orfalse
if not.- Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.
-
entryExists
public static boolean entryExists(LDAPInterface conn, java.lang.String dn, java.lang.String filter) throws LDAPException
Indicates whether the specified entry exists in the server and matches the given filter.- Parameters:
conn
- The connection to use to communicate with the directory server.dn
- The DN of the entry for which to make the determination.filter
- The filter the entry is expected to match.- Returns:
true
if the entry exists and matches the specified filter, orfalse
if not.- Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.
-
entryExists
public static boolean entryExists(LDAPInterface conn, Entry entry) throws LDAPException
Indicates whether the specified entry exists in the server. This will returntrue
only if the target entry exists and contains all values for all attributes of the provided entry. The entry will be allowed to have attribute values not included in the provided entry.- Parameters:
conn
- The connection to use to communicate with the directory server.entry
- The entry to compare against the directory server.- Returns:
true
if the entry exists in the server and is a superset of the provided entry, orfalse
if not.- Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.
-
assertEntryExists
public static void assertEntryExists(LDAPInterface conn, java.lang.String dn) throws LDAPException, java.lang.AssertionError
Ensures that an entry with the provided DN exists in the directory.- Parameters:
conn
- The connection to use to communicate with the directory server.dn
- The DN of the entry for which to make the determination.- Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.java.lang.AssertionError
- If the target entry does not exist.
-
assertEntryExists
public static void assertEntryExists(LDAPInterface conn, java.lang.String dn, java.lang.String filter) throws LDAPException, java.lang.AssertionError
Ensures that an entry with the provided DN exists in the directory.- Parameters:
conn
- The connection to use to communicate with the directory server.dn
- The DN of the entry for which to make the determination.filter
- A filter that the target entry must match.- Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.java.lang.AssertionError
- If the target entry does not exist or does not match the provided filter.
-
assertEntryExists
public static void assertEntryExists(LDAPInterface conn, Entry entry) throws LDAPException, java.lang.AssertionError
Ensures that an entry exists in the directory with the same DN and all attribute values contained in the provided entry. The server entry may contain additional attributes and/or attribute values not included in the provided entry.- Parameters:
conn
- The connection to use to communicate with the directory server.entry
- The entry expected to be present in the directory server.- Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.java.lang.AssertionError
- If the target entry does not exist or does not match the provided filter.
-
getMissingEntryDNs
public static java.util.List<java.lang.String> getMissingEntryDNs(LDAPInterface conn, java.lang.String... dns) throws LDAPException
Retrieves a list containing the DNs of the entries which are missing from the directory server.- Parameters:
conn
- The connection to use to communicate with the directory server.dns
- The DNs of the entries to try to find in the server.- Returns:
- A list containing all of the provided DNs that were not found in the server, or an empty list if all entries were found.
- Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.
-
getMissingEntryDNs
public static java.util.List<java.lang.String> getMissingEntryDNs(LDAPInterface conn, java.util.Collection<java.lang.String> dns) throws LDAPException
Retrieves a list containing the DNs of the entries which are missing from the directory server.- Parameters:
conn
- The connection to use to communicate with the directory server.dns
- The DNs of the entries to try to find in the server.- Returns:
- A list containing all of the provided DNs that were not found in the server, or an empty list if all entries were found.
- Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.
-
assertEntriesExist
public static void assertEntriesExist(LDAPInterface conn, java.lang.String... dns) throws LDAPException, java.lang.AssertionError
Ensures that all of the entries with the provided DNs exist in the directory.- Parameters:
conn
- The connection to use to communicate with the directory server.dns
- The DNs of the entries for which to make the determination.- Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.java.lang.AssertionError
- If any of the target entries does not exist.
-
assertEntriesExist
public static void assertEntriesExist(LDAPInterface conn, java.util.Collection<java.lang.String> dns) throws LDAPException, java.lang.AssertionError
Ensures that all of the entries with the provided DNs exist in the directory.- Parameters:
conn
- The connection to use to communicate with the directory server.dns
- The DNs of the entries for which to make the determination.- Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.java.lang.AssertionError
- If any of the target entries does not exist.
-
getMissingAttributeNames
public static java.util.List<java.lang.String> getMissingAttributeNames(LDAPInterface conn, java.lang.String dn, java.lang.String... attributeNames) throws LDAPException
Retrieves a list containing all of the named attributes which do not exist in the target entry.- Parameters:
conn
- The connection to use to communicate with the directory server.dn
- The DN of the entry to examine.attributeNames
- The names of the attributes expected to be present in the target entry.- Returns:
- A list containing the names of the attributes which were not
present in the target entry, an empty list if all specified
attributes were found in the entry, or
null
if the target entry does not exist. - Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.
-
getMissingAttributeNames
public static java.util.List<java.lang.String> getMissingAttributeNames(LDAPInterface conn, java.lang.String dn, java.util.Collection<java.lang.String> attributeNames) throws LDAPException
Retrieves a list containing all of the named attributes which do not exist in the target entry.- Parameters:
conn
- The connection to use to communicate with the directory server.dn
- The DN of the entry to examine.attributeNames
- The names of the attributes expected to be present in the target entry.- Returns:
- A list containing the names of the attributes which were not
present in the target entry, an empty list if all specified
attributes were found in the entry, or
null
if the target entry does not exist. - Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.
-
assertAttributeExists
public static void assertAttributeExists(LDAPInterface conn, java.lang.String dn, java.lang.String... attributeNames) throws LDAPException, java.lang.AssertionError
Ensures that the specified entry exists in the directory with all of the specified attributes.- Parameters:
conn
- The connection to use to communicate with the directory server.dn
- The DN of the entry to examine.attributeNames
- The names of the attributes that are expected to be present in the provided entry.- Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.java.lang.AssertionError
- If the target entry does not exist or does not contain all of the specified attributes.
-
assertAttributeExists
public static void assertAttributeExists(LDAPInterface conn, java.lang.String dn, java.util.Collection<java.lang.String> attributeNames) throws LDAPException, java.lang.AssertionError
Ensures that the specified entry exists in the directory with all of the specified attributes.- Parameters:
conn
- The connection to use to communicate with the directory server.dn
- The DN of the entry to examine.attributeNames
- The names of the attributes that are expected to be present in the provided entry.- Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.java.lang.AssertionError
- If the target entry does not exist or does not contain all of the specified attributes.
-
getMissingAttributeValues
public static java.util.List<java.lang.String> getMissingAttributeValues(LDAPInterface conn, java.lang.String dn, java.lang.String attributeName, java.lang.String... attributeValues) throws LDAPException
Retrieves a list of all provided attribute values which are missing from the specified entry.- Parameters:
conn
- The connection to use to communicate with the directory server.dn
- The DN of the entry to examine.attributeName
- The attribute expected to be present in the target entry with the given values.attributeValues
- The values expected to be present in the target entry.- Returns:
- A list containing all of the provided values which were not found
in the entry, an empty list if all provided attribute values were
found, or
null
if the target entry does not exist. - Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.
-
getMissingAttributeValues
public static java.util.List<java.lang.String> getMissingAttributeValues(LDAPInterface conn, java.lang.String dn, java.lang.String attributeName, java.util.Collection<java.lang.String> attributeValues) throws LDAPException
Retrieves a list of all provided attribute values which are missing from the specified entry. The target attribute may or may not contain additional values.- Parameters:
conn
- The connection to use to communicate with the directory server.dn
- The DN of the entry to examine.attributeName
- The attribute expected to be present in the target entry with the given values.attributeValues
- The values expected to be present in the target entry.- Returns:
- A list containing all of the provided values which were not found
in the entry, an empty list if all provided attribute values were
found, or
null
if the target entry does not exist. - Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.
-
assertValueExists
public static void assertValueExists(LDAPInterface conn, java.lang.String dn, java.lang.String attributeName, java.lang.String... attributeValues) throws LDAPException, java.lang.AssertionError
Ensures that the specified entry exists in the directory with all of the specified values for the given attribute. The attribute may or may not contain additional values.- Parameters:
conn
- The connection to use to communicate with the directory server.dn
- The DN of the entry to examine.attributeName
- The name of the attribute to examine.attributeValues
- The set of values which must exist for the given attribute.- Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.java.lang.AssertionError
- If the target entry does not exist, does not contain the specified attribute, or that attribute does not have all of the specified values.
-
assertValueExists
public static void assertValueExists(LDAPInterface conn, java.lang.String dn, java.lang.String attributeName, java.util.Collection<java.lang.String> attributeValues) throws LDAPException, java.lang.AssertionError
Ensures that the specified entry exists in the directory with all of the specified values for the given attribute. The attribute may or may not contain additional values.- Parameters:
conn
- The connection to use to communicate with the directory server.dn
- The DN of the entry to examine.attributeName
- The name of the attribute to examine.attributeValues
- The set of values which must exist for the given attribute.- Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.java.lang.AssertionError
- If the target entry does not exist, does not contain the specified attribute, or that attribute does not have all of the specified values.
-
assertEntryMissing
public static void assertEntryMissing(LDAPInterface conn, java.lang.String dn) throws LDAPException, java.lang.AssertionError
Ensures that the specified entry does not exist in the directory.- Parameters:
conn
- The connection to use to communicate with the directory server.dn
- The DN of the entry expected to be missing.- Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.java.lang.AssertionError
- If the target entry is found in the server.
-
assertAttributeMissing
public static void assertAttributeMissing(LDAPInterface conn, java.lang.String dn, java.lang.String... attributeNames) throws LDAPException, java.lang.AssertionError
Ensures that the specified entry exists in the directory but does not contain any of the specified attributes.- Parameters:
conn
- The connection to use to communicate with the directory server.dn
- The DN of the entry expected to be present.attributeNames
- The names of the attributes expected to be missing from the entry.- Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.java.lang.AssertionError
- If the target entry is missing from the server, or if it contains any of the target attributes.
-
assertAttributeMissing
public static void assertAttributeMissing(LDAPInterface conn, java.lang.String dn, java.util.Collection<java.lang.String> attributeNames) throws LDAPException, java.lang.AssertionError
Ensures that the specified entry exists in the directory but does not contain any of the specified attributes.- Parameters:
conn
- The connection to use to communicate with the directory server.dn
- The DN of the entry expected to be present.attributeNames
- The names of the attributes expected to be missing from the entry.- Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.java.lang.AssertionError
- If the target entry is missing from the server, or if it contains any of the target attributes.
-
assertValueMissing
public static void assertValueMissing(LDAPInterface conn, java.lang.String dn, java.lang.String attributeName, java.lang.String... attributeValues) throws LDAPException, java.lang.AssertionError
Ensures that the specified entry exists in the directory but does not contain any of the specified attribute values.- Parameters:
conn
- The connection to use to communicate with the directory server.dn
- The DN of the entry expected to be present.attributeName
- The name of the attribute to examine.attributeValues
- The values expected to be missing from the target entry.- Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.java.lang.AssertionError
- If the target entry is missing from the server, or if it contains any of the target attribute values.
-
assertValueMissing
public static void assertValueMissing(LDAPInterface conn, java.lang.String dn, java.lang.String attributeName, java.util.Collection<java.lang.String> attributeValues) throws LDAPException, java.lang.AssertionError
Ensures that the specified entry exists in the directory but does not contain any of the specified attribute values.- Parameters:
conn
- The connection to use to communicate with the directory server.dn
- The DN of the entry expected to be present.attributeName
- The name of the attribute to examine.attributeValues
- The values expected to be missing from the target entry.- Throws:
LDAPException
- If a problem is encountered while trying to communicate with the directory server.java.lang.AssertionError
- If the target entry is missing from the server, or if it contains any of the target attribute values.
-
assertResultCodeEquals
public static void assertResultCodeEquals(LDAPResult result, ResultCode... acceptableResultCodes) throws java.lang.AssertionError
Ensures that the result code for the provided result matches one of the given acceptable result codes.- Parameters:
result
- The LDAP result to examine.acceptableResultCodes
- The set of result codes that are considered acceptable.- Throws:
java.lang.AssertionError
- If the result code from the provided result did not match any of the acceptable values.
-
assertResultCodeEquals
public static void assertResultCodeEquals(LDAPException exception, ResultCode... acceptableResultCodes) throws java.lang.AssertionError
Ensures that the result code for the provided LDAP exception matches one of the given acceptable result codes.- Parameters:
exception
- The LDAP exception to examine.acceptableResultCodes
- The set of result codes that are considered acceptable.- Throws:
java.lang.AssertionError
- If the result code from the provided exception did not match any of the acceptable values.
-
assertResultCodeEquals
public static LDAPResult assertResultCodeEquals(LDAPConnection conn, LDAPRequest request, ResultCode... acceptableResultCodes) throws java.lang.AssertionError
Processes the provided request using the given connection and ensures that the result code matches one of the provided acceptable values.- Parameters:
conn
- The connection to use to communicate with the directory server.request
- The request to be processed.acceptableResultCodes
- The set of result codes that are considered acceptable.- Returns:
- The result returned from processing the requested operation.
- Throws:
java.lang.AssertionError
- If the result code returned by the server did not match any acceptable values.
-
assertResultCodeNot
public static void assertResultCodeNot(LDAPResult result, ResultCode... unacceptableResultCodes) throws java.lang.AssertionError
Ensures that the result code for the provided result does not match any of the given unacceptable result codes.- Parameters:
result
- The LDAP result to examine.unacceptableResultCodes
- The set of result codes that are considered unacceptable.- Throws:
java.lang.AssertionError
- If the result code from the provided result matched any of the unacceptable values.
-
assertResultCodeNot
public static void assertResultCodeNot(LDAPException exception, ResultCode... unacceptableResultCodes) throws java.lang.AssertionError
Ensures that the result code for the provided result does not match any of the given unacceptable result codes.- Parameters:
exception
- The LDAP exception to examine.unacceptableResultCodes
- The set of result codes that are considered unacceptable.- Throws:
java.lang.AssertionError
- If the result code from the provided result matched any of the unacceptable values.
-
assertResultCodeNot
public static LDAPResult assertResultCodeNot(LDAPConnection conn, LDAPRequest request, ResultCode... unacceptableResultCodes) throws java.lang.AssertionError
Processes the provided request using the given connection and ensures that the result code does not match any of the given unacceptable values.- Parameters:
conn
- The connection to use to communicate with the directory server.request
- The request to be processed.unacceptableResultCodes
- The set of result codes that are considered unacceptable.- Returns:
- The result returned from processing the requested operation.
- Throws:
java.lang.AssertionError
- If the result code from the provided result matched any of the unacceptable values.
-
assertContainsMatchedDN
public static void assertContainsMatchedDN(LDAPResult result) throws java.lang.AssertionError
Ensures that the provided LDAP result contains a matched DN value.- Parameters:
result
- The LDAP result to examine.- Throws:
java.lang.AssertionError
- If the provided result did not contain a matched DN value.
-
assertContainsMatchedDN
public static void assertContainsMatchedDN(LDAPException exception) throws java.lang.AssertionError
Ensures that the provided LDAP exception contains a matched DN value.- Parameters:
exception
- The LDAP exception to examine.- Throws:
java.lang.AssertionError
- If the provided exception did not contain a matched DN value.
-
assertMissingMatchedDN
public static void assertMissingMatchedDN(LDAPResult result) throws java.lang.AssertionError
Ensures that the provided LDAP result does not contain a matched DN value.- Parameters:
result
- The LDAP result to examine.- Throws:
java.lang.AssertionError
- If the provided result contained a matched DN value.
-
assertMissingMatchedDN
public static void assertMissingMatchedDN(LDAPException exception) throws java.lang.AssertionError
Ensures that the provided LDAP exception does not contain a matched DN value.- Parameters:
exception
- The LDAP exception to examine.- Throws:
java.lang.AssertionError
- If the provided exception contained a matched DN value.
-
assertMatchedDNEquals
public static void assertMatchedDNEquals(LDAPResult result, java.lang.String matchedDN) throws LDAPException, java.lang.AssertionError
Ensures that the provided LDAP result has the given matched DN value.- Parameters:
result
- The LDAP result to examine.matchedDN
- The matched DN value expected to be found in the provided result. It must not benull
.- Throws:
LDAPException
- If either the found or expected matched DN values could not be parsed as a valid DN.java.lang.AssertionError
- If the provided LDAP result did not contain a matched DN, or if it had a matched DN that differed from the expected value.
-
assertMatchedDNEquals
public static void assertMatchedDNEquals(LDAPException exception, java.lang.String matchedDN) throws LDAPException, java.lang.AssertionError
Ensures that the provided LDAP exception has the given matched DN value.- Parameters:
exception
- The LDAP exception to examine.matchedDN
- The matched DN value expected to be found in the provided exception. It must not benull
.- Throws:
LDAPException
- If either the found or expected matched DN values could not be parsed as a valid DN.java.lang.AssertionError
- If the provided LDAP exception did not contain a matched DN, or if it had a matched DN that differed from the expected value.
-
assertContainsDiagnosticMessage
public static void assertContainsDiagnosticMessage(LDAPResult result) throws java.lang.AssertionError
Ensures that the provided LDAP result contains a diagnostic message.- Parameters:
result
- The LDAP result to examine.- Throws:
java.lang.AssertionError
- If the provided result did not contain a diagnostic message.
-
assertContainsDiagnosticMessage
public static void assertContainsDiagnosticMessage(LDAPException exception) throws java.lang.AssertionError
Ensures that the provided LDAP exception contains a diagnostic message.- Parameters:
exception
- The LDAP exception to examine.- Throws:
java.lang.AssertionError
- If the provided exception did not contain a diagnostic message.
-
assertMissingDiagnosticMessage
public static void assertMissingDiagnosticMessage(LDAPResult result) throws java.lang.AssertionError
Ensures that the provided LDAP result does not contain a diagnostic message.- Parameters:
result
- The LDAP result to examine.- Throws:
java.lang.AssertionError
- If the provided result contained a diagnostic message.
-
assertMissingDiagnosticMessage
public static void assertMissingDiagnosticMessage(LDAPException exception) throws java.lang.AssertionError
Ensures that the provided LDAP exception does not contain a diagnostic message.- Parameters:
exception
- The LDAP exception to examine.- Throws:
java.lang.AssertionError
- If the provided exception contained a diagnostic message.
-
assertDiagnosticMessageEquals
public static void assertDiagnosticMessageEquals(LDAPResult result, java.lang.String diagnosticMessage) throws java.lang.AssertionError
Ensures that the provided LDAP result has the given diagnostic message.- Parameters:
result
- The LDAP result to examine.diagnosticMessage
- The diagnostic message expected to be found in the provided result. It must not benull
.- Throws:
java.lang.AssertionError
- If the provided LDAP result did not contain a diagnostic message, or if it had a diagnostic message that differed from the expected value.
-
assertDiagnosticMessageEquals
public static void assertDiagnosticMessageEquals(LDAPException exception, java.lang.String diagnosticMessage) throws java.lang.AssertionError
Ensures that the provided LDAP exception has the given diagnostic message.- Parameters:
exception
- The LDAP exception to examine.diagnosticMessage
- The diagnostic message expected to be found in the provided exception. It must not benull
.- Throws:
java.lang.AssertionError
- If the provided LDAP exception did not contain a diagnostic message, or if it had a diagnostic message that differed from the expected value.
-
assertHasReferral
public static void assertHasReferral(LDAPResult result) throws java.lang.AssertionError
Ensures that the provided LDAP result has one or more referral URLs.- Parameters:
result
- The LDAP result to examine.- Throws:
java.lang.AssertionError
- If the provided result does not have any referral URLs.
-
assertHasReferral
public static void assertHasReferral(LDAPException exception) throws java.lang.AssertionError
Ensures that the provided LDAP exception has one or more referral URLs.- Parameters:
exception
- The LDAP exception to examine.- Throws:
java.lang.AssertionError
- If the provided exception does not have any referral URLs.
-
assertMissingReferral
public static void assertMissingReferral(LDAPResult result) throws java.lang.AssertionError
Ensures that the provided LDAP result does not have any referral URLs.- Parameters:
result
- The LDAP result to examine.- Throws:
java.lang.AssertionError
- If the provided result has one or more referral URLs.
-
assertMissingReferral
public static void assertMissingReferral(LDAPException exception) throws java.lang.AssertionError
Ensures that the provided LDAP exception does not have any referral URLs.- Parameters:
exception
- The LDAP exception to examine.- Throws:
java.lang.AssertionError
- If the provided exception has one or more referral URLs.
-
assertHasControl
public static Control assertHasControl(LDAPResult result, java.lang.String oid) throws java.lang.AssertionError
Ensures that the provided LDAP result includes at least one control with the specified OID.- Parameters:
result
- The LDAP result to examine.oid
- The OID of the control which is expected to be present in the result.- Returns:
- The first control found with the specified OID.
- Throws:
java.lang.AssertionError
- If the provided LDAP result does not include any control with the specified OID.
-
assertHasControl
public static Control assertHasControl(LDAPException exception, java.lang.String oid) throws java.lang.AssertionError
Ensures that the provided LDAP exception includes at least one control with the specified OID.- Parameters:
exception
- The LDAP exception to examine.oid
- The OID of the control which is expected to be present in the exception.- Returns:
- The first control found with the specified OID.
- Throws:
java.lang.AssertionError
- If the provided LDAP exception does not include any control with the specified OID.
-
assertHasControl
public static Control assertHasControl(SearchResultEntry entry, java.lang.String oid) throws java.lang.AssertionError
Ensures that the provided search result entry includes at least one control with the specified OID.- Parameters:
entry
- The search result entry to examine.oid
- The OID of the control which is expected to be present in the search result entry.- Returns:
- The first control found with the specified OID.
- Throws:
java.lang.AssertionError
- If the provided search result entry does not include any control with the specified OID.
-
assertHasControl
public static Control assertHasControl(SearchResultReference reference, java.lang.String oid) throws java.lang.AssertionError
Ensures that the provided search result reference includes at least one control with the specified OID.- Parameters:
reference
- The search result reference to examine.oid
- The OID of the control which is expected to be present in the search result reference.- Returns:
- The first control found with the specified OID.
- Throws:
java.lang.AssertionError
- If the provided search result reference does not include any control with the specified OID.
-
assertMissingControl
public static void assertMissingControl(LDAPResult result, java.lang.String oid) throws java.lang.AssertionError
Ensures that the provided LDAP result does not include any control with the specified OID.- Parameters:
result
- The LDAP result to examine.oid
- The OID of the control which is not expected to be present in the result.- Throws:
java.lang.AssertionError
- If the provided LDAP result includes any control with the specified OID.
-
assertMissingControl
public static void assertMissingControl(LDAPException exception, java.lang.String oid) throws java.lang.AssertionError
Ensures that the provided LDAP exception does not include any control with the specified OID.- Parameters:
exception
- The LDAP exception to examine.oid
- The OID of the control which is not expected to be present in the exception.- Throws:
java.lang.AssertionError
- If the provided LDAP exception includes any control with the specified OID.
-
assertMissingControl
public static void assertMissingControl(SearchResultEntry entry, java.lang.String oid) throws java.lang.AssertionError
Ensures that the provided search result entry does not includes any control with the specified OID.- Parameters:
entry
- The search result entry to examine.oid
- The OID of the control which is not expected to be present in the search result entry.- Throws:
java.lang.AssertionError
- If the provided search result entry includes any control with the specified OID.
-
assertMissingControl
public static void assertMissingControl(SearchResultReference reference, java.lang.String oid) throws java.lang.AssertionError
Ensures that the provided search result reference does not includes any control with the specified OID.- Parameters:
reference
- The search result reference to examine.oid
- The OID of the control which is not expected to be present in the search result reference.- Throws:
java.lang.AssertionError
- If the provided search result reference includes any control with the specified OID.
-
assertEntryReturned
public static int assertEntryReturned(SearchResult result) throws java.lang.AssertionError
Ensures that the provided search result indicates that at least one search result entry was returned.- Parameters:
result
- The search result to examine.- Returns:
- The number of search result entries that were returned.
- Throws:
java.lang.AssertionError
- If the provided search result indicates that no entries were returned.
-
assertEntryReturned
public static int assertEntryReturned(LDAPSearchException exception) throws java.lang.AssertionError
Ensures that the provided search exception indicates that at least one search result entry was returned.- Parameters:
exception
- The search exception to examine.- Returns:
- The number of search result entries that were returned.
- Throws:
java.lang.AssertionError
- If the provided search exception indicates that no entries were returned.
-
assertEntryReturned
public static SearchResultEntry assertEntryReturned(SearchResult result, java.lang.String dn) throws LDAPException, java.lang.AssertionError
Ensures that the specified search result entry was included in provided search result.- Parameters:
result
- The search result to examine.dn
- The DN of the entry expected to be included in the search result.- Returns:
- The search result entry with the provided DN.
- Throws:
LDAPException
- If the provided string cannot be parsed as a valid DN.java.lang.AssertionError
- If the specified entry was not included in the set of entries that were returned, or if a search result listener was used which makes the determination impossible.
-
assertEntryReturned
public static SearchResultEntry assertEntryReturned(LDAPSearchException exception, java.lang.String dn) throws LDAPException, java.lang.AssertionError
Ensures that the specified search result entry was included in provided search exception.- Parameters:
exception
- The search exception to examine.dn
- The DN of the entry expected to be included in the search exception.- Returns:
- The search result entry with the provided DN.
- Throws:
LDAPException
- If the provided string cannot be parsed as a valid DN.java.lang.AssertionError
- If the specified entry was not included in the set of entries that were returned, or if a search result listener was used which makes the determination impossible.
-
assertNoEntriesReturned
public static void assertNoEntriesReturned(SearchResult result) throws java.lang.AssertionError
Ensures that the provided search result indicates that no search result entries were returned.- Parameters:
result
- The search result to examine.- Throws:
java.lang.AssertionError
- If the provided search result indicates that one or more entries were returned.
-
assertNoEntriesReturned
public static void assertNoEntriesReturned(LDAPSearchException exception) throws java.lang.AssertionError
Ensures that the provided search exception indicates that no search result entries were returned.- Parameters:
exception
- The search exception to examine.- Throws:
java.lang.AssertionError
- If the provided search exception indicates that one or more entries were returned.
-
assertEntriesReturnedEquals
public static void assertEntriesReturnedEquals(SearchResult result, int expectedEntryCount) throws java.lang.AssertionError
Ensures that the provided search result indicates that the expected number of entries were returned.- Parameters:
result
- The search result to examine.expectedEntryCount
- The number of expected search result entries.- Throws:
java.lang.AssertionError
- If the number of entries returned does not match the expected value.
-
assertEntriesReturnedEquals
public static void assertEntriesReturnedEquals(LDAPSearchException exception, int expectedEntryCount) throws java.lang.AssertionError
Ensures that the provided search exception indicates that the expected number of entries were returned.- Parameters:
exception
- The search exception to examine.expectedEntryCount
- The number of expected search result entries.- Throws:
java.lang.AssertionError
- If the number of entries returned does not match the expected value.
-
assertReferenceReturned
public static int assertReferenceReturned(SearchResult result) throws java.lang.AssertionError
Ensures that the provided search result indicates that at least one search result reference was returned.- Parameters:
result
- The search result to examine.- Returns:
- The number of search result references that were returned.
- Throws:
java.lang.AssertionError
- If the provided search result indicates that no references were returned.
-
assertReferenceReturned
public static int assertReferenceReturned(LDAPSearchException exception) throws java.lang.AssertionError
Ensures that the provided search exception indicates that at least one search result reference was returned.- Parameters:
exception
- The search exception to examine.- Returns:
- The number of search result references that were returned.
- Throws:
java.lang.AssertionError
- If the provided search exception indicates that no references were returned.
-
assertNoReferencesReturned
public static void assertNoReferencesReturned(SearchResult result) throws java.lang.AssertionError
Ensures that the provided search result indicates that no search result references were returned.- Parameters:
result
- The search result to examine.- Throws:
java.lang.AssertionError
- If the provided search result indicates that one or more references were returned.
-
assertNoReferencesReturned
public static void assertNoReferencesReturned(LDAPSearchException exception) throws java.lang.AssertionError
Ensures that the provided search exception indicates that no search result references were returned.- Parameters:
exception
- The search exception to examine.- Throws:
java.lang.AssertionError
- If the provided search exception indicates that one or more references were returned.
-
assertReferencesReturnedEquals
public static void assertReferencesReturnedEquals(SearchResult result, int expectedReferenceCount) throws java.lang.AssertionError
Ensures that the provided search result indicates that the expected number of references were returned.- Parameters:
result
- The search result to examine.expectedReferenceCount
- The number of expected search result references.- Throws:
java.lang.AssertionError
- If the number of references returned does not match the expected value.
-
assertReferencesReturnedEquals
public static void assertReferencesReturnedEquals(LDAPSearchException exception, int expectedReferenceCount) throws java.lang.AssertionError
Ensures that the provided search exception indicates that the expected number of references were returned.- Parameters:
exception
- The search exception to examine.expectedReferenceCount
- The number of expected search result references.- Throws:
java.lang.AssertionError
- If the number of references returned does not match the expected value.
-
assertDNsEqual
public static void assertDNsEqual(java.lang.String s1, java.lang.String s2) throws java.lang.AssertionError
Ensures that the two provided strings represent the same DN.- Parameters:
s1
- The first string to compare.s2
- The second string to compare.- Throws:
java.lang.AssertionError
- If either string doesn't represent a valid DN, or if they do not represent the same DN.
-
-