use of org.apache.directory.api.ldap.schema.loader.JarLdifSchemaLoader in project directory-ldap-api by apache.
the class ACIItemParserTest method init.
/**
* Initialization
*/
@BeforeClass
public static void init() throws Exception {
JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
SchemaManager schemaManager = new DefaultSchemaManager(loader);
schemaManager.loadAllEnabled();
parser = new ACIItemParser(schemaManager);
}
use of org.apache.directory.api.ldap.schema.loader.JarLdifSchemaLoader in project directory-ldap-api by apache.
the class ApiLdapSchemaDataOsgiTest method useBundleClasses.
@Override
protected void useBundleClasses() throws LdapException, IOException {
JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
loader.getAllEnabled();
loader.getAllSchemas();
SchemaManager schemaManager = new DefaultSchemaManager();
schemaManager.getEnabled();
schemaManager.getDisabled();
}
use of org.apache.directory.api.ldap.schema.loader.JarLdifSchemaLoader in project directory-ldap-api by apache.
the class ACIItemCheckerTest method init.
/**
* Initialization
*/
@BeforeClass
public static void init() throws Exception {
JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
SchemaManager schemaManager = new DefaultSchemaManager(loader);
schemaManager.loadAllEnabled();
checker = new ACIItemChecker(schemaManager);
}
use of org.apache.directory.api.ldap.schema.loader.JarLdifSchemaLoader in project directory-ldap-api by apache.
the class JarLdifSchemaLoaderTest method testJarLdifSchemaLoader.
@Test
public void testJarLdifSchemaLoader() throws Exception {
JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
SchemaManager sm = new DefaultSchemaManager(loader);
sm.loadWithDeps("system");
assertTrue(sm.getRegistries().getAttributeTypeRegistry().contains("cn"));
assertFalse(sm.getRegistries().getAttributeTypeRegistry().contains("m-aux"));
sm.loadWithDeps("apachemeta");
assertTrue(sm.getRegistries().getAttributeTypeRegistry().contains("m-aux"));
}
use of org.apache.directory.api.ldap.schema.loader.JarLdifSchemaLoader in project cloudstack by apache.
the class EmbeddedLdapServer method addSchemaFromClasspath.
/**
* Add additional schemas to the directory server. This uses
* JarLdifSchemaLoader, which will search for the "ou=schema" directory
* within "/schema" on the classpath. If packaging the schema as part of
* a jar using Gradle or Maven, you'd probably want to put your
* "ou=schema" directory in src/main/resources/schema.
* <p/>
* It's also required that a META-INF/apacheds-schema.index be present in
* your classpath that lists each LDIF file in your schema directory.
*
* @param schemaName The name of the schema
* @return true if the schemas have been loaded and the registries is
* consistent
*/
public boolean addSchemaFromClasspath(String schemaName) throws LdapException, IOException {
// To debug if your apacheds-schema.index isn't found:
// Enumeration<URL> indexes = getClass().getClassLoader().getResources("META-INF/apacheds-schema.index");
JarLdifSchemaLoader schemaLoader = new JarLdifSchemaLoader();
Schema schema = schemaLoader.getSchema(schemaName);
return schema != null && getDirectoryService().getSchemaManager().load(schema);
}
Aggregations