Search in sources :

Example 61 with DefaultSchemaManager

use of org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager in project directory-ldap-api by apache.

the class SchemaManagerLoadWithDepsTest method testLoadApache.

/**
 * test loading the "apache" schema, which depends on "system" and "core"
 */
@Test
public void testLoadApache() throws Exception {
    LdifSchemaLoader loader = new LdifSchemaLoader(schemaRepository);
    SchemaManager schemaManager = new DefaultSchemaManager(loader);
    schemaManager.loadWithDeps("apache");
    assertTrue(schemaManager.getErrors().isEmpty());
    assertEquals(148, schemaManager.getAttributeTypeRegistry().size());
    assertEquals(44, schemaManager.getComparatorRegistry().size());
    assertEquals(50, schemaManager.getMatchingRuleRegistry().size());
    assertEquals(43, schemaManager.getNormalizerRegistry().size());
    assertEquals(53, schemaManager.getObjectClassRegistry().size());
    assertEquals(62, schemaManager.getSyntaxCheckerRegistry().size());
    assertEquals(73, schemaManager.getLdapSyntaxRegistry().size());
    assertEquals(324, schemaManager.getGlobalOidRegistry().size());
    assertEquals(3, schemaManager.getRegistries().getLoadedSchemas().size());
    assertNotNull(schemaManager.getRegistries().getLoadedSchema("system"));
    assertNotNull(schemaManager.getRegistries().getLoadedSchema("core"));
    assertNotNull(schemaManager.getRegistries().getLoadedSchema("apache"));
}
Also used : 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)

Example 62 with DefaultSchemaManager

use of org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager in project directory-ldap-api by apache.

the class SchemaManagerLoadWithDepsTest method testLoadApacheMeta.

/**
 * test loading the "apacheMeta" schema, which depends on "system"
 */
@Test
public void testLoadApacheMeta() throws Exception {
    LdifSchemaLoader loader = new LdifSchemaLoader(schemaRepository);
    SchemaManager schemaManager = new DefaultSchemaManager(loader);
    schemaManager.loadWithDeps("apacheMeta");
    assertTrue(schemaManager.getErrors().isEmpty());
    assertEquals(71, schemaManager.getAttributeTypeRegistry().size());
    assertEquals(40, schemaManager.getComparatorRegistry().size());
    assertEquals(40, schemaManager.getMatchingRuleRegistry().size());
    assertEquals(40, schemaManager.getNormalizerRegistry().size());
    assertEquals(22, schemaManager.getObjectClassRegistry().size());
    assertEquals(63, schemaManager.getSyntaxCheckerRegistry().size());
    assertEquals(64, schemaManager.getLdapSyntaxRegistry().size());
    assertEquals(197, schemaManager.getGlobalOidRegistry().size());
    assertEquals(2, schemaManager.getRegistries().getLoadedSchemas().size());
    assertNotNull(schemaManager.getRegistries().getLoadedSchema("system"));
    assertNotNull(schemaManager.getRegistries().getLoadedSchema("apachemeta"));
}
Also used : 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)

Example 63 with DefaultSchemaManager

use of org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager in project directory-ldap-api by apache.

the class SchemaManagerLoadWithDepsTest 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);
    schemaManager.loadWithDeps("nis");
    assertTrue(schemaManager.getErrors().isEmpty());
    assertEquals(0, schemaManager.getAttributeTypeRegistry().size());
    assertEquals(0, schemaManager.getComparatorRegistry().size());
    assertEquals(0, schemaManager.getMatchingRuleRegistry().size());
    assertEquals(0, schemaManager.getNormalizerRegistry().size());
    assertEquals(0, schemaManager.getObjectClassRegistry().size());
    assertEquals(0, schemaManager.getSyntaxCheckerRegistry().size());
    assertEquals(0, schemaManager.getLdapSyntaxRegistry().size());
    assertEquals(0, schemaManager.getGlobalOidRegistry().size());
    assertEquals(0, schemaManager.getRegistries().getLoadedSchemas().size());
    assertNull(schemaManager.getRegistries().getLoadedSchema("system"));
    assertNull(schemaManager.getRegistries().getLoadedSchema("core"));
    assertNull(schemaManager.getRegistries().getLoadedSchema("cosine"));
}
Also used : 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)

Example 64 with DefaultSchemaManager

use of org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager in project directory-ldap-api by apache.

the class SchemaManagerLoadWithDepsTest method testLoadKrb5Kdc.

/**
 * test loading the "Krb5Kdc" schema, which depends on "system" and "core"
 */
@Test
public void testLoadKrb5Kdc() throws Exception {
    LdifSchemaLoader loader = new LdifSchemaLoader(schemaRepository);
    SchemaManager schemaManager = new DefaultSchemaManager(loader);
    schemaManager.loadWithDeps("Krb5Kdc");
    assertTrue(schemaManager.getErrors().isEmpty());
    assertEquals(107, schemaManager.getAttributeTypeRegistry().size());
    assertEquals(36, schemaManager.getComparatorRegistry().size());
    assertEquals(42, schemaManager.getMatchingRuleRegistry().size());
    assertEquals(35, schemaManager.getNormalizerRegistry().size());
    assertEquals(39, schemaManager.getObjectClassRegistry().size());
    assertEquals(59, schemaManager.getSyntaxCheckerRegistry().size());
    assertEquals(66, schemaManager.getLdapSyntaxRegistry().size());
    assertEquals(254, schemaManager.getGlobalOidRegistry().size());
    assertEquals(3, schemaManager.getRegistries().getLoadedSchemas().size());
    assertNotNull(schemaManager.getRegistries().getLoadedSchema("system"));
    assertNotNull(schemaManager.getRegistries().getLoadedSchema("core"));
    assertNotNull(schemaManager.getRegistries().getLoadedSchema("Krb5Kdc"));
}
Also used : 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

DefaultSchemaManager (org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager)64 SchemaManager (org.apache.directory.api.ldap.model.schema.SchemaManager)55 Test (org.junit.Test)41 BeforeClass (org.junit.BeforeClass)11 JarLdifSchemaLoader (org.apache.directory.api.ldap.schema.loader.JarLdifSchemaLoader)9 File (java.io.File)7 Schema (org.apache.directory.api.ldap.model.schema.registries.Schema)7 InstanceLayout (org.apache.directory.server.core.api.InstanceLayout)6 SchemaPartition (org.apache.directory.server.core.api.schema.SchemaPartition)6 IOException (java.io.IOException)5 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)4 LdapUnwillingToPerformException (org.apache.directory.api.ldap.model.exception.LdapUnwillingToPerformException)4 SchemaLoader (org.apache.directory.api.ldap.model.schema.registries.SchemaLoader)4 DefaultSchema (org.apache.directory.api.ldap.model.schema.registries.DefaultSchema)3 SchemaLdifExtractor (org.apache.directory.api.ldap.schema.extractor.SchemaLdifExtractor)3 DefaultSchemaLdifExtractor (org.apache.directory.api.ldap.schema.extractor.impl.DefaultSchemaLdifExtractor)3 CacheService (org.apache.directory.server.core.api.CacheService)3 CacheManager (net.sf.ehcache.CacheManager)2 CacheConfiguration (net.sf.ehcache.config.CacheConfiguration)2 Configuration (net.sf.ehcache.config.Configuration)2