use of org.apache.directory.api.ldap.model.url.LdapUrl in project directory-ldap-api by apache.
the class LdapUrlTest method testLdapURLDNNoAttrsNoScopeNoFilterExtension.
/**
* test a LdapUrl with a Dn, no attributes, no scope, no filter and some extensions
*/
@Test
public void testLdapURLDNNoAttrsNoScopeNoFilterExtension() throws LdapURLEncodingException {
LdapUrl url = new LdapUrl("ldap://localhost:123/ou=system????!a=b,!c");
assertEquals("ldap://localhost:123/ou=system????!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 testLdapURLNoDNAttrsScope.
/**
* test a LdapUrl with no Dn, some attributes an scope
*/
@Test
public void testLdapURLNoDNAttrsScope() throws LdapURLEncodingException {
LdapUrl url = new LdapUrl("ldap://localhost:123/?ou,cn?sub");
assertEquals("ldap://localhost:123/?ou,cn?sub", url.toString());
}
use of org.apache.directory.api.ldap.model.url.LdapUrl in project directory-ldap-api by apache.
the class LdapUrlTest method testDnSetFilter.
/**
* test the setFilter() method
*/
@Test
public void testDnSetFilter() throws LdapURLEncodingException, LdapInvalidDnException {
LdapUrl url = new LdapUrl();
assertNull(url.getFilter());
url.setDn(new Dn("dc=example,dc=com"));
url.setFilter("(objectClass=person)");
assertEquals("(objectClass=person)", url.getFilter());
assertEquals("ldap:///dc=example,dc=com???(objectClass=person)", url.toString());
url.setFilter("(cn=Babs Jensen)");
assertEquals("(cn=Babs Jensen)", url.getFilter());
assertEquals("ldap:///dc=example,dc=com???(cn=Babs%20Jensen)", url.toString());
url.setFilter(null);
assertNull(url.getFilter());
assertEquals("ldap:///dc=example,dc=com", url.toString());
}
use of org.apache.directory.api.ldap.model.url.LdapUrl in project directory-ldap-api by apache.
the class LdapUrlTest method testLdapURLDNAttrsScopeBaseFilter.
/**
* test a LdapUrl with a Dn, some attributes, a base scope, and filter
*/
@Test
public void testLdapURLDNAttrsScopeBaseFilter() throws LdapURLEncodingException {
LdapUrl url = new LdapUrl("ldap://localhost:123/ou=system?cn,ou,dc?base?(cn=test)");
assertEquals("ldap://localhost:123/ou=system?cn,ou,dc??(cn=test)", url.toString());
}
use of org.apache.directory.api.ldap.model.url.LdapUrl in project directory-ldap-api by apache.
the class LdapUrlTest method testLdapURLDNAttrsScopeBaseNoFilterExtension.
/**
* test a LdapUrl with a Dn, some attributes, a base scope, no filter and some extensions
*/
@Test
public void testLdapURLDNAttrsScopeBaseNoFilterExtension() throws LdapURLEncodingException {
LdapUrl url = new LdapUrl("ldap://localhost:123/ou=system?cn,ou,dc?base??!a=b,!c");
assertEquals("ldap://localhost:123/ou=system?cn,ou,dc???!a=b,!c", url.toString());
}
Aggregations