Search in sources :

Example 6 with DeepTrimToLowerNormalizer

use of org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer in project directory-ldap-api by apache.

the class DeepTrimToLowerNormalizerTest method testInsignifiantSpacesStringNCombining.

@Test
public void testInsignifiantSpacesStringNCombining() throws LdapException {
    Normalizer normalizer = new DeepTrimToLowerNormalizer("1.1.1");
    char[] chars = new char[] { 'e', 0x0301, ' ', 'a', 0x0300, 'i', 0x0302 };
    char[] expected = new char[] { ' ', '\u00E9', ' ', ' ', '\u00E0', '\u00EE', ' ' };
    assertEquals(new String(expected), normalizer.normalize(new String(chars)));
}
Also used : DeepTrimToLowerNormalizer(org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer) DeepTrimToLowerNormalizer(org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer) Normalizer(org.apache.directory.api.ldap.model.schema.Normalizer) Test(org.junit.Test)

Example 7 with DeepTrimToLowerNormalizer

use of org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer in project directory-ldap-api by apache.

the class DeepTrimToLowerNormalizerTest method testNormalizeCharsCombiningSpaces.

@Test
public void testNormalizeCharsCombiningSpaces() throws LdapException {
    Normalizer normalizer = new DeepTrimToLowerNormalizer("1.1.1");
    char[] chars = new char[] { 'a', 'm', ' ', 'e', 0x0301, 'l', 'i', 'e' };
    char[] expected = new char[] { ' ', 'a', 'm', ' ', ' ', '\u00e9', 'l', 'i', 'e', ' ' };
    String expectedStr = new String(expected);
    String charsStr = new String(chars);
    assertEquals(expectedStr, normalizer.normalize(charsStr));
}
Also used : DeepTrimToLowerNormalizer(org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer) DeepTrimToLowerNormalizer(org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer) Normalizer(org.apache.directory.api.ldap.model.schema.Normalizer) Test(org.junit.Test)

Example 8 with DeepTrimToLowerNormalizer

use of org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer in project directory-ldap-api by apache.

the class DeepTrimToLowerNormalizerTest method testDeepTrimToLowerNormalizerOneSpace.

@Test
public void testDeepTrimToLowerNormalizerOneSpace() throws LdapException {
    Normalizer normalizer = new DeepTrimToLowerNormalizer("1.1.1");
    assertEquals("  ", normalizer.normalize(" "));
}
Also used : DeepTrimToLowerNormalizer(org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer) DeepTrimToLowerNormalizer(org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer) Normalizer(org.apache.directory.api.ldap.model.schema.Normalizer) Test(org.junit.Test)

Example 9 with DeepTrimToLowerNormalizer

use of org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer in project directory-ldap-api by apache.

the class DeepTrimToLowerNormalizerTest method testInsignifiantSpacesStringTwoChars.

@Test
public void testInsignifiantSpacesStringTwoChars() throws LdapException {
    Normalizer normalizer = new DeepTrimToLowerNormalizer("1.1.1");
    assertEquals(" aa ", normalizer.normalize("aa"));
}
Also used : DeepTrimToLowerNormalizer(org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer) DeepTrimToLowerNormalizer(org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer) Normalizer(org.apache.directory.api.ldap.model.schema.Normalizer) Test(org.junit.Test)

Example 10 with DeepTrimToLowerNormalizer

use of org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer in project directory-ldap-api by apache.

the class DeepTrimToLowerNormalizerTest method testMapToSpace.

@Test
public void testMapToSpace() throws Exception {
    Normalizer normalizer = new DeepTrimToLowerNormalizer("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)));
}
Also used : DeepTrimToLowerNormalizer(org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer) DeepTrimToLowerNormalizer(org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer) Normalizer(org.apache.directory.api.ldap.model.schema.Normalizer) Test(org.junit.Test)

Aggregations

DeepTrimToLowerNormalizer (org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer)24 Normalizer (org.apache.directory.api.ldap.model.schema.Normalizer)17 Test (org.junit.Test)16 PrepareString (org.apache.directory.api.ldap.model.schema.PrepareString)3 StringComparator (org.apache.directory.api.ldap.model.schema.comparators.StringComparator)3 OidNormalizer (org.apache.directory.api.ldap.model.schema.normalizers.OidNormalizer)3 Before (org.junit.Before)3 BeforeClass (org.junit.BeforeClass)3 LdapSyntax (org.apache.directory.api.ldap.model.schema.LdapSyntax)2 MutableAttributeType (org.apache.directory.api.ldap.model.schema.MutableAttributeType)2 MutableMatchingRule (org.apache.directory.api.ldap.model.schema.MutableMatchingRule)2 SyntaxChecker (org.apache.directory.api.ldap.model.schema.SyntaxChecker)2 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)1 ByteArrayComparator (org.apache.directory.api.ldap.model.schema.comparators.ByteArrayComparator)1 Ignore (org.junit.Ignore)1