org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager Java Examples
The following examples show how to use
org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager.
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: SchemaManagerLoadTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "InetOrgPerson" and "core" schema, which depends on "system" and "cosine" */ @Test public void testLoadCoreAndInetOrgPerson() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); assertTrue( schemaManager.load( "system" ) ); assertTrue( schemaManager.load( "core", "cosine", "InetOrgPerson" ) ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 142, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 36, schemaManager.getComparatorRegistry().size() ); assertEquals( 42, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 35, schemaManager.getNormalizerRegistry().size() ); assertEquals( 50, schemaManager.getObjectClassRegistry().size() ); assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 66, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 300, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 4, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "cosine" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "InetOrgPerson" ) ); }
Example #2
Source File: SchemaManagerLoadWithDepsTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "Krb5Kdc" schema, which depends on "system" and "core" */ @Test public void testLoadKrb5Kdc() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); schemaManager.loadWithDeps( "Krb5Kdc" ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 107, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 36, schemaManager.getComparatorRegistry().size() ); assertEquals( 42, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 35, schemaManager.getNormalizerRegistry().size() ); assertEquals( 39, schemaManager.getObjectClassRegistry().size() ); assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 66, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 254, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 3, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "Krb5Kdc" ) ); }
Example #3
Source File: SchemaManagerLoadWithDepsTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "InetOrgPerson" schema, which depends on "system", "core" * and "cosine" */ @Test public void testLoadInetOrgPerson() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); schemaManager.loadWithDeps( "InetOrgPerson" ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 142, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 36, schemaManager.getComparatorRegistry().size() ); assertEquals( 42, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 35, schemaManager.getNormalizerRegistry().size() ); assertEquals( 50, schemaManager.getObjectClassRegistry().size() ); assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 66, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 300, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 4, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "cosine" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "InetOrgPerson" ) ); }
Example #4
Source File: SchemaManagerLoadWithDepsTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "nis" schema, which depends on "system", "core" and "cosine", * but is disabled */ @Test public void testLoadNis() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); schemaManager.loadWithDeps( "nis" ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 0, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 0, schemaManager.getComparatorRegistry().size() ); assertEquals( 0, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 0, schemaManager.getNormalizerRegistry().size() ); assertEquals( 0, schemaManager.getObjectClassRegistry().size() ); assertEquals( 0, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 0, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 0, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 0, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); assertNull( schemaManager.getRegistries().getLoadedSchema( "cosine" ) ); }
Example #5
Source File: SchemaManagerLoadWithDepsTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "other" schema, which depends on "system", "core", * "apache" and "apacheMeta" */ @Test public void testLoadOther() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); schemaManager.loadWithDeps( "other" ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 181, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 49, schemaManager.getComparatorRegistry().size() ); assertEquals( 55, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 48, schemaManager.getNormalizerRegistry().size() ); assertEquals( 66, schemaManager.getObjectClassRegistry().size() ); assertEquals( 66, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 78, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 380, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 5, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "apache" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "apacheMeta" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "other" ) ); }
Example #6
Source File: SchemaManagerLoadWithDepsTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "Collective" schema, which depends on "system" and "core" */ @Test public void testLoadCollective() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); schemaManager.loadWithDeps( "Collective" ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 105, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 36, schemaManager.getComparatorRegistry().size() ); assertEquals( 42, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 35, schemaManager.getNormalizerRegistry().size() ); assertEquals( 36, schemaManager.getObjectClassRegistry().size() ); assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 66, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 249, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 3, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "collective" ) ); }
Example #7
Source File: SchemaManagerLoadWithDepsTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "rfc2307bis" schema, which depends on "system", "nis" and "core", * but is disabled */ @Test public void testLoadRfc2307Bis() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); schemaManager.loadWithDeps( "rfc2307bis" ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 0, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 0, schemaManager.getComparatorRegistry().size() ); assertEquals( 0, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 0, schemaManager.getNormalizerRegistry().size() ); assertEquals( 0, schemaManager.getObjectClassRegistry().size() ); assertEquals( 0, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 0, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 0, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 0, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNull( schemaManager.getRegistries().getLoadedSchema( "nis" ) ); assertNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); }
Example #8
Source File: SchemaManagerLoadWithDepsTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "InetOrgPerson" and "core" schema, which depends on "system" and "cosine" */ @Test public void testLoadCoreAndInetOrgPerson() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); schemaManager.loadWithDeps( "core", "InetOrgPerson" ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 142, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 36, schemaManager.getComparatorRegistry().size() ); assertEquals( 42, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 35, schemaManager.getNormalizerRegistry().size() ); assertEquals( 50, schemaManager.getObjectClassRegistry().size() ); assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 66, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 300, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 4, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "cosine" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "InetOrgPerson" ) ); }
Example #9
Source File: SchemaManagerLoadWithDepsTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "InetOrgPerson", "core" and a disabled schema */ @Test public void testLoadCoreInetOrgPersonAndNis() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); schemaManager.loadWithDeps( "core", "nis", "InetOrgPerson" ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 142, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 36, schemaManager.getComparatorRegistry().size() ); assertEquals( 42, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 35, schemaManager.getNormalizerRegistry().size() ); assertEquals( 50, schemaManager.getObjectClassRegistry().size() ); assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 66, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 300, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 4, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "cosine" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "InetOrgPerson" ) ); }
Example #10
Source File: SchemaAwareValueSerializationTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * Initialize OIDs maps for normalization */ @BeforeAll public static void setup() throws Exception { schemaManager = new DefaultSchemaManager(); cn = schemaManager.getAttributeType( "cn" ); dc = schemaManager.getAttributeType( "dc" ); userCertificate = schemaManager.getAttributeType( "userCertificate" ); bv1 = new Value( userCertificate, DATA ); bv2 = new Value( userCertificate, Strings.EMPTY_BYTES ); bv3 = new Value( userCertificate, ( byte[] ) null ); bv1n = new Value( userCertificate, DATA ); bv2n = new Value( userCertificate, Strings.EMPTY_BYTES ); bv3n = new Value( userCertificate, ( byte[] ) null ); sv1 = new Value( cn, "test" ); sv2 = new Value( dc, "" ); sv3 = new Value( dc, ( String ) null ); sv1n = new Value( cn, "test" ); sv2n = new Value( dc, "" ); sv3n = new Value( dc, ( String ) null ); }
Example #11
Source File: LdifSchemaLoaderTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
@Test public void testLoader() throws Exception { SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( tmpFolder.toFile() ); extractor.extractOrCopy(); LdifSchemaLoader loader = new LdifSchemaLoader( new File( tmpFolder.toFile(), "schema" ) ); SchemaManager sm = new DefaultSchemaManager( loader ); boolean loaded = sm.loadAllEnabled(); if ( !loaded ) { fail( "Schema load failed : " + Exceptions.printErrors( sm.getErrors() ) ); } assertTrue( sm.getRegistries().getAttributeTypeRegistry().contains( "cn" ) ); }
Example #12
Source File: SchemaManagerLoadWithDepsTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "cosine" schema, which depends on "system" and "core" */ @Test public void testLoadCosine() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader.getAllSchemas() ); schemaManager.loadWithDeps( "cosine" ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 133, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 36, schemaManager.getComparatorRegistry().size() ); assertEquals( 42, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 35, schemaManager.getNormalizerRegistry().size() ); assertEquals( 49, schemaManager.getObjectClassRegistry().size() ); assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 66, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 290, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 3, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "cosine" ) ); }
Example #13
Source File: SchemaManagerLoadWithDepsTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "java" schema, which depends on "system" and "core" */ @Test public void testLoadJava() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); schemaManager.loadWithDeps( "Java" ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 99, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 36, schemaManager.getComparatorRegistry().size() ); assertEquals( 42, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 35, schemaManager.getNormalizerRegistry().size() ); assertEquals( 41, schemaManager.getObjectClassRegistry().size() ); assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 66, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 248, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 3, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "Java" ) ); }
Example #14
Source File: SchemaManagerLoadWithDepsTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "apacheMeta" schema, which depends on "system" */ @Test public void testLoadApacheMeta() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); schemaManager.loadWithDeps( "apacheMeta" ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 71, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 40, schemaManager.getComparatorRegistry().size() ); assertEquals( 40, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 40, schemaManager.getNormalizerRegistry().size() ); assertEquals( 22, schemaManager.getObjectClassRegistry().size() ); assertEquals( 63, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 64, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 197, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 2, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "apachemeta" ) ); }
Example #15
Source File: SchemaManagerLoadWithDepsTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "apache" schema, which depends on "system" and "core" */ @Test public void testLoadApache() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); schemaManager.loadWithDeps( "apache" ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 148, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 44, schemaManager.getComparatorRegistry().size() ); assertEquals( 50, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 43, schemaManager.getNormalizerRegistry().size() ); assertEquals( 53, schemaManager.getObjectClassRegistry().size() ); assertEquals( 62, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 73, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 324, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 3, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "apache" ) ); }
Example #16
Source File: SchemaManagerLoadWithDepsTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "core" schema, which depends on "system" */ @Test public void testLoadCore() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); schemaManager.loadWithDeps( "core" ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 92, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 36, schemaManager.getComparatorRegistry().size() ); assertEquals( 42, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 35, schemaManager.getNormalizerRegistry().size() ); assertEquals( 36, schemaManager.getObjectClassRegistry().size() ); assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 66, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 236, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 2, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); }
Example #17
Source File: SchemaManagerLoadWithDepsTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "system" schema */ @Test public void testLoadSystem() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); schemaManager.loadWithDeps( "system" ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 38, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 35, schemaManager.getComparatorRegistry().size() ); assertEquals( 35, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 35, schemaManager.getNormalizerRegistry().size() ); assertEquals( 9, schemaManager.getObjectClassRegistry().size() ); assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 59, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 141, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 1, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); }
Example #18
Source File: MatchingRuleTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
@BeforeAll public static void setup() throws Exception { tmpFolder = Files.createTempDirectory( MatchingRuleTest.class.getSimpleName() ); SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( tmpFolder.toFile() ); extractor.extractOrCopy(); LdifSchemaLoader loader = new LdifSchemaLoader( new File( tmpFolder.toFile(), "schema" ) ); schemaManager = new DefaultSchemaManager( loader ); for ( Schema schema : loader.getAllSchemas() ) { schema.enable(); } schemaManager.loadAllEnabled(); }
Example #19
Source File: SchemaManagerLoadTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "system" schema amone */ @Test public void testLoadSystem() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); assertTrue( schemaManager.load( "system" ) ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 38, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 35, schemaManager.getComparatorRegistry().size() ); assertEquals( 35, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 35, schemaManager.getNormalizerRegistry().size() ); assertEquals( 9, schemaManager.getObjectClassRegistry().size() ); assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 59, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 141, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 1, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); }
Example #20
Source File: SchemaManagerLoadTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * Test that we can't load a new schema with bad dependencies */ @Test public void loadNewSchemaBadDependencies() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); Schema dummy = new DefaultSchema( loader, "dummy" ); dummy.addDependencies( "bad" ); assertFalse( schemaManager.load( dummy ) ); assertFalse( schemaManager.getErrors().isEmpty() ); assertEquals( 0, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 0, schemaManager.getComparatorRegistry().size() ); assertEquals( 0, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 0, schemaManager.getNormalizerRegistry().size() ); assertEquals( 0, schemaManager.getObjectClassRegistry().size() ); assertEquals( 0, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 0, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 0, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 0, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNull( schemaManager.getRegistries().getLoadedSchema( "dummy" ) ); }
Example #21
Source File: SchemaManagerLoadTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "apache" schema, which depends on "system" and "core" */ @Test public void testLoadApache() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); assertTrue( schemaManager.load( "system" ) ); assertTrue( schemaManager.load( "core" ) ); assertTrue( schemaManager.load( "apache" ) ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 148, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 44, schemaManager.getComparatorRegistry().size() ); assertEquals( 50, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 43, schemaManager.getNormalizerRegistry().size() ); assertEquals( 53, schemaManager.getObjectClassRegistry().size() ); assertEquals( 62, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 73, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 324, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 3, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "apache" ) ); }
Example #22
Source File: SchemaManagerLoadTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "apacheMeta" schema, which depends on "system" */ @Test public void testLoadApacheMeta() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); assertTrue( schemaManager.load( "system" ) ); assertTrue( schemaManager.load( "apacheMeta" ) ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 71, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 40, schemaManager.getComparatorRegistry().size() ); assertEquals( 40, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 40, schemaManager.getNormalizerRegistry().size() ); assertEquals( 22, schemaManager.getObjectClassRegistry().size() ); assertEquals( 63, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 64, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 197, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 2, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "apachemeta" ) ); }
Example #23
Source File: SchemaManagerLoadTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "java" schema, which depends on "system" and "core" */ @Test public void testLoadJava() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); assertTrue( schemaManager.load( "system" ) ); assertTrue( schemaManager.load( "core" ) ); assertTrue( schemaManager.load( "Java" ) ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 99, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 36, schemaManager.getComparatorRegistry().size() ); assertEquals( 42, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 35, schemaManager.getNormalizerRegistry().size() ); assertEquals( 41, schemaManager.getObjectClassRegistry().size() ); assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 66, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 248, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 3, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "Java" ) ); }
Example #24
Source File: SchemaManagerLoadTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "other" schema, which depends on "system", "core", * "apache" and "apacheMeta". As we don't have any cross dependencies * with any of this other schemas, we can only load core and system */ @Test public void testLoadOther() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); assertTrue( schemaManager.load( "system" ) ); assertTrue( schemaManager.load( "core" ) ); assertTrue( schemaManager.load( "other" ) ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 92, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 36, schemaManager.getComparatorRegistry().size() ); assertEquals( 42, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 35, schemaManager.getNormalizerRegistry().size() ); assertEquals( 36, schemaManager.getObjectClassRegistry().size() ); assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 66, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 236, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 3, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "other" ) ); }
Example #25
Source File: SchemaManagerLoadTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "cosine" schema, which depends on "system" and "core" */ @Test public void testLoadCosine() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); assertTrue( schemaManager.load( "system" ) ); assertTrue( schemaManager.load( "core" ) ); assertTrue( schemaManager.load( "cosine" ) ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 133, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 36, schemaManager.getComparatorRegistry().size() ); assertEquals( 42, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 35, schemaManager.getNormalizerRegistry().size() ); assertEquals( 49, schemaManager.getObjectClassRegistry().size() ); assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 66, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 290, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 3, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "cosine" ) ); }
Example #26
Source File: SchemaManagerLoadTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * Test that we can load a new schema */ @Test public void loadNewSchema() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); Schema dummy = new DefaultSchema( loader, "dummy" ); assertTrue( schemaManager.load( dummy ) ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 0, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 0, schemaManager.getComparatorRegistry().size() ); assertEquals( 0, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 0, schemaManager.getNormalizerRegistry().size() ); assertEquals( 0, schemaManager.getObjectClassRegistry().size() ); assertEquals( 0, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 0, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 0, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 1, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "dummy" ) ); }
Example #27
Source File: SchemaManagerLoadTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "Collective" schema, which depends on "system" and "core" */ @Test public void testLoadCollective() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); assertTrue( schemaManager.load( "system" ) ); assertTrue( schemaManager.load( "core" ) ); assertTrue( schemaManager.load( "Collective" ) ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 105, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 36, schemaManager.getComparatorRegistry().size() ); assertEquals( 42, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 35, schemaManager.getNormalizerRegistry().size() ); assertEquals( 36, schemaManager.getObjectClassRegistry().size() ); assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 66, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 249, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 3, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "collective" ) ); }
Example #28
Source File: SchemaManagerLoadTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * test loading the "Krb5Kdc" schema, which depends on "system" and "core" */ @Test public void testLoadKrb5Kdc() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); assertTrue( schemaManager.load( "system" ) ); assertTrue( schemaManager.load( "core" ) ); assertTrue( schemaManager.load( "Krb5Kdc" ) ); assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 107, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 36, schemaManager.getComparatorRegistry().size() ); assertEquals( 42, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 35, schemaManager.getNormalizerRegistry().size() ); assertEquals( 39, schemaManager.getObjectClassRegistry().size() ); assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 66, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 254, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 3, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "core" ) ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( "Krb5Kdc" ) ); }
Example #29
Source File: SubtreeSpecificationParserTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * Initialization */ @BeforeAll public static void init() throws Exception { JarLdifSchemaLoader loader = new JarLdifSchemaLoader(); schemaManager = new DefaultSchemaManager( loader ); schemaManager.loadAllEnabled(); parser = new SubtreeSpecificationParser( schemaManager ); topOC = schemaManager.lookupObjectClassRegistry( "top" ); aliasOC = schemaManager.lookupObjectClassRegistry( "alias" ); countryOC = schemaManager.lookupObjectClassRegistry( "country" ); personOC = schemaManager.lookupObjectClassRegistry( "person" ); }
Example #30
Source File: SchemaManagerAddTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
private SchemaManager loadSystem() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); String schemaName = "system"; schemaManager.loadWithDeps( schemaName ); return schemaManager; }