public final class DirectoryServerRule extends Object implements org.junit.rules.TestRule
DirectoryServerConfiguration annotation applied to either the test method or the test
class.| Modifier and Type | Field and Description |
|---|---|
private DirectoryServerConfiguration |
annotation
The current configuration for the in-memory LDAP directory server.
|
| Constructor and Description |
|---|
DirectoryServerRule() |
| Modifier and Type | Method and Description |
|---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
Modifies the method-running
Statement to implement this test-running rule. |
void |
assertDNExists(String dn)
Assert that an entry identified by
dn exists. |
void |
assertDNHasAttribute(String dn,
String attributeName)
Assert that the entry identified by
dn has an attribute named attributeName. |
void |
assertDNHasAttributeValue(String dn,
String attributeName,
String... attributeValue)
Assert that the entry identified by
dn has an attribute named attributeName with
the attribute value(s) attributeName. |
void |
assertDNIsA(String dn,
String objectclass)
Assert that the entry identified by
dn is of type objectclass. |
private DirectoryTester |
getDirectoryTester()
Create a
DirectoryTester that connects to the in-memory LDAP directory server created by this rule. |
boolean |
verifyDNExists(String dn)
Verify that an entry identified by
dn exists. |
boolean |
verifyDNHasAttribute(String dn,
String attributeName)
Verify that the entry identified by
dn has an attribute named attributeName. |
boolean |
verifyDNHasAttributeValue(String dn,
String attributeName,
String... attributeValue)
Verify that the entry identified by
dn has an attribute named attributeName with
the attribute value(s) attributeName. |
boolean |
verifyDNIsA(String dn,
String objectclass)
Verify that the entry identified by
dn is of type objectclass. |
private DirectoryServerConfiguration annotation
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
Statement to implement this test-running rule. The configuration for
the embedded LDAP directory server is obtained from the DirectoryServerConfiguration annotation that was
applied to either the test class or test method.apply in interface org.junit.rules.TestRulebase - The Statement to be modifieddescription - A Description of the test implemented in basebase is returned. Otherwise, a new
DirectoryServerStatement that wraps base is returned.public boolean verifyDNExists(String dn)
dn exists.dn - The distinguished name.true if an entry identified by dn exists. Otherwise, false is returned.public boolean verifyDNIsA(String dn, String objectclass)
dn is of type objectclass.dn - The distinguished name.objectclass - The type name.true if an entry identified by dn exists and has attribute named objectclass.
Otherwise, false is returned.public boolean verifyDNHasAttribute(String dn, String attributeName)
dn has an attribute named attributeName.dn - The distinguished name.attributeName - The attribute name.true if an entry identified by dn exists and has an attributed named
attributeName. Otherwise, false is returned.public boolean verifyDNHasAttributeValue(String dn, String attributeName, String... attributeValue)
dn has an attribute named attributeName with
the attribute value(s) attributeName.dn - The distinguished name.attributeName - The attribute name.attributeValue - The attribute value(s).true if an antry identified by dn exists with an an attribute named attributeName
that has value(s) attributeValue. Otherwise, false is returned.public void assertDNExists(String dn)
dn exists.dn - The distinguished name.public void assertDNIsA(String dn, String objectclass)
dn is of type objectclass.dn - The distinguished name.objectclass - The type name.public void assertDNHasAttribute(String dn, String attributeName)
dn has an attribute named attributeName.dn - The distinguished nameattributeName - The attribute namepublic void assertDNHasAttributeValue(String dn, String attributeName, String... attributeValue)
dn has an attribute named attributeName with
the attribute value(s) attributeName.dn - The distinguished nameattributeName - The attribute nameattributeValue - The attribute value(s)private DirectoryTester getDirectoryTester()
DirectoryTester that connects to the in-memory LDAP directory server created by this rule.DirectoryTester.Copyright © 2013–2025 Buralo Technologies. All rights reserved.