* operations remove objectClasses.
*/
@Test
public void testPreventStructuralClassRemovalOnModifyRemoveAttribute() throws Exception
{
AttributeTypeRegistry atReg = registries.getAttributeTypeRegistry();
LdapDN name = new LdapDN( "uid=akarasulu,ou=users,dc=example,dc=com" );
ModificationOperation mod = ModificationOperation.REMOVE_ATTRIBUTE;
AttributeType ocAt = atReg.lookup( "objectClass" );
ServerAttribute entryObjectClasses = new DefaultServerAttribute( "objectClass", ocAt );
entryObjectClasses.add( "top", "person", "organizationalPerson" );
ObjectClassRegistry ocRegistry = registries.getObjectClassRegistry();
// this should pass
SchemaChecker.preventStructuralClassRemovalOnModifyRemove(
ocRegistry,
name,
mod,
new DefaultServerAttribute( "cn", atReg.lookup( "cn" ) ),
entryObjectClasses );
// this should succeed since person is left and is structural
ServerAttribute objectClassesRemoved = new DefaultServerAttribute(
"objectClass", ocAt );