Package org.apache.directory.shared.ldap.model.schema.comparators

Examples of org.apache.directory.shared.ldap.model.schema.comparators.ByteArrayComparator


        } );

        MatchingRule matchingRule = new MatchingRule( "1.2.2" );
        matchingRule.setSyntax( syntax );

        matchingRule.setLdapComparator( new ByteArrayComparator( "1.2.2" ) );
       
        matchingRule.setNormalizer( new Normalizer( "1.1.1" )
        {
            public Value<?> normalize( Value<?> value ) throws LdapException
            {
View Full Code Here


        s = EntryUtils.syntaxFactory( "1.1.1.1", false );
        s.setSyntaxChecker( new OctetStringSyntaxChecker() );
        mr = EntryUtils.matchingRuleFactory( "1.1.2.1" );
        mr.setSyntax( s );
       
        mr.setLdapComparator( new ByteArrayComparator( "1.1.1" ) );
        mr.setNormalizer( new Normalizer( "1.1.1" )
        {
            public Value<?> normalize( Value<?> value ) throws LdapException
            {
                if ( !value.isHumanReadable() )
View Full Code Here

public class ByteArrayComparatorTest
{
    @Test
    public void testBothNull()
    {
        assertEquals( 0, new ByteArrayComparator( null ).compare( null, null ) );
    }
View Full Code Here

   
    @Test
    public void testB2Null()
    {
        assertEquals( 1, new ByteArrayComparator( null ).compare( new byte[0], null ) );
    }
View Full Code Here

   
    @Test
    public void testB1Null()
    {
        assertEquals( -1, new ByteArrayComparator( null ).compare( null, new byte[0] ) );
    }
View Full Code Here

   
    @Test
    public void testBothEmpty()
    {
        assertEquals( 0, new ByteArrayComparator( null ).compare( new byte[0], new byte[0] ) );
    }
View Full Code Here

   
    @Test
    public void testBothEqualLengthOne()
    {
        assertEquals( 0, new ByteArrayComparator( null ).compare( new byte[1], new byte[1] ) );
    }
View Full Code Here

   
    @Test
    public void testBothEqualLengthTen()
    {
        assertEquals( 0, new ByteArrayComparator( null ).compare( new byte[10], new byte[10] ) );
    }
View Full Code Here

    public void testB1PrefixOfB2()
    {
        byte[] b1 = new byte[] { 0, 1, 2 };
        byte[] b2 = new byte[] { 0, 1, 2, 3 };

        assertEquals( -1, new ByteArrayComparator( null ).compare( b1, b2 ) );
    }
View Full Code Here

    public void testB2PrefixOfB1()
    {
        byte[] b1 = new byte[] { 0, 1, 2, 3 };
        byte[] b2 = new byte[] { 0, 1, 2 };

        assertEquals( 1, new ByteArrayComparator( null ).compare( b1, b2 ) );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.model.schema.comparators.ByteArrayComparator

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.