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

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


        StringBuilder fileName = new StringBuilder( "" );

        Iterator<Ava> iterator = rdn.iterator();
        while ( iterator.hasNext() )
        {
            Ava ava = iterator.next();

            // First, get the AT name, or OID
            String normAT = ava.getNormType();
            AttributeType at = schemaManager.lookupAttributeTypeRegistry( normAT );

            String atName = at.getName();

            // Now, get the normalized value
            String normValue = ava.getNormValue().getString();

            fileName.append( atName ).append( "=" ).append( normValue );

            if ( iterator.hasNext() )
            {
View Full Code Here


            // below we only process multi-valued rdns
            StringBuffer buf = new StringBuffer();

            for ( Iterator<Ava> atavs = rdn.iterator(); atavs.hasNext(); /**/)
            {
                Ava atav = atavs.next();
                String type = schemaManager.lookupAttributeTypeRegistry( rdn.getNormType() ).getName();
                buf.append( type ).append( '=' ).append( atav.getNormValue() );

                if ( atavs.hasNext() )
                {
                    buf.append( '+' );
                }
View Full Code Here

     * Test a null AttributeTypeAndValue
     */
    @Test
    public void testAttributeTypeAndValueNull()
    {
        Ava atav = new Ava( schemaManager );
        assertEquals( "", atav.toString() );
        assertEquals( "", atav.getUpName() );
    }
View Full Code Here

    @Test
    public void testAttributeTypeAndValueNullType() throws LdapException
    {
        try
        {
            new Ava( schemaManager, null, (String)null );
            fail();
        }
        catch ( LdapException ine )
        {
            assertTrue( true );
View Full Code Here

    @Test
    public void testAttributeTypeAndValueInvalidType() throws LdapException
    {
        try
        {
            new Ava( schemaManager, "  ", (String)null );
            fail();
        }
        catch ( LdapException ine )
        {
            assertTrue( true );
View Full Code Here

     * Test a valid type for an AttributeTypeAndValue
     */
    @Test
    public void testAttributeTypeAndValueValidType() throws LdapException
    {
        Ava atav = new Ava( schemaManager, "CN", (String)null );
        assertEquals( "CN=", atav.toString() );
        assertEquals( "2.5.4.3=", atav.getNormName() );
        assertEquals( "CN=", atav.getUpName() );
       
        atav = new Ava( schemaManager, "  CN  ", (String)null );
        assertEquals( "  CN  =", atav.toString() );
        assertEquals( "2.5.4.3=", atav.getNormName() );
        assertEquals( "  CN  =", atav.getUpName() );

        atav = new Ava( schemaManager, "cn", (String)null );
        assertEquals( "cn=", atav.toString() );
        assertEquals( "2.5.4.3=", atav.getNormName() );
        assertEquals( "cn=", atav.getUpName() );
       
        atav = new Ava( schemaManager, "  cn  ", (String)null );
        assertEquals( "  cn  =", atav.toString() );
        assertEquals( "2.5.4.3=", atav.getNormName() );
        assertEquals( "  cn  =", atav.getUpName() );
    }
View Full Code Here

    @Test
    public void testLdapRDNEmpty()
    {
        try
        {
            new Ava( schemaManager, "", "" );
            fail( "Should not occurs ... " );
        }
        catch ( LdapException ine )
        {
            assertTrue( true );
View Full Code Here

     * test a simple AttributeTypeAndValue : a = b
     */
    @Test
    public void testLdapRDNSimple() throws LdapException
    {
        Ava atav = new Ava( schemaManager, "cn", "b" );
        assertEquals( "cn=b", atav.toString() );
        assertEquals( "2.5.4.3=b", atav.getNormName() );
        assertEquals( "cn=b", atav.getUpName() );
    }
View Full Code Here

     * Compares two equals atavs
     */
    @Test
    public void testCompareToEquals() throws LdapException
    {
        Ava atav1 = new Ava( schemaManager, "cn", "b" );
        Ava atav2 = new Ava( schemaManager, "cn", "b" );

        assertTrue( atav1.equals( atav2 ) );
    }
View Full Code Here

     * Compares two equals atavs but with a type in different case
     */
    @Test
    public void testCompareToEqualsCase() throws LdapException
    {
        Ava atav1 = new Ava( schemaManager, "cn", "b" );
        Ava atav2 = new Ava( schemaManager, "CN", "b" );

        assertTrue( atav1.equals( atav2 ) );
    }
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.