Search in sources :

Example 6 with DefaultSchema

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

the class SchemaManagerLoadWithDepsTest method testLoadWithDepsCoreInetOrgPersonAndNis.

/**
 * test loading the "InetOrgPerson", "core" and a disabled schema
 */
@Test
public void testLoadWithDepsCoreInetOrgPersonAndNis() throws Exception {
    LdifSchemaLoader loader = new LdifSchemaLoader(schemaRepository);
    SchemaManager schemaManager = new DefaultSchemaManager(loader);
    Schema system = loader.getSchema("system");
    Schema core = loader.getSchema("core");
    Schema empty = new DefaultSchema(loader, "empty");
    Schema cosine = loader.getSchema("cosine");
    Schema inetOrgPerson = loader.getSchema("InetOrgPerson");
    assertTrue(schemaManager.load(system, core, empty, cosine, inetOrgPerson));
    assertTrue(schemaManager.getErrors().isEmpty());
    assertEquals(142, schemaManager.getAttributeTypeRegistry().size());
    assertEquals(36, schemaManager.getComparatorRegistry().size());
    assertEquals(42, schemaManager.getMatchingRuleRegistry().size());
    assertEquals(35, schemaManager.getNormalizerRegistry().size());
    assertEquals(50, schemaManager.getObjectClassRegistry().size());
    assertEquals(59, schemaManager.getSyntaxCheckerRegistry().size());
    assertEquals(66, schemaManager.getLdapSyntaxRegistry().size());
    assertEquals(300, schemaManager.getGlobalOidRegistry().size());
    assertEquals(5, schemaManager.getRegistries().getLoadedSchemas().size());
    assertNotNull(schemaManager.getRegistries().getLoadedSchema("system"));
    assertNotNull(schemaManager.getRegistries().getLoadedSchema("core"));
    assertNotNull(schemaManager.getRegistries().getLoadedSchema("cosine"));
    assertNotNull(schemaManager.getRegistries().getLoadedSchema("InetOrgPerson"));
}
Also used : Schema(org.apache.directory.api.ldap.model.schema.registries.Schema) DefaultSchema(org.apache.directory.api.ldap.model.schema.registries.DefaultSchema) DefaultSchema(org.apache.directory.api.ldap.model.schema.registries.DefaultSchema) 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

DefaultSchema (org.apache.directory.api.ldap.model.schema.registries.DefaultSchema)6 Schema (org.apache.directory.api.ldap.model.schema.registries.Schema)5 SchemaManager (org.apache.directory.api.ldap.model.schema.SchemaManager)4 DefaultSchemaManager (org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager)4 Test (org.junit.Test)4 HashSet (java.util.HashSet)1 Attribute (org.apache.directory.api.ldap.model.entry.Attribute)1 DefaultAttribute (org.apache.directory.api.ldap.model.entry.DefaultAttribute)1 Value (org.apache.directory.api.ldap.model.entry.Value)1 SchemaObjectWrapper (org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper)1