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

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


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

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


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

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

     * Test the serialization of a CBV with an empty value
     */
    @Test
    public void testSerializeEmptyValue() throws LdapException, IOException, ClassNotFoundException
    {
        BinaryValue bv = new BinaryValue( ( byte[] ) null );
        bv = new BinaryValue( StringConstants.EMPTY_BYTES );
        bv.isValid( BINARY_CHECKER );
        bv.apply( at );

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

     * Test the serialization of a CBV with an empty value not normalized
     */
    @Test
    public void testSerializeEmptyValueNotNormalized() throws LdapException, IOException, ClassNotFoundException
    {
        BinaryValue bv = new BinaryValue( ( byte[] ) null );
        bv = new BinaryValue( StringConstants.EMPTY_BYTES );
        bv.isValid( BINARY_CHECKER );

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

     */
    @Test
    public void testClone() throws LdapException
    {
        AttributeType at1 = EntryUtils.getBytesAttributeType();
        BinaryValue bv = new BinaryValue( at1, null );
        BinaryValue bv1 = bv.clone();

        assertEquals( bv, bv1 );

        bv = new BinaryValue( StringConstants.EMPTY_BYTES );

        assertNotSame( bv, bv1 );
        assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, bv.getBytes() ) );

        bv = new BinaryValue( BYTES2 );
        bv1 = bv.clone();

        assertEquals( bv, bv1 );

        bv.apply( at );
View Full Code Here

    @Test
    public void testEquals() throws LdapInvalidAttributeValueException
    {
        AttributeType at1 = EntryUtils.getBytesAttributeType();

        BinaryValue value1 = new BinaryValue( at1, new byte[]
            { 0x01, ( byte ) 0x02 } );
        BinaryValue value2 = new BinaryValue( at1, new byte[]
            { 0x01, ( byte ) 0x02 } );
        BinaryValue value3 = new BinaryValue( at1, new byte[]
            { 0x01, ( byte ) 0x82 } );
        BinaryValue value4 = new BinaryValue( at1, new byte[]
            { 0x01 } );
        BinaryValue value5 = new BinaryValue( at1, null );
        BinaryValue value6 = new BinaryValue( at, new byte[]
            { 0x01, 0x02 } );
        StringValue value7 = new StringValue( EntryUtils.getIA5StringAttributeType(),
            "test" );

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

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

        BinaryValue value = new BinaryValue( attribute, null );
        assertNull( value.getNormValue() );

        value = new BinaryValue( attribute, StringConstants.EMPTY_BYTES );
        assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, value.getNormValue() ) );

        value = new BinaryValue( attribute, BYTES2 );
        assertTrue( Arrays.equals( BYTES1, value.getNormValue() ) );
    }
View Full Code Here

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

        BinaryValue value = new BinaryValue( attribute, null );
        assertNull( value.getNormValue() );

        value = new BinaryValue( attribute, StringConstants.EMPTY_BYTES );
        assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, value.getNormValue() ) );

        value = new BinaryValue( attribute, BYTES2 );
        assertTrue( Arrays.equals( BYTES1, value.getNormValue() ) );
    }
View Full Code Here

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

        BinaryValue value = new BinaryValue( attribute, null );
        assertNull( value.getNormReference() );

        value = new BinaryValue( attribute, StringConstants.EMPTY_BYTES );
        assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, value.getNormReference() ) );

        value = new BinaryValue( attribute, BYTES2 );
        assertTrue( Arrays.equals( BYTES1, value.getNormReference() ) );
    }
View Full Code Here

     */
    @Test
    public void testgetAttributeType()
    {
        AttributeType attribute = EntryUtils.getBytesAttributeType();
        BinaryValue sbv = new BinaryValue( attribute );

        assertEquals( attribute, sbv.getAttributeType() );
    }
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.