Search in sources :

Example 26 with LdapUrl

use of org.apache.directory.api.ldap.model.url.LdapUrl in project directory-ldap-api by apache.

the class LdapUrlTest method testLdapURLNoDNNoAttrsScopeBaseFilter.

/**
 * test a LdapUrl with no Dn, no attributes, a base scope, and filter
 */
@Test
public void testLdapURLNoDNNoAttrsScopeBaseFilter() throws LdapURLEncodingException {
    LdapUrl url = new LdapUrl("ldap://localhost:123/??base?(cn=test)");
    assertEquals("ldap://localhost:123/???(cn=test)", url.toString());
}
Also used : LdapUrl(org.apache.directory.api.ldap.model.url.LdapUrl) Test(org.junit.Test)

Example 27 with LdapUrl

use of org.apache.directory.api.ldap.model.url.LdapUrl in project directory-ldap-api by apache.

the class LdapUrlTest method testDnSetPort.

/**
 * test the setPort() method
 */
@Test
public void testDnSetPort() throws LdapURLEncodingException {
    LdapUrl url = new LdapUrl();
    assertEquals(-1, url.getPort());
    url.setPort(389);
    assertEquals(389, url.getPort());
    assertEquals("ldap://:389/", url.toString());
    url.setPort(0);
    assertEquals(-1, url.getPort());
    assertEquals("ldap:///", url.toString());
    url.setPort(65536);
    assertEquals(-1, url.getPort());
    assertEquals("ldap:///", url.toString());
}
Also used : LdapUrl(org.apache.directory.api.ldap.model.url.LdapUrl) Test(org.junit.Test)

Example 28 with LdapUrl

use of org.apache.directory.api.ldap.model.url.LdapUrl in project directory-ldap-api by apache.

the class LdapUrlTest method testLdapURLNoDNNoAttrsScopeBase.

/**
 * test a LdapUrl with no Dn, no attributes an scope base
 */
@Test
public void testLdapURLNoDNNoAttrsScopeBase() throws LdapURLEncodingException {
    LdapUrl url = new LdapUrl("ldap://localhost:123/??base");
    assertEquals("ldap://localhost:123/", url.toString());
}
Also used : LdapUrl(org.apache.directory.api.ldap.model.url.LdapUrl) Test(org.junit.Test)

Example 29 with LdapUrl

use of org.apache.directory.api.ldap.model.url.LdapUrl in project directory-ldap-api by apache.

the class LdapUrlTest method testLdapURLDNAttrsScopeFilter.

/**
 * test a LdapUrl with a Dn, some attributes, a scope and filter
 */
@Test
public void testLdapURLDNAttrsScopeFilter() throws LdapURLEncodingException {
    LdapUrl url = new LdapUrl("ldap://localhost:123/ou=system?cn,ou,dc?sub?(cn=test)");
    assertEquals("ldap://localhost:123/ou=system?cn,ou,dc?sub?(cn=test)", url.toString());
}
Also used : LdapUrl(org.apache.directory.api.ldap.model.url.LdapUrl) Test(org.junit.Test)

Example 30 with LdapUrl

use of org.apache.directory.api.ldap.model.url.LdapUrl in project directory-ldap-api by apache.

the class LdapUrlTest method testLdapURLDN.

/**
 * test a LdapUrl with no Dn and attributes
 */
@Test
public void testLdapURLDN() throws LdapURLEncodingException {
    LdapUrl url = new LdapUrl("ldap://localhost:123/ou=system");
    assertEquals("ldap://localhost:123/ou=system", url.toString());
}
Also used : LdapUrl(org.apache.directory.api.ldap.model.url.LdapUrl) Test(org.junit.Test)

Aggregations

LdapUrl (org.apache.directory.api.ldap.model.url.LdapUrl)98 Test (org.junit.Test)95 LdapURLEncodingException (org.apache.directory.api.ldap.model.exception.LdapURLEncodingException)27 AbstractResponseTest (org.apache.directory.api.dsmlv2.AbstractResponseTest)24 Dsmlv2ResponseParser (org.apache.directory.api.dsmlv2.Dsmlv2ResponseParser)24 LdapResult (org.apache.directory.api.ldap.model.message.LdapResult)23 DecoderException (org.apache.directory.api.asn1.DecoderException)5 SearchResponse (org.apache.directory.api.dsmlv2.response.SearchResponse)5 Dn (org.apache.directory.api.ldap.model.name.Dn)5 Extension (org.apache.directory.api.ldap.model.url.LdapUrl.Extension)5 BindResponse (org.apache.directory.api.ldap.model.message.BindResponse)3 CompareResponse (org.apache.directory.api.ldap.model.message.CompareResponse)3 DeleteResponse (org.apache.directory.api.ldap.model.message.DeleteResponse)3 ExtendedResponse (org.apache.directory.api.ldap.model.message.ExtendedResponse)3 ModifyDnResponse (org.apache.directory.api.ldap.model.message.ModifyDnResponse)3 ModifyResponse (org.apache.directory.api.ldap.model.message.ModifyResponse)3 SearchResultDone (org.apache.directory.api.ldap.model.message.SearchResultDone)3 SearchResultReference (org.apache.directory.api.ldap.model.message.SearchResultReference)3 TLV (org.apache.directory.api.asn1.ber.tlv.TLV)2 Referral (org.apache.directory.api.ldap.model.message.Referral)2