@Test public void testLdapURLDNNoAttrsScopeFilter() throws LdapURLEncodingException { LdapUrl url = new LdapUrl( "ldap: assertEquals( "ldap: }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append( scheme ); if ( host != null ) { switch ( hostType ) { case IPV4: case REGULAR_NAME: sb.append( host ); break; case IPV6: case IPV_FUTURE: sb.append( '[' ).append( host ).append( ']' ); break; default: throw new IllegalArgumentException( I18n.err( I18n.ERR_13012_UNEXPECTED_HOST_TYPE_ENUM, hostType ) ); } } if ( port != -1 ) { sb.append( ':' ).append( port ); } if ( dn != null ) { sb.append( '/' ).append( urlEncode( dn.getName(), false ) ); if ( !attributes.isEmpty() || forceScopeRendering || ( ( scope != SearchScope.OBJECT ) || ( filter != null ) || !extensionList.isEmpty() ) ) { sb.append( '?' ); boolean isFirst = true; for ( String attribute : attributes ) { if ( isFirst ) { isFirst = false; } else { sb.append( ',' ); } sb.append( urlEncode( attribute, false ) ); } } if ( forceScopeRendering ) { sb.append( '?' ); sb.append( scope.getLdapUrlValue() ); } else { if ( ( scope != SearchScope.OBJECT ) || ( filter != null ) || !extensionList.isEmpty() ) { sb.append( '?' ); switch ( scope ) { case ONELEVEL: case SUBTREE: sb.append( scope.getLdapUrlValue() ); break; default: break; } if ( ( filter != null ) || ( !extensionList.isEmpty() ) ) { sb.append( "?" ); if ( filter != null ) { sb.append( urlEncode( filter, false ) ); } if ( !extensionList.isEmpty() ) { sb.append( '?' ); boolean isFirst = true; if ( !extensionList.isEmpty() ) { for ( Extension extension : extensionList ) { if ( !isFirst ) { sb.append( ',' ); } else { isFirst = false; } if ( extension.isCritical ) { sb.append( '!' ); } sb.append( urlEncode( extension.type, false ) ); if ( extension.value != null ) { sb.append( '=' ); sb.append( urlEncode( extension.value, true ) ); } } } } } } } } else { sb.append( '/' ); } return sb.toString(); }
LdapUrl { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append( scheme ); if ( host != null ) { switch ( hostType ) { case IPV4: case REGULAR_NAME: sb.append( host ); break; case IPV6: case IPV_FUTURE: sb.append( '[' ).append( host ).append( ']' ); break; default: throw new IllegalArgumentException( I18n.err( I18n.ERR_13012_UNEXPECTED_HOST_TYPE_ENUM, hostType ) ); } } if ( port != -1 ) { sb.append( ':' ).append( port ); } if ( dn != null ) { sb.append( '/' ).append( urlEncode( dn.getName(), false ) ); if ( !attributes.isEmpty() || forceScopeRendering || ( ( scope != SearchScope.OBJECT ) || ( filter != null ) || !extensionList.isEmpty() ) ) { sb.append( '?' ); boolean isFirst = true; for ( String attribute : attributes ) { if ( isFirst ) { isFirst = false; } else { sb.append( ',' ); } sb.append( urlEncode( attribute, false ) ); } } if ( forceScopeRendering ) { sb.append( '?' ); sb.append( scope.getLdapUrlValue() ); } else { if ( ( scope != SearchScope.OBJECT ) || ( filter != null ) || !extensionList.isEmpty() ) { sb.append( '?' ); switch ( scope ) { case ONELEVEL: case SUBTREE: sb.append( scope.getLdapUrlValue() ); break; default: break; } if ( ( filter != null ) || ( !extensionList.isEmpty() ) ) { sb.append( "?" ); if ( filter != null ) { sb.append( urlEncode( filter, false ) ); } if ( !extensionList.isEmpty() ) { sb.append( '?' ); boolean isFirst = true; if ( !extensionList.isEmpty() ) { for ( Extension extension : extensionList ) { if ( !isFirst ) { sb.append( ',' ); } else { isFirst = false; } if ( extension.isCritical ) { sb.append( '!' ); } sb.append( urlEncode( extension.type, false ) ); if ( extension.value != null ) { sb.append( '=' ); sb.append( urlEncode( extension.value, true ) ); } } } } } } } } else { sb.append( '/' ); } return sb.toString(); } }
LdapUrl { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append( scheme ); if ( host != null ) { switch ( hostType ) { case IPV4: case REGULAR_NAME: sb.append( host ); break; case IPV6: case IPV_FUTURE: sb.append( '[' ).append( host ).append( ']' ); break; default: throw new IllegalArgumentException( I18n.err( I18n.ERR_13012_UNEXPECTED_HOST_TYPE_ENUM, hostType ) ); } } if ( port != -1 ) { sb.append( ':' ).append( port ); } if ( dn != null ) { sb.append( '/' ).append( urlEncode( dn.getName(), false ) ); if ( !attributes.isEmpty() || forceScopeRendering || ( ( scope != SearchScope.OBJECT ) || ( filter != null ) || !extensionList.isEmpty() ) ) { sb.append( '?' ); boolean isFirst = true; for ( String attribute : attributes ) { if ( isFirst ) { isFirst = false; } else { sb.append( ',' ); } sb.append( urlEncode( attribute, false ) ); } } if ( forceScopeRendering ) { sb.append( '?' ); sb.append( scope.getLdapUrlValue() ); } else { if ( ( scope != SearchScope.OBJECT ) || ( filter != null ) || !extensionList.isEmpty() ) { sb.append( '?' ); switch ( scope ) { case ONELEVEL: case SUBTREE: sb.append( scope.getLdapUrlValue() ); break; default: break; } if ( ( filter != null ) || ( !extensionList.isEmpty() ) ) { sb.append( "?" ); if ( filter != null ) { sb.append( urlEncode( filter, false ) ); } if ( !extensionList.isEmpty() ) { sb.append( '?' ); boolean isFirst = true; if ( !extensionList.isEmpty() ) { for ( Extension extension : extensionList ) { if ( !isFirst ) { sb.append( ',' ); } else { isFirst = false; } if ( extension.isCritical ) { sb.append( '!' ); } sb.append( urlEncode( extension.type, false ) ); if ( extension.value != null ) { sb.append( '=' ); sb.append( urlEncode( extension.value, true ) ); } } } } } } } } else { sb.append( '/' ); } return sb.toString(); } LdapUrl();  LdapUrl( String string ); }
LdapUrl { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append( scheme ); if ( host != null ) { switch ( hostType ) { case IPV4: case REGULAR_NAME: sb.append( host ); break; case IPV6: case IPV_FUTURE: sb.append( '[' ).append( host ).append( ']' ); break; default: throw new IllegalArgumentException( I18n.err( I18n.ERR_13012_UNEXPECTED_HOST_TYPE_ENUM, hostType ) ); } } if ( port != -1 ) { sb.append( ':' ).append( port ); } if ( dn != null ) { sb.append( '/' ).append( urlEncode( dn.getName(), false ) ); if ( !attributes.isEmpty() || forceScopeRendering || ( ( scope != SearchScope.OBJECT ) || ( filter != null ) || !extensionList.isEmpty() ) ) { sb.append( '?' ); boolean isFirst = true; for ( String attribute : attributes ) { if ( isFirst ) { isFirst = false; } else { sb.append( ',' ); } sb.append( urlEncode( attribute, false ) ); } } if ( forceScopeRendering ) { sb.append( '?' ); sb.append( scope.getLdapUrlValue() ); } else { if ( ( scope != SearchScope.OBJECT ) || ( filter != null ) || !extensionList.isEmpty() ) { sb.append( '?' ); switch ( scope ) { case ONELEVEL: case SUBTREE: sb.append( scope.getLdapUrlValue() ); break; default: break; } if ( ( filter != null ) || ( !extensionList.isEmpty() ) ) { sb.append( "?" ); if ( filter != null ) { sb.append( urlEncode( filter, false ) ); } if ( !extensionList.isEmpty() ) { sb.append( '?' ); boolean isFirst = true; if ( !extensionList.isEmpty() ) { for ( Extension extension : extensionList ) { if ( !isFirst ) { sb.append( ',' ); } else { isFirst = false; } if ( extension.isCritical ) { sb.append( '!' ); } sb.append( urlEncode( extension.type, false ) ); if ( extension.value != null ) { sb.append( '=' ); sb.append( urlEncode( extension.value, true ) ); } } } } } } } } else { sb.append( '/' ); } return sb.toString(); } LdapUrl();  LdapUrl( String string ); boolean isValidInet4Address( String inet4Address ); boolean isValidInet6Address( String inet6Address ); static String urlEncode( String url, boolean doubleEncode ); @Override String toString(); List<String> getAttributes(); Dn getDn(); List<Extension> getExtensions(); Extension getExtension( String type ); String getExtensionValue( String type ); String getFilter(); String getHost(); int getPort(); SearchScope getScope(); String getScheme(); int getNbBytes(); byte[] getBytesReference(); byte[] getBytesCopy(); String getString(); @Override int hashCode(); @Override boolean equals( Object obj ); void setScheme( String scheme ); void setHost( String host ); void setPort( int port ); void setDn( Dn dn ); void setAttributes( List<String> attributes ); void setScope( int scope ); void setScope( SearchScope scope ); void setFilter( String filter ); void setForceScopeRendering( boolean forceScopeRendering ); }
LdapUrl { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append( scheme ); if ( host != null ) { switch ( hostType ) { case IPV4: case REGULAR_NAME: sb.append( host ); break; case IPV6: case IPV_FUTURE: sb.append( '[' ).append( host ).append( ']' ); break; default: throw new IllegalArgumentException( I18n.err( I18n.ERR_13012_UNEXPECTED_HOST_TYPE_ENUM, hostType ) ); } } if ( port != -1 ) { sb.append( ':' ).append( port ); } if ( dn != null ) { sb.append( '/' ).append( urlEncode( dn.getName(), false ) ); if ( !attributes.isEmpty() || forceScopeRendering || ( ( scope != SearchScope.OBJECT ) || ( filter != null ) || !extensionList.isEmpty() ) ) { sb.append( '?' ); boolean isFirst = true; for ( String attribute : attributes ) { if ( isFirst ) { isFirst = false; } else { sb.append( ',' ); } sb.append( urlEncode( attribute, false ) ); } } if ( forceScopeRendering ) { sb.append( '?' ); sb.append( scope.getLdapUrlValue() ); } else { if ( ( scope != SearchScope.OBJECT ) || ( filter != null ) || !extensionList.isEmpty() ) { sb.append( '?' ); switch ( scope ) { case ONELEVEL: case SUBTREE: sb.append( scope.getLdapUrlValue() ); break; default: break; } if ( ( filter != null ) || ( !extensionList.isEmpty() ) ) { sb.append( "?" ); if ( filter != null ) { sb.append( urlEncode( filter, false ) ); } if ( !extensionList.isEmpty() ) { sb.append( '?' ); boolean isFirst = true; if ( !extensionList.isEmpty() ) { for ( Extension extension : extensionList ) { if ( !isFirst ) { sb.append( ',' ); } else { isFirst = false; } if ( extension.isCritical ) { sb.append( '!' ); } sb.append( urlEncode( extension.type, false ) ); if ( extension.value != null ) { sb.append( '=' ); sb.append( urlEncode( extension.value, true ) ); } } } } } } } } else { sb.append( '/' ); } return sb.toString(); } LdapUrl();  LdapUrl( String string ); boolean isValidInet4Address( String inet4Address ); boolean isValidInet6Address( String inet6Address ); static String urlEncode( String url, boolean doubleEncode ); @Override String toString(); List<String> getAttributes(); Dn getDn(); List<Extension> getExtensions(); Extension getExtension( String type ); String getExtensionValue( String type ); String getFilter(); String getHost(); int getPort(); SearchScope getScope(); String getScheme(); int getNbBytes(); byte[] getBytesReference(); byte[] getBytesCopy(); String getString(); @Override int hashCode(); @Override boolean equals( Object obj ); void setScheme( String scheme ); void setHost( String host ); void setPort( int port ); void setDn( Dn dn ); void setAttributes( List<String> attributes ); void setScope( int scope ); void setScope( SearchScope scope ); void setFilter( String filter ); void setForceScopeRendering( boolean forceScopeRendering ); static final String LDAPS_SCHEME; static final String LDAP_SCHEME; static final LdapUrl EMPTY_URL; }