directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r452497 [9/9] - in /directory/trunks/shared/ldap/src: main/java/org/apache/directory/shared/ldap/codec/ main/java/org/apache/directory/shared/ldap/codec/abandon/ main/java/org/apache/directory/shared/ldap/codec/add/ main/java/org/apache/dir...
Date Tue, 03 Oct 2006 13:49:46 GMT
Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponseTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponseTest.java?view=diff&rev=452497&r1=452496&r2=452497
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponseTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponseTest.java Tue Oct  3 06:49:43 2006
@@ -131,25 +131,32 @@
         ByteBuffer stream = ByteBuffer.allocate( 0x41 );
 
         stream.put( new byte[]
-            { 0x30, 0x3F, // LDAPMessage ::= SEQUENCE {
-                0x02, 0x01, 0x01, // messageID MessageID
-                // CHOICE { ..., extendedResp ExtendedResponse, ...
-                0x78, 0x1D, // ExtendedResponse ::= [APPLICATION 23] SEQUENCE {
-                // COMPONENTS OF LDAPResult,
-                0x0A, 0x01, 0x00, // LDAPResult ::= SEQUENCE {
-                // resultCode ENUMERATED {
-                // success (0), ...
-                // },
-                0x04, 0x00, // matchedDN LDAPDN,
-                0x04, 0x00, // errorMessage LDAPString,
-                // referral [3] Referral OPTIONAL }
-                // responseName [10] LDAPOID OPTIONAL,
-                ( byte ) 0x8A, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5', '.', '2',
-                // response [11] OCTET STRING OPTIONAL }
-                ( byte ) 0x8B, 0x05, 'v', 'a', 'l', 'u', 'e', ( 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 } );
+            { 
+            0x30, 0x3F,                 // LDAPMessage ::= SEQUENCE {
+              0x02, 0x01, 0x01,         // messageID MessageID
+                                        // CHOICE { 
+                                        //    ..., 
+                                        //    extendedResp ExtendedResponse, 
+                                        //    ...
+              0x78, 0x1D,               // ExtendedResponse ::= [APPLICATION 23] SEQUENCE {
+                                        //   COMPONENTS OF LDAPResult,
+                0x0A, 0x01, 0x00,       //   LDAPResult ::= SEQUENCE {
+                                        //     resultCode ENUMERATED {
+                                        //         success (0), ...
+                                        //     },
+                0x04, 0x00,             //     matchedDN LDAPDN,
+                0x04, 0x00,             //     errorMessage LDAPString,
+                                        //     referral [3] Referral OPTIONAL }
+                ( byte ) 0x8A, 0x0D,    //   responseName [10] LDAPOID OPTIONAL,
+                  '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5', '.', '2',
+                ( byte ) 0x8B, 0x05,    // response [11] OCTET STRING OPTIONAL } 
+                  'v', 'a', 'l', 'u', 'e', 
+              ( byte ) 0xA0, 0x1B,      // A control
+                0x30, 0x19, 
+                  0x04, 0x17,
+                    '2', '.', '1', '6', '.', '8', '4', '0', '.', '1', '.', '1', 
+                    '1', '3', '7', '3', '0', '.', '3', '.', '4', '.', '2'
+            } );
 
         String decodedPdu = StringTools.dumpBytes( stream.array() );
         stream.flip();

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnectTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnectTest.java?view=diff&rev=452497&r1=452496&r2=452497
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnectTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnectTest.java Tue Oct  3 06:49:43 2006
@@ -274,15 +274,17 @@
         Asn1Decoder decoder = new GracefulDisconnectDecoder();
         ByteBuffer stream = ByteBuffer.allocate( 0x6A );
         stream.put( new byte[]
-            { 0x30, 0x68, // GracefulDisconnec ::= SEQUENCE {
-                0x30, 0x66, // replicatedContexts Referral OPTIONAL
-                0x04, 0x1F, 'l', 'd', 'a', 'p', ':', '/', '/', 'd', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', '.', 'a',
-                'p', 'a', 'c', 'h', 'e', '.', 'o', 'r', 'g', ':', '8', '0', '/', 0x04, 0x43, 'l', 'd', 'a', 'p', ':',
-                '/', '/', 'l', 'd', 'a', 'p', '.', 'n', 'e', 't', 's', 'c', 'a', 'p', 'e', '.', 'c', 'o', 'm', '/',
-                'o', '=', 'B', 'a', 'b', 's', 'c', 'o', ',', 'c', '=', 'U', 'S', '?', '?', '?', '(', 'i', 'n', 't',
-                '=', '%', '5', 'c', '0', '0', '%', '5', 'c', '0', '0', '%', '5', 'c', '0', '0', '%', '5', 'c', '0',
-                '4', ')'
-            // }
+            { 
+            0x30, 0x68,             // GracefulDisconnec ::= SEQUENCE {
+              0x30, 0x66,           // replicatedContexts Referral OPTIONAL
+                0x04, 0x1F, 
+                  'l', 'd', 'a', 'p', ':', '/', '/', 'd', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', '.', 'a',
+                  'p', 'a', 'c', 'h', 'e', '.', 'o', 'r', 'g', ':', '8', '0', '/', 
+                0x04, 0x43, 
+                  'l', 'd', 'a', 'p', ':', '/', '/', 'l', 'd', 'a', 'p', '.', 'n', 'e', 't', 's', 'c', 'a', 
+                  'p', 'e', '.', 'c', 'o', 'm', '/', 'o', '=', 'B', 'a', 'b', 's', 'c', 'o', ',', 'c', '=', 
+                  'U', 'S', '?', '?', '?', '(', 'i', 'n', 't', '=', '%', '5', 'c', '0', '0', '%', '5', 'c', 
+                  '0', '0', '%', '5', 'c', '0', '0', '%', '5', 'c', '0', '4', ')'
             } );
 
         String decodedPdu = StringTools.dumpBytes( stream.array() );

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java?view=diff&rev=452497&r1=452496&r2=452497
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java Tue Oct  3 06:49:43 2006
@@ -372,7 +372,7 @@
                     0x30, 0x0F,                     // type : description
                       0x04, 0x0B, 
                         0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6F, 0x6E, 
-                      0x31, 0x00,                   // Vals = null
+                    0x31, 0x00,                     // Vals = null
                   0x30, 0x25,                       // Modification
                     0x0A, 0x01, 0x00,               // Operation : Add
                     0x30, 0x20,                     // type : telephoneNumber

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestMatchingRuleAssertionTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestMatchingRuleAssertionTest.java?view=diff&rev=452497&r1=452496&r2=452497
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestMatchingRuleAssertionTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestMatchingRuleAssertionTest.java Tue Oct  3 06:49:43 2006
@@ -659,18 +659,19 @@
             { 
             0x30, 0x43, 
               0x02, 0x01, 0x04, // messageID
-              0x63, 0x3E, 0x04, 0x1F, // baseObject LDAPDN,
-                'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a',
-                'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', 
-              0x0A, 0x01, 0x01, 
-              0x0A, 0x01, 0x03, 
-              0x02, 0x01, 0x00, 
-              0x02, 0x01, 0x00, 
-              0x01, 0x01, ( byte ) 0xFF, 
-              ( byte ) 0xA9, 0x06, 
-                ( byte ) 0x83, 0x04, 't', 'e', 's', 't', 
-              0x30, 0x02, // AttributeDescriptionList ::= SEQUENCE OF AttributeDescription
-                0x04, 0x00 
+              0x63, 0x3E, 0x04, 
+                0x1F, // baseObject LDAPDN,
+                  'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a',
+                  'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', 
+                0x0A, 0x01, 0x01, 
+                0x0A, 0x01, 0x03, 
+                0x02, 0x01, 0x00, 
+                0x02, 0x01, 0x00, 
+                0x01, 0x01, ( byte ) 0xFF, 
+                ( byte ) 0xA9, 0x06, 
+                  ( byte ) 0x83, 0x04, 't', 'e', 's', 't', 
+                0x30, 0x02, // AttributeDescriptionList ::= SEQUENCE OF AttributeDescription
+                  0x04, 0x00 
             };
 
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -689,8 +690,7 @@
         }
         catch ( DecoderException de )
         {
-            assertTrue( true );
-            return;
+            fail( de.getMessage() );
         }
         catch ( NamingException ne )
         {
@@ -698,6 +698,33 @@
             fail( ne.getMessage() );
         }
 
-        fail( "We should not reach this point" );
+        LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
+        SearchRequest sr = message.getSearchRequest();
+
+        assertEquals( 4, message.getMessageId() );
+        assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
+        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
+        assertEquals( 0, sr.getSizeLimit() );
+        assertEquals( 0, sr.getTimeLimit() );
+        assertEquals( true, sr.isTypesOnly() );
+
+        // Extended
+        ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter ) sr.getFilter();
+        assertNotNull( extensibleMatchFilter );
+
+        assertNull( extensibleMatchFilter.getMatchingRule() );
+        assertNull( extensibleMatchFilter.getType() );
+        assertEquals( "test", extensibleMatchFilter.getMatchValue() );
+        assertFalse( extensibleMatchFilter.isDnAttributes() );
+
+        Attributes attributes = sr.getAttributes();
+
+        assertEquals( 1, attributes.size() );
+
+        for ( int i = 0; i < attributes.size(); i++ )
+        {
+            assertNull( attributes.get( "" ) );
+        }
     }
 }

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestSubstringTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestSubstringTest.java?view=diff&rev=452497&r1=452496&r2=452497
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestSubstringTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestSubstringTest.java Tue Oct  3 06:49:43 2006
@@ -39,7 +39,6 @@
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.search.SearchRequest;
 import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
-import org.apache.directory.shared.ldap.codec.util.LdapString;
 import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
 import org.apache.directory.shared.ldap.schema.OidNormalizer;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -81,27 +80,27 @@
 
         ByteBuffer stream = ByteBuffer.allocate( 0x64 );
         stream.put( new byte[]
-            { 0x30, 0x62, // LDAPMessage ::=SEQUENCE {
-                0x02, 0x01, 0x01, // messageID MessageID
-                0x63, 0x5D, // CHOICE { ..., searchRequest SearchRequest, ...
-                // SearchRequest ::= APPLICATION[3] SEQUENCE {
-                0x04, 0x1F, // baseObject LDAPDN,
-                'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a',
-                'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', 0x0A, 0x01, 0x01, // scope
-                                                                                            // ENUMERATED
-                                                                                            // {
-                // baseObject (0),
-                // singleLevel (1),
-                // wholeSubtree (2) },
-                0x0A, 0x01, 0x03, // derefAliases ENUMERATED {
-                // neverDerefAliases (0),
-                // derefInSearching (1),
-                // derefFindingBaseObj (2),
-                // derefAlways (3) },
-                // sizeLimit INTEGER (0 .. maxInt), (1000)
-                0x02, 0x02, 0x03, ( byte ) 0xE8,
-                // timeLimit INTEGER (0 .. maxInt), (1000)
-                0x02, 0x02, 0x03, ( byte ) 0xE8, 0x01, 0x01, ( byte ) 0xFF, // typesOnly
+            { 
+            0x30, 0x62,                     // LDAPMessage ::=SEQUENCE {
+              0x02, 0x01, 0x01,             //      messageID MessageID
+              0x63, 0x5D,                   //      CHOICE { ..., 
+                                            //          searchRequest SearchRequest, ...
+                                            // SearchRequest ::= APPLICATION[3] SEQUENCE {
+                0x04, 0x1F,                 //      baseObject LDAPDN,
+                  'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a',
+                  'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', 
+                0x0A, 0x01, 0x01,           //      scope ENUMERATED {
+                                            //          baseObject      (0),
+                                            //          singleLevel     (1),
+                                            //          wholeSubtree    (2) },
+                0x0A, 0x01, 0x03,           //      derefAliases ENUMERATED {
+                                            //          neverDerefAliases   (0),
+                                            //          derefInSearching    (1),
+                                            //          derefFindingBaseObj (2),
+                                            //          derefAlways         (3) },
+                0x02, 0x02, 0x03, ( byte ) 0xE8,    //      sizeLimit INTEGER (0 .. maxInt), (1000)
+                0x02, 0x02, 0x03, ( byte ) 0xE8,    // timeLimit INTEGER (0 .. maxInt), (1000) 
+                0x01, 0x01, ( byte ) 0xFF, // typesOnly
                                                                             // BOOLEAN,
                                                                             // (TRUE)
                 // filter Filter,
@@ -109,15 +108,17 @@
                 // substrings [4] SubstringFilter
                 // }
                 // SubstringFilter ::= SEQUENCE {
-                0x04, 0x0B, // type AttributeDescription,
-                'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's', 0x30, 0x03, ( byte ) 0x80, 0x01, 't', //
+                  0x04, 0x0B, // type AttributeDescription,
+                    'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's', 
+                  0x30, 0x03, 
+                    ( byte ) 0x80, 0x01, 't', //
                 0x30, 0x15, // AttributeDescriptionList ::= SEQUENCE OF
                             // AttributeDescription
-                0x04, 0x05, 'a', 't', 't', 'r', '0', // AttributeDescription
+                  0x04, 0x05, 'a', 't', 't', 'r', '0', // AttributeDescription
                                                         // ::= LDAPString
-                0x04, 0x05, 'a', 't', 't', 'r', '1', // AttributeDescription
+                  0x04, 0x05, 'a', 't', 't', 'r', '1', // AttributeDescription
                                                         // ::= LDAPString
-                0x04, 0x05, 'a', 't', 't', 'r', '2' // AttributeDescription ::=
+                  0x04, 0x05, 'a', 't', 't', 'r', '2' // AttributeDescription ::=
                                                     // LDAPString
             } );
 
@@ -408,7 +409,7 @@
 
         assertEquals( "objectclass", substringFilter.getType().toString() );
         assertEquals( null, substringFilter.getInitialSubstrings() );
-        assertEquals( "t", ( ( LdapString ) substringFilter.getAnySubstrings().get( 0 ) ).toString() );
+        assertEquals( "t", ( ( String ) substringFilter.getAnySubstrings().get( 0 ) ) );
         assertEquals( null, substringFilter.getFinalSubstrings() );
 
         // The attributes
@@ -530,7 +531,7 @@
 
         assertEquals( "objectclass", substringFilter.getType().toString() );
         assertEquals( null, substringFilter.getInitialSubstrings() );
-        assertEquals( "t", ( ( LdapString ) substringFilter.getAnySubstrings().get( 0 ) ).toString() );
+        assertEquals( "t", ( ( String ) substringFilter.getAnySubstrings().get( 0 ) ) );
         assertEquals( "t", substringFilter.getFinalSubstrings().toString() );
 
         // The attributes
@@ -653,7 +654,7 @@
 
         assertEquals( "objectclass", substringFilter.getType().toString() );
         assertEquals( "t", substringFilter.getInitialSubstrings().toString() );
-        assertEquals( "t", ( ( LdapString ) substringFilter.getAnySubstrings().get( 0 ) ).toString() );
+        assertEquals( "t", ( ( String ) substringFilter.getAnySubstrings().get( 0 ) ) );
         assertEquals( "t", substringFilter.getFinalSubstrings().toString() );
 
         // The attributes
@@ -775,7 +776,7 @@
 
         assertEquals( "objectclass", substringFilter.getType().toString() );
         assertEquals( "t", substringFilter.getInitialSubstrings().toString() );
-        assertEquals( "t", ( ( LdapString ) substringFilter.getAnySubstrings().get( 0 ) ).toString() );
+        assertEquals( "t", ( ( String ) substringFilter.getAnySubstrings().get( 0 ) ) );
 
         // The attributes
         Attributes attributes = sr.getAttributes();
@@ -817,46 +818,40 @@
 
         ByteBuffer stream = ByteBuffer.allocate( 0x6A );
         stream.put( new byte[]
-            { 0x30, 0x68, // LDAPMessage ::=SEQUENCE {
-                0x02, 0x01, 0x01, // messageID MessageID
-                0x63, 0x63, // CHOICE { ..., searchRequest SearchRequest, ...
-                // SearchRequest ::= APPLICATION[3] SEQUENCE {
-                0x04, 0x1F, // baseObject LDAPDN,
-                'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a',
-                'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', 0x0A, 0x01, 0x01, // scope
-                                                                                            // ENUMERATED
-                                                                                            // {
-                // baseObject (0),
-                // singleLevel (1),
-                // wholeSubtree (2) },
-                0x0A, 0x01, 0x03, // derefAliases ENUMERATED {
-                // neverDerefAliases (0),
-                // derefInSearching (1),
-                // derefFindingBaseObj (2),
-                // derefAlways (3) },
-                // sizeLimit INTEGER (0 .. maxInt), (1000)
-                0x02, 0x02, 0x03, ( byte ) 0xE8,
-                // timeLimit INTEGER (0 .. maxInt), (1000)
-                0x02, 0x02, 0x03, ( byte ) 0xE8, 0x01, 0x01, ( byte ) 0xFF, // typesOnly
-                                                                            // BOOLEAN,
-                                                                            // (TRUE)
-                // filter Filter,
-                ( byte ) 0xA4, 0x18, // Filter ::= CHOICE {
-                // substrings [4] SubstringFilter
-                // }
-                // SubstringFilter ::= SEQUENCE {
-                0x04, 0x0B, // type AttributeDescription,
-                'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's', 0x30, 0x09, ( byte ) 0x81, 0x01, 't', //
-                ( byte ) 0x81, 0x01, 't', //
-                ( byte ) 0x82, 0x01, 't', //
-                0x30, 0x15, // AttributeDescriptionList ::= SEQUENCE OF
-                            // AttributeDescription
-                0x04, 0x05, 'a', 't', 't', 'r', '0', // AttributeDescription
-                                                        // ::= LDAPString
-                0x04, 0x05, 'a', 't', 't', 'r', '1', // AttributeDescription
-                                                        // ::= LDAPString
-                0x04, 0x05, 'a', 't', 't', 'r', '2' // AttributeDescription ::=
-                                                    // LDAPString
+            { 
+            0x30, 0x68,                     // LDAPMessage ::=SEQUENCE {
+              0x02, 0x01, 0x01,             // messageID MessageID
+              0x63, 0x63,                   // CHOICE { ..., searchRequest SearchRequest, ...
+                                            // SearchRequest ::= APPLICATION[3] SEQUENCE {
+                0x04, 0x1F,                 // baseObject LDAPDN,
+                  'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a',
+                  'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', 
+                0x0A, 0x01, 0x01,           // scope ENUMERATED {
+                                            // baseObject (0),
+                                            // singleLevel (1),
+                                            // wholeSubtree (2) },
+                0x0A, 0x01, 0x03,           // derefAliases ENUMERATED {
+                                            // neverDerefAliases (0),
+                                            // derefInSearching (1),
+                                            // derefFindingBaseObj (2),
+                                            // derefAlways (3) },
+                0x02, 0x02, 0x03, ( byte ) 0xE8, // sizeLimit INTEGER (0 .. maxInt), (1000)
+                0x02, 0x02, 0x03, ( byte ) 0xE8, // timeLimit INTEGER (0 .. maxInt), (1000)
+                0x01, 0x01, ( byte ) 0xFF,  // typesOnly BOOLEAN, (TRUE)
+                                            // filter Filter,
+                ( byte ) 0xA4, 0x18,        // Filter ::= CHOICE {
+                                            // substrings [4] SubstringFilter }
+                                            // SubstringFilter ::= SEQUENCE {
+                  0x04, 0x0B,               // type AttributeDescription,
+                    'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's', 
+                  0x30, 0x09, 
+                    ( byte ) 0x81, 0x01, 't',
+                    ( byte ) 0x81, 0x01, 't',
+                    ( byte ) 0x82, 0x01, 't',
+                0x30, 0x15,                 // AttributeDescriptionList ::= SEQUENCE OF AttributeDescription
+                  0x04, 0x05, 'a', 't', 't', 'r', '0', // AttributeDescription ::= LDAPString
+                  0x04, 0x05, 'a', 't', 't', 'r', '1', // AttributeDescription ::= LDAPString
+                  0x04, 0x05, 'a', 't', 't', 'r', '2' // AttributeDescription ::= LDAPString
             } );
 
         String decodedPdu = StringTools.dumpBytes( stream.array() );
@@ -897,8 +892,8 @@
 
         assertEquals( "objectclass", substringFilter.getType().toString() );
         assertEquals( null, substringFilter.getInitialSubstrings() );
-        assertEquals( "t", ( ( LdapString ) substringFilter.getAnySubstrings().get( 0 ) ).toString() );
-        assertEquals( "t", ( ( LdapString ) substringFilter.getAnySubstrings().get( 1 ) ).toString() );
+        assertEquals( "t", ( ( String ) substringFilter.getAnySubstrings().get( 0 ) ) );
+        assertEquals( "t", ( ( String ) substringFilter.getAnySubstrings().get( 1 ) ) );
         assertEquals( "t", substringFilter.getFinalSubstrings().toString() );
 
         // The attributes
@@ -1020,7 +1015,7 @@
 
         assertEquals( "objectclass", substringFilter.getType().toString() );
         assertEquals( "t", substringFilter.getInitialSubstrings().toString() );
-        assertEquals( "*", ( ( LdapString ) substringFilter.getAnySubstrings().get( 0 ) ).toString() );
+        assertEquals( "*", ( ( String ) substringFilter.getAnySubstrings().get( 0 ) ) );
 
         // The attributes
         Attributes attributes = sr.getAttributes();
@@ -1140,11 +1135,11 @@
         SubstringFilter substringFilter = ( SubstringFilter ) sr.getFilter();
         assertNotNull( substringFilter );
 
-        assertEquals( "objectclass", substringFilter.getType().getString() );
+        assertEquals( "objectclass", substringFilter.getType() );
         assertEquals( null, substringFilter.getInitialSubstrings() );
-        assertEquals( "t", ( ( LdapString ) substringFilter.getAnySubstrings().get( 0 ) ).getString() );
-        assertEquals( "t", ( ( LdapString ) substringFilter.getAnySubstrings().get( 1 ) ).getString() );
-        assertEquals( "t", ( ( LdapString ) substringFilter.getAnySubstrings().get( 2 ) ).getString() );
+        assertEquals( "t", ( ( String ) substringFilter.getAnySubstrings().get( 0 ) ) );
+        assertEquals( "t", ( ( String ) substringFilter.getAnySubstrings().get( 1 ) ) );
+        assertEquals( "t", ( ( String ) substringFilter.getAnySubstrings().get( 2 ) ) );
         assertEquals( null, substringFilter.getFinalSubstrings() );
 
         // The attributes
@@ -1264,7 +1259,7 @@
         SubstringFilter substringFilter = ( SubstringFilter ) sr.getFilter();
         assertNotNull( substringFilter );
 
-        assertEquals( "objectclass", substringFilter.getType().getString() );
+        assertEquals( "objectclass", substringFilter.getType() );
         assertEquals( null, substringFilter.getInitialSubstrings() );
         assertEquals( 0, substringFilter.getAnySubstrings().size() );
         assertEquals( "Amos", substringFilter.getFinalSubstrings().toString() );

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java?view=diff&rev=452497&r1=452496&r2=452497
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java Tue Oct  3 06:49:43 2006
@@ -258,67 +258,55 @@
 
         ByteBuffer stream = ByteBuffer.allocate( 0x90 );
         stream.put( new byte[]
-            { 0x30, ( byte ) 0x81, ( byte ) 0x8D, // LDAPMessage ::=SEQUENCE {
-                0x02, 0x01, 0x01, // messageID MessageID
-                0x63, ( byte ) 0x81, ( byte ) 0x87, // CHOICE { ...,
-                                                    // searchRequest
-                                                    // SearchRequest, ...
-                // SearchRequest ::= APPLICATION[3] SEQUENCE {
-                0x04, 0x1F, // baseObject LDAPDN,
-                'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a',
-                'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', 0x0A, 0x01, 0x01, // scope
-                                                                                            // ENUMERATED
-                                                                                            // {
-                // baseObject (0),
-                // singleLevel (1),
-                // wholeSubtree (2) },
-                0x0A, 0x01, 0x03, // derefAliases ENUMERATED {
-                // neverDerefAliases (0),
-                // derefInSearching (1),
-                // derefFindingBaseObj (2),
-                // derefAlways (3) },
-                // sizeLimit INTEGER (0 .. maxInt), (1000)
-                0x02, 0x02, 0x03, ( byte ) 0xE8,
-                // timeLimit INTEGER (0 .. maxInt), (1000)
-                0x02, 0x02, 0x03, ( byte ) 0xE8, 0x01, 0x01, ( byte ) 0xFF, // typesOnly
-                                                                            // BOOLEAN,
-                                                                            // (TRUE)
-                // filter Filter,
-                ( byte ) 0xA0, 0x3C, // Filter ::= CHOICE {
-                // and [0] SET OF Filter,
-                ( byte ) 0xA1, 0x24, // or [1] SET of Filter,
-                ( byte ) 0xA8, 0x12, // approxMatch [8]
-                                        // AttributeValueAssertion,
-                // AttributeValueAssertion ::= SEQUENCE {
-                // attributeDesc AttributeDescription (LDAPString),
-                0x04, 0x0B, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's',
-                // assertionValue AssertionValue (OCTET STRING) }
-                0x04, 0x03, 't', 'o', 'p', ( byte ) 0xA6, 0x0E, // lessOrEqual
-                                                                // [3]
-                                                                // AttributeValueAssertion,
-                // AttributeValueAssertion ::= SEQUENCE {
-                0x04, 0x02, 'o', 'u', // attributeDesc AttributeDescription
-                                        // (LDAPString),
-                // assertionValue AssertionValue (OCTET STRING) }
-                0x04, 0x08, 'c', 'o', 'n', 't', 'a', 'c', 't', 's', ( byte ) 0xA2, 0x14, // not
-                                                                                            // [2]
-                                                                                            // Filter,
-                ( byte ) 0xA5, 0x12, // greaterOrEqual [5]
-                                        // AttributeValueAssertion,
-                // AttributeValueAssertion ::= SEQUENCE {
-                // attributeDesc AttributeDescription (LDAPString),
-                0x04, 0x0B, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's',
-                // assertionValue AssertionValue (OCTET STRING) }
-                0x04, 0x03, 't', 't', 't',
-                // attributes AttributeDescriptionList }
-                0x30, 0x15, // AttributeDescriptionList ::= SEQUENCE OF
-                            // AttributeDescription
-                0x04, 0x05, 'a', 't', 't', 'r', '0', // AttributeDescription
-                                                        // ::= LDAPString
-                0x04, 0x05, 'a', 't', 't', 'r', '1', // AttributeDescription
-                                                        // ::= LDAPString
-                0x04, 0x05, 'a', 't', 't', 'r', '2' // AttributeDescription ::=
-                                                    // LDAPString
+            { 
+            0x30, ( byte ) 0x81, ( byte ) 0x8D,             // LDAPMessage ::=SEQUENCE {
+              0x02, 0x01, 0x01,                             //     messageID MessageID
+              0x63, ( byte ) 0x81, ( byte ) 0x87,           //     CHOICE { ...,
+                                                            //         searchRequest SearchRequest, ...
+                                                            // SearchRequest ::= APPLICATION[3] SEQUENCE {
+                0x04, 0x1F,                                 //     baseObject LDAPDN,
+                  'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a',
+                  'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', 
+                0x0A, 0x01, 0x01,                           //     scope ENUMERATED {
+                                                            //         baseObject   (0),
+                                                            //         singleLevel  (1),
+                                                            //         wholeSubtree (2) },
+                0x0A, 0x01, 0x03,                           //     derefAliases ENUMERATED {
+                                                            //         neverDerefAliases (0),
+                                                            //         derefInSearching (1),
+                                                            //         derefFindingBaseObj (2),
+                                                            //         derefAlways (3) },
+                0x02, 0x02, 0x03, ( byte ) 0xE8,            //     sizeLimit INTEGER (0 .. maxInt), (1000)
+                0x02, 0x02, 0x03, ( byte ) 0xE8,            //     timeLimit INTEGER (0 .. maxInt), (1000) 
+                0x01, 0x01, ( byte ) 0xFF,                  //     typesOnly BOOLEAN, (TRUE)
+                                                            //     filter Filter,
+                ( byte ) 0xA0, 0x3C,                        // Filter ::= CHOICE {
+                                                            //      and [0] SET OF Filter,
+                  ( byte ) 0xA1, 0x24,                      //      or [1] SET of Filter,
+                    ( byte ) 0xA8, 0x12,                    //      approxMatch [8]
+                                                            // AttributeValueAssertion,
+                                                            // AttributeValueAssertion ::= SEQUENCE {
+                      0x04, 0x0B,                           // attributeDesc AttributeDescription (LDAPString),
+                        'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's',
+                      0x04, 0x03,                           // attributeDesc AttributeDescription (LDAPString), 
+                        't', 'o', 'p', 
+                    ( byte ) 0xA6, 0x0E,                    // lessOrEqual [3] AttributeValueAssertion,
+                      0x04, 0x02,                           // AttributeValueAssertion ::= SEQUENCE {
+                        'o', 'u',                           // attributeDesc AttributeDescription (LDAPString),
+                      0x04, 0x08,                           // assertionValue AssertionValue (OCTET STRING) } 
+                        'c', 'o', 'n', 't', 'a', 'c', 't', 's', 
+                  ( byte ) 0xA2, 0x14,                      // not [2] Filter,
+                    ( byte ) 0xA5, 0x12,                    // greaterOrEqual [5] AttributeValueAssertion,
+                                                            // AttributeValueAssertion ::= SEQUENCE {
+                      0x04, 0x0B,                           // attributeDesc AttributeDescription (LDAPString), 
+                        'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's',
+                      0x04, 0x03, 't', 't', 't',            // assertionValue AssertionValue (OCTET STRING) }
+                                                            // attributes AttributeDescriptionList }
+                0x30, 0x15,                                 // AttributeDescriptionList ::= SEQUENCE OF
+                                                            // AttributeDescription
+                0x04, 0x05, 'a', 't', 't', 'r', '0',        // AttributeDescription ::= LDAPString
+                0x04, 0x05, 'a', 't', 't', 'r', '1',        // AttributeDescription ::= LDAPString
+                0x04, 0x05, 'a', 't', 't', 'r', '2'         // AttributeDescription ::= LDAPString
             } );
 
         String decodedPdu = StringTools.dumpBytes( stream.array() );
@@ -864,29 +852,35 @@
     public void testDecodeSearchRequestWithControls()
     {
         byte[] asn1BER = new byte[]
-            { 0x30, 0x7f, 0x02, 0x01, 0x04, // messageID
-                0x63, 0x33, 0x04, 0x13, 0x64, 0x63, 0x3d, 0x6d, 0x79, 0x2d, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2c,
-                0x64, 0x63, 0x3d, 0x63, 0x6f, 0x6d, // baseObject:
-                                                    // dc=my-domain,dc=com
-                0x0a, 0x01, 0x02, // scope: subtree
-                0x0a, 0x01, 0x03, // derefAliases: derefAlways
-                0x02, 0x01, 0x00, // sizeLimit: 0
-                0x02, 0x01, 0x00, // timeLimit: 0
-                0x01, 0x01, 0x00, // typesOnly: false
-                ( byte ) 0x87, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x43, 0x6c, 0x61, 0x73, 0x73, // filter:
-                                                                                                        // (objectClass=*)
-                0x30, 0x00, ( byte ) 0xa0, 0x45, // controls
-                0x30, 0x28, 0x04, 0x16, 0x31, 0x2e, 0x32, 0x2e, 0x38, 0x34, 0x30, 0x2e, 0x31, 0x31, 0x33, 0x35, 0x35,
-                0x36, 0x2e, 0x31, 0x2e, 0x34, 0x2e, 0x33, 0x31, 0x39, // control
-                                                                        // oid:
-                                                                        // 1.2.840.113556.1.4.319
-                0x01, 0x01, ( byte ) 0xff, // criticality: false
-                0x04, 0x0b, 0x30, 0x09, 0x02, 0x01, 0x02, 0x04, 0x04, 0x47, 0x00, 0x00, 0x00, // value:
-                                                                                                // pageSize=2
-                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 // control
-                                                                            // oid:
-                                                                            // 2.16.840.1.113730.3.4.2
+            { 
+            0x30, 0x7f, 
+              0x02, 0x01, 0x04,                 // messageID
+              0x63, 0x33, 
+                0x04, 0x13,                     // baseObject
+                  'd', 'c', '=', 'm', 'y', '-', 'd', 'o', 'm', 'a', 'i', 
+                  'n', ',', 'd', 'c', '=', 'c', 'o', 'm',
+                0x0a, 0x01, 0x02,               // scope: subtree
+                0x0a, 0x01, 0x03,               // derefAliases: derefAlways
+                0x02, 0x01, 0x00,               // sizeLimit: 0
+                0x02, 0x01, 0x00,               // timeLimit: 0
+                0x01, 0x01, 0x00,               // typesOnly: false
+                ( byte ) 0x87, 0x0b,            // Present filter: (objectClass=*)
+                  'o', 'b', 'j', 'e', 'c', 't', 'C', 'l', 'a', 's', 's',
+                  0x30, 0x00,                   // Attributes = '*'
+                ( byte ) 0xa0, 0x45,            // controls
+                  0x30, 0x28, 
+                    0x04, 0x16,                 // control
+                      '1', '.', '2', '.', '8', '4', '0', '.', '1', '1', '3', 
+                      '5', '5', '6', '.', '1', '.', '4', '.', '3', '1', '9',
+                    0x01, 0x01, ( byte ) 0xff, // criticality: false
+                    0x04, 0x0b, 
+                      0x30, 0x09, 
+                        0x02, 0x01, 0x02, 
+                        0x04, 0x04, 0x47, 0x00, 0x00, 0x00, // value: pageSize=2
+                  0x30, 0x19, 
+                    0x04, 0x17, // control
+                      '2', '.', '1', '6', '.', '8', '4', '0', '.', '1', '.', '1',
+                      '1', '3', '7', '3', '0', '.', '3', '.', '4', '.', '2',
             };
 
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -937,7 +931,7 @@
         assertEquals( false, sr.isTypesOnly() );
 
         assertTrue( sr.getFilter() instanceof PresentFilter );
-        assertEquals( "objectClass", ( ( PresentFilter ) sr.getFilter() ).getAttributeDescription().getString() );
+        assertEquals( "objectClass", ( ( PresentFilter ) sr.getFilter() ).getAttributeDescription() );
 
         // Check the encoding
         try
@@ -1127,22 +1121,29 @@
     public void testDecodeSearchRequestSubEntryControl()
     {
         byte[] asn1BER = new byte[]
-            { 0x30, 0x5D, 0x02, 0x01, 0x04, // messageID
-                0x63, 0x33, 0x04, 0x13, 0x64, 0x63, 0x3d, 0x6d, 0x79, 0x2d, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2c,
-                0x64, 0x63, 0x3d, 0x63, 0x6f, 0x6d, // baseObject:
-                                                    // dc=my-domain,dc=com
-                0x0a, 0x01, 0x02, // scope: subtree
-                0x0a, 0x01, 0x03, // derefAliases: derefAlways
-                0x02, 0x01, 0x00, // sizeLimit: 0
-                0x02, 0x01, 0x00, // timeLimit: 0
-                0x01, 0x01, 0x00, // typesOnly: false
-                ( byte ) 0x87, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x43, 0x6c, 0x61, 0x73, 0x73, // filter:
-                                                                                                        // (objectClass=*)
-                0x30, 0x00, ( byte ) 0xa0, 0x23, // controls
-                0x30, 0x21, 0x04, 0x17, '1', '.', '3', '.', '6', '.', '1', '.', '4', '.', '1', '.', '4', '2', '0', '3',
-                '.', '1', '.', '1', '0', '.', '1', // SubEntry OID
-                0x01, 0x01, ( byte ) 0xFF, // criticality: true
-                0x04, 0x03, 0x01, 0x01, ( byte ) 0xFF // SubEntry visibility
+            { 
+            0x30, 0x5D, 
+              0x02, 0x01, 0x04,                 // messageID
+              0x63, 0x33, 
+                0x04, 0x13,                     // baseObject: dc=my-domain,dc=com
+                  'd', 'c', '=', 'm', 'y', '-', 'd', 'o', 'm', 'a', 
+                  'i', 'n', ',', 'd', 'c', '=', 'c', 'o', 'm',
+                0x0a, 0x01, 0x02,               // scope: subtree
+                0x0a, 0x01, 0x03,               // derefAliases: derefAlways
+                0x02, 0x01, 0x00,               // sizeLimit: 0
+                0x02, 0x01, 0x00,               // timeLimit: 0
+                0x01, 0x01, 0x00,               // typesOnly: false
+                ( byte ) 0x87, 0x0b,            // filter: (objectClass=*)
+                  'o', 'b', 'j', 'e', 'c', 't', 'C', 'l', 'a', 's', 's',
+                0x30, 0x00, 
+              ( byte ) 0xa0, 0x23,              // controls
+                0x30, 0x21, 
+                  0x04, 0x17, 
+                    '1', '.', '3', '.', '6', '.', '1', '.', '4', '.', '1', '.', '4', '2', '0', '3',
+                    '.', '1', '.', '1', '0', '.', '1', // SubEntry OID
+                  0x01, 0x01, ( byte ) 0xFF,    // criticality: true
+                  0x04, 0x03, 
+                    0x01, 0x01, ( byte ) 0xFF   // SubEntry visibility
             };
 
         Asn1Decoder ldapDecoder = new LdapDecoder();
@@ -1189,7 +1190,7 @@
         assertEquals( false, sr.isTypesOnly() );
 
         assertTrue( sr.getFilter() instanceof PresentFilter );
-        assertEquals( "objectClass", ( ( PresentFilter ) sr.getFilter() ).getAttributeDescription().getString() );
+        assertEquals( "objectClass", ( ( PresentFilter ) sr.getFilter() ).getAttributeDescription() );
 
         // Check the encoding
         try
@@ -2888,7 +2889,7 @@
         SubstringFilter substringFilter = ( SubstringFilter ) andFilters.get( 0 );
         assertNotNull( substringFilter );
 
-        assertEquals( "pgpuserid", substringFilter.getType().getString() );
+        assertEquals( "pgpuserid", substringFilter.getType() );
         assertEquals( "vgjokjev@netcetera.com.mk", substringFilter.getInitialSubstrings().toString() );
         assertEquals( 0, substringFilter.getAnySubstrings().size() );
         assertEquals( null, substringFilter.getFinalSubstrings() );

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java?view=diff&rev=452497&r1=452496&r2=452497
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java Tue Oct  3 06:49:43 2006
@@ -619,19 +619,25 @@
         ByteBuffer stream = ByteBuffer.allocate( 0x45 );
 
         stream.put( new byte[]
-            { 0x30, 0x43, // LDAPMessage ::=SEQUENCE {
-                0x02, 0x01, 0x01, // messageID MessageID
-                0x64, 0x21, // CHOICE { ..., searchResEntry SearchResultEntry,
-                            // ...
-                // SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
-                // objectName LDAPDN,
-                0x04, 0x1B, 'o', 'u', '=', 'c', 'o', 'n', 't', 'a', 'c', 't', 's', ',', 'd', 'c', '=', 'i', 'k', 't',
-                'e', 'k', ',', 'd', 'c', '=', 'c', 'o', 'm',
-                // attributes PartialAttributeList }
-                // PartialAttributeList ::= SEQUENCE OF SEQUENCE {
-                0x30, 0x02, 0x30, 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 } );
+            { 
+            0x30, 0x43,                 // LDAPMessage ::=SEQUENCE {
+              0x02, 0x01, 0x01,         // messageID MessageID
+              0x64, 0x21,               // CHOICE { ..., searchResEntry SearchResultEntry,
+                                        // ...
+                                        // SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
+                                        // objectName LDAPDN,
+                0x04, 0x1B, 
+                  'o', 'u', '=', 'c', 'o', 'n', 't', 'a', 'c', 't', 's', ',', 'd', 'c', '=', 
+                  'i', 'k', 't', 'e', 'k', ',', 'd', 'c', '=', 'c', 'o', 'm',
+                                        // attributes PartialAttributeList }
+                                        // PartialAttributeList ::= SEQUENCE OF SEQUENCE {
+                0x30, 0x02, 
+                  0x30, 0x00, 
+              ( byte ) 0xA0, 0x1B,      // A control
+                0x30, 0x19, 
+                  0x04, 0x17,
+                    '2', '.', '1', '6', '.', '8', '4', '0', '.', '1', '.', '1', 
+                    '1', '3', '7', '3', '0', '.', '3', '.', '4', '.', '2' } );
 
         stream.flip();
 

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlTest.java?view=diff&rev=452497&r1=452496&r2=452497
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlTest.java Tue Oct  3 06:49:43 2006
@@ -52,15 +52,13 @@
         Asn1Decoder decoder = new EntryChangeControlDecoder();
         ByteBuffer bb = ByteBuffer.allocate( 0x0D );
         bb.put( new byte[]
-            { 0x30, 0x0B, // EntryChangeNotification ::= SEQUENCE {
-                0x0A, 0x01, 0x08, // changeType ENUMERATED {
-                // modDN (8)
-                // }
-                0x04, 0x03, 'a', '=', 'b', // previousDN LDAPDN OPTIONAL, --
-                                            // modifyDN ops. only
-                0x02, 0x01, 0x10 // changeNumber INTEGER OPTIONAL -- if
-                                    // supported
-            // }
+            { 
+            0x30, 0x0B,                     // EntryChangeNotification ::= SEQUENCE {
+              0x0A, 0x01, 0x08,             //     changeType ENUMERATED {
+                                            //         modDN (8)
+                                            //     }
+              0x04, 0x03, 'a', '=', 'b',    //     previousDN LDAPDN OPTIONAL, -- modifyDN ops. only
+              0x02, 0x01, 0x10              //     changeNumber INTEGER OPTIONAL } -- if supported
             } );
         bb.flip();
 
@@ -90,13 +88,13 @@
         Asn1Decoder decoder = new EntryChangeControlDecoder();
         ByteBuffer bb = ByteBuffer.allocate( 0x08 );
         bb.put( new byte[]
-            { 0x30, 0x06, // EntryChangeNotification ::= SEQUENCE {
-                0x0A, 0x01, 0x01, // changeType ENUMERATED {
-                // Add (1)
-                // }
-                0x02, 0x01, 0x10 // changeNumber INTEGER OPTIONAL -- if
-                                    // supported
-            // }
+            { 
+            0x30, 0x06,             // EntryChangeNotification ::= SEQUENCE {
+              0x0A, 0x01, 0x01,     //     changeType ENUMERATED {
+                                    //         Add (1)
+                                    //     }
+              0x02, 0x01, 0x10      //     changeNumber INTEGER OPTIONAL -- if supported
+                                    // }
             } );
         bb.flip();
 
@@ -127,15 +125,15 @@
         Asn1Decoder decoder = new EntryChangeControlDecoder();
         ByteBuffer bb = ByteBuffer.allocate( 0x0D );
         bb.put( new byte[]
-            { 0x30, 0x0B, // EntryChangeNotification ::= SEQUENCE {
-                0x0A, 0x01, 0x01, // changeType ENUMERATED {
-                // ADD (1)
-                // }
-                0x04, 0x03, 'a', '=', 'b', // previousDN LDAPDN OPTIONAL, --
-                                            // modifyDN ops. only
-                0x02, 0x01, 0x10 // changeNumber INTEGER OPTIONAL -- if
-                                    // supported
-            // }
+            { 
+            0x30, 0x0B,                     // EntryChangeNotification ::= SEQUENCE {
+              0x0A, 0x01, 0x01,             //     changeType ENUMERATED {
+                                            //         ADD (1)
+                                            //     }
+              0x04, 0x03, 'a', '=', 'b',    //     previousDN LDAPDN OPTIONAL, --
+                                            //     modifyDN ops. only
+              0x02, 0x01, 0x10              //     changeNumber INTEGER OPTIONAL -- if supported
+                                            // }
             } );
         bb.flip();
 
@@ -164,11 +162,12 @@
         Asn1Decoder decoder = new EntryChangeControlDecoder();
         ByteBuffer bb = ByteBuffer.allocate( 0x05 );
         bb.put( new byte[]
-            { 0x30, 0x03, // EntryChangeNotification ::= SEQUENCE {
-                0x0A, 0x01, 0x01, // changeType ENUMERATED {
-            // ADD (1)
-            // }
-            // }
+            { 
+            0x30, 0x03,                 // EntryChangeNotification ::= SEQUENCE {
+              0x0A, 0x01, 0x01,         //     changeType ENUMERATED {
+                                        //         ADD (1)
+                                        //     }
+                                        // }
             } );
         bb.flip();
 
@@ -200,11 +199,12 @@
         Asn1Decoder decoder = new EntryChangeControlDecoder();
         ByteBuffer bb = ByteBuffer.allocate( 0x05 );
         bb.put( new byte[]
-            { 0x30, 0x03, // EntryChangeNotification ::= SEQUENCE {
-                0x0A, 0x01, 0x03, // changeType ENUMERATED {
-            // BAD Change Type
-            // }
-            // }
+            { 
+            0x30, 0x03,                 // EntryChangeNotification ::= SEQUENCE {
+              0x0A, 0x01, 0x03,         //     changeType ENUMERATED {
+                                        //         BAD Change Type
+                                        //     }
+                                        // }
             } );
         bb.flip();
 
@@ -232,14 +232,13 @@
     {
         ByteBuffer bb = ByteBuffer.allocate( 0x0D );
         bb.put( new byte[]
-            { 0x30, 0x0B, // EntryChangeNotification ::= SEQUENCE {
-                0x0A, 0x01, 0x08, // changeType ENUMERATED {
-                // modDN (8)
-                // }
-                0x04, 0x03, 'a', '=', 'b', // previousDN LDAPDN OPTIONAL, --
-                                            // modifyDN ops. only
-                0x02, 0x01, 0x10 // changeNumber INTEGER OPTIONAL -- if
-                                    // supported
+            { 
+            0x30, 0x0B,                     // EntryChangeNotification ::= SEQUENCE {
+              0x0A, 0x01, 0x08,             //     changeType ENUMERATED {
+                                            //         modDN (8)
+                                            //     }
+              0x04, 0x03, 'a', '=', 'b',    //     previousDN LDAPDN OPTIONAL, -- modifyDN ops. only
+              0x02, 0x01, 0x10              //     changeNumber INTEGER OPTIONAL -- if supported
             } );
 
         String expected = StringTools.dumpBytes( bb.array() );

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlTest.java?view=diff&rev=452497&r1=452496&r2=452497
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlTest.java Tue Oct  3 06:49:43 2006
@@ -43,18 +43,44 @@
 public class PSearchControlTest extends TestCase
 {
     /**
-     * Test the decoding of a PSearchControl
+     * Test encoding of a PSearchControl.
      */
-    public void testDecodeModifyDNRequestSuccess() throws NamingException
+    public void testEncodePSearchControl() throws Exception
+    {
+        ByteBuffer bb = ByteBuffer.allocate( 0x0b );
+        bb.put( new byte[]
+            { 
+              0x30, 0x09,           // PersistentSearch ::= SEQUENCE {
+                0x02, 0x01, 0x01,   // changeTypes INTEGER,
+                0x01, 0x01, 0x00,   // changesOnly BOOLEAN,
+                0x01, 0x01, 0x00    // returnECs BOOLEAN
+            } );
+
+        String expected = StringTools.dumpBytes( bb.array() );
+        bb.flip();
+
+        PSearchControl ctrl = new PSearchControl();
+        ctrl.setChangesOnly( false );
+        ctrl.setReturnECs( false );
+        ctrl.setChangeTypes( 1 );
+        bb = ctrl.encode( null );
+        String decoded = StringTools.dumpBytes( bb.array() );
+        assertEquals( expected, decoded );
+    }
+
+    /**
+     * Test the decoding of a PSearchControl with combined changes types
+     */
+    public void testDecodeModifyDNRequestSuccessChangeTypesAddModDN() throws NamingException
     {
         Asn1Decoder decoder = new PSearchControlDecoder();
         ByteBuffer bb = ByteBuffer.allocate( 0x0b );
         bb.put( new byte[]
-            { 0x30, 0x09, // PersistentSearch ::= SEQUENCE {
-                0x02, 0x01, 0x01, // changeTypes INTEGER,
-                0x01, 0x01, 0x00, // changesOnly BOOLEAN,
-                0x01, 0x01, 0x00 // returnECs BOOLEAN
-            // }
+            { 
+            0x30, 0x09,         // PersistentSearch ::= SEQUENCE {
+              0x02, 0x01, 0x09, // changeTypes INTEGER,
+              0x01, 0x01, 0x00, // changesOnly BOOLEAN,
+              0x01, 0x01, 0x00  // returnECs BOOLEAN
             } );
         bb.flip();
 
@@ -65,40 +91,178 @@
         }
         catch ( DecoderException de )
         {
-            de.printStackTrace();
             Assert.fail( de.getMessage() );
         }
 
         PSearchControl control = container.getPSearchControl();
-        assertEquals( 1, control.getChangeTypes() );
+        int changeTypes = control.getChangeTypes();
+        assertEquals( PSearchControl.CHANGE_TYPE_ADD, changeTypes & PSearchControl.CHANGE_TYPE_ADD );
+        assertEquals( PSearchControl.CHANGE_TYPE_MODDN, changeTypes & PSearchControl.CHANGE_TYPE_MODDN );
         assertEquals( false, control.isChangesOnly() );
         assertEquals( false, control.isReturnECs() );
     }
 
+    /**
+     * Test the decoding of a PSearchControl with a changes types which
+     * value is 0
+     */
+    public void testDecodeModifyDNRequestSuccessChangeTypes0() throws NamingException
+    {
+        Asn1Decoder decoder = new PSearchControlDecoder();
+        ByteBuffer bb = ByteBuffer.allocate( 0x0b );
+        bb.put( new byte[]
+            { 
+            0x30, 0x09,         // PersistentSearch ::= SEQUENCE {
+              0x02, 0x01, 0x00, // changeTypes INTEGER,
+              0x01, 0x01, 0x00, // changesOnly BOOLEAN,
+              0x01, 0x01, 0x00  // returnECs BOOLEAN
+            } );
+        bb.flip();
+
+        PSearchControlContainer container = new PSearchControlContainer();
+        try
+        {
+            decoder.decode( bb, container );
+            fail( "We should never reach this point" );
+        }
+        catch ( DecoderException de )
+        {
+            assertTrue( true );
+        }
+    }
 
     /**
-     * Test encoding of a PSearchControl.
+     * Test the decoding of a PSearchControl with a changes types which
+     * value is above 15
      */
-    public void testEncodePSearchControl() throws Exception
+    public void testDecodeModifyDNRequestSuccessChangeTypes22() throws NamingException
     {
+        Asn1Decoder decoder = new PSearchControlDecoder();
         ByteBuffer bb = ByteBuffer.allocate( 0x0b );
         bb.put( new byte[]
-            { 0x30, 0x09, // PersistentSearch ::= SEQUENCE {
-                0x02, 0x01, 0x01, // changeTypes INTEGER,
-                0x01, 0x01, 0x00, // changesOnly BOOLEAN,
-                0x01, 0x01, 0x00 // returnECs BOOLEAN
-            // }
+            { 
+            0x30, 0x09,         // PersistentSearch ::= SEQUENCE {
+              0x02, 0x01, 0x22, // changeTypes INTEGER,
+              0x01, 0x01, 0x00, // changesOnly BOOLEAN,
+              0x01, 0x01, 0x00  // returnECs BOOLEAN
             } );
+        bb.flip();
 
-        String expected = StringTools.dumpBytes( bb.array() );
+        PSearchControlContainer container = new PSearchControlContainer();
+        try
+        {
+            decoder.decode( bb, container );
+            fail( "We should never reach this point" );
+        }
+        catch ( DecoderException de )
+        {
+            assertTrue( true );
+        }
+    }
+
+    /**
+     * Test the decoding of a PSearchControl with a null sequence
+     */
+    public void testDecodeModifyDNRequestSuccessNullSequence() throws NamingException
+    {
+        Asn1Decoder decoder = new PSearchControlDecoder();
+        ByteBuffer bb = ByteBuffer.allocate( 0x02 );
+        bb.put( new byte[]
+            { 
+            0x30, 0x00,         // PersistentSearch ::= SEQUENCE {
+            } );
         bb.flip();
 
-        PSearchControl ctrl = new PSearchControl();
-        ctrl.setChangesOnly( false );
-        ctrl.setReturnECs( false );
-        ctrl.setChangeTypes( 1 );
-        bb = ctrl.encode( null );
-        String decoded = StringTools.dumpBytes( bb.array() );
-        assertEquals( expected, decoded );
+        PSearchControlContainer container = new PSearchControlContainer();
+        try
+        {
+            decoder.decode( bb, container );
+            fail( "We should never reach this point" );
+        }
+        catch ( DecoderException de )
+        {
+            assertTrue( true );
+        }
+    }
+
+    /**
+     * Test the decoding of a PSearchControl without changeTypes
+     */
+    public void testDecodeModifyDNRequestSuccessWithoutChangeTypes() throws NamingException
+    {
+        Asn1Decoder decoder = new PSearchControlDecoder();
+        ByteBuffer bb = ByteBuffer.allocate( 0x08 );
+        bb.put( new byte[]
+            { 
+            0x30, 0x06,         // PersistentSearch ::= SEQUENCE {
+              0x01, 0x01, 0x00, // changesOnly BOOLEAN,
+              0x01, 0x01, 0x00  // returnECs BOOLEAN
+            } );
+        bb.flip();
+
+        PSearchControlContainer container = new PSearchControlContainer();
+        try
+        {
+            decoder.decode( bb, container );
+            fail( "We should never reach this point" );
+        }
+        catch ( DecoderException de )
+        {
+            assertTrue( true );
+        }
+    }
+
+    /**
+     * Test the decoding of a PSearchControl without changeOnly
+     */
+    public void testDecodeModifyDNRequestSuccessWithoutChangesOnly() throws NamingException
+    {
+        Asn1Decoder decoder = new PSearchControlDecoder();
+        ByteBuffer bb = ByteBuffer.allocate( 0x08 );
+        bb.put( new byte[]
+            { 
+            0x30, 0x06,         // PersistentSearch ::= SEQUENCE {
+              0x02, 0x01, 0x01, // changeTypes INTEGER,
+              0x01, 0x01, 0x00  // returnECs BOOLEAN
+            } );
+        bb.flip();
+
+        PSearchControlContainer container = new PSearchControlContainer();
+        try
+        {
+            decoder.decode( bb, container );
+            fail( "We should never reach this point" );
+        }
+        catch ( DecoderException de )
+        {
+            assertTrue( true );
+        }
+    }
+
+    /**
+     * Test the decoding of a PSearchControl without returnECs
+     */
+    public void testDecodeModifyDNRequestSuccessWithoutReturnECs() throws NamingException
+    {
+        Asn1Decoder decoder = new PSearchControlDecoder();
+        ByteBuffer bb = ByteBuffer.allocate( 0x08 );
+        bb.put( new byte[]
+            { 
+            0x30, 0x06,         // PersistentSearch ::= SEQUENCE {
+              0x02, 0x01, 0x01, // changeTypes INTEGER,
+              0x01, 0x01, 0x00, // changesOnly BOOLEAN,
+            } );
+        bb.flip();
+
+        PSearchControlContainer container = new PSearchControlContainer();
+        try
+        {
+            decoder.decode( bb, container );
+            fail( "We should never reach this point" );
+        }
+        catch ( DecoderException de )
+        {
+            assertTrue( true );
+        }
     }
 }

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/unbind/UnBindRequestTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/unbind/UnBindRequestTest.java?view=diff&rev=452497&r1=452496&r2=452497
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/unbind/UnBindRequestTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/unbind/UnBindRequestTest.java Tue Oct  3 06:49:43 2006
@@ -80,16 +80,16 @@
             fail( ne.getMessage() );
         }
 
-        LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
+        LdapMessage ldapMessage = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
 
-        assertEquals( 1, message.getMessageId() );
+        assertEquals( 1, ldapMessage.getMessageId() );
 
         // Check the length
-        assertEquals( 7, message.computeLength() );
+        assertEquals( 7, ldapMessage.computeLength() );
 
         try
         {
-            ByteBuffer bb = message.encode( null );
+            ByteBuffer bb = ldapMessage.encode( null );
 
             String encodedPdu = StringTools.dumpBytes( bb.array() );
 
@@ -145,25 +145,25 @@
             fail( ne.getMessage() );
         }
 
-        LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
+        LdapMessage ldapMessage = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
 
-        assertEquals( 1, message.getMessageId() );
+        assertEquals( 1, ldapMessage.getMessageId() );
 
         // Check the Control
-        List controls = message.getControls();
+        List controls = ldapMessage.getControls();
 
         assertEquals( 1, controls.size() );
 
-        Control control = message.getControls( 0 );
+        Control control = ldapMessage.getControls( 0 );
         assertEquals( "2.16.840.1.113730.3.4.2", control.getControlType() );
         assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getControlValue() ) );
 
         // Check the length
-        assertEquals( 0x24, message.computeLength() );
+        assertEquals( 0x24, ldapMessage.computeLength() );
 
         try
         {
-            ByteBuffer bb = message.encode( null );
+            ByteBuffer bb = ldapMessage.encode( null );
 
             String encodedPdu = StringTools.dumpBytes( bb.array() );
 



Mime
View raw message