directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r437693 - /directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java
Date Mon, 28 Aug 2006 13:09:59 GMT
Author: elecharny
Date: Mon Aug 28 06:09:59 2006
New Revision: 437693

URL: http://svn.apache.org/viewvc?rev=437693&view=rev
Log:
- Reformated the PDUs
- Fixed the tests and added one to check throwed Exceptions

Modified:
    directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java

Modified: directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java?rev=437693&r1=437692&r2=437693&view=diff
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java
Mon Aug 28 06:09:59 2006
@@ -38,7 +38,11 @@
 import org.apache.directory.shared.ldap.codec.LdapDecoder;
 import org.apache.directory.shared.ldap.codec.LdapMessage;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.ResponseCarryingException;
 import org.apache.directory.shared.ldap.codec.add.AddRequest;
+import org.apache.directory.shared.ldap.message.AddResponseImpl;
+import org.apache.directory.shared.ldap.message.Message;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 import junit.framework.TestCase;
@@ -61,28 +65,33 @@
         ByteBuffer stream = ByteBuffer.allocate( 0x59 );
 
         stream.put( new byte[]
-            { 0x30, 0x57, // LDAPMessage ::= SEQUENCE {
-                0x02, 0x01, 0x01, // messageID MessageID
-                0x68, 0x52, // CHOICE { ..., addRequest AddRequest, ...
-                // AddRequest ::= [APPLICATION 8] SEQUENCE {
-                // entry LDAPDN,
-                0x04, 0x20, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y',
',', 'o', 'u', '=', 'u',
+            { 
+            0x30, 0x57,                 // LDAPMessage ::= SEQUENCE {
+              0x02, 0x01, 0x01,         // messageID MessageID
+              0x68, 0x52,               // CHOICE { ..., addRequest AddRequest, ...
+                                        // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                                        // entry LDAPDN,
+                0x04, 0x20, 
+                'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o',
'u', '=', 'u',
                 's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
-                // attributes AttributeList }
-                0x30, 0x2E, // AttributeList ::= SEQUENCE OF SEQUENCE {
-                0x30, 0x0c, // attribute 1
-                0x04, 0x01, 'l', // type AttributeDescription,
-                0x31, 0x07, // vals SET OF AttributeValue }
-                0x04, 0x05, 'P', 'a', 'r', 'i', 's',
-
-                0x30, 0x1E, // attribute 2
-                // type AttributeDescription,
-                0x04, 0x05, 'a', 't', 't', 'r', 's', 0x31, 0x15, // vals SET
-                                                                    // OF
-                                                                    // AttributeValue
-                                                                    // }
-                0x04, 0x05, 't', 'e', 's', 't', '1', 0x04, 0x05, 't', 'e', 's', 't', '2',
0x04, 0x05, 't', 'e', 's',
-                't', '3', } );
+                                        // attributes AttributeList }
+                0x30, 0x2E,             // AttributeList ::= SEQUENCE OF SEQUENCE {
+                  0x30, 0x0c,           // attribute 1
+                    0x04, 0x01, 'l',    // type AttributeDescription,
+                    0x31, 0x07,         // vals SET OF AttributeValue }
+                      0x04, 0x05, 'P', 'a', 'r', 'i', 's',
+
+                  0x30, 0x1E,           // attribute 2
+                                        // type AttributeDescription,
+                    0x04, 0x05, 'a', 't', 't', 'r', 's', 
+                    0x31, 0x15,         // vals SET
+                                        // OF
+                                        // AttributeValue
+                                        // }
+                      0x04, 0x05, 't', 'e', 's', 't', '1', 
+                      0x04, 0x05, 't', 'e', 's', 't', '2', 
+                      0x04, 0x05, 't', 'e', 's', 't', '3', 
+            } );
 
         String decodedPdu = StringTools.dumpBytes( stream.array() );
         stream.flip();
@@ -191,9 +200,10 @@
         ByteBuffer stream = ByteBuffer.allocate( 0x07 );
 
         stream.put( new byte[]
-            { 0x30, 0x05, // LDAPMessage ::= SEQUENCE {
-                0x02, 0x01, 0x01, // messageID MessageID
-                0x68, 0x00 // CHOICE { ..., addRequest AddRequest, ...
+            { 
+            0x30, 0x05, // LDAPMessage ::= SEQUENCE {
+              0x02, 0x01, 0x01, // messageID MessageID
+              0x68, 0x00 // CHOICE { ..., addRequest AddRequest, ...
             } );
 
         stream.flip();
@@ -226,27 +236,31 @@
         ByteBuffer stream = ByteBuffer.allocate( 0x39 );
 
         stream.put( new byte[]
-            { 0x30, 0x37, // LDAPMessage ::= SEQUENCE {
-                0x02, 0x01, 0x01, // messageID MessageID
-                0x68, 0x26, // CHOICE { ..., addRequest AddRequest, ...
-                // AddRequest ::= [APPLICATION 8] SEQUENCE {
-                // entry LDAPDN,
+            { 
+            0x30, 0x37,                 // LDAPMessage ::= SEQUENCE {
+              0x02, 0x01, 0x01,         // messageID MessageID
+              0x68, 0x26,               // CHOICE { ..., addRequest AddRequest, ...
+                                        // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                                        // entry LDAPDN,
                 0x04, 0x00,
-                // attributes AttributeList }
-                0x30, 0x2E, // AttributeList ::= SEQUENCE OF SEQUENCE {
-                0x30, 0x0c, // attribute 1
-                0x04, 0x01, 'l', // type AttributeDescription,
-                0x31, 0x07, // vals SET OF AttributeValue }
-                0x04, 0x05, 'P', 'a', 'r', 'i', 's',
-
-                0x30, 0x1E, // attribute 2
-                // type AttributeDescription,
-                0x04, 0x05, 'a', 't', 't', 'r', 's', 0x31, 0x15, // vals SET
-                                                                    // OF
-                                                                    // AttributeValue
-                                                                    // }
-                0x04, 0x05, 't', 'e', 's', 't', '1', 0x04, 0x05, 't', 'e', 's', 't', '2',
0x04, 0x05, 't', 'e', 's',
-                't', '3', } );
+                                        // attributes AttributeList }
+                0x30, 0x2E,             // AttributeList ::= SEQUENCE OF SEQUENCE {
+                  0x30, 0x0c,           // attribute 1
+                    0x04, 0x01, 'l',    // type AttributeDescription,
+                    0x31, 0x07,         // vals SET OF AttributeValue }
+                      0x04, 0x05, 'P', 'a', 'r', 'i', 's',
+
+                  0x30, 0x1E,           // attribute 2
+                                        // type AttributeDescription,
+                    0x04, 0x05, 'a', 't', 't', 'r', 's', 
+                    0x31, 0x15,         // vals SET
+                                        // OF
+                                        // AttributeValue
+                                        // }
+                      0x04, 0x05, 't', 'e', 's', 't', '1', 
+                      0x04, 0x05, 't', 'e', 's', 't', '2', 
+                      0x04, 0x05, 't', 'e', 's', 't', '3', 
+            } );
 
         stream.flip();
 
@@ -260,13 +274,75 @@
         }
         catch ( DecoderException de )
         {
-            assertTrue( true );
+            assertTrue( de instanceof ResponseCarryingException );
+            Message response = ((ResponseCarryingException)de).getResponse();
+            assertTrue( response instanceof AddResponseImpl );
+            assertEquals( ResultCodeEnum.NAMINGVIOLATION, ((AddResponseImpl)response).getLdapResult().getResultCode()
);
             return;
         }
 
         fail( "We should not reach this point" );
     }
 
+    /**
+     * Test the decoding of a AddRequest
+     */
+    public void testDecodeAddRequestbadDN() throws NamingException
+    {
+        Asn1Decoder ldapDecoder = new LdapDecoder();
+
+        ByteBuffer stream = ByteBuffer.allocate( 0x59 );
+
+        stream.put( new byte[]
+            { 
+            0x30, 0x57,                 // LDAPMessage ::= SEQUENCE {
+              0x02, 0x01, 0x01,         // messageID MessageID
+              0x68, 0x52,               // CHOICE { ..., addRequest AddRequest, ...
+                                        // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                                        // entry LDAPDN,
+                0x04, 0x20, 
+                'c', 'n', ':', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o',
'u', '=', 'u',
+                's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+                                        // attributes AttributeList }
+                0x30, 0x2E,             // AttributeList ::= SEQUENCE OF SEQUENCE {
+                  0x30, 0x0c,           // attribute 1
+                    0x04, 0x01, 'l',    // type AttributeDescription,
+                    0x31, 0x07,         // vals SET OF AttributeValue }
+                      0x04, 0x05, 'P', 'a', 'r', 'i', 's',
+
+                  0x30, 0x1E,           // attribute 2
+                                        // type AttributeDescription,
+                    0x04, 0x05, 'a', 't', 't', 'r', 's', 
+                    0x31, 0x15,         // vals SET
+                                        // OF
+                                        // AttributeValue
+                                        // }
+                      0x04, 0x05, 't', 'e', 's', 't', '1', 
+                      0x04, 0x05, 't', 'e', 's', 't', '2', 
+                      0x04, 0x05, 't', 'e', 's', 't', '3', 
+            } );
+
+        stream.flip();
+
+        // Allocate a LdapMessage Container
+        IAsn1Container ldapMessageContainer = new LdapMessageContainer();
+
+        // Decode a AddRequest message
+        try
+        {
+            ldapDecoder.decode( stream, ldapMessageContainer );
+        }
+        catch ( DecoderException de )
+        {
+            assertTrue( de instanceof ResponseCarryingException );
+            Message response = ((ResponseCarryingException)de).getResponse();
+            assertTrue( response instanceof AddResponseImpl );
+            assertEquals( ResultCodeEnum.INVALIDDNSYNTAX, ((AddResponseImpl)response).getLdapResult().getResultCode()
);
+            return;
+        }
+
+        fail( "We should not reach this point" );
+    }
 
     /**
      * Test the decoding of a AddRequest with a null attributeList
@@ -278,15 +354,17 @@
         ByteBuffer stream = ByteBuffer.allocate( 0x2B );
 
         stream.put( new byte[]
-            { 0x30, 0x29, // LDAPMessage ::= SEQUENCE {
-                0x02, 0x01, 0x01, // messageID MessageID
-                0x68, 0x24, // CHOICE { ..., addRequest AddRequest, ...
-                // AddRequest ::= [APPLICATION 8] SEQUENCE {
-                // entry LDAPDN,
-                0x04, 0x20, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y',
',', 'o', 'u', '=', 'u',
-                's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
-                // attributes AttributeList }
-                0x30, 0x00, // AttributeList ::= SEQUENCE OF SEQUENCE {
+            { 
+            0x30, 0x29,                 // LDAPMessage ::= SEQUENCE {
+              0x02, 0x01, 0x01,         // messageID MessageID
+              0x68, 0x24,               // CHOICE { ..., addRequest AddRequest, ...
+                                        // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                                        // entry LDAPDN,
+                0x04, 0x20, 
+                  'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o',
'u', '=', 'u',
+                  's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+                                        // attributes AttributeList }
+                0x30, 0x00,             // AttributeList ::= SEQUENCE OF SEQUENCE {
             } );
 
         stream.flip();
@@ -319,16 +397,18 @@
         ByteBuffer stream = ByteBuffer.allocate( 0x2D );
 
         stream.put( new byte[]
-            { 0x30, 0x2B, // LDAPMessage ::= SEQUENCE {
-                0x02, 0x01, 0x01, // messageID MessageID
-                0x68, 0x26, // CHOICE { ..., addRequest AddRequest, ...
-                // AddRequest ::= [APPLICATION 8] SEQUENCE {
-                // entry LDAPDN,
-                0x04, 0x20, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y',
',', 'o', 'u', '=', 'u',
-                's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
-                // attributes AttributeList }
-                0x30, 0x02, // AttributeList ::= SEQUENCE OF SEQUENCE {
-                0x30, 0x00, // AttributeList ::= SEQUENCE OF SEQUENCE {
+            { 
+            0x30, 0x2B,                 // LDAPMessage ::= SEQUENCE {
+              0x02, 0x01, 0x01,         // messageID MessageID
+              0x68, 0x26,               // CHOICE { ..., addRequest AddRequest, ...
+                                        // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                                        // entry LDAPDN,
+                0x04, 0x20, 
+                  'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o',
'u', '=', 'u',
+                  's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+                                        // attributes AttributeList }
+                0x30, 0x02,             // AttributeList ::= SEQUENCE OF SEQUENCE {
+                  0x30, 0x00,           // AttributeList ::= SEQUENCE OF SEQUENCE {
             } );
 
         stream.flip();
@@ -361,17 +441,19 @@
         ByteBuffer stream = ByteBuffer.allocate( 0x2F );
 
         stream.put( new byte[]
-            { 0x30, 0x2D, // LDAPMessage ::= SEQUENCE {
-                0x02, 0x01, 0x01, // messageID MessageID
-                0x68, 0x28, // CHOICE { ..., addRequest AddRequest, ...
-                // AddRequest ::= [APPLICATION 8] SEQUENCE {
-                // entry LDAPDN,
-                0x04, 0x20, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y',
',', 'o', 'u', '=', 'u',
-                's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
-                // attributes AttributeList }
-                0x30, 0x04, // AttributeList ::= SEQUENCE OF SEQUENCE {
-                0x30, 0x02, // attribute 1
-                0x04, 0x00, // type AttributeDescription,
+            { 
+            0x30, 0x2D,                 // LDAPMessage ::= SEQUENCE {
+              0x02, 0x01, 0x01,         // messageID MessageID
+              0x68, 0x28,               // CHOICE { ..., addRequest AddRequest, ...
+                                        // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                                        // entry LDAPDN,
+                0x04, 0x20, 
+                  'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o',
'u', '=', 'u',
+                  's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+                                        // attributes AttributeList }
+                0x30, 0x04,             // AttributeList ::= SEQUENCE OF SEQUENCE {
+                  0x30, 0x02,           // attribute 1
+                    0x04, 0x00,         // type AttributeDescription,
             } );
 
         stream.flip();
@@ -386,7 +468,10 @@
         }
         catch ( DecoderException de )
         {
-            assertTrue( true );
+            assertTrue( de instanceof ResponseCarryingException );
+            Message response = ((ResponseCarryingException)de).getResponse();
+            assertTrue( response instanceof AddResponseImpl );
+            assertEquals( ResultCodeEnum.INVALIDATTRIBUTESYNTAX, ((AddResponseImpl)response).getLdapResult().getResultCode()
);
             return;
         }
 
@@ -404,17 +489,19 @@
         ByteBuffer stream = ByteBuffer.allocate( 0x30 );
 
         stream.put( new byte[]
-            { 0x30, 0x2E, // LDAPMessage ::= SEQUENCE {
-                0x02, 0x01, 0x01, // messageID MessageID
-                0x68, 0x29, // CHOICE { ..., addRequest AddRequest, ...
-                // AddRequest ::= [APPLICATION 8] SEQUENCE {
-                // entry LDAPDN,
-                0x04, 0x20, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y',
',', 'o', 'u', '=', 'u',
-                's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
-                // attributes AttributeList }
-                0x30, 0x05, // AttributeList ::= SEQUENCE OF SEQUENCE {
-                0x30, 0x03, // attribute 1
-                0x04, 0x01, 'A', // type AttributeDescription,
+            { 
+            0x30, 0x2E,                 // LDAPMessage ::= SEQUENCE {
+              0x02, 0x01, 0x01,         // messageID MessageID
+              0x68, 0x29,               // CHOICE { ..., addRequest AddRequest, ...
+                                        // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                                        // entry LDAPDN,
+                0x04, 0x20, 
+                  'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o',
'u', '=', 'u',
+                  's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+                                        // attributes AttributeList }
+                0x30, 0x05,             // AttributeList ::= SEQUENCE OF SEQUENCE {
+                  0x30, 0x03,           // attribute 1
+                    0x04, 0x01, 'A',    // type AttributeDescription,
             } );
 
         stream.flip();
@@ -447,18 +534,21 @@
         ByteBuffer stream = ByteBuffer.allocate( 0x32 );
 
         stream.put( new byte[]
-            { 0x30, 0x30, // LDAPMessage ::= SEQUENCE {
-                0x02, 0x01, 0x01, // messageID MessageID
-                0x68, 0x2B, // CHOICE { ..., addRequest AddRequest, ...
-                // AddRequest ::= [APPLICATION 8] SEQUENCE {
-                // entry LDAPDN,
-                0x04, 0x20, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y',
',', 'o', 'u', '=', 'u',
-                's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
-                // attributes AttributeList }
-                0x30, 0x07, // AttributeList ::= SEQUENCE OF SEQUENCE {
-                0x30, 0x05, // attribute 1
-                0x04, 0x01, 'A', // type AttributeDescription,
-                0x31, 0x00 } );
+            { 
+            0x30, 0x30,                 // LDAPMessage ::= SEQUENCE {
+              0x02, 0x01, 0x01,         // messageID MessageID
+              0x68, 0x2B,               // CHOICE { ..., addRequest AddRequest, ...
+                                        // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                                        // entry LDAPDN,
+                0x04, 0x20, 
+                  'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o',
'u', '=', 'u',
+                  's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+                                        // attributes AttributeList }
+                0x30, 0x07,             // AttributeList ::= SEQUENCE OF SEQUENCE {
+                  0x30, 0x05,           // attribute 1
+                    0x04, 0x01, 'A',    // type AttributeDescription,
+                    0x31, 0x00 
+            } );
 
         stream.flip();
 
@@ -490,18 +580,22 @@
         ByteBuffer stream = ByteBuffer.allocate( 0x34 );
 
         stream.put( new byte[]
-            { 0x30, 0x32, // LDAPMessage ::= SEQUENCE {
-                0x02, 0x01, 0x01, // messageID MessageID
-                0x68, 0x2D, // CHOICE { ..., addRequest AddRequest, ...
-                // AddRequest ::= [APPLICATION 8] SEQUENCE {
-                // entry LDAPDN,
-                0x04, 0x20, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y',
',', 'o', 'u', '=', 'u',
-                's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
-                // attributes AttributeList }
-                0x30, 0x09, // AttributeList ::= SEQUENCE OF SEQUENCE {
-                0x30, 0x07, // attribute 1
-                0x04, 0x01, 'l', // type AttributeDescription,
-                0x31, 0x02, 0x04, 0x00 } );
+            { 
+            0x30, 0x32,                 // LDAPMessage ::= SEQUENCE {
+              0x02, 0x01, 0x01,         // messageID MessageID
+              0x68, 0x2D,               // CHOICE { ..., addRequest AddRequest, ...
+                                        // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                                        // entry LDAPDN,
+                0x04, 0x20, 
+                  'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o',
'u', '=', 'u',
+                  's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+                                        // attributes AttributeList }
+                0x30, 0x09,             // AttributeList ::= SEQUENCE OF SEQUENCE {
+                  0x30, 0x07,           // attribute 1
+                    0x04, 0x01, 'l',    // type AttributeDescription,
+                  0x31, 0x02, 
+                    0x04, 0x00 
+            } );
 
         String decodedPdu = StringTools.dumpBytes( stream.array() );
         stream.flip();
@@ -575,20 +669,25 @@
         ByteBuffer stream = ByteBuffer.allocate( 0x51 );
 
         stream.put( new byte[]
-            { 0x30, 0x4F, // LDAPMessage ::= SEQUENCE {
-                0x02, 0x01, 0x01, // messageID MessageID
-                0x68, 0x2D, // CHOICE { ..., addRequest AddRequest, ...
-                // AddRequest ::= [APPLICATION 8] SEQUENCE {
-                // entry LDAPDN,
-                0x04, 0x20, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y',
',', 'o', 'u', '=', 'u',
-                's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
-                // attributes AttributeList }
-                0x30, 0x09, // AttributeList ::= SEQUENCE OF SEQUENCE {
-                0x30, 0x07, // attribute 1
-                0x04, 0x01, 'l', // type AttributeDescription,
-                0x31, 0x02, 0x04, 0x00, ( byte ) 0xA0, 0x1B, // A control
+            { 
+            0x30, 0x4F,                 // LDAPMessage ::= SEQUENCE {
+              0x02, 0x01, 0x01,         // messageID MessageID
+              0x68, 0x2D,               // CHOICE { ..., addRequest AddRequest, ...
+                                        // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                                        // entry LDAPDN,
+                0x04, 0x20, 
+                  'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o',
'u', '=', 'u',
+                  's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+                                        // attributes AttributeList }
+                0x30, 0x09,             // AttributeList ::= SEQUENCE OF SEQUENCE {
+                  0x30, 0x07,           // attribute 1
+                    0x04, 0x01, 'l',    // type AttributeDescription,
+                  0x31, 0x02, 
+                    0x04, 0x00, 
+              ( 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 } );
+                0x33, 0x37, 0x33, 0x30, 0x2E, 0x33, 0x2E, 0x34, 0x2E, 0x32 
+            } );
 
         String decodedPdu = StringTools.dumpBytes( stream.array() );
         stream.flip();



Mime
View raw message