directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1243041 - in /directory/apacheds/trunk: interceptors/schema/src/main/java/org/apache/directory/server/core/schema/ ldap-client-test/src/test/java/org/apache/directory/shared/client/api/
Date Sat, 11 Feb 2012 12:03:57 GMT
Author: elecharny
Date: Sat Feb 11 12:03:56 2012
New Revision: 1243041

URL: http://svn.apache.org/viewvc?rev=1243041&view=rev
Log:
o Used the X-SCHEMA-AT constant in the server
o Added some tests in lda-api-client-test to check that we are correctly loading the schema
from the server

Added:
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
      - copied, changed from r1242044, directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
Modified:
    directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/ServerSchemaLoaderTest.java

Modified: directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java?rev=1243041&r1=1243040&r2=1243041&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
(original)
+++ directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
Sat Feb 11 12:03:56 2012
@@ -319,9 +319,9 @@ public class SchemaSubentryModifier
 
     private String getSchema( SchemaObject desc )
     {
-        if ( desc.getExtensions().containsKey( MetaSchemaConstants.X_SCHEMA ) )
+        if ( desc.getExtensions().containsKey( MetaSchemaConstants.X_SCHEMA_AT ) )
         {
-            return desc.getExtensions().get( MetaSchemaConstants.X_SCHEMA ).get( 0 );
+            return desc.getExtensions().get( MetaSchemaConstants.X_SCHEMA_AT ).get( 0 );
         }
 
         return MetaSchemaConstants.SCHEMA_OTHER;

Copied: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
(from r1242044, directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java?p2=directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java&p1=directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java&r1=1242044&r2=1243041&rev=1243041&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
Sat Feb 11 12:03:56 2012
@@ -41,7 +41,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.shared.ldap.codec.api.ConfigurableBinaryAttributeDetector;
 import org.apache.directory.shared.ldap.codec.api.DefaultConfigurableBinaryAttributeDetector;
-import org.apache.directory.shared.ldap.codec.api.SchemaBinaryAttributeDetector;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.cursor.EntryCursor;
 import org.apache.directory.shared.ldap.model.entry.Entry;
@@ -166,6 +165,7 @@ public class LdapConnectionTest extends 
     @Test
     public void testRetrieveBinaryAttibute() throws Exception
     {
+        // test with a local connection using a local BinaryAttributeDetector
         LdapConnectionConfig config = new LdapConnectionConfig();
         config.setLdapHost( "localhost" );
         config.setLdapPort( ldapServer.getPort() );
@@ -174,16 +174,12 @@ public class LdapConnectionTest extends 
         config.setBinaryAttributeDetector( new DefaultConfigurableBinaryAttributeDetector()
);
 
         LdapConnection myConnection = new LdapNetworkConnection( config );
-        myConnection.bind( "uid=admin,ou=system", "secret" );
-
-        // Use the default list of binary Attributes
-        Entry entry = myConnection.lookup( "uid=admin,ou=system" );
-        assertFalse( entry.get( SchemaConstants.USER_PASSWORD_AT ).get().isHumanReadable()
);
         
         // Remove the UserPassword from the list
         ((ConfigurableBinaryAttributeDetector)config.getBinaryAttributeDetector()).
             removeBinaryAttribute( "userPassword" );
-        entry = myConnection.lookup( "uid=admin,ou=system" );
+        myConnection.bind( "uid=admin,ou=system", "secret" );
+        Entry entry = myConnection.lookup( "uid=admin,ou=system" );
         assertTrue( entry.get( SchemaConstants.USER_PASSWORD_AT ).get().isHumanReadable()
);
         
         // Now, load a new binary Attribute
@@ -192,8 +188,11 @@ public class LdapConnectionTest extends 
         entry = myConnection.lookup( "uid=admin,ou=system" );
         assertFalse( entry.get( SchemaConstants.USER_PASSWORD_AT ).get().isHumanReadable()
);
 
-        connection.loadDefaultSchema();
+        // Now, test using the scerver's schema
+        ((LdapNetworkConnection)connection).loadSchema();
+        connection.bind( "uid=admin,ou=system", "secret" );
 
+        // Use the default list of binary Attributes
         entry = connection.lookup( "uid=admin,ou=system" );
         assertFalse( entry.get( SchemaConstants.USER_PASSWORD_AT ).get().isHumanReadable()
);
     }
@@ -282,14 +281,14 @@ public class LdapConnectionTest extends 
         LdapConnectionConfig config = new LdapConnectionConfig();
         config.setLdapHost( "localhost" );
         config.setLdapPort( ldapServer.getPort() );
-        config.setBinaryAttributeDetector( new SchemaBinaryAttributeDetector() );
+        config.setBinaryAttributeDetector( new DefaultConfigurableBinaryAttributeDetector()
);
         
         LdapConnection ldapConnection = new LdapNetworkConnection( config );
         
         ldapConnection.bind( "uid=admin,ou=system", "secret" );
         
-        // Try to retrieve a binary attribute : it should be seen as a String
+        // Try to retrieve a binary attribute : it should be seen as a byte[]
         Entry entry = ldapConnection.lookup( "uid=admin,ou=system" );
-        assertTrue( entry.get( SchemaConstants.USER_PASSWORD_AT ).get().isHumanReadable()
);
+        assertFalse( entry.get( SchemaConstants.USER_PASSWORD_AT ).get().isHumanReadable()
);
     }
 }

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/ServerSchemaLoaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/ServerSchemaLoaderTest.java?rev=1243041&r1=1243040&r2=1243041&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/ServerSchemaLoaderTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/ServerSchemaLoaderTest.java
Sat Feb 11 12:03:56 2012
@@ -28,7 +28,7 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 
 import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.SsseSchemaLoader;
+import org.apache.directory.ldap.client.api.DefaultSchemaLoader;
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
@@ -74,7 +74,7 @@ public class ServerSchemaLoaderTest exte
     public void testLoadSSSE() throws Exception
     {
         connection.setTimeOut( 0L );
-        SchemaLoader loader = new SsseSchemaLoader( connection );
+        SchemaLoader loader = new DefaultSchemaLoader( connection );
         
         // Load the schemas
         SchemaManager schemaManager = new DefaultSchemaManager( loader );



Mime
View raw message