use of org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager in project directory-ldap-api by apache.
the class QuirkySchemaTest method testLoadMinimalSchema.
/**
* Try to load a very minimal (and correct) schema. It has just 'person' objectclass and all
* the necessary attributes, matching rules and syntaxes. Load it in strict mode.
* This test is here mostly to make sure that the test itself works.
*/
@Test
public void testLoadMinimalSchema() throws Exception {
LdapConnection connection = createFakeConnection("src/test/resources/schema-minimal.ldif");
DefaultSchemaLoader loader = new DefaultSchemaLoader(connection);
Collection<Schema> allEnabled = loader.getAllEnabled();
assertEquals(1, allEnabled.size());
Schema schema = allEnabled.iterator().next();
assertNotNull(schema);
assertEquals(26, schema.getContent().size());
SchemaManager schemaManager = new DefaultSchemaManager(loader);
boolean loaded = schemaManager.loadAllEnabled();
if (!loaded) {
fail("Schema load failed : " + Exceptions.printErrors(schemaManager.getErrors()));
}
assertTrue(schemaManager.getRegistries().getAttributeTypeRegistry().contains("cn"));
ObjectClass person = schemaManager.getRegistries().getObjectClassRegistry().lookup("person");
assertNotNull(person);
assertEquals(2, person.getMustAttributeTypes().size());
assertEquals(4, person.getMayAttributeTypes().size());
}
use of org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager 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.manager.impl.DefaultSchemaManager in project directory-ldap-api by apache.
the class SchemaAwareEntryTest method setUpBeforeClass.
/**
* @throws java.lang.Exception
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
exampleDn = new Dn("dc=example,dc=com");
schemaManager = new DefaultSchemaManager();
}
use of org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager in project directory-ldap-api by apache.
the class SchemaAwareValueSerializationTest method setup.
/**
* Initialize OIDs maps for normalization
*/
@BeforeClass
public static void setup() throws Exception {
schemaManager = new DefaultSchemaManager();
cn = schemaManager.getAttributeType("cn");
dc = schemaManager.getAttributeType("dc");
userCertificate = schemaManager.getAttributeType("userCertificate");
bv1 = new Value(userCertificate, DATA);
bv2 = new Value(userCertificate, Strings.EMPTY_BYTES);
bv3 = new Value(userCertificate, (byte[]) null);
bv1n = new Value(userCertificate, DATA);
bv2n = new Value(userCertificate, Strings.EMPTY_BYTES);
bv3n = new Value(userCertificate, (byte[]) null);
sv1 = new Value(cn, "test");
sv2 = new Value(dc, "");
sv3 = new Value(dc, (String) null);
sv1n = new Value(cn, "test");
sv2n = new Value(dc, "");
sv3n = new Value(dc, (String) null);
}
use of org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager in project directory-ldap-api by apache.
the class MultiThreadedTest method setup.
@BeforeClass
public static void setup() throws Exception {
schemaManager = new DefaultSchemaManager();
referenceDn = new Dn(schemaManager, "dc=example,dc=com");
sharedDn = new Dn(schemaManager, "dc=example,dc=com");
referenceRdn = new Rdn(schemaManager, "ou=system");
sharedRdn = new Rdn(schemaManager, "ou=system");
referenceAva = new Ava(schemaManager, "ou", "System");
sharedAva = new Ava(schemaManager, "ou", "System");
}
Aggregations