Search in sources :

Example 31 with Normalizer

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

the class TelephoneNumberNormalizerTest method testTelephoneNumberNormalizerEmpty.

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

Example 32 with Normalizer

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

the class TelephoneNumberNormalizerTest method testTelephoneNumberNormalizerTwoSpaces.

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

Example 33 with Normalizer

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

the class TelephoneNumberNormalizerTest method testInsignifiantSpacesStringTwoChars.

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

Example 34 with Normalizer

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

the class TelephoneNumberNormalizerTest method testInsignifiantTelephoneNumberCharsSpaces.

@Test
public void testInsignifiantTelephoneNumberCharsSpaces() throws LdapException {
    Normalizer normalizer = new TelephoneNumberNormalizer();
    assertEquals("1", normalizer.normalize(" 1"));
    assertEquals("1", normalizer.normalize("1 "));
    assertEquals("1", normalizer.normalize(" 1 "));
    assertEquals("11", normalizer.normalize("1 1"));
    assertEquals("11", normalizer.normalize(" 1 1"));
    assertEquals("11", normalizer.normalize("1 1 "));
    assertEquals("11", normalizer.normalize("1  1"));
    assertEquals("11", normalizer.normalize(" 1   1 "));
    assertEquals("123456789", normalizer.normalize("  123   456   789  "));
    assertEquals("1", normalizer.normalize("-1"));
    assertEquals("1", normalizer.normalize("1-"));
    assertEquals("1", normalizer.normalize("-1-"));
    assertEquals("11", normalizer.normalize("1-1"));
    assertEquals("11", normalizer.normalize("-1-1"));
    assertEquals("11", normalizer.normalize("1-1-"));
    assertEquals("11", normalizer.normalize("1--1"));
    assertEquals("11", normalizer.normalize("-1---1-"));
    assertEquals("1(2)+3456789", normalizer.normalize("---1(2)+3   456-  789 --"));
}
Also used : TelephoneNumberNormalizer(org.apache.directory.api.ldap.model.schema.normalizers.TelephoneNumberNormalizer) TelephoneNumberNormalizer(org.apache.directory.api.ldap.model.schema.normalizers.TelephoneNumberNormalizer) Normalizer(org.apache.directory.api.ldap.model.schema.Normalizer) Test(org.junit.Test)

Example 35 with Normalizer

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

the class TelephoneNumberNormalizerTest method testTelephoneNumberNormalizerOneSpace.

@Test
public void testTelephoneNumberNormalizerOneSpace() throws LdapException {
    Normalizer normalizer = new TelephoneNumberNormalizer();
    assertEquals("", normalizer.normalize(" "));
}
Also used : TelephoneNumberNormalizer(org.apache.directory.api.ldap.model.schema.normalizers.TelephoneNumberNormalizer) TelephoneNumberNormalizer(org.apache.directory.api.ldap.model.schema.normalizers.TelephoneNumberNormalizer) 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