directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1073036 - in /directory: apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/kerberos/ shared/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/ shared/trunk/ldap-codec/src/main/java/org/apache/dire...
Date Mon, 21 Feb 2011 15:49:26 GMT
Author: elecharny
Date: Mon Feb 21 15:49:26 2011
New Revision: 1073036

URL: http://svn.apache.org/viewvc?rev=1073036&view=rev
Log:
o Using one single LdapDecoder for the client and the server
o Created a LdapMessaegContainer when a session is created on the client API
o Closing connections when done with them in tests

Removed:
    directory/shared/trunk/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/protocol/mina/LdapProtocolDecoder.java
Modified:
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/kerberos/KeyDerivationServiceIT.java
    directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
    directory/shared/trunk/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/protocol/mina/LdapProtocolCodecFactory.java

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/kerberos/KeyDerivationServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/kerberos/KeyDerivationServiceIT.java?rev=1073036&r1=1073035&r2=1073036&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/kerberos/KeyDerivationServiceIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/kerberos/KeyDerivationServiceIT.java
Mon Feb 21 15:49:26 2011
@@ -211,6 +211,7 @@ public class KeyDerivationServiceIT exte
 
         attrs = getPersonAttributes( "Nelson", "Horatio Nelson", "hnelson", "secret", "hnelson@EXAMPLE.COM"
);
         users.createSubcontext( "uid=hnelson", attrs );
+        ctx.close();
     }
 
 
@@ -281,6 +282,7 @@ public class KeyDerivationServiceIT exte
         }
 
         assertEquals( "Key version number", 0, keyVersionNumber );
+        ctx.close();
     }
 
 
@@ -417,6 +419,7 @@ public class KeyDerivationServiceIT exte
         }
 
         assertEquals( "Key version number", 3, keyVersionNumber );
+        ctx.close();
     }
 
 
@@ -547,6 +550,7 @@ public class KeyDerivationServiceIT exte
         }
 
         assertEquals( "Key version number", 3, keyVersionNumber );
+        ctx.close();
     }
 
 
@@ -653,6 +657,7 @@ public class KeyDerivationServiceIT exte
 
         assertTrue( DESKeySpec.isParityAdjusted( tquistKey, 0 ) );
         assertTrue( DESKeySpec.isParityAdjusted( jfryerKey, 0 ) );
+        ctx.close();
     }
 
 

Modified: directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=1073036&r1=1073035&r2=1073036&view=diff
==============================================================================
--- directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
(original)
+++ directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
Mon Feb 21 15:49:26 2011
@@ -28,7 +28,6 @@ import java.net.SocketAddress;
 import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -58,18 +57,12 @@ import org.apache.directory.ldap.client.
 import org.apache.directory.ldap.client.api.future.SearchFuture;
 import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.util.OID;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.api.BinaryAttributeDetector;
 import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.codec.api.LdapCodecServiceFactory;
 import org.apache.directory.shared.ldap.codec.api.MessageEncoderException;
-import org.apache.directory.shared.ldap.model.message.extended.AddNoDResponse;
-import org.apache.directory.shared.ldap.model.message.extended.BindNoDResponse;
-import org.apache.directory.shared.ldap.model.message.extended.CompareNoDResponse;
-import org.apache.directory.shared.ldap.model.message.extended.DeleteNoDResponse;
-import org.apache.directory.shared.ldap.model.message.extended.ExtendedNoDResponse;
-import org.apache.directory.shared.ldap.model.message.extended.ModifyDnNoDResponse;
-import org.apache.directory.shared.ldap.model.message.extended.ModifyNoDResponse;
-import org.apache.directory.shared.ldap.model.message.extended.NoticeOfDisconnect;
-import org.apache.directory.shared.ldap.model.message.extended.SearchNoDResponse;
+import org.apache.directory.shared.ldap.codec.decorators.MessageDecorator;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.cursor.Cursor;
 import org.apache.directory.shared.ldap.model.cursor.SearchCursor;
@@ -1663,6 +1656,10 @@ public class LdapNetworkConnection exten
                 response.setCause( realCause );
             }
         }
+        else
+        {
+            cause.printStackTrace();
+        }
     }
 
 
@@ -3459,6 +3456,38 @@ public class LdapNetworkConnection exten
 
 
     /**
+     * This method is called when a new session is created. We will store some
+     * informations that the session will need to process incoming requests.
+     * 
+     * @param session the newly created session
+     */
+    public void sessionCreated( IoSession session ) throws Exception
+    {
+        // Last, store the message container
+        LdapMessageContainer<? extends MessageDecorator<Message>> ldapMessageContainer
= 
+            new LdapMessageContainer<MessageDecorator<Message>>( 
+            codec,
+            new BinaryAttributeDetector()
+            {
+                public boolean isBinary( String id )
+                {
+                    try
+                    {
+                        AttributeType type = schemaManager.lookupAttributeTypeRegistry( id
);
+                        return !type.getSyntax().isHumanReadable();
+                    }
+                    catch ( Exception e )
+                    {
+                        return !Strings.isEmpty(id) && id.endsWith(";binary");
+                    }
+                }
+            } );
+
+        session.setAttribute( "messageContainer", ldapMessageContainer );
+    }
+
+
+    /**
      * {@inheritDoc}
      */
     @Override

Modified: directory/shared/trunk/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/protocol/mina/LdapProtocolCodecFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/protocol/mina/LdapProtocolCodecFactory.java?rev=1073036&r1=1073035&r2=1073036&view=diff
==============================================================================
--- directory/shared/trunk/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/protocol/mina/LdapProtocolCodecFactory.java
(original)
+++ directory/shared/trunk/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/protocol/mina/LdapProtocolCodecFactory.java
Mon Feb 21 15:49:26 2011
@@ -20,6 +20,7 @@
 package org.apache.directory.shared.ldap.codec.protocol.mina;
 
 
+import org.apache.directory.shared.ldap.codec.LdapDecoder;
 import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.mina.core.session.IoSession;
 import org.apache.mina.filter.codec.ProtocolCodecFactory;
@@ -64,7 +65,7 @@ public class LdapProtocolCodecFactory im
      */
     public ProtocolDecoder getDecoder( IoSession session )
     {
-        return new LdapProtocolDecoder();
+        return new LdapDecoder();
     }
 
 



Mime
View raw message