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

Examples of org.apache.directory.api.ldap.model.schema.Normalizer



    @Test
    public void testInsignifiantSpacesStringOneChar() throws LdapException
    {
        Normalizer normalizer = new DeepTrimNormalizer( "1.1.1" );
        assertEquals( "a", normalizer.normalize( "a" ) );
    }
View Full Code Here



    @Test
    public void testInsignifiantSpacesStringTwoChars() throws LdapException
    {
        Normalizer normalizer = new DeepTrimNormalizer( "1.1.1" );
        assertEquals( "aa", normalizer.normalize( "aa" ) );
    }
View Full Code Here


    @Test
    public void testInsignifiantSpacesStringNChars() throws LdapException
    {
        Normalizer normalizer = new DeepTrimNormalizer( "1.1.1" );
        assertEquals( "aaaaa", normalizer.normalize( "aaaaa" ) );
    }
View Full Code Here


    @Test
    public void testInsignifiantSpacesStringOneCombining() throws LdapException
    {
        Normalizer normalizer = new DeepTrimNormalizer( "1.1.1" );
        char[] chars = new char[]
            { ' ', 0x0310 };
        char[] expected = new char[]
            { ' ', 0x0310 };
        assertEquals( new String( expected ), normalizer.normalize( new String( chars ) ) );
    }
View Full Code Here


    @Test
    public void testInsignifiantSpacesStringNCombining() throws LdapException
    {
        Normalizer normalizer = new DeepTrimNormalizer( "1.1.1" );
        char[] chars = new char[]
            { ' ', 0x0310, ' ', 0x0311, ' ', 0x0312 };
        char[] expected = new char[]
            { ' ', 0x0310, ' ', 0x0311, ' ', 0x0312 };
        assertEquals( new String( expected ), normalizer.normalize( new String( chars ) ) );
    }
View Full Code Here


    @Test
    public void testInsignifiantSpacesStringCharsSpaces() throws LdapException
    {
        Normalizer normalizer = new DeepTrimNormalizer( "1.1.1" );
        assertEquals( "a", normalizer.normalize( " a" ) );
        assertEquals( "a", normalizer.normalize( "a " ) );
        assertEquals( "a", normalizer.normalize( " a " ) );
        assertEquals( "a a", normalizer.normalize( "a a" ) );
        assertEquals( "a a", normalizer.normalize( " a a" ) );
        assertEquals( "a a", normalizer.normalize( "a a " ) );
        assertEquals( "a a", normalizer.normalize( "a  a" ) );
        assertEquals( "a a", normalizer.normalize( " a   a " ) );
        assertEquals( "aaa aaa aaa", normalizer.normalize( "  aaa   aaa   aaa  " ) );
    }
View Full Code Here


    @Test
    public void testNormalizeCharsCombiningSpaces() throws LdapException
    {
        Normalizer normalizer = new DeepTrimNormalizer( "1.1.1" );
        char[] chars = new char[]
            { ' ', 0x0310, 'a', 'a', ' ', ' ', 0x0311, ' ', ' ', 'a', 0x0311, 0x0312 };
        char[] expected = new char[]
            { ' ', 0x0310, 'a', 'a', ' ', ' ', 0x0311, ' ', 'a', 0x0311, 0x0312 };
        assertEquals( new String( expected ), normalizer.normalize( new String( chars ) ) );
    }
View Full Code Here


    @Test
    public void testNormalizeString() throws Exception
    {
        Normalizer normalizer = new DeepTrimNormalizer( "1.1.1" );
        assertEquals( "abcd", normalizer.normalize( "abcd" ) );
    }
View Full Code Here


    @Test
    public void testMapToSpace() throws Exception
    {
        Normalizer normalizer = new DeepTrimNormalizer( "1.1.1" );
        char[] chars = new char[]
            { 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0085, 0x00A0, 0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005,
                0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x2028, 0x2029, 0x202F, 0x205F };
        assertEquals( " ", normalizer.normalize( new String( chars ) ) );
    }
View Full Code Here


    @Test
    public void testNormalizeIgnore() throws Exception
    {
        Normalizer normalizer = new DeepTrimNormalizer( "1.1.1" );
        char[] chars = new char[58];

        int pos = 0;

        for ( char c = 0x0000; c < 0x0008; c++ )
        {
            chars[pos++] = c;
        }

        for ( char c = 0x000E; c < 0x001F; c++ )
        {
            chars[pos++] = c;
        }

        for ( char c = 0x007F; c < 0x0084; c++ )
        {
            chars[pos++] = c;
        }

        for ( char c = 0x0086; c < 0x009F; c++ )
        {
            chars[pos++] = c;
        }

        chars[pos++] = 0x00AD;

        assertEquals( " ", normalizer.normalize( new String( chars ) ) );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.model.schema.Normalizer

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.