Search in sources :

Example 21 with Ava

use of org.apache.directory.api.ldap.model.name.Ava in project directory-ldap-api by apache.

the class AvaTest method testAvaSimpleNorm.

@Test
public void testAvaSimpleNorm() throws LdapException {
    Ava atav = new Ava(schemaManager, " CommonName ", " This is    a TEST ");
    assertEquals(" CommonName =\\ This is    a TEST\\ ", atav.toString());
    assertEquals(" CommonName =\\ This is    a TEST\\ ", atav.getName());
}
Also used : Ava(org.apache.directory.api.ldap.model.name.Ava) Test(org.junit.Test)

Example 22 with Ava

use of org.apache.directory.api.ldap.model.name.Ava in project directory-ldap-api by apache.

the class AvaTest method testAttributeTypeAndValueValidType.

/**
 * Test a valid type for an AttributeTypeAndValue
 */
@Test
public void testAttributeTypeAndValueValidType() throws LdapException {
    Ava atav = new Ava(schemaManager, "DC", (String) null);
    assertEquals("DC=", atav.toString());
    assertEquals("DC=", atav.getName());
    atav = new Ava(schemaManager, "  DC  ", (String) null);
    assertEquals("  DC  =", atav.toString());
    assertEquals("  DC  =", atav.getName());
    try {
        atav = new Ava(schemaManager, null, (String) null);
        fail();
    } catch (LdapInvalidDnException lide) {
        assertTrue(true);
    }
}
Also used : Ava(org.apache.directory.api.ldap.model.name.Ava) LdapInvalidDnException(org.apache.directory.api.ldap.model.exception.LdapInvalidDnException) Test(org.junit.Test)

Example 23 with Ava

use of org.apache.directory.api.ldap.model.name.Ava in project directory-ldap-api by apache.

the class AvaTest method testEqualsAttributeIdSameCase.

/**
 * Compares two equals atavs but with a type in different case
 */
@Test
public void testEqualsAttributeIdSameCase() throws LdapException {
    Ava atav1 = new Ava(schemaManager, "a", "b");
    Ava atav2 = new Ava(schemaManager, "A", "b");
    assertTrue(atav1.equals(atav2));
}
Also used : Ava(org.apache.directory.api.ldap.model.name.Ava) Test(org.junit.Test)

Example 24 with Ava

use of org.apache.directory.api.ldap.model.name.Ava in project directory-ldap-api by apache.

the class FastRdnParserTest method testAvaConstructorRdnAtUsedTwice.

/**
 * test that a RDN can have an attributeType twice
 */
@Test
public void testAvaConstructorRdnAtUsedTwice() throws LdapException {
    Rdn rdn = new Rdn(new Ava("A", "b"), new Ava("A", "d"));
    assertEquals("A=b+A=d", rdn.getName());
}
Also used : Rdn(org.apache.directory.api.ldap.model.name.Rdn) Ava(org.apache.directory.api.ldap.model.name.Ava) Test(org.junit.Test)

Example 25 with Ava

use of org.apache.directory.api.ldap.model.name.Ava in project directory-ldap-api by apache.

the class RdnTest method testAvaConstructorRdnAtUsedTwice.

/**
 * test that a RDN can have an attributeType twice
 */
@Test
public void testAvaConstructorRdnAtUsedTwice() throws LdapException {
    Rdn rdn = new Rdn(new Ava("A", "b"), new Ava("A", "d"));
    assertEquals("A=b+A=d", rdn.getName());
}
Also used : Rdn(org.apache.directory.api.ldap.model.name.Rdn) Ava(org.apache.directory.api.ldap.model.name.Ava) Test(org.junit.Test)

Aggregations

Ava (org.apache.directory.api.ldap.model.name.Ava)44 Test (org.junit.Test)39 ByteArrayOutputStream (java.io.ByteArrayOutputStream)14 ObjectOutputStream (java.io.ObjectOutputStream)14 Rdn (org.apache.directory.api.ldap.model.name.Rdn)12 ByteArrayInputStream (java.io.ByteArrayInputStream)8 ObjectInputStream (java.io.ObjectInputStream)8 IOException (java.io.IOException)5 Dn (org.apache.directory.api.ldap.model.name.Dn)3 DefaultAttribute (org.apache.directory.api.ldap.model.entry.DefaultAttribute)2 LdapInvalidDnException (org.apache.directory.api.ldap.model.exception.LdapInvalidDnException)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Attribute (org.apache.directory.api.ldap.model.entry.Attribute)1 DefaultModification (org.apache.directory.api.ldap.model.entry.DefaultModification)1 Modification (org.apache.directory.api.ldap.model.entry.Modification)1 Value (org.apache.directory.api.ldap.model.entry.Value)1 Anonymizer (org.apache.directory.api.ldap.model.ldif.anonymizer.Anonymizer)1 BinaryAnonymizer (org.apache.directory.api.ldap.model.ldif.anonymizer.BinaryAnonymizer)1 CaseSensitiveStringAnonymizer (org.apache.directory.api.ldap.model.ldif.anonymizer.CaseSensitiveStringAnonymizer)1