use of org.apache.directory.api.ldap.model.schema.normalizers.BooleanNormalizer in project directory-ldap-api by apache.
the class SchemaManagerDelTest method testDeleteNonExistingNormalizer.
@Test
public void testDeleteNonExistingNormalizer() throws Exception {
SchemaManager schemaManager = loadSchema("system");
int nrSize = schemaManager.getNormalizerRegistry().size();
int goidSize = schemaManager.getGlobalOidRegistry().size();
Normalizer nr = new BooleanNormalizer();
nr.setOid("0.0");
assertFalse(schemaManager.delete(nr));
List<Throwable> errors = schemaManager.getErrors();
assertFalse(errors.isEmpty());
assertEquals(nrSize, schemaManager.getNormalizerRegistry().size());
assertEquals(goidSize, schemaManager.getGlobalOidRegistry().size());
}
use of org.apache.directory.api.ldap.model.schema.normalizers.BooleanNormalizer in project directory-ldap-api by apache.
the class SchemaManagerDelTest method testDeleteExistingNormalizer.
// =========================================================================
// MatchingRuleUse deletion tests
// -------------------------------------------------------------------------
// TODO
// =========================================================================
// NameForm deletion tests
// -------------------------------------------------------------------------
// TODO
// =========================================================================
// Normalizer deletion tests
// -------------------------------------------------------------------------
@Test
public void testDeleteExistingNormalizer() throws Exception {
SchemaManager schemaManager = loadSchema("system");
int nrSize = schemaManager.getNormalizerRegistry().size();
int goidSize = schemaManager.getGlobalOidRegistry().size();
Normalizer nr = new BooleanNormalizer();
nr.setOid("0.1.1");
assertTrue(schemaManager.add(nr));
assertEquals(nrSize + 1, schemaManager.getNormalizerRegistry().size());
assertEquals(goidSize, schemaManager.getGlobalOidRegistry().size());
// FIXME this lookup is failing ! but it shouldn't be
nr = schemaManager.lookupNormalizerRegistry("0.1.1");
assertNotNull(nr);
assertTrue(schemaManager.delete(nr));
try {
schemaManager.lookupNormalizerRegistry("0.1.1");
fail();
} catch (Exception e) {
// expected
}
assertEquals(nrSize, schemaManager.getNormalizerRegistry().size());
assertEquals(goidSize, schemaManager.getGlobalOidRegistry().size());
}
Aggregations