use of org.apache.directory.api.ldap.model.url.LdapUrl in project directory-ldap-api by apache.
the class LdapUrlTest method testLdapURLNoDNNoAttrsScopeNoFilterExtension.
/**
* test a LdapUrl with no Dn, no attributes, a scope, no filter and some extensions
*/
@Test
public void testLdapURLNoDNNoAttrsScopeNoFilterExtension() throws LdapURLEncodingException {
LdapUrl url = new LdapUrl("ldap://localhost:123/??sub??!a=b,!c");
assertEquals("ldap://localhost:123/??sub??!a=b,!c", url.toString());
}
use of org.apache.directory.api.ldap.model.url.LdapUrl in project directory-ldap-api by apache.
the class LdapUrlTest method testLdapURLNoDNNoAttrsScopeFilterExtension.
/**
* test a LdapUrl with no Dn, no attributes, a scope, a filter and some extensions
*/
@Test
public void testLdapURLNoDNNoAttrsScopeFilterExtension() throws LdapURLEncodingException {
LdapUrl url = new LdapUrl("ldap://localhost:123/??sub?(cn=test)?!a=b,!c");
assertEquals("ldap://localhost:123/??sub?(cn=test)?!a=b,!c", url.toString());
}
use of org.apache.directory.api.ldap.model.url.LdapUrl in project directory-ldap-api by apache.
the class LdapUrlTest method testDnSetDn.
/**
* test the setDn() method
*/
@Test
public void testDnSetDn() throws LdapURLEncodingException, LdapInvalidDnException {
LdapUrl url = new LdapUrl();
assertNull(url.getDn());
Dn dn = new Dn("dc=example,dc=com");
url.setDn(dn);
assertEquals(dn, url.getDn());
assertEquals("ldap:///dc=example,dc=com", url.toString());
url.setDn(null);
assertNull(url.getDn());
assertEquals("ldap:///", url.toString());
}
use of org.apache.directory.api.ldap.model.url.LdapUrl in project directory-ldap-api by apache.
the class LdapUrlTest method testLdapURLExtensionOrder.
/**
* Test the extension order of an LdapUrl.
*/
@Test
public void testLdapURLExtensionOrder() throws LdapURLEncodingException {
LdapUrl url = new LdapUrl("ldap://localhost:123/????!a=b,!c,!x,d=e,f=g,!h=i");
assertEquals("ldap://localhost:123/????!a=b,!c,!x,d=e,f=g,!h=i", url.toString());
List<Extension> extensions = url.getExtensions();
assertTrue(extensions.get(0).isCritical());
assertEquals("a", extensions.get(0).getType());
assertEquals("b", extensions.get(0).getValue());
assertTrue(extensions.get(1).isCritical());
assertEquals("c", extensions.get(1).getType());
assertNull(extensions.get(1).getValue());
assertTrue(extensions.get(2).isCritical());
assertEquals("x", extensions.get(2).getType());
assertNull(extensions.get(2).getValue());
assertFalse(extensions.get(3).isCritical());
assertEquals("d", extensions.get(3).getType());
assertEquals("e", extensions.get(3).getValue());
assertFalse(extensions.get(4).isCritical());
assertEquals("f", extensions.get(4).getType());
assertEquals("g", extensions.get(4).getValue());
assertTrue(extensions.get(5).isCritical());
assertEquals("h", extensions.get(5).getType());
assertEquals("i", extensions.get(5).getValue());
}
use of org.apache.directory.api.ldap.model.url.LdapUrl in project directory-ldap-api by apache.
the class LdapUrlTest method testLdapURLNoDNNoAttrsNoScopeNoFilterNoExtension.
/**
* test a LdapUrl with no Dn, no attributes, no scope, no filter and no extension
*/
@Test
public void testLdapURLNoDNNoAttrsNoScopeNoFilterNoExtension() throws LdapURLEncodingException {
LdapUrl url = new LdapUrl("ldap://localhost:123/????");
assertEquals("ldap://localhost:123/", url.toString());
}
Aggregations