directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r441703 - /directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/asn1ber/messages/bind/BindRequestDecoratorTest.java
Date Sat, 09 Sep 2006 00:43:29 GMT
Author: elecharny
Date: Fri Sep  8 17:43:28 2006
New Revision: 441703

URL: http://svn.apache.org/viewvc?view=rev&rev=441703
Log:
Completed the encoding test.

Modified:
    directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/asn1ber/messages/bind/BindRequestDecoratorTest.java

Modified: directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/asn1ber/messages/bind/BindRequestDecoratorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/asn1ber/messages/bind/BindRequestDecoratorTest.java?view=diff&rev=441703&r1=441702&r2=441703
==============================================================================
--- directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/asn1ber/messages/bind/BindRequestDecoratorTest.java
(original)
+++ directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/asn1ber/messages/bind/BindRequestDecoratorTest.java
Fri Sep  8 17:43:28 2006
@@ -21,10 +21,14 @@
 
 import java.nio.ByteBuffer;
 
+import javax.naming.ldap.Control;
+
 import org.apache.directory.shared.asn1.ber.tlv.ValueException;
 import org.apache.directory.shared.ldap.codec.EncoderException;
 import org.apache.directory.shared.ldap.codec.asn1ber.messages.bind.BindRequestAsn1Ber;
+import org.apache.directory.shared.ldap.messages.ConcreteControl;
 import org.apache.directory.shared.ldap.messages.Message;
+import org.apache.directory.shared.ldap.messages.MessageException;
 import org.apache.directory.shared.ldap.messages.bind.ConcreteBindRequest;
 import org.apache.directory.shared.ldap.messages.bind.BindRequest;
 import org.apache.directory.shared.ldap.messages.bind.ConcreteSaslCredentials;
@@ -52,7 +56,7 @@
     {
         BindRequest bindRequest = new ConcreteBindRequest( 1 );
         
-        bindRequest.setName( new LdapDN() );
+        bindRequest.setName( new LdapDN( "" ) );
         bindRequest.setVersion( 3 );
         
         ConcreteSimpleAuthentication simpleAuthentication = new ConcreteSimpleAuthentication();
@@ -77,7 +81,7 @@
     {
         BindRequest bindRequest = new ConcreteBindRequest( 1 );
         
-        bindRequest.setName( new LdapDN() );
+        bindRequest.setName( new LdapDN( "" ) );
         bindRequest.setVersion( 3 );
         
         ConcreteSaslCredentials saslCredentials = new ConcreteSaslCredentials();
@@ -97,7 +101,7 @@
      * Test the decoding of a BindRequest with Simple authentication and no
      * controls
      */
-    public void testDecodeBindRequestSimpleNoControls()
+    public void testEncodeBindRequestSimple() throws MessageException
     {
         ByteBuffer stream = ByteBuffer.allocate( 0x52 );
         stream.put( new byte[]
@@ -116,9 +120,9 @@
                   'p', 'a', 's', 's', 'w', 'o', 'r', 'd', 
               ( byte ) 0xA0, 0x1B, // A control
                 0x30, 0x19, 
-                  0x04, 0x17, 
-                    0x32, 0x2E, 0x31, 0x36, 0x2E, 0x38, 0x34, 0x30, 0x2E, 0x31, 0x2E, 0x31,
0x31, 0x33, 0x37, 0x33, 
-                    0x30, 0x2E, 0x33, 0x2E, 0x34, 0x2E, 0x32 
+                  0x04, 0x17,
+                    '2', '.', '1', '6', '.', '8', '4', '0', '.', '1', '.', '1', 
+                    '1', '3', '7', '3', '0', '.', '3', '.', '4', '.', '2'
             } );
 
         String decodedPdu = StringTools.dumpBytes( stream.array() );
@@ -127,13 +131,20 @@
         // Create a BindRequest message
         BindRequest bindRequest = new ConcreteBindRequest( 1 );
 
-        bindRequest.setName( new LdapDN() );
+        bindRequest.setName( new LdapDN( "uid=akarasulu,dc=example,dc=com" ) );
         bindRequest.setVersion( 3 );
         
         ConcreteSimpleAuthentication simpleAuthentication = new ConcreteSimpleAuthentication();
-        simpleAuthentication.setSimple( StringTools.getBytesUtf8( "test" ) );
+        simpleAuthentication.setSimple( StringTools.getBytesUtf8( "password" ) );
         
         bindRequest.setAuthentication( simpleAuthentication );
+        
+        Control control = new ConcreteControl();
+        ((ConcreteControl)control).setControlType( "2.16.840.1.113730.3.4.2" );
+        
+        ((Message)bindRequest).addControl( control );
+        
+        System.out.println( bindRequest);
         
         BindRequestAsn1Ber bindRequestDecorator = new BindRequestAsn1Ber( (Message)bindRequest
);
 



Mime
View raw message