Package org.apache.directory.api.ldap.model.entry

Examples of org.apache.directory.api.ldap.model.entry.BinaryValue


        Value<String> strValue1 = new StringValue( atEMail, "test1" );
        Value<String> strValue2 = new StringValue( atEMail, "test2" );
        Value<String> strValue3 = new StringValue( atEMail, "test3" );
        Value<String> strNullValue = new StringValue( atEMail, null );

        Value<byte[]> binValue1 = new BinaryValue( atPwd, BYTES1 );

        Attribute attrPWD = new DefaultAttribute( atEMail, "test1", ( String ) null, "test2" );

        entry.put( attrPWD );
        assertTrue( entry.remove( atEMail, strNullValue ) );
View Full Code Here


        Value<String> strValue1 = new StringValue( atEMail, "test1" );
        Value<String> strValue2 = new StringValue( atEMail, "test2" );
        Value<String> strValue3 = new StringValue( atEMail, "test3" );
        Value<String> strNullValue = new StringValue( atEMail, null );

        Value<byte[]> binValue1 = new BinaryValue( atPwd, BYTES1 );

        Attribute attrPWD = new DefaultAttribute( atEMail, "test1", ( String ) null, "test2" );

        entry.put( attrPWD );
        assertTrue( entry.remove( "EMail", strNullValue ) );
View Full Code Here

        byte[] b2 = Strings.getBytesUtf8( "test2" );

        Value<String> test1 = new StringValue( atCN, "test1" );
        Value<String> test2 = new StringValue( atCN, "test2" );

        Value<byte[]> testB1 = new BinaryValue( atPassword, b1 );
        Value<byte[]> testB2 = new BinaryValue( atPassword, b2 );

        // test a removal of an non existing attribute
        entry.removeAttributes( atCN );

        // Test a simple removal
View Full Code Here

        assertEquals( "Entry\n    dn[n]: dc=example,dc=com\n", entry.toString() );

        Value<String> strValueTop = new StringValue( "top" );
        Value<String> strValuePerson = new StringValue( "person" );

        Value<byte[]> binValue1 = new BinaryValue( BYTES1 );
        Value<byte[]> binValue2 = new BinaryValue( BYTES2 );
        Value<byte[]> binNullValue = new BinaryValue( ( byte[] ) null );

        entry.put( "ObjectClass", atOC, strValueTop, strValuePerson );
        entry.put( "UserPassword", atPwd, binValue1, binValue2, binNullValue );

        String expected =
View Full Code Here

     */
    public CompareRequest setAssertionValue( byte[] value )
    {
        if ( value != null )
        {
            this.attrVal = new BinaryValue( value );
        }
        else
        {
            this.attrVal = null;
        }
View Full Code Here

            {
                AttributeType attributeType = schemaManager.getAttributeType( attribute );
               
                if ( attributeType == null )
                {
                    return new BinaryValue( result );
                }
               
                if ( attributeType.getSyntax().isHumanReadable() )
                {
                    return new StringValue( Strings.utf8ToString( result ) );
                }
                else
                {
                    return new BinaryValue( result );
                }
            }
            else
            {
                return new BinaryValue( result );
            }
        }
        else
        {
            if ( schemaManager != null )
            {
                AttributeType attributeType = schemaManager.getAttributeType( attribute );
               
                if ( attributeType.getEquality().getSyntax().isHumanReadable() )
                {
                    return new StringValue( null );
                }
                else
                {
                    return new BinaryValue( null );
                }
            }
            else
            {
                return new BinaryValue( ( byte[] ) null );
            }
        }
    }
View Full Code Here

            {
                AttributeType attributeType = schemaManager.getAttributeType( attribute );

                if ( attributeType != null )
                {
                    return new EqualityNode( attributeType, new BinaryValue( ( byte[] ) null ) );
                }

                else
                {
                    return null;
                }
            }
            else
            {
                return new EqualityNode( attribute, new BinaryValue( ( byte[] ) null ) );
            }
        }
        else
        {
            // A substring or an equality node
View Full Code Here

                throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, message, le );
            }

            try
            {
                createAva( schemaManager, upType, new BinaryValue( attributeType, upValue ) );
            }
            catch ( LdapInvalidAttributeValueException liave )
            {
                String message = I18n.err( I18n.ERR_04188 );
                LOG.error( message );
                throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, message, liave );
            }
        }
        else
        {
            createAva( upType, new BinaryValue( upValue ) );
        }
    }
View Full Code Here

        StringValue value1 = new StringValue( at1, "test" );
        StringValue value2 = new StringValue( at1, "test" );
        StringValue value3 = new StringValue( at1, "TEST" );
        StringValue value4 = new StringValue( at1, "tes" );
        StringValue value5 = new StringValue( at1, null );
        BinaryValue valueBytes = new BinaryValue( at2, new byte[]
            { 0x01 } );
        StringValue valueString = new StringValue( at, "test" );

        assertTrue( value1.equals( value1 ) );
        assertTrue( value1.equals( value2 ) );
View Full Code Here

     * Test the serialization of a CBV with a value and no normalized value
     */
    @Test
    public void testSerializeNotNormalized() throws LdapException, IOException, ClassNotFoundException
    {
        BinaryValue bv = new BinaryValue( ( byte[] ) null );
        bv = new BinaryValue( BYTES2 );
        bv.isValid( BINARY_CHECKER );

        BinaryValue cbvSer = deserializeValue( null, serializeValue( bv ) );
        assertNotSame( bv, cbvSer );
        assertTrue( Arrays.equals( bv.getReference(), cbvSer.getReference() ) );
        assertTrue( Arrays.equals( bv.getReference(), cbvSer.getNormReference() ) );
        assertFalse( cbvSer.isSchemaAware() );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.model.entry.BinaryValue

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.