Search in sources :

Example 46 with Normalizer

use of org.apache.directory.api.ldap.model.schema.Normalizer 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 47 with Normalizer

use of org.apache.directory.api.ldap.model.schema.Normalizer 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 48 with Normalizer

use of org.apache.directory.api.ldap.model.schema.Normalizer 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 49 with Normalizer

use of org.apache.directory.api.ldap.model.schema.Normalizer 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 50 with Normalizer

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

the class NumericNormalizerTest method testInsignifiantSpacesStringOneChar.

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

Aggregations

Normalizer (org.apache.directory.api.ldap.model.schema.Normalizer)78 Test (org.junit.Test)59 DeepTrimToLowerNormalizer (org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer)20 DeepTrimNormalizer (org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimNormalizer)15 TelephoneNumberNormalizer (org.apache.directory.api.ldap.model.schema.normalizers.TelephoneNumberNormalizer)12 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)10 NumericNormalizer (org.apache.directory.api.ldap.model.schema.normalizers.NumericNormalizer)9 SchemaManager (org.apache.directory.api.ldap.model.schema.SchemaManager)7 NoOpNormalizer (org.apache.directory.api.ldap.model.schema.normalizers.NoOpNormalizer)7 DefaultSchemaManager (org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager)7 MutableAttributeType (org.apache.directory.api.ldap.model.schema.MutableAttributeType)6 PrepareString (org.apache.directory.api.ldap.model.schema.PrepareString)6 LdapSchemaException (org.apache.directory.api.ldap.model.exception.LdapSchemaException)5 LdapSyntax (org.apache.directory.api.ldap.model.schema.LdapSyntax)5 MatchingRule (org.apache.directory.api.ldap.model.schema.MatchingRule)5 MutableMatchingRule (org.apache.directory.api.ldap.model.schema.MutableMatchingRule)4 SyntaxChecker (org.apache.directory.api.ldap.model.schema.SyntaxChecker)4 ByteArrayComparator (org.apache.directory.api.ldap.model.schema.comparators.ByteArrayComparator)4 BooleanNormalizer (org.apache.directory.api.ldap.model.schema.normalizers.BooleanNormalizer)4 LdapProtocolErrorException (org.apache.directory.api.ldap.model.exception.LdapProtocolErrorException)3