directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r887142 - in /directory/shared/branches/shared-schema: ldap-schema-loader/src/test/java/org/apache/directory/server/schema/SchemaManagerTest.java ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/OidRegistry.java
Date Fri, 04 Dec 2009 10:10:18 GMT
Author: elecharny
Date: Fri Dec  4 10:10:18 2009
New Revision: 887142

URL: http://svn.apache.org/viewvc?rev=887142&view=rev
Log:
o The size() method for OidRegistryis now public
o Added some more check in the AT tests

Modified:
    directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/SchemaManagerTest.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/OidRegistry.java

Modified: directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/SchemaManagerTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/SchemaManagerTest.java?rev=887142&r1=887141&r2=887142&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/SchemaManagerTest.java
(original)
+++ directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/SchemaManagerTest.java
Fri Dec  4 10:10:18 2009
@@ -129,6 +129,11 @@
 
 
     //=========================================================================
+    // For each test, we will check many different things.
+    // If the test is successful, we want to know if the SchemaObject
+    // Registry has grown : its size must be one bigger. If the SchemaObject
+    // is not loadable, then the GlobalOidRegistry must also have grwon.
+    //=========================================================================
     // AttributeType addition tests
     //-------------------------------------------------------------------------
     // First, not defined superior
@@ -140,6 +145,8 @@
     public void testAddAttributeTypeNoSupNoSyntaxNoSuperior() throws Exception
     {
         SchemaManager schemaManager = loadSystem();
+        int atrSize = schemaManager.getAttributeTypeRegistry().size();
+        int goidSize = schemaManager.getOidRegistry().size();
 
         AttributeType attributeType = new AttributeType( "1.1.0" );
         attributeType.setEqualityOid( "2.5.13.1" );
@@ -156,6 +163,8 @@
         assertTrue( error instanceof LdapSchemaViolationException );
 
         assertFalse( isATPresent( schemaManager, "1.1.0" ) );
+        assertEquals( atrSize, schemaManager.getAttributeTypeRegistry().size() );
+        assertEquals( goidSize, schemaManager.getOidRegistry().size() );
     }
 
 
@@ -166,6 +175,8 @@
     public void testAddAttributeTypeNoSupCollectiveUser() throws Exception
     {
         SchemaManager schemaManager = loadSystem();
+        int atrSize = schemaManager.getAttributeTypeRegistry().size();
+        int goidSize = schemaManager.getOidRegistry().size();
 
         AttributeType attributeType = new AttributeType( "1.1.0" );
         attributeType.setEqualityOid( "2.5.13.1" );
@@ -179,6 +190,8 @@
         assertTrue( schemaManager.add( attributeType ) );
 
         assertTrue( isATPresent( schemaManager, "1.1.0" ) );
+        assertEquals( atrSize + 1, schemaManager.getAttributeTypeRegistry().size() );
+        assertEquals( goidSize + 1, schemaManager.getOidRegistry().size() );
     }
 
 
@@ -189,6 +202,8 @@
     public void testAddAttributeTypeNoSupCollectiveOperational() throws Exception
     {
         SchemaManager schemaManager = loadSystem();
+        int atrSize = schemaManager.getAttributeTypeRegistry().size();
+        int goidSize = schemaManager.getOidRegistry().size();
 
         AttributeType attributeType = new AttributeType( "1.1.0" );
         attributeType.setEqualityOid( "2.5.13.1" );
@@ -208,6 +223,8 @@
         assertTrue( error instanceof LdapSchemaViolationException );
 
         assertFalse( isATPresent( schemaManager, "1.1.0" ) );
+        assertEquals( atrSize, schemaManager.getAttributeTypeRegistry().size() );
+        assertEquals( goidSize, schemaManager.getOidRegistry().size() );
     }
 
 
@@ -218,6 +235,8 @@
     public void testAddAttributeTypeNoSupNoUserModificationUserAplication() throws Exception
     {
         SchemaManager schemaManager = loadSystem();
+        int atrSize = schemaManager.getAttributeTypeRegistry().size();
+        int goidSize = schemaManager.getOidRegistry().size();
 
         AttributeType attributeType = new AttributeType( "1.1.0" );
         attributeType.setEqualityOid( "2.5.13.1" );
@@ -237,6 +256,8 @@
         assertTrue( error instanceof LdapSchemaViolationException );
 
         assertFalse( isATPresent( schemaManager, "1.1.0" ) );
+        assertEquals( atrSize, schemaManager.getAttributeTypeRegistry().size() );
+        assertEquals( goidSize, schemaManager.getOidRegistry().size() );
     }
 
 
@@ -247,6 +268,8 @@
     public void testAddAttributeTypeNoSupNoUserModificationOpAttr() throws Exception
     {
         SchemaManager schemaManager = loadSystem();
+        int atrSize = schemaManager.getAttributeTypeRegistry().size();
+        int goidSize = schemaManager.getOidRegistry().size();
 
         AttributeType attributeType = new AttributeType( "1.1.0" );
         attributeType.setEqualityOid( "2.5.13.1" );
@@ -260,6 +283,8 @@
         assertTrue( schemaManager.add( attributeType ) );
 
         assertTrue( isATPresent( schemaManager, "1.1.0" ) );
+        assertEquals( atrSize + 1, schemaManager.getAttributeTypeRegistry().size() );
+        assertEquals( goidSize + 1, schemaManager.getOidRegistry().size() );
     }
 
 
@@ -270,6 +295,8 @@
     public void testAddAttributeTypeNoSupInvalidEqualityMR() throws Exception
     {
         SchemaManager schemaManager = loadSystem();
+        int atrSize = schemaManager.getAttributeTypeRegistry().size();
+        int goidSize = schemaManager.getOidRegistry().size();
 
         AttributeType attributeType = new AttributeType( "1.1.0" );
         attributeType.setEqualityOid( "0.0" );
@@ -288,6 +315,8 @@
         assertTrue( error instanceof LdapSchemaViolationException );
 
         assertFalse( isATPresent( schemaManager, "1.1.0" ) );
+        assertEquals( atrSize, schemaManager.getAttributeTypeRegistry().size() );
+        assertEquals( goidSize, schemaManager.getOidRegistry().size() );
     }
 
 
@@ -298,6 +327,8 @@
     public void testAddAttributeTypeNoSupInvalidOrderingMR() throws Exception
     {
         SchemaManager schemaManager = loadSystem();
+        int atrSize = schemaManager.getAttributeTypeRegistry().size();
+        int goidSize = schemaManager.getOidRegistry().size();
 
         AttributeType attributeType = new AttributeType( "1.1.0" );
         attributeType.setEqualityOid( null );
@@ -316,6 +347,8 @@
         assertTrue( error instanceof LdapSchemaViolationException );
 
         assertFalse( isATPresent( schemaManager, "1.1.0" ) );
+        assertEquals( atrSize, schemaManager.getAttributeTypeRegistry().size() );
+        assertEquals( goidSize, schemaManager.getOidRegistry().size() );
     }
 
 
@@ -326,6 +359,8 @@
     public void testAddAttributeTypeNoSupInvalidSubstringMR() throws Exception
     {
         SchemaManager schemaManager = loadSystem();
+        int atrSize = schemaManager.getAttributeTypeRegistry().size();
+        int goidSize = schemaManager.getOidRegistry().size();
 
         AttributeType attributeType = new AttributeType( "1.1.0" );
         attributeType.setEqualityOid( null );
@@ -344,6 +379,8 @@
         assertTrue( error instanceof LdapSchemaViolationException );
 
         assertFalse( isATPresent( schemaManager, "1.1.0" ) );
+        assertEquals( atrSize, schemaManager.getAttributeTypeRegistry().size() );
+        assertEquals( goidSize, schemaManager.getOidRegistry().size() );
     }
 
 
@@ -354,6 +391,8 @@
     public void testAddAttributeTypeNoSupValidMR() throws Exception
     {
         SchemaManager schemaManager = loadSystem();
+        int atrSize = schemaManager.getAttributeTypeRegistry().size();
+        int goidSize = schemaManager.getOidRegistry().size();
 
         AttributeType attributeType = new AttributeType( "1.1.0" );
         attributeType.setEqualityOid( "2.5.13.1" );
@@ -366,6 +405,8 @@
         assertTrue( schemaManager.add( attributeType ) );
 
         assertTrue( isATPresent( schemaManager, "1.1.0" ) );
+        assertEquals( atrSize + 1, schemaManager.getAttributeTypeRegistry().size() );
+        assertEquals( goidSize + 1, schemaManager.getOidRegistry().size() );
     }
 
 
@@ -376,6 +417,8 @@
     public void testAddAttributeTypeAlreadyExist() throws Exception
     {
         SchemaManager schemaManager = loadSystem();
+        int atrSize = schemaManager.getAttributeTypeRegistry().size();
+        int goidSize = schemaManager.getOidRegistry().size();
 
         AttributeType attributeType = new AttributeType( "2.5.18.4" );
         attributeType.setEqualityOid( "2.5.13.1" );
@@ -397,6 +440,8 @@
         // Check that it hasen't changed
         AttributeType original = schemaManager.lookupAttributeTypeRegistry( "2.5.18.4" );
         assertEquals( "distinguishedNameMatch", original.getEqualityOid() );
+        assertEquals( atrSize, schemaManager.getAttributeTypeRegistry().size() );
+        assertEquals( goidSize, schemaManager.getOidRegistry().size() );
     }
 
 
@@ -411,6 +456,8 @@
     public void testAddAttributeTypeSupNoSyntaxNoSuperior() throws Exception
     {
         SchemaManager schemaManager = loadSystem();
+        int atrSize = schemaManager.getAttributeTypeRegistry().size();
+        int goidSize = schemaManager.getOidRegistry().size();
 
         AttributeType attributeType = new AttributeType( "1.1.0" );
         attributeType.setEqualityOid( null );
@@ -426,6 +473,8 @@
 
         assertEquals( "1.3.6.1.4.1.1466.115.121.1.12", result.getSyntaxOid() );
         assertEquals( "2.5.13.1", result.getEqualityOid() );
+        assertEquals( atrSize + 1, schemaManager.getAttributeTypeRegistry().size() );
+        assertEquals( goidSize + 1, schemaManager.getOidRegistry().size() );
     }
 
 
@@ -436,6 +485,8 @@
     public void testAddAttributeTypeSupDifferentUsage() throws Exception
     {
         SchemaManager schemaManager = loadSystem();
+        int atrSize = schemaManager.getAttributeTypeRegistry().size();
+        int goidSize = schemaManager.getOidRegistry().size();
 
         AttributeType attributeType = new AttributeType( "1.1.0" );
         attributeType.setEqualityOid( null );
@@ -454,6 +505,8 @@
         assertTrue( error instanceof LdapSchemaViolationException );
 
         assertFalse( isATPresent( schemaManager, "1.1.0" ) );
+        assertEquals( atrSize, schemaManager.getAttributeTypeRegistry().size() );
+        assertEquals( goidSize, schemaManager.getOidRegistry().size() );
     }
 
 
@@ -464,6 +517,8 @@
     public void testAddAttributeTypeSupWithOwnSup() throws Exception
     {
         SchemaManager schemaManager = loadSystem();
+        int atrSize = schemaManager.getAttributeTypeRegistry().size();
+        int goidSize = schemaManager.getOidRegistry().size();
 
         AttributeType attributeType = new AttributeType( "1.1.0" );
         attributeType.setEqualityOid( null );
@@ -482,6 +537,8 @@
         assertTrue( error instanceof LdapSchemaViolationException );
 
         assertFalse( isATPresent( schemaManager, "1.1.0" ) );
+        assertEquals( atrSize, schemaManager.getAttributeTypeRegistry().size() );
+        assertEquals( goidSize, schemaManager.getOidRegistry().size() );
     }
 
 
@@ -492,6 +549,8 @@
     public void testAddAttributeTypeSupBadSup() throws Exception
     {
         SchemaManager schemaManager = loadSystem();
+        int atrSize = schemaManager.getAttributeTypeRegistry().size();
+        int goidSize = schemaManager.getOidRegistry().size();
 
         AttributeType attributeType = new AttributeType( "1.1.0" );
         attributeType.setEqualityOid( null );
@@ -510,5 +569,7 @@
         assertTrue( error instanceof LdapSchemaViolationException );
 
         assertFalse( isATPresent( schemaManager, "1.1.0" ) );
+        assertEquals( atrSize, schemaManager.getAttributeTypeRegistry().size() );
+        assertEquals( goidSize, schemaManager.getOidRegistry().size() );
     }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/OidRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/OidRegistry.java?rev=887142&r1=887141&r2=887142&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/OidRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/OidRegistry.java
Fri Dec  4 10:10:18 2009
@@ -268,7 +268,7 @@
     /**
      * @return The number of stored OIDs
      */
-    protected int size()
+    public int size()
     {
         return byOid.size();
     }



Mime
View raw message