directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r356994 - /directory/shared/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchRequestEncoderTest.java
Date Thu, 15 Dec 2005 09:27:55 GMT
Author: elecharny
Date: Thu Dec 15 01:27:51 2005
New Revision: 356994

URL: http://svn.apache.org/viewcvs?rev=356994&view=rev
Log:
Added a tests case for Presence Filter

Modified:
    directory/shared/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchRequestEncoderTest.java

Modified: directory/shared/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchRequestEncoderTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchRequestEncoderTest.java?rev=356994&r1=356993&r2=356994&view=diff
==============================================================================
--- directory/shared/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchRequestEncoderTest.java
(original)
+++ directory/shared/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchRequestEncoderTest.java
Thu Dec 15 01:27:51 2005
@@ -58,4 +58,29 @@
         encode( ( DefaultMutableTupleNode ) node );
         TestUtils.assertEquals( expected, getEncoded() );
     }
+    
+    /**
+     * Tests the encode method.
+     */
+    public void testEncodePresenceFilter() throws Exception
+    {
+        FilterParserImpl parser = new FilterParserImpl();
+        SearchRequestImpl request = new SearchRequestImpl( 33 );
+        request.setBase( "dc=apache,dc=org" );
+        request.setDerefAliases( DerefAliasesEnum.DEREFINSEARCHING );
+        request.setFilter( parser.parse(
+                    "(objectClass=*)" ) );
+        request.setScope( ScopeEnum.SINGLELEVEL );
+        request.setSizeLimit( 12 );
+        request.setTimeLimit( 300 );
+        request.setTypesOnly( true );
+    
+        byte[] expected = new byte[] {0x30, 0x36, 0x02, 0x01, 0x21, 0x63, 0x31, 0x04, 0x10,
0x64, 0x63, 0x3D, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x6F, 0x72,
0x67, 0x0A, 0x01, 0x01, 0x0A, 0x01, 0x01, 0x02, 0x01, 0x0C, 0x02, 0x02, 0x01, 0x2C, 0x01,
0x01, 0xFFFFFFFF, 0xFFFFFF87, 0x0B, 0x6F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x43, 0x6C, 0x61,
0x73, 0x73, 0x30, 0x00};
+    
+        // Encode stub into tuple tree then into the accumulator
+        TupleNode node = SearchRequestEncoder.INSTANCE.encode( request );
+        encode( ( DefaultMutableTupleNode ) node );
+        TestUtils.assertEquals( expected, getEncoded() );
+    }
+    
 }



Mime
View raw message