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

Examples of org.apache.directory.api.ldap.model.entry.BinaryValue.apply()


    @Test
    public void testSerializeStandard() throws LdapException, IOException, ClassNotFoundException
    {
        BinaryValue bv = new BinaryValue( ( byte[] ) null );
        bv = new BinaryValue( BYTES2 );
        bv.apply( at );
        assertTrue( bv.isValid( BINARY_CHECKER ) );

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


    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() ) );
View Full Code Here

    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() ) );
View Full Code Here

    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() ) );
View Full Code Here

    public void testNormalize() throws LdapException
    {
        AttributeType attribute = EntryUtils.getBytesAttributeType();
        BinaryValue bv = new BinaryValue( attribute );

        bv.apply( at );
        assertEquals( null, bv.getNormValue() );

        bv = new BinaryValue( attribute, StringConstants.EMPTY_BYTES );
        bv.apply( at );
        assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, bv.getNormValue() ) );
View Full Code Here

        bv.apply( at );
        assertEquals( null, bv.getNormValue() );

        bv = new BinaryValue( attribute, StringConstants.EMPTY_BYTES );
        bv.apply( at );
        assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, bv.getNormValue() ) );

        bv = new BinaryValue( attribute, BYTES2 );
        bv.apply( at );
        assertTrue( Arrays.equals( BYTES1, bv.getNormValue() ) );
View Full Code Here

        bv = new BinaryValue( attribute, StringConstants.EMPTY_BYTES );
        bv.apply( at );
        assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, bv.getNormValue() ) );

        bv = new BinaryValue( attribute, BYTES2 );
        bv.apply( at );
        assertTrue( Arrays.equals( BYTES1, bv.getNormValue() ) );
    }


    /**
 
View Full Code Here

        byte[] v1Norm = Strings.getBytesUtf8( "Test   Test" );

        // First check with a value which will be normalized
        BinaryValue sbv = new BinaryValue( at, v1 );

        sbv.apply( at );
        byte[] normalized = sbv.getNormReference();

        assertTrue( Arrays.equals( v1Norm, normalized ) );
        assertTrue( Arrays.equals( v1, sbv.getReference() ) );
View Full Code Here

        byte[] v1Norm = Strings.getBytesUtf8( "test" );

        // First check with a value which will be normalized
        BinaryValue sbv = new BinaryValue( at, v1 );

        sbv.apply( at );
        byte[] normalized = sbv.getNormReference();

        assertTrue( Arrays.equals( v1Norm, normalized ) );
        assertTrue( Arrays.equals( v1, sbv.getBytes() ) );
View Full Code Here

    public void testNullBinaryValueSerialization() throws LdapException, IOException, ClassNotFoundException
    {
        // First check with a value which will be normalized
        BinaryValue sbv = new BinaryValue( at );

        sbv.apply( at );
        byte[] normalized = sbv.getNormReference();

        assertEquals( null, normalized );
        assertEquals( null, sbv.getValue() );
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.