directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1392053 - /directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SchemaPersistenceIT.java
Date Sun, 30 Sep 2012 15:52:39 GMT
Author: elecharny
Date: Sun Sep 30 15:52:39 2012
New Revision: 1392053

URL: http://svn.apache.org/viewvc?rev=1392053&view=rev
Log:
Added a test for DIRSERVER-1718

Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SchemaPersistenceIT.java

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SchemaPersistenceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SchemaPersistenceIT.java?rev=1392053&r1=1392052&r2=1392053&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SchemaPersistenceIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SchemaPersistenceIT.java
Sun Sep 30 15:52:39 2012
@@ -43,13 +43,19 @@ import javax.naming.directory.Modificati
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
+import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.server.core.annotations.CreateDS;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.server.core.integ.IntegrationUtils;
+import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
+import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
+import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.apache.directory.shared.ldap.model.schema.parsers.AttributeTypeDescriptionSchemaParser;
 import org.apache.directory.shared.ldap.util.JndiUtils;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -66,6 +72,16 @@ public class SchemaPersistenceIT extends
 {
     private static final String SUBSCHEMA_SUBENTRY = "subschemaSubentry";
     private static final AttributeTypeDescriptionSchemaParser ATTRIBUTE_TYPE_DESCRIPTION_SCHEMA_PARSER
= new AttributeTypeDescriptionSchemaParser();
+    public static SchemaManager schemaManager;
+    private static LdapConnection connection;
+
+
+    @Before
+    public void setup() throws Exception
+    {
+        connection = IntegrationUtils.getAdminConnection( getService() );
+        schemaManager = getService().getSchemaManager();
+    }
 
 
     /**
@@ -131,6 +147,58 @@ public class SchemaPersistenceIT extends
     }
 
 
+    /**
+     * Tests to see if we can create a schema with a mixed case name (see DIRSERVER-1718)
+     *
+     * @throws Exception on error
+     */
+    @Test
+    public void testAddSchemaMixedCase() throws Exception
+    {
+        try
+        {
+            Dn dn = new Dn( "cn=DuMMy,ou=schema" );
+
+            Entry dummySchema = new DefaultEntry(
+                dn,
+                "objectClass: top",
+                "objectClass: metaSchema",
+                "cn: DuMMy" );
+
+            connection.add( dummySchema );
+
+            assertNotNull( connection.lookup( "cn=dummy,ou=schema" ) );
+
+            // sync operation happens anyway on shutdowns but just to make sure we can do
it again
+            getService().sync();
+
+            getService().shutdown();
+            getService().startup();
+
+            // Check that the schema still exists
+            assertNotNull( connection.lookup( "cn=dummy,ou=schema" ) );
+
+            // Now, delete the schema
+            connection.delete( "cn=dummy,ou=schema" );
+
+            assertNull( connection.lookup( "cn=dummy,ou=schema" ) );
+
+            // sync operation happens anyway on shutdowns but just to make sure we can do
it again
+            getService().sync();
+
+            getService().shutdown();
+            getService().startup();
+
+            // Check that the schema does not exists
+            assertNull( connection.lookup( "cn=dummy,ou=schema" ) );
+        }
+        catch ( Exception e )
+        {
+            throw e;
+        }
+    }
+
+
     // -----------------------------------------------------------------------
     // Private Utility Methods
     // -----------------------------------------------------------------------



Mime
View raw message