Examples of Ava


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

    public void testBinaryAtavStaticSerialization() throws LdapException, IOException, ClassNotFoundException
    {
        byte[] upValue = Strings.getBytesUtf8("  Test  ");
        byte[] normValue = Strings.getBytesUtf8("Test");

        Ava atav = new Ava( "cn", "CN", upValue, normValue );

        atav.normalize();

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream( baos );

        AvaSerializer.serialize(atav, out);
        out.flush();

        ObjectInputStream in = null;

        byte[] data = baos.toByteArray();
        in = new ObjectInputStream( new ByteArrayInputStream( data ) );

        Ava atav2 = AvaSerializer.deserialize(in);

        assertEquals( atav, atav2 );
    }
View Full Code Here

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

     * Test static serialization of a simple ATAV
     */
    @Test
    public void testNullAtavStaticSerialization() throws LdapException, IOException, ClassNotFoundException
    {
        Ava atav = new Ava();

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream( baos );

        try
View Full Code Here

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


    @Test
    public void testNullNormValueStaticSerialization() throws LdapException, IOException, ClassNotFoundException
    {
        Ava atav = new Ava( "CN", "cn", "test", (String)null );

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream( baos );

        try
View Full Code Here

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


    @Test
    public void testNullUpValueStaticSerialization() throws LdapException, IOException, ClassNotFoundException
    {
        Ava atav = new Ava( "CN", "cn", null, "test" );

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream( baos );

        try
View Full Code Here

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


    @Test
    public void testEmptyNormValueStaticSerialization() throws LdapException, IOException, ClassNotFoundException
    {
        Ava atav = new Ava( "CN", "cn", "test", "" );

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream( baos );

        AvaSerializer.serialize(atav, out);
        out.flush();

        ObjectInputStream in = null;

        byte[] data = baos.toByteArray();
        in = new ObjectInputStream( new ByteArrayInputStream( data ) );

        Ava atav2 = AvaSerializer.deserialize(in);

        assertEquals( atav, atav2 );
    }
View Full Code Here

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


    @Test
    public void testEmptyUpValueStaticSerialization() throws LdapException, IOException, ClassNotFoundException
    {
        Ava atav = new Ava( "CN", "cn", "", "test" );

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream( baos );

        AvaSerializer.serialize(atav, out);
        out.flush();

        ObjectInputStream in = null;

        byte[] data = baos.toByteArray();
        in = new ObjectInputStream( new ByteArrayInputStream( data ) );

        Ava atav2 = AvaSerializer.deserialize(in);

        assertEquals( atav, atav2 );
    }
View Full Code Here

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

        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

Examples of org.apache.directory.shared.ldap.name.AVA

            // 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

Examples of org.apache.directory.shared.ldap.name.AVA

        }
        else
        {
            for ( Iterator<AVA> ii = rdn.iterator(); ii.hasNext(); /**/)
            {
                AVA atav = ii.next();

                // Add the RDN attribute
                boolean doRdnPut = attributes.get( atav.getNormType() ) == null;
                doRdnPut = doRdnPut || attributes.get( atav.getNormType() ).size() == 0;

                // TODO Fix DIRSERVER-832
                doRdnPut = doRdnPut || !attributes.get( atav.getNormType() ).contains( atav.getNormValue() );

                if ( doRdnPut )
                {
                    attributes.put( atav.getNormType(), atav.getNormValue() );
                }
            }
        }

        // Add the new context to the server which as a side effect adds
View Full Code Here

Examples of org.apache.directory.shared.ldap.name.AVA

            // 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
TOP
Copyright © 2018 www.massapi.com. 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.