use of org.apache.directory.api.ldap.model.url.LdapUrl in project directory-ldap-api by apache.
the class LdapUrlTest method testLdapURLExtensionWithCommaValue.
/**
* Test comma in extension value.
*/
@Test
public void testLdapURLExtensionWithCommaValue() throws Exception {
LdapUrl url1 = new LdapUrl();
url1.setHost("localhost");
url1.setPort(123);
url1.setDn(Dn.EMPTY_DN);
url1.getExtensions().add(new Extension(false, "X-CONNECTION-NAME", ","));
assertEquals("ldap://localhost:123/????X-CONNECTION-NAME=%2c", url1.toString());
LdapUrl url2 = new LdapUrl("ldap://localhost:123/????X-CONNECTION-NAME=%2c");
assertEquals(",", url1.getExtensionValue("X-CONNECTION-NAME"));
assertEquals("ldap://localhost:123/????X-CONNECTION-NAME=%2c", url2.toString());
}
use of org.apache.directory.api.ldap.model.url.LdapUrl in project directory-ldap-api by apache.
the class LdapUrlTest method testLdapURLDNNoAttrsScopeBaseFilterExtension.
/**
* test a LdapUrl with a Dn, no attributes, a base scope, a filter and some extensions
*/
@Test
public void testLdapURLDNNoAttrsScopeBaseFilterExtension() throws LdapURLEncodingException {
LdapUrl url = new LdapUrl("ldap://localhost:123/ou=system??base?(cn=test)?!a=b,!c");
assertEquals("ldap://localhost:123/ou=system???(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 testLdapURLDNNoAttrsScopeBaseFilter.
/**
* test a LdapUrl with a Dn, no attributes, a base scope, and filter
*/
@Test
public void testLdapURLDNNoAttrsScopeBaseFilter() throws LdapURLEncodingException {
LdapUrl url = new LdapUrl("ldap://localhost:123/ou=system??base?(cn=test)");
assertEquals("ldap://localhost:123/ou=system???(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 testLdapURLNoDNAttrsDefaultScope.
/**
* test a LdapUrl with no Dn, some attributes an default scope
*/
@Test
public void testLdapURLNoDNAttrsDefaultScope() throws LdapURLEncodingException {
LdapUrl url = new LdapUrl("ldap://localhost:123/?ou,cn?");
assertEquals("ldap://localhost:123/?ou,cn", url.toString());
}
use of org.apache.directory.api.ldap.model.url.LdapUrl in project directory-ldap-api by apache.
the class LdapUrlTest method testLdapURLNoDNNoAttrsNoScopeFilterExtension.
/**
* test a LdapUrl with no Dn, no attributes, no scope, a filter and some extensions
*/
@Test
public void testLdapURLNoDNNoAttrsNoScopeFilterExtension() throws LdapURLEncodingException {
LdapUrl url = new LdapUrl("ldap://localhost:123/???(cn=test)?!a=b,!c");
assertEquals("ldap://localhost:123/???(cn=test)?!a=b,!c", url.toString());
}
Aggregations