You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/02/27 19:18:21 UTC

svn commit: r917003 - in /directory/shared/trunk/ldap/src: main/java/org/apache/directory/shared/ldap/util/LdapURL.java test/java/org/apache/directory/shared/ldap/util/LdapUrlTest.java

Author: elecharny
Date: Sat Feb 27 18:18:20 2010
New Revision: 917003

URL: http://svn.apache.org/viewvc?rev=917003&view=rev
Log:
Removed the last references to SearchControls in shared-ldap

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapURL.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/LdapUrlTest.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapURL.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapURL.java?rev=917003&r1=917002&r2=917003&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapURL.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapURL.java Sat Feb 27 18:18:20 2010
@@ -1744,6 +1744,26 @@
 
 
     /**
+     * Sets the scope. Must be one of {@link SearchScope.OBJECT}, 
+     * {@link SearchScope.ONELEVEL} or {@link SearchScope.SUBTREE},
+     * otherwise {@link SearchScope.OBJECT} is assumed as default.
+     * 
+     * @param scope the new scope
+     */
+    public void setScope( SearchScope scope )
+    {
+        if ( scope == null )
+        {
+            this.scope = SearchScope.OBJECT;
+        }
+        else
+        {
+            this.scope = scope;
+        }
+    }
+
+
+    /**
      * Sets the filter.
      * 
      * @param filter the new filter

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/LdapUrlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/LdapUrlTest.java?rev=917003&r1=917002&r2=917003&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/LdapUrlTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/LdapUrlTest.java Sat Feb 27 18:18:20 2010
@@ -20,22 +20,23 @@
 package org.apache.directory.shared.ldap.util;
 
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.util.ArrayList;
 import java.util.List;
 
 import javax.naming.InvalidNameException;
-import javax.naming.directory.SearchControls;
 
 import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
+import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.LdapURL.Extension;
 import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertFalse;
 
 
 /**
@@ -790,20 +791,20 @@
     public void testLdapDNSetScope() throws LdapURLEncodingException, InvalidNameException
     {
         LdapURL url = new LdapURL();
-        assertEquals( SearchControls.OBJECT_SCOPE, url.getScope() );
+        assertEquals( SearchScope.OBJECT, url.getScope() );
 
         url.setDn( new LdapDN( "dc=example,dc=com" ) );
 
-        url.setScope( SearchControls.ONELEVEL_SCOPE );
-        assertEquals( SearchControls.ONELEVEL_SCOPE, url.getScope() );
+        url.setScope( SearchScope.ONELEVEL );
+        assertEquals( SearchScope.ONELEVEL, url.getScope() );
         assertEquals( "ldap:///dc=example,dc=com??one", url.toString() );
 
-        url.setScope( SearchControls.SUBTREE_SCOPE );
-        assertEquals( SearchControls.SUBTREE_SCOPE, url.getScope() );
+        url.setScope( SearchScope.SUBTREE );
+        assertEquals( SearchScope.SUBTREE, url.getScope() );
         assertEquals( "ldap:///dc=example,dc=com??sub", url.toString() );
 
         url.setScope( -1 );
-        assertEquals( SearchControls.OBJECT_SCOPE, url.getScope() );
+        assertEquals( SearchScope.OBJECT, url.getScope() );
         assertEquals( "ldap:///dc=example,dc=com", url.toString() );
     }