// check that the nis schema is loaded and the dummy schema is loaded
assertTrue( IntegrationUtils.isEnabled( service, "nis" ) );
assertNotNull( IntegrationUtils.getLoadedSchemas( service ).get( "dummy" ) );
AttributeTypeRegistry atr = getAttributeTypeRegistry();
// double check and make sure an attribute from that schema is
// in the AttributeTypeRegistry
assertTrue( atr.hasAttributeType( TEST_ATTR_OID ) );
// now try to disable the test schema which should fail
// since it's dependent, the dummy schema, is enabled
ModificationItem[] mods = new ModificationItem[1];
Attribute attr = new BasicAttribute( "m-disabled", "TRUE" );
mods[0] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
try
{
schemaRoot.modifyAttributes( "cn=nis", mods );
fail( "attempt to disable schema with enabled dependents should fail" );
}
catch ( LdapOperationNotSupportedException e )
{
assertTrue( e.getResultCode().equals( ResultCodeEnum.UNWILLING_TO_PERFORM ) );
}
// now test that both schema are still loaded
assertTrue( IntegrationUtils.isEnabled( service, "nis" ) );
assertNotNull( IntegrationUtils.getLoadedSchemas( service ).get( "dummy" ) );
// double check and make sure the test attribute from the test
// schema is still loaded and present within the attr registry
assertTrue( atr.hasAttributeType( TEST_ATTR_OID ) );
}