當前位置: 首頁>>代碼示例>>Java>>正文


Java LdapURLEncodingException類代碼示例

本文整理匯總了Java中org.apache.directory.api.ldap.model.exception.LdapURLEncodingException的典型用法代碼示例。如果您正苦於以下問題:Java LdapURLEncodingException類的具體用法?Java LdapURLEncodingException怎麽用?Java LdapURLEncodingException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LdapURLEncodingException類屬於org.apache.directory.api.ldap.model.exception包,在下文中一共展示了LdapURLEncodingException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testDnSetScheme

import org.apache.directory.api.ldap.model.exception.LdapURLEncodingException; //導入依賴的package包/類
/**
 * test the setScheme() method
 */
@Test
public void testDnSetScheme() throws LdapURLEncodingException
{
    LdapUrl url = new LdapUrl();
    assertEquals( "ldap://", url.getScheme() );

    url.setScheme( "invalid" );
    assertEquals( "ldap://", url.getScheme() );

    url.setScheme( "ldap://" );
    assertEquals( "ldap://", url.getScheme() );

    url.setScheme( "ldaps://" );
    assertEquals( "ldaps://", url.getScheme() );

    url.setScheme( null );
    assertEquals( "ldap://", url.getScheme() );
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:22,代碼來源:LdapUrlTest.java

示例2: testDnSetPort

import org.apache.directory.api.ldap.model.exception.LdapURLEncodingException; //導入依賴的package包/類
/**
 * 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() );
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:22,代碼來源:LdapUrlTest.java

示例3: testDnSetDn

import org.apache.directory.api.ldap.model.exception.LdapURLEncodingException; //導入依賴的package包/類
/**
 * 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() );
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:19,代碼來源:LdapUrlTest.java

示例4: testDnSetScope

import org.apache.directory.api.ldap.model.exception.LdapURLEncodingException; //導入依賴的package包/類
/**
 * test the setScope() method
 */
@Test
public void testDnSetScope() throws LdapURLEncodingException, LdapInvalidDnException
{
    LdapUrl url = new LdapUrl();
    assertEquals( SearchScope.OBJECT, url.getScope() );

    url.setDn( new Dn( "dc=example,dc=com" ) );

    url.setScope( SearchScope.ONELEVEL );
    assertEquals( SearchScope.ONELEVEL, url.getScope() );
    assertEquals( "ldap:///dc=example,dc=com??one", url.toString() );

    url.setScope( SearchScope.SUBTREE );
    assertEquals( SearchScope.SUBTREE, url.getScope() );
    assertEquals( "ldap:///dc=example,dc=com??sub", url.toString() );

    url.setScope( -1 );
    assertEquals( SearchScope.OBJECT, url.getScope() );
    assertEquals( "ldap:///dc=example,dc=com", url.toString() );
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:24,代碼來源:LdapUrlTest.java

示例5: testDnSetFilter

import org.apache.directory.api.ldap.model.exception.LdapURLEncodingException; //導入依賴的package包/類
/**
 * 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() );
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:24,代碼來源:LdapUrlTest.java

示例6: action

import org.apache.directory.api.ldap.model.exception.LdapURLEncodingException; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void action( Dsmlv2Container container ) throws XmlPullParserException
{
    SearchResponse searchResponse = ( SearchResponse )
        container.getBatchResponse().getCurrentResponse().getDecorated();
    SearchResultReference searchResultReference = searchResponse.getCurrentSearchResultReference();

    XmlPullParser xpp = container.getParser();

    try
    {
        String nextText = xpp.nextText();

        if ( !Strings.isEmpty( nextText ) )
        {
            LdapUrl ldapUrl = new LdapUrl( nextText );

            searchResultReference.getReferral().addLdapUrl( ldapUrl.toString() );
        }
    }
    catch ( IOException ioe )
    {
        throw new XmlPullParserException( I18n.err( I18n.ERR_03008, ioe.getMessage() ), xpp, ioe );
    }
    catch ( LdapURLEncodingException luee )
    {
        throw new XmlPullParserException( luee.getMessage(), xpp, luee );
    }
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:33,代碼來源:Dsmlv2ResponseGrammar.java

示例7: LdapUrl

import org.apache.directory.api.ldap.model.exception.LdapURLEncodingException; //導入依賴的package包/類
/**
 * Create a new LdapUrl from a String after having parsed it.
 *
 * @param string TheString that contains the LdapUrl
 * @throws LdapURLEncodingException If the String does not comply with RFC 2255
 */
public LdapUrl( String string ) throws LdapURLEncodingException
{
    if ( string == null )
    {
        throw new LdapURLEncodingException( I18n.err( I18n.ERR_04408 ) );
    }

    bytes = Strings.getBytesUtf8( string );
    this.string = string;
    parse( string.toCharArray() );
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:18,代碼來源:LdapUrl.java

示例8: testDnSimple

import org.apache.directory.api.ldap.model.exception.LdapURLEncodingException; //導入依賴的package包/類
/**
 * test a simple LdapUrl
 */
@Test
public void testDnSimple() throws LdapURLEncodingException
{
    assertEquals( "ldap://directory.apache.org:80/", new LdapUrl( "ldap://directory.apache.org:80/" )
        .toString() );
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:10,代碼來源:LdapUrlTest.java

示例9: testLdapURLNoDNAttrsScopeNoFilterExtension

import org.apache.directory.api.ldap.model.exception.LdapURLEncodingException; //導入依賴的package包/類
/**
 * test a LdapUrl with no Dn, some attributes, a scope, no filter and some extensions
 *
 */
@Test
public void testLdapURLNoDNAttrsScopeNoFilterExtension() throws LdapURLEncodingException
{
    LdapUrl url = new LdapUrl( "ldap://localhost:123/?cn,dc,ou?sub??!a=b,!c" );

    assertEquals( "ldap://localhost:123/?cn,dc,ou?sub??!a=b,!c", url.toString() );
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:12,代碼來源:LdapUrlTest.java

示例10: testLdapURLNoDNAttrsScopeBaseNoFilterExtension

import org.apache.directory.api.ldap.model.exception.LdapURLEncodingException; //導入依賴的package包/類
/**
 * test a LdapUrl with no Dn, some attributes, a base scope, no filter and some extensions
 *
 */
@Test
public void testLdapURLNoDNAttrsScopeBaseNoFilterExtension() throws LdapURLEncodingException
{
    LdapUrl url = new LdapUrl( "ldap://localhost:123/?cn,dc,ou?base??!a=b,!c" );

    assertEquals( "ldap://localhost:123/?cn,dc,ou???!a=b,!c", url.toString() );
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:12,代碼來源:LdapUrlTest.java

示例11: testDnBadHost6

import org.apache.directory.api.ldap.model.exception.LdapURLEncodingException; //導入依賴的package包/類
/**
 * test a LdapUrl with a bad host 6
 */
@Test
public void testDnBadHost6() throws LdapURLEncodingException
{
    assertEquals( "ldap://a.b.-c/", new LdapUrl( "ldap://a.b.-c/" ).toString() );
    new LdapUrl( "ldap://a.b.-c/" );
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:10,代碼來源:LdapUrlTest.java

示例12: testLdapURLExtensionAfterEmptyExtension

import org.apache.directory.api.ldap.model.exception.LdapURLEncodingException; //導入依賴的package包/類
/**
 * Test a LdapUrl with an extension after an empty extension.
 */
@Test
public void testLdapURLExtensionAfterEmptyExtension() throws LdapURLEncodingException
{
    LdapUrl url = new LdapUrl( "ldap://localhost:123/????!a=b,!c,d=e" );

    assertEquals( "ldap://localhost:123/????!a=b,!c,d=e", url.toString() );
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:11,代碼來源:LdapUrlTest.java

示例13: testLdapURLDNNoAttrsNoScopeFilterExtension

import org.apache.directory.api.ldap.model.exception.LdapURLEncodingException; //導入依賴的package包/類
/**
 * test a LdapUrl with a Dn, no attributes, no scope, a filter and some extensions
 *
 */
@Test
public void testLdapURLDNNoAttrsNoScopeFilterExtension() throws LdapURLEncodingException
{
    LdapUrl url = new LdapUrl( "ldap://localhost:123/ou=system???(cn=test)?!a=b,!c" );

    assertEquals( "ldap://localhost:123/ou=system???(cn=test)?!a=b,!c", url.toString() );
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:12,代碼來源:LdapUrlTest.java

示例14: testDnSimpleDN

import org.apache.directory.api.ldap.model.exception.LdapURLEncodingException; //導入依賴的package包/類
/**
 * test a LdapUrl with valid simpleDN
 */
@Test
public void testDnSimpleDN() throws LdapURLEncodingException
{
    assertEquals( "ldap://directory.apache.org:389/dc=example,dc=org/", new LdapUrl(
        "ldap://directory.apache.org:389/dc=example,dc=org/" ).toString() );
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:10,代碼來源:LdapUrlTest.java

示例15: testDnSimpleDN2

import org.apache.directory.api.ldap.model.exception.LdapURLEncodingException; //導入依賴的package包/類
/**
 * test a LdapUrl with valid simpleDN 2
 */
@Test
public void testDnSimpleDN2() throws LdapURLEncodingException
{
    assertEquals( "ldap://directory.apache.org:389/dc=example", new LdapUrl(
        "ldap://directory.apache.org:389/dc=example" ).toString() );
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:10,代碼來源:LdapUrlTest.java


注:本文中的org.apache.directory.api.ldap.model.exception.LdapURLEncodingException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。