Search in sources :

Example 16 with LdapUrl

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());
}
Also used : LdapUrl(org.apache.directory.api.ldap.model.url.LdapUrl) Test(org.junit.Test)

Example 17 with LdapUrl

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());
}
Also used : LdapUrl(org.apache.directory.api.ldap.model.url.LdapUrl) Test(org.junit.Test)

Example 18 with LdapUrl

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());
}
Also used : LdapUrl(org.apache.directory.api.ldap.model.url.LdapUrl) Dn(org.apache.directory.api.ldap.model.name.Dn) Test(org.junit.Test)

Example 19 with LdapUrl

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());
}
Also used : LdapUrl(org.apache.directory.api.ldap.model.url.LdapUrl) Test(org.junit.Test)

Example 20 with LdapUrl

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());
}
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