directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r479675 - /directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java
Date Mon, 27 Nov 2006 16:17:37 GMT
Author: elecharny
Date: Mon Nov 27 08:17:36 2006
New Revision: 479675

URL: http://svn.apache.org/viewvc?view=rev&rev=479675
Log:
Added a test for search : request the rootDSE

Modified:
    directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java

Modified: directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java?view=diff&rev=479675&r1=479674&r2=479675
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java
Mon Nov 27 08:17:36 2006
@@ -4222,4 +4222,69 @@
             fail( ee.getMessage() );
         }
     }
+
+    /**
+     * Test the decoding of a SearchRequest
+     * for rootDSE
+     */
+    public void testDecodeSearchRequestRootDSE()
+    {
+        Asn1Decoder ldapDecoder = new LdapDecoder();
+
+        ByteBuffer stream = ByteBuffer.allocate( 0x33 );
+        stream.put( new byte[]
+            { 
+                0x30, (byte)0x84, 0x00, 0x00, 0x00, 0x2D, 
+                  0x02, 0x01, 0x01, 
+                  0x63, (byte)0x84, 0x00, 0x00, 0x00, 0x24, 
+                    0x04, 0x00, 
+                    0x0A, 0x01, 0x00, 
+                    0x0A, 0x01, 0x00, 
+                    0x02, 0x01, 0x00, 
+                    0x02, 0x01, 0x00, 
+                    0x01, 0x01, 0x00, 
+                    (byte)0x87, 0x0B, 
+                      0x6F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x43, 0x6C, 0x61, 0x73, 0x73, 
+                    0x30, (byte)0x84, 0x00, 0x00, 0x00, 0x00
+            } );
+
+        String decodedPdu = StringTools.dumpBytes( stream.array() );
+        stream.flip();
+
+        // Allocate a BindRequest Container
+        IAsn1Container ldapMessageContainer = new LdapMessageContainer();
+
+        try
+        {
+            ldapDecoder.decode( stream, ldapMessageContainer );
+        }
+        catch ( DecoderException de )
+        {
+            de.printStackTrace();
+            fail( de.getMessage() );
+        }
+        catch ( NamingException ne )
+        {
+            ne.printStackTrace();
+            fail( ne.getMessage() );
+        }
+
+        LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
+        SearchRequest sr = message.getSearchRequest();
+
+        assertEquals( 1, message.getMessageId() );
+        assertEquals( "", sr.getBaseObject().toString() );
+        assertEquals( LdapConstants.SCOPE_BASE_OBJECT, sr.getScope() );
+        assertEquals( LdapConstants.SCOPE_BASE_OBJECT, sr.getDerefAliases() );
+        assertEquals( 0, sr.getSizeLimit() );
+        assertEquals( 0, sr.getTimeLimit() );
+        assertEquals( false, sr.isTypesOnly() );
+        
+        PresentFilter presentFilter = ( PresentFilter ) sr.getFilter();
+        assertNotNull( presentFilter );
+        assertEquals( "objectClass", presentFilter.getAttributeDescription().toString() );
+        
+        Attributes attributes = sr.getAttributes();
+        assertEquals( 0, attributes.size() );
+    }
 }



Mime
View raw message