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());
}
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);
}
}
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));
}
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());
}
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());
}
Aggregations