Java 8 ReferralException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 ReferralException class.

This code example shows how to use the following methods:getReferralInfo
            fail( "Should never get here" ); 
        } 
        catch ( ReferralException e )
        { 
            // seems JNDI only returns the first referral URL and not all so we test for it 
            assertEquals( "ldap://localhost:10389/uid=akarasulu,ou=users,ou=system", e.getReferralInfo() );
        } 
 
        ctx.close();
    } 
 
 
    /** 
     * Tests referral handling when an ancestor is a referral. 
     */ 
    @Test
    public void testAncestorReferral() throws Exception
    { 
        LOG.debug( "" ); 
 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getReferralInfo
            fail( "Should never get here due to ModifyDN failure on ReferralException" ); 
        } 
        catch ( ReferralException e )
        { 
            // seems JNDI only returns the first referral URL and not all so we test for it 
            assertEquals( "ldap://localhost:10389/uid=akarasulu,ou=users,ou=system", e.getReferralInfo() );
        } 
 
        ctx.close();
    } 
 
 
    /** 
     * Tests referral handling when an ancestor is a referral. 
     */ 
    @Test
    public void testAncestorReferral() throws Exception
    { 
        LOG.debug( "" ); 
 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getReferralInfo, skipReferral
            ctx.search( "ou=RemoteUsers,ou=system", "(objectClass=*)", controls );
            fail( "should never get here" ); 
        } 
        catch ( ReferralException e )
        { 
            assertEquals( "ldap://fermi:10389/ou=users,ou=system??sub", e.getReferralInfo() );
            assertTrue( e.skipReferral() );
            assertEquals( "ldap://hertz:10389/ou=users,dc=example,dc=com??sub", e.getReferralInfo() );
            assertTrue( e.skipReferral() );
            assertEquals( "ldap://maxwell:10389/ou=users,ou=system??sub", e.getReferralInfo() );
            assertFalse( e.skipReferral() );
        } 
        finally 
        { 
            ctx.close();
        } 
    } 
 
 
    @Test
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getReferralInfo
            fail( "Should never get here: add should fail with ReferralExcpetion" ); 
        } 
        catch ( ReferralException e )
        { 
            assertEquals( "ldap://localhost:10389/ou=UnderReferral,uid=akarasulu,ou=users,ou=system", e
                .getReferralInfo() );
        } 
 
        ctx.close();
    } 
 
 
    /** 
     * Test for DIRSERVER-1183. 
     *  
     * @see https://issues.apache.org/jira/browse/DIRSERVER-1183 
     * @throws Exception 
     */ 
    @Test
    public void testDIRSERVER_1183() throws Exception
2
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getReferralInfo
            fail( "Should never get here" ); 
        } 
        catch ( ReferralException e )
        { 
            // seems JNDI only returns the first referral URL and not all so we test for it 
            assertEquals( "ldap://localhost:10389/uid=akarasulu,ou=users,ou=system", e.getReferralInfo() );
        } 
 
        ctx.close();
    } 
 
 
    /** 
     * Check that operation are not executed if we are now allowed to bind 
     * anonymous 
     * @throws LdapException 
     */ 
    @Test(expected = InvalidConnectionException.class)
    public void testCompareWithoutAuthentication() throws LdapException 
    { 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getReferralInfo
            ctx.search( "c=america,ou=Countries,ou=system", "(cn=alex karasulu)", controls );
            fail( "Should fail here throwing a ReferralException" ); 
        } 
        catch ( ReferralException re )
        { 
            String referral = ( String ) re.getReferralInfo();
            assertEquals( "ldap://localhost:" + getLdapServer().getPort() + "/c=usa,ou=system??base", referral );
        } 
 
        ( ( LdapContext ) ctx ).setRequestControls( new javax.naming.ldap.Control[]
            { new ManageReferralControl() } );
 
        // Now let's move the entry 
        ctx.rename( "c=america,ou=Countries,ou=system", "c=america,ou=system" );
 
        controls.setSearchScope( SearchControls.OBJECT_SCOPE );
 
        ( ( LdapContext ) ctx ).setRequestControls( new javax.naming.ldap.Control[]
            {} ); 
 

3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getReferralInfo, skipReferral
    } 
 
 
    private void checkAncestorReferrals( ReferralException e ) throws Exception
    { 
        assertEquals( "ldap://fermi:10389/cn=alex%20karasulu,ou=apache,ou=users,ou=system", e.getReferralInfo() );
        assertTrue( e.skipReferral() );
        assertEquals( "ldap://hertz:10389/cn=alex%20karasulu,ou=apache,ou=users,dc=example,dc=com", e.getReferralInfo() );
        assertTrue( e.skipReferral() );
        assertEquals( "ldap://maxwell:10389/cn=alex%20karasulu,ou=apache,ou=users,ou=system", e.getReferralInfo() );
        assertFalse( e.skipReferral() );
    } 
 
 
    private void checkParentReferrals( ReferralException e ) throws Exception
    { 
        assertEquals( "ldap://fermi:10389/cn=alex%20karasulu,ou=users,ou=system", e.getReferralInfo() );
        assertTrue( e.skipReferral() );
        assertEquals( "ldap://hertz:10389/cn=alex%20karasulu,ou=users,dc=example,dc=com", e.getReferralInfo() );
        assertTrue( e.skipReferral() );
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getReferralInfo
                { mod } );
        } 
        catch ( ReferralException e )
        { 
            // seems JNDI only returns the first referral URL and not all so we test for it 
            assertEquals( "ldap://localhost:10389/uid=akarasulu,ou=users,ou=system", e.getReferralInfo() );
        } 
 
        ctx.close();
    } 
 
 
    /** 
     * Tests referral handling when an ancestor is a referral. 
     */ 
    @Test
    public void testAncestorReferral() throws Exception
    { 
        LOG.debug( "" ); 
 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getReferralInfo
            ctx.search( "c=america,ou=Countries,ou=system", "(cn=alex karasulu)", controls );
            fail( "Should fail here throwing a ReferralException" ); 
        } 
        catch ( ReferralException re )
        { 
            String referral = ( String ) re.getReferralInfo();
            assertEquals( "ldap://localhost:" + getLdapServer().getPort() + "/c=usa,ou=system??base", referral );
        } 
 
        ( ( LdapContext ) ctx ).setRequestControls( new javax.naming.ldap.Control[]
            { new ManageReferralControl() } );
 
        // Now let's move the entry 
        ctx.rename( "c=america,ou=Countries,ou=system", "c=us,ou=system" );
 
        controls.setSearchScope( SearchControls.OBJECT_SCOPE );
 
        ( ( LdapContext ) ctx ).setRequestControls( new javax.naming.ldap.Control[]
            {} ); 
 

3
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 ReferralException Methods: