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

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


        try
        {
            oIn = new ObjectInputStream( in );

            BinaryValue value = new BinaryValue( ( AttributeType ) null );
            value.readExternal( oIn );

            return value;
        }
        catch ( IOException ioe )
        {
View Full Code Here


        // create a AT without no syntax
        MutableAttributeType attribute = new MutableAttributeType( "1.1.3.1" );

        try
        {
            new BinaryValue( attribute );
            fail();
        }
        catch ( IllegalArgumentException ae )
        {
            // Expected...
View Full Code Here

    @Test
    public void testServerBinaryValueNullValue() throws LdapInvalidAttributeValueException
    {
        AttributeType attribute = EntryUtils.getBytesAttributeType();

        BinaryValue value = new BinaryValue( attribute, null );

        assertNull( value.getReference() );
        assertTrue( value.isNull() );
    }
View Full Code Here

    @Test
    public void testServerBinaryValueEmptyValue() throws LdapInvalidAttributeValueException
    {
        AttributeType attribute = EntryUtils.getBytesAttributeType();

        BinaryValue value = new BinaryValue( attribute, StringConstants.EMPTY_BYTES );

        assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, value.getReference() ) );
        assertFalse( value.isNull() );
    }
View Full Code Here

    public void testServerBinaryValueNoValue()
    {
        AttributeType attribute = EntryUtils.getBytesAttributeType();
        byte[] val = new byte[]
            { 0x01 };
        BinaryValue bv = new BinaryValue( attribute );

        bv = new BinaryValue( val );
        assertTrue( Arrays.equals( val, bv.getReference() ) );
        assertFalse( bv.isNull() );
        assertTrue( Arrays.equals( val, bv.getValue() ) );
    }
View Full Code Here

    public void testServerBinaryValue() throws LdapInvalidAttributeValueException
    {
        AttributeType attribute = EntryUtils.getBytesAttributeType();
        byte[] val = new byte[]
            { 0x01 };
        BinaryValue value = new BinaryValue( attribute, val );

        assertTrue( Arrays.equals( val, value.getReference() ) );
        assertFalse( value.isNull() );
        assertTrue( Arrays.equals( val, value.getValue() ) );
    }
View Full Code Here


    @Test
    public void testCompareToValueOfbyte() throws LdapException
    {
        BinaryValue bv1 = new BinaryValue( ( byte[] ) null );
        BinaryValue bv2 = new BinaryValue( ( byte[] ) null );

        assertEquals( 0, bv1.compareTo( bv2 ) );

        bv1 = new BinaryValue( BYTES1 );
        assertEquals( 1, bv1.compareTo( bv2 ) );

        bv2 = new BinaryValue( BYTES2 );
        assertEquals( 1, bv1.compareTo( bv2 ) );

        bv2.apply( at );
        assertEquals( 0, bv1.compareTo( bv2 ) );

        bv1 = new BinaryValue( BYTES2 );
        assertEquals( -1, bv1.compareTo( bv2 ) );
    }
View Full Code Here


    @Test
    public void testEquals() throws LdapException
    {
        BinaryValue bv1 = new BinaryValue( ( byte[] ) null );
        BinaryValue bv2 = new BinaryValue( ( byte[] ) null );

        assertEquals( bv1, bv2 );

        bv1 = new BinaryValue( BYTES1 );
        assertNotSame( bv1, bv2 );

        bv2 = new BinaryValue( BYTES2 );
        assertNotSame( bv1, bv2 );

        bv2.apply( at );
        assertEquals( bv1, bv2 );

        bv1 = new BinaryValue( BYTES2 );
        assertNotSame( bv1, bv2 );
    }
View Full Code Here


    @Test
    public void testClone()
    {
        BinaryValue bv = new BinaryValue( ( byte[] ) null );
        BinaryValue copy = bv.clone();

        assertEquals( bv, copy );

        bv = new BinaryValue( BYTES1 );
        assertNotSame( bv, copy );

        copy = bv.clone();
        assertEquals( bv, copy );

        bv.getReference()[0] = 0x11;

        assertTrue( Arrays.equals( BYTES_MOD, bv.getBytes() ) );
        assertTrue( Arrays.equals( BYTES1, copy.getBytes() ) );
    }
View Full Code Here


    @Test
    public void testGetCopy()
    {
        BinaryValue bv = new BinaryValue( ( byte[] ) null );

        assertNull( bv.getValue() );

        bv = new BinaryValue( StringConstants.EMPTY_BYTES );
        assertNotNull( bv.getValue() );
        assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, bv.getValue() ) );

        bv = new BinaryValue( BYTES1 );
        byte[] copy = bv.getValue();

        assertTrue( Arrays.equals( BYTES1, copy ) );

        bv.getReference()[0] = 0x11;
        assertTrue( Arrays.equals( BYTES1, copy ) );
        assertTrue( Arrays.equals( BYTES_MOD, bv.getBytes() ) );
    }
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.