本文整理汇总了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() );
}
示例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() );
}
示例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() );
}
示例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() );
}
示例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() );
}
示例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 );
}
}
示例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() );
}
示例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() );
}
示例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() );
}
示例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() );
}
示例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/" );
}
示例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() );
}
示例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() );
}
示例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() );
}
示例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() );
}