directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 20824 - incubator/directory/snickers/trunk/ldap-ber-provider/src/test/org/apache/snickers/ldap
Date Fri, 04 Jun 2004 18:42:14 GMT
Author: akarasulu
Date: Fri Jun  4 11:42:13 2004
New Revision: 20824

Added:
   incubator/directory/snickers/trunk/ldap-ber-provider/src/test/org/apache/snickers/ldap/SearchRequestTest.java
Log:
just setting up testcase

Added: incubator/directory/snickers/trunk/ldap-ber-provider/src/test/org/apache/snickers/ldap/SearchRequestTest.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ldap-ber-provider/src/test/org/apache/snickers/ldap/SearchRequestTest.java
Fri Jun  4 11:42:13 2004
@@ -0,0 +1,80 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ldap ;
+
+
+import java.util.HashSet ;
+import java.util.Iterator ;
+import java.util.Collection ;
+import javax.naming.directory.Attribute ;
+import javax.naming.directory.DirContext ;
+import javax.naming.directory.ModificationItem ;
+
+import org.apache.ldap.common.message.* ;
+import org.apache.ldap.common.filter.ExprNode;
+import org.apache.ldap.common.filter.FilterParserImpl;
+
+import org.apache.snickers.ldap.testutils.TestUtils ;
+import org.apache.snickers.ldap.testutils.RuleTestCase ;
+
+
+/**
+ * Tests the capability to end to end decode a SearchRequest.
+ * 
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory
+ * Project</a>
+ * @version $Rev$
+ */
+public class SearchRequestTest extends RuleTestCase
+{
+    /**
+     * Tests an search request decode.
+     */
+    public void testModifyRequest() throws Exception
+    {
+        SearchRequestImpl req = new SearchRequestImpl( 33 ) ;
+        req.setBase( "dc=example,dc=com" ) ;
+        req.setDerefAliases( DerefAliasesEnum.DEREFINSEARCHING ) ;
+        req.setScope( ScopeEnum.SINGLELEVEL ) ;
+        req.setSizeLimit( 2 ) ;
+        req.setTimeLimit( 3 ) ;
+        req.setTypesOnly( true ) ;
+
+        req.addAttribute( "attr0" ) ;
+        req.addAttribute( "attr1" ) ;
+        req.addAttribute( "attr2" ) ;
+
+        FilterParserImpl parser = new FilterParserImpl() ;
+        ExprNode node = null ;
+        node =  parser.parse( "(& (ou=Human Resources) (l=SunnyVale) " +
+                " (| (uid=akarasulu) (! (uid=jbean ) ) ) )" ) ;
+        req.setFilter( node ) ;
+
+        System.out.println( "Generated SearchRequest for test:" ) ;
+        System.out.println( TestUtils.printTupleTree( req ) ) ;
+
+        /*
+
+        NOT COMPLETE YET!
+
+        SearchRequest decoded = ( SearchRequest )
+                snickersDecode( snaccEncode( req ) ) ;
+        assertNotNull( decoded ) ;
+        assertEquals( req.getBase(), decoded.getBase() ) ;
+        */
+    }
+}
\ No newline at end of file

Mime
View raw message