use of org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager in project jackrabbit-oak by apache.
the class AbstractServer method setUp.
/**
* Get's the initial context factory for the provider's ou=system context
* root.
*/
protected void setUp() throws Exception {
File cwd = new File("target", "apacheds");
doDelete(cwd);
// setup directory service
directoryService = new DefaultDirectoryService();
directoryService.setShutdownHookEnabled(false);
directoryService.setInstanceLayout(new InstanceLayout(cwd));
cacheService = new CacheService();
cacheService.initialize(directoryService.getInstanceLayout());
SchemaManager schemaManager = new DefaultSchemaManager();
directoryService.setSchemaManager(schemaManager);
directoryService.setDnFactory(new DefaultDnFactory(directoryService.getSchemaManager(), cacheService.getCache("dnCache")));
AvlPartition schLdifPart = new AvlPartition(directoryService.getSchemaManager(), directoryService.getDnFactory());
schLdifPart.setId("schema");
schLdifPart.setSuffixDn(directoryService.getDnFactory().create(ServerDNConstants.CN_SCHEMA_DN));
SchemaPartition schPart = new SchemaPartition(directoryService.getSchemaManager());
schPart.setWrappedPartition(schLdifPart);
directoryService.setSchemaPartition(schPart);
AvlPartition sysPart = new AvlPartition(directoryService.getSchemaManager(), directoryService.getDnFactory());
sysPart.setId(SystemSchemaConstants.SCHEMA_NAME);
sysPart.setSuffixDn(directoryService.getDnFactory().create(ServerDNConstants.SYSTEM_DN));
directoryService.setSystemPartition(sysPart);
AvlPartition examplePart = new AvlPartition(directoryService.getSchemaManager(), directoryService.getDnFactory());
examplePart.setId("example");
examplePart.setSuffixDn(directoryService.getDnFactory().create(EXAMPLE_DN));
examplePart.setCacheService(cacheService);
directoryService.addPartition(examplePart);
// setup ldap server
port = AvailablePortFinder.getNextAvailable(1024);
ldapServer = new LdapServer();
setupLdapServer();
setupSaslMechanisms();
directoryService.startup();
setupExamplePartition();
startLdapServer();
setContexts(ServerDNConstants.ADMIN_SYSTEM_DN, "secret");
}
use of org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager in project directory-ldap-api by apache.
the class SchemaManagerDelTest method loadSchema.
private SchemaManager loadSchema(String schemaName) throws Exception {
LdifSchemaLoader loader = new LdifSchemaLoader(schemaRepository);
SchemaManager schemaManager = new DefaultSchemaManager(loader);
schemaManager.loadWithDeps(schemaName);
return schemaManager;
}
use of org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager in project directory-ldap-api by apache.
the class SchemaManagerEnableDisableLoadTest method init.
@Before
public void init() throws Exception {
LdifSchemaLoader loader = new LdifSchemaLoader(schemaRepository);
schemaManager = new DefaultSchemaManager(loader);
}
use of org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager in project directory-ldap-api by apache.
the class SchemaManagerLoadTest method testLoadCoreAndInetOrgPerson.
/**
* test loading the "InetOrgPerson" and "core" schema, which depends on "system" and "cosine"
*/
@Test
public void testLoadCoreAndInetOrgPerson() throws Exception {
LdifSchemaLoader loader = new LdifSchemaLoader(schemaRepository);
SchemaManager schemaManager = new DefaultSchemaManager(loader);
assertTrue(schemaManager.load("system"));
assertTrue(schemaManager.load("core", "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(4, schemaManager.getRegistries().getLoadedSchemas().size());
assertNotNull(schemaManager.getRegistries().getLoadedSchema("system"));
assertNotNull(schemaManager.getRegistries().getLoadedSchema("core"));
assertNotNull(schemaManager.getRegistries().getLoadedSchema("cosine"));
assertNotNull(schemaManager.getRegistries().getLoadedSchema("InetOrgPerson"));
}
use of org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager in project directory-ldap-api by apache.
the class SchemaManagerLoadTest method testLoadSystem.
// -------------------------------------------------------------------------
// Test the load( String... schemaName) method
// -------------------------------------------------------------------------
/**
* test loading the "system" schema amone
*/
@Test
public void testLoadSystem() throws Exception {
LdifSchemaLoader loader = new LdifSchemaLoader(schemaRepository);
SchemaManager schemaManager = new DefaultSchemaManager(loader);
assertTrue(schemaManager.load("system"));
assertTrue(schemaManager.getErrors().isEmpty());
assertEquals(38, schemaManager.getAttributeTypeRegistry().size());
assertEquals(35, schemaManager.getComparatorRegistry().size());
assertEquals(35, schemaManager.getMatchingRuleRegistry().size());
assertEquals(35, schemaManager.getNormalizerRegistry().size());
assertEquals(9, schemaManager.getObjectClassRegistry().size());
assertEquals(59, schemaManager.getSyntaxCheckerRegistry().size());
assertEquals(59, schemaManager.getLdapSyntaxRegistry().size());
assertEquals(141, schemaManager.getGlobalOidRegistry().size());
assertEquals(1, schemaManager.getRegistries().getLoadedSchemas().size());
assertNotNull(schemaManager.getRegistries().getLoadedSchema("system"));
}
Aggregations