* Try to inject an AttributeType with a superior and different USAGE
*/
@Test
public void testAddAttributeTypeSupDifferentUsage() throws Exception
{
SchemaManager schemaManager = loadSystem();
int atrSize = schemaManager.getAttributeTypeRegistry().size();
int goidSize = schemaManager.getGlobalOidRegistry().size();
MutableAttributeType attributeType = new MutableAttributeType( "1.1.0" );
attributeType.setEqualityOid( null );
attributeType.setOrderingOid( null );
attributeType.setSubstringOid( null );
attributeType.setSuperiorOid( "2.5.18.4" );
attributeType.setUsage( UsageEnum.DISTRIBUTED_OPERATION );
// It should fail
assertFalse( schemaManager.add( attributeType ) );
List<Throwable> errors = schemaManager.getErrors();
assertEquals( 1, errors.size() );
Throwable error = errors.get( 0 );
assertTrue( error instanceof LdapSchemaException );
assertFalse( isATPresent( schemaManager, "1.1.0" ) );
assertEquals( atrSize, schemaManager.getAttributeTypeRegistry().size() );
assertEquals( goidSize, schemaManager.getGlobalOidRegistry().size() );
}