Search in sources :

Example 16 with DeepTrimToLowerNormalizer

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

the class DeepTrimToLowerNormalizerTest method testNormalizeIgnore.

@Test
public void testNormalizeIgnore() throws Exception {
    Normalizer normalizer = new DeepTrimToLowerNormalizer("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)));
}
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 17 with DeepTrimToLowerNormalizer

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

the class DeepTrimToLowerNormalizerTest method testInsignifiantSpacesStringOneCombining.

@Test
public void testInsignifiantSpacesStringOneCombining() throws LdapException {
    Normalizer normalizer = new DeepTrimToLowerNormalizer("1.1.1");
    char[] chars = new char[] { 'e', 0x0301 };
    char[] expected = new char[] { ' ', '\u00E9', ' ' };
    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 18 with DeepTrimToLowerNormalizer

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

the class DeepTrimToLowerNormalizerTest method testInsignifiantSpacesStringOneChar.

@Test
public void testInsignifiantSpacesStringOneChar() throws LdapException {
    Normalizer normalizer = new DeepTrimToLowerNormalizer("1.1.1");
    assertEquals(" a ", normalizer.normalize("a"));
}
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 19 with DeepTrimToLowerNormalizer

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

the class DeepTrimToLowerNormalizerTest method testNormalizeString.

@Test
public void testNormalizeString() throws Exception {
    Normalizer normalizer = new DeepTrimToLowerNormalizer("1.1.1");
    assertEquals(" abcd ", normalizer.normalize("abcd"));
}
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 20 with DeepTrimToLowerNormalizer

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

the class DeepTrimToLowerNormalizerTest method testDeepTrimToLowerNormalizerNSpaces.

@Test
public void testDeepTrimToLowerNormalizerNSpaces() 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)

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