Search in sources :

Example 1 with AttributeType

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

the class ProtectedItem_AttributeTypeTest method initNames.

/**
 * Initialize name instances
 */
@Before
public void initNames() throws Exception {
    Set<AttributeType> colA = new HashSet<AttributeType>();
    colA.add(new AttributeType("aa"));
    colA.add(new AttributeType("bb"));
    colA.add(new AttributeType("cc"));
    Set<AttributeType> colB = new HashSet<AttributeType>();
    colB.add(new AttributeType("aa"));
    colB.add(new AttributeType("bb"));
    colB.add(new AttributeType("cc"));
    Set<AttributeType> colC = new HashSet<AttributeType>();
    colC.add(new AttributeType("bb"));
    colC.add(new AttributeType("cc"));
    colC.add(new AttributeType("dd"));
    attributeTypeA = new AttributeTypeItem(colA);
    attributeTypeACopy = new AttributeTypeItem(colA);
    attributeTypeB = new AttributeTypeItem(colB);
    attributeTypeC = new AttributeTypeItem(colC);
}
Also used : AttributeTypeItem(org.apache.directory.api.ldap.aci.protectedItem.AttributeTypeItem) AttributeType(org.apache.directory.api.ldap.model.schema.AttributeType) HashSet(java.util.HashSet) Before(org.junit.Before)

Example 2 with AttributeType

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

the class ProtectedItem_SelfValueTest method initNames.

/**
 * Initialize name instances
 */
@Before
public void initNames() throws Exception {
    Set<AttributeType> colA = new HashSet<AttributeType>();
    colA.add(new AttributeType("aa"));
    colA.add(new AttributeType("bb"));
    colA.add(new AttributeType("cc"));
    Set<AttributeType> colB = new HashSet<AttributeType>();
    colB.add(new AttributeType("aa"));
    colB.add(new AttributeType("bb"));
    colB.add(new AttributeType("cc"));
    Set<AttributeType> colC = new HashSet<AttributeType>();
    colC.add(new AttributeType("bb"));
    colC.add(new AttributeType("cc"));
    colC.add(new AttributeType("dd"));
    selfValueA = new SelfValueItem(colA);
    selfValueACopy = new SelfValueItem(colA);
    selfValueB = new SelfValueItem(colB);
    selfValueC = new SelfValueItem(colC);
}
Also used : SelfValueItem(org.apache.directory.api.ldap.aci.protectedItem.SelfValueItem) AttributeType(org.apache.directory.api.ldap.model.schema.AttributeType) HashSet(java.util.HashSet) Before(org.junit.Before)

Example 3 with AttributeType

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

the class MaxValueCountItemTest method initNames.

/**
 * Initialize maxValueCountItem instances
 */
@Before
public void initNames() throws Exception {
    itemsA = new HashSet<MaxValueCountElem>();
    itemsA.add(new MaxValueCountElem(new AttributeType("aa"), 1));
    itemsA.add(new MaxValueCountElem(new AttributeType("aa"), 2));
    itemsA.add(new MaxValueCountElem(new AttributeType("aa"), 3));
    // Sets aren't ordered, so adding order must not matter
    itemsB = new HashSet<MaxValueCountElem>();
    itemsB.add(new MaxValueCountElem(new AttributeType("aa"), 2));
    itemsB.add(new MaxValueCountElem(new AttributeType("aa"), 3));
    itemsB.add(new MaxValueCountElem(new AttributeType("aa"), 1));
    itemsC = new HashSet<MaxValueCountElem>();
    itemsC.add(new MaxValueCountElem(new AttributeType("aa"), 1));
    itemsC.add(new MaxValueCountElem(new AttributeType("bb"), 2));
    itemsC.add(new MaxValueCountElem(new AttributeType("aa"), 3));
    itemsD = new HashSet<MaxValueCountElem>();
    itemsD.add(new MaxValueCountElem(new AttributeType("aa"), 1));
    itemsD.add(new MaxValueCountElem(new AttributeType("aa"), 2));
    itemsD.add(new MaxValueCountElem(new AttributeType("aa"), 4));
    maxValueCountItemA = new MaxValueCountItem(itemsA);
    maxValueCountItemACopy = new MaxValueCountItem(itemsA);
    maxValueCountItemB = new MaxValueCountItem(itemsB);
    maxValueCountItemC = new MaxValueCountItem(itemsC);
    maxValueCountItemD = new MaxValueCountItem(itemsD);
}
Also used : AttributeType(org.apache.directory.api.ldap.model.schema.AttributeType) MaxValueCountItem(org.apache.directory.api.ldap.aci.protectedItem.MaxValueCountItem) MaxValueCountElem(org.apache.directory.api.ldap.aci.protectedItem.MaxValueCountElem) Before(org.junit.Before)

Example 4 with AttributeType

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

the class RestrictedByItemTest method initNames.

/**
 * Initialize maxValueCountItem instances
 */
@Before
public void initNames() throws Exception {
    elemsA = new HashSet<RestrictedByElem>();
    elemsA.add(new RestrictedByElem(new AttributeType("aa"), new AttributeType("aa")));
    elemsA.add(new RestrictedByElem(new AttributeType("aa"), new AttributeType("bb")));
    elemsA.add(new RestrictedByElem(new AttributeType("aa"), new AttributeType("cc")));
    // Sets aren't ordered, so adding order must not matter
    elemsB = new HashSet<RestrictedByElem>();
    elemsB.add(new RestrictedByElem(new AttributeType("aa"), new AttributeType("bb")));
    elemsB.add(new RestrictedByElem(new AttributeType("aa"), new AttributeType("cc")));
    elemsB.add(new RestrictedByElem(new AttributeType("aa"), new AttributeType("aa")));
    elemsC = new HashSet<RestrictedByElem>();
    elemsC.add(new RestrictedByElem(new AttributeType("aa"), new AttributeType("aa")));
    elemsC.add(new RestrictedByElem(new AttributeType("bb"), new AttributeType("bb")));
    elemsC.add(new RestrictedByElem(new AttributeType("aa"), new AttributeType("cc")));
    elemsD = new HashSet<RestrictedByElem>();
    elemsD.add(new RestrictedByElem(new AttributeType("aa"), new AttributeType("aa")));
    elemsD.add(new RestrictedByElem(new AttributeType("aa"), new AttributeType("bb")));
    elemsD.add(new RestrictedByElem(new AttributeType("aa"), new AttributeType("dd")));
    restrictedByItemA = new RestrictedByItem(elemsA);
    restrictedByItemACopy = new RestrictedByItem(elemsA);
    restrictedByItemB = new RestrictedByItem(elemsB);
    restrictedByItemC = new RestrictedByItem(elemsC);
    restrictedByItemD = new RestrictedByItem(elemsD);
}
Also used : AttributeType(org.apache.directory.api.ldap.model.schema.AttributeType) RestrictedByItem(org.apache.directory.api.ldap.aci.protectedItem.RestrictedByItem) RestrictedByElem(org.apache.directory.api.ldap.aci.protectedItem.RestrictedByElem) Before(org.junit.Before)

Example 5 with AttributeType

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

the class SchemaManagerLoadTest method testLoadNis.

/**
 * test loading the "nis" schema, which depends on "system", "core" and "cosine",
 * but is disabled
 */
@Test
public void testLoadNis() throws Exception {
    LdifSchemaLoader loader = new LdifSchemaLoader(schemaRepository);
    SchemaManager schemaManager = new DefaultSchemaManager(loader);
    assertTrue(schemaManager.load("system"));
    assertTrue(schemaManager.load("core"));
    assertTrue(schemaManager.load("cosine"));
    assertFalse(schemaManager.load("nis"));
    AttributeType at = schemaManager.getAttributeType("uidNumber");
    // if nis schema was loaded then the at will not be null
    assertNull(at);
    assertTrue(schemaManager.getErrors().isEmpty());
    assertEquals(133, schemaManager.getAttributeTypeRegistry().size());
    assertEquals(36, schemaManager.getComparatorRegistry().size());
    assertEquals(42, schemaManager.getMatchingRuleRegistry().size());
    assertEquals(35, schemaManager.getNormalizerRegistry().size());
    assertEquals(49, schemaManager.getObjectClassRegistry().size());
    assertEquals(59, schemaManager.getSyntaxCheckerRegistry().size());
    assertEquals(66, schemaManager.getLdapSyntaxRegistry().size());
    assertEquals(290, schemaManager.getGlobalOidRegistry().size());
    assertEquals(3, schemaManager.getRegistries().getLoadedSchemas().size());
    assertNotNull(schemaManager.getRegistries().getLoadedSchema("system"));
    assertNotNull(schemaManager.getRegistries().getLoadedSchema("core"));
    assertNotNull(schemaManager.getRegistries().getLoadedSchema("cosine"));
    assertNull(schemaManager.getRegistries().getLoadedSchema("nis"));
}
Also used : AttributeType(org.apache.directory.api.ldap.model.schema.AttributeType) SchemaManager(org.apache.directory.api.ldap.model.schema.SchemaManager) DefaultSchemaManager(org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager) DefaultSchemaManager(org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager) Test(org.junit.Test)

Aggregations

AttributeType (org.apache.directory.api.ldap.model.schema.AttributeType)135 Test (org.junit.Test)68 MutableAttributeType (org.apache.directory.api.ldap.model.schema.MutableAttributeType)42 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)25 ParseException (java.text.ParseException)15 DefaultAttribute (org.apache.directory.api.ldap.model.entry.DefaultAttribute)15 Value (org.apache.directory.api.ldap.model.entry.Value)15 Attribute (org.apache.directory.api.ldap.model.entry.Attribute)11 LdapInvalidAttributeValueException (org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException)11 HashSet (java.util.HashSet)10 LdapSchemaException (org.apache.directory.api.ldap.model.exception.LdapSchemaException)10 ObjectClass (org.apache.directory.api.ldap.model.schema.ObjectClass)10 MatchingRule (org.apache.directory.api.ldap.model.schema.MatchingRule)9 IOException (java.io.IOException)7 LdapInvalidDnException (org.apache.directory.api.ldap.model.exception.LdapInvalidDnException)7 Before (org.junit.Before)7 SchemaManager (org.apache.directory.api.ldap.model.schema.SchemaManager)6 DefaultSchemaManager (org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager)6 ArrayList (java.util.ArrayList)5 Dn (org.apache.directory.api.ldap.model.name.Dn)4