Java Code Examples for org.apache.directory.api.ldap.model.schema.AttributeType#setSuperiorOid()
The following examples show how to use
org.apache.directory.api.ldap.model.schema.AttributeType#setSuperiorOid() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SchemaManagerAddTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * Try to inject an AttributeType with a superior and no Syntax : it should * take its superior' syntax and MR */ @Test public void testAddAttributeTypeSupNoSyntaxNoSuperior() throws Exception { SchemaManager schemaManager = loadSystem(); int atrSize = schemaManager.getAttributeTypeRegistry().size(); int goidSize = schemaManager.getGlobalOidRegistry().size(); AttributeType attributeType = new AttributeType( "1.1.0" ); attributeType.setEqualityOid( null ); attributeType.setOrderingOid( null ); attributeType.setSubstringOid( null ); attributeType.setSuperiorOid( "2.5.18.4" ); attributeType.setUsage( UsageEnum.DIRECTORY_OPERATION ); // It should not fail assertTrue( schemaManager.add( attributeType ) ); AttributeType result = schemaManager.lookupAttributeTypeRegistry( "1.1.0" ); assertEquals( "1.3.6.1.4.1.1466.115.121.1.12", result.getSyntaxOid() ); assertEquals( SchemaConstants.DISTINGUISHED_NAME_MATCH_MR_OID, result.getEqualityOid() ); assertEquals( atrSize + 1, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( goidSize + 1, schemaManager.getGlobalOidRegistry().size() ); }
Example 2
Source File: SchemaManagerAddTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * 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(); AttributeType attributeType = new AttributeType( "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() ); }
Example 3
Source File: SchemaManagerAddTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Try to inject an AttributeType with itself as a superior */ @Test public void testAddAttributeTypeSupWithOwnSup() throws Exception { SchemaManager schemaManager = loadSystem(); int atrSize = schemaManager.getAttributeTypeRegistry().size(); int goidSize = schemaManager.getGlobalOidRegistry().size(); AttributeType attributeType = new AttributeType( "1.1.0" ); attributeType.setEqualityOid( null ); attributeType.setOrderingOid( null ); attributeType.setSubstringOid( null ); attributeType.setSuperiorOid( "1.1.0" ); 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() ); }
Example 4
Source File: SchemaManagerAddTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Try to inject an AttributeType with a bad superior */ @Test public void testAddAttributeTypeSupBadSup() throws Exception { SchemaManager schemaManager = loadSystem(); int atrSize = schemaManager.getAttributeTypeRegistry().size(); int goidSize = schemaManager.getGlobalOidRegistry().size(); AttributeType attributeType = new AttributeType( "1.1.0" ); attributeType.setEqualityOid( null ); attributeType.setOrderingOid( null ); attributeType.setSubstringOid( null ); attributeType.setSuperiorOid( "0.0" ); 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() ); }
Example 5
Source File: SchemaManagerAddTest.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * Try to inject an AttributeType which is a subtype of a Collective AT */ @Test public void testAddAttributeTypeSupCollectiveUser() throws Exception { SchemaManager schemaManager = loadSystem(); int atrSize = schemaManager.getAttributeTypeRegistry().size(); int goidSize = schemaManager.getGlobalOidRegistry().size(); // Create the collective attribute first AttributeType attributeType = new AttributeType( "1.1.0" ); attributeType.setEqualityOid( SchemaConstants.DISTINGUISHED_NAME_MATCH_MR_OID ); attributeType.setOrderingOid( null ); attributeType.setSubstringOid( null ); attributeType.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.26" ); attributeType.setUsage( UsageEnum.USER_APPLICATIONS ); attributeType.setCollective( true ); // It should not fail assertTrue( schemaManager.add( attributeType ) ); assertTrue( isATPresent( schemaManager, "1.1.0" ) ); assertEquals( atrSize + 1, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( goidSize + 1, schemaManager.getGlobalOidRegistry().size() ); // Now try to create an AT which is a subtype of teh create collective attribute AttributeType subType = new AttributeType( "1.1.1" ); subType.setEqualityOid( SchemaConstants.DISTINGUISHED_NAME_MATCH_MR_OID ); subType.setOrderingOid( null ); subType.setSubstringOid( null ); subType.setSuperiorOid( "1.1.0" ); subType.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.26" ); subType.setUsage( UsageEnum.USER_APPLICATIONS ); subType.setCollective( false ); // It should fail assertFalse( schemaManager.add( subType ) ); assertFalse( isATPresent( schemaManager, "1.1.1" ) ); assertEquals( atrSize + 1, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( goidSize + 1, schemaManager.getGlobalOidRegistry().size() ); }