Package org.apache.directory.shared.ldap.model.name

Examples of org.apache.directory.shared.ldap.model.name.Ava


    public void testTrimAtavs() throws LdapException
    {
        // antlr parser: string value with trailing spaces
        Dn dn1 = new Dn( " cn = Amos\\,Tori , ou=system " );
        assertEquals( " cn = Amos\\,Tori ", dn1.getRdn().getName() );
        Ava atav1 = dn1.getRdn().getAva();
        assertEquals( "cn", atav1.getUpType() );
        assertEquals( "Amos,Tori", atav1.getUpValue().getString() );

        // antlr parser: hexstring with trailing spaces
        Dn dn3 = new Dn( " cn = #414243 , ou=system " );
        assertEquals( " cn = #414243 ", dn3.getRdn().getName() );
        Ava atav3 = dn3.getRdn().getAva();
        assertEquals( "cn", atav3.getUpType() );
        assertEquals( "ABC", atav3.getUpValue().getString() );
        assertTrue( Arrays.equals( Strings.getBytesUtf8("ABC"), atav3.getNormValue().getBytes() ) );

        // antlr parser:
        Dn dn4 = new Dn( " cn = \\41\\42\\43 , ou=system " );
        assertEquals( " cn = \\41\\42\\43 ", dn4.getRdn().getName() );
        Ava atav4 = dn4.getRdn().getAva();
        assertEquals( "cn", atav4.getUpType() );
        assertEquals( "ABC", atav4.getUpValue().getString() );
        assertEquals( "ABC", atav4.getNormValue().getString() );

        // antlr parser: quotestring with trailing spaces
        Dn dn5 = new Dn( " cn = \"ABC\" , ou=system " );
        assertEquals( " cn = \"ABC\" ", dn5.getRdn().getName() );
        Ava atav5 = dn5.getRdn().getAva();
        assertEquals( "cn", atav5.getUpType() );
        assertEquals( "ABC", atav5.getUpValue().getString() );
        assertEquals( "ABC", atav5.getNormValue().getString() );

        // fast parser: string value with trailing spaces
        Dn dn2 = new Dn( " cn = Amos Tori , ou=system " );
        assertEquals( " cn = Amos Tori ", dn2.getRdn().getName() );
        Ava atav2 = dn2.getRdn().getAva();
        assertEquals( "cn", atav2.getUpType() );
        assertEquals( "Amos Tori", atav2.getUpValue().getString() );
    }
View Full Code Here


        assertEquals( "2.5.4.11=example", rdn.getNormName() );
        assertEquals( "ou", rdn.getUpType() );
        assertEquals( "Example", rdn.getUpValue().getString() );
        assertEquals( "  ou  =  Example ", rdn.getName() );

        Ava atav = rdn.getAva();

        assertEquals( "2.5.4.11=example", atav.getNormName() );
        assertEquals( "2.5.4.11", atav.getNormType() );
        assertEquals( "example", atav.getNormValue().get() );

        assertEquals( "ou", atav.getUpType() );
        assertEquals( "Example", atav.getUpValue().get() );

        assertEquals( "  ou  =  Example ", atav.getUpName() );
    }
View Full Code Here

        assertEquals( "ou", rdn.getUpType() );
        assertEquals( "Example", rdn.getUpValue().getString() );
        assertEquals( "  ou  =  Example + ou = TEST ", rdn.getName() );

        // The first ATAV
        Ava atav = rdn.getAva();

        assertEquals( "2.5.4.11=example", atav.getNormName() );
        assertEquals( "2.5.4.11", atav.getNormType() );
        assertEquals( "example", atav.getNormValue().get() );

        assertEquals( "ou", atav.getUpType() );
        assertEquals( "Example", atav.getUpValue().get() );

        assertEquals( "  ou  =  Example ", atav.getUpName() );

        assertEquals( 2, rdn.getNbAtavs() );

        // The second ATAV
        for ( Ava ava : rdn )
View Full Code Here

        assertEquals( "2.5.4.11=ex\\+mple", rdn.getNormName() );
        assertEquals( "ou", rdn.getUpType() );
        assertEquals( "Ex+mple", rdn.getUpValue().getString() );
        assertEquals( "  ou  =  Ex\\+mple ", rdn.getName() );

        Ava atav = rdn.getAva();

        assertEquals( "2.5.4.11=ex\\+mple", atav.getNormName() );
        assertEquals( "2.5.4.11", atav.getNormType() );
        assertEquals( "ex+mple", atav.getNormValue().get() );

        assertEquals( "ou", atav.getUpType() );
        assertEquals( "Ex+mple", atav.getUpValue().get() );

        assertEquals( "  ou  =  Ex\\+mple ", atav.getUpName() );
    }
View Full Code Here

        assertEquals( "Ex+mple", rdn.getUpValue().getString() );
        assertEquals( "Ex+mple", rdn.getNormValue().getString() );

        // The first ATAV
        Ava atav = rdn.getAva();

        assertEquals( "  OU  =  Ex\\+mple ", atav.getUpName() );
        assertEquals( "ou=Ex\\+mple", atav.getNormName() );

        assertEquals( "ou", atav.getNormType() );
        assertEquals( "OU", atav.getUpType() );

        assertEquals( "Ex+mple", atav.getUpValue().get() );
        assertEquals( "Ex+mple", atav.getNormValue().get() );

        assertEquals( 2, rdn.getNbAtavs() );

        // The second ATAV
        for ( Ava ava : rdn )
        {
            if ( "Ex+mple".equals( ava.getNormValue().get() ) )
            {
                // Skip the first one
                continue;
            }

            assertEquals( " ou = T\\+ST\\  ", ava.getUpName() );
            assertEquals( "ou=T\\+ST\\ ", ava.getNormName() );

            assertEquals( "ou", ava.getUpType() );
            assertEquals( "ou", ava.getNormType() );

            assertEquals( "T+ST ", ava.getUpValue().get() );
            assertEquals( "T+ST ", ava.getNormValue().get() );
        }

        // ------------------------------------------------------------------
        // Now normalize the Dn
        dn.normalize( schemaManager );

        assertEquals( "  OU  =  Ex\\+mple + ou = T\\+ST\\  ,  ou  =  COM ", dn.getName() );
        assertEquals( "2.5.4.11=ex\\+mple+2.5.4.11=t\\+st,2.5.4.11=com", dn.getNormName() );

        // Check the first Rdn
        rdn = dn.getRdn();
        assertEquals( "  OU  =  Ex\\+mple + ou = T\\+ST\\  ", rdn.getName() );
        assertEquals( "2.5.4.11=ex\\+mple+2.5.4.11=t\\+st", rdn.getNormName() );

        assertEquals( "OU", rdn.getUpType() );
        assertEquals( "2.5.4.11", rdn.getNormType() );

        assertEquals( "Ex+mple", rdn.getUpValue().getString() );
        assertEquals( "ex+mple", rdn.getNormValue().getString() );

        // The first ATAV
        atav = rdn.getAva();

        assertEquals( "  OU  =  Ex\\+mple ", atav.getUpName() );
        assertEquals( "2.5.4.11=ex\\+mple", atav.getNormName() );

        assertEquals( "2.5.4.11", atav.getNormType() );
        assertEquals( "OU", atav.getUpType() );

        assertEquals( "Ex+mple", atav.getUpValue().get() );
        assertEquals( "ex+mple", atav.getNormValue().get() );

        assertEquals( 2, rdn.getNbAtavs() );

        // The second ATAV
        for ( Ava ava : rdn )
View Full Code Here

        referenceRdn = new Rdn( "ou=system" );
        referenceRdn.normalize( schemaManager );
        sharedRdn = new Rdn( "ou=system" );
        sharedRdn.normalize( schemaManager );

        referenceAva = new Ava( schemaManager, "ou", "System" );
        sharedAva = new Ava( schemaManager, "ou", "System" );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.model.name.Ava

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.