Search in sources :

Example 1 with BooleanNormalizer

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());
}
Also used : BooleanNormalizer(org.apache.directory.api.ldap.model.schema.normalizers.BooleanNormalizer) Normalizer(org.apache.directory.api.ldap.model.schema.Normalizer) BooleanNormalizer(org.apache.directory.api.ldap.model.schema.normalizers.BooleanNormalizer) SchemaManager(org.apache.directory.api.ldap.model.schema.SchemaManager) DefaultSchemaManager(org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager) Test(org.junit.Test)

Example 2 with BooleanNormalizer

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());
}
Also used : BooleanNormalizer(org.apache.directory.api.ldap.model.schema.normalizers.BooleanNormalizer) Normalizer(org.apache.directory.api.ldap.model.schema.Normalizer) BooleanNormalizer(org.apache.directory.api.ldap.model.schema.normalizers.BooleanNormalizer) SchemaManager(org.apache.directory.api.ldap.model.schema.SchemaManager) DefaultSchemaManager(org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager) LdapProtocolErrorException(org.apache.directory.api.ldap.model.exception.LdapProtocolErrorException) IOException(java.io.IOException) LdapException(org.apache.directory.api.ldap.model.exception.LdapException) Test(org.junit.Test)

Aggregations

Normalizer (org.apache.directory.api.ldap.model.schema.Normalizer)2 SchemaManager (org.apache.directory.api.ldap.model.schema.SchemaManager)2 BooleanNormalizer (org.apache.directory.api.ldap.model.schema.normalizers.BooleanNormalizer)2 DefaultSchemaManager (org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)1 LdapProtocolErrorException (org.apache.directory.api.ldap.model.exception.LdapProtocolErrorException)1