directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r476896 - in /directory/trunks/shared/ldap/src: main/java/org/apache/directory/shared/ldap/codec/ main/java/org/apache/directory/shared/ldap/codec/search/ main/java/org/apache/directory/shared/ldap/message/ test/java/org/apache/directory/sh...
Date Sun, 19 Nov 2006 19:47:39 GMT
Author: elecharny
Date: Sun Nov 19 11:47:38 2006
New Revision: 476896

URL: http://svn.apache.org/viewvc?view=rev&rev=476896
Log:
Changed the ScopeEnum to become an enum instead of an subclass
of ValuedEnum (Java 5 migration)

Modified:
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ScopeEnum.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestMatchingRuleAssertionTest.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestSubstringTest.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java?view=diff&rev=476896&r1=476895&r2=476896
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
Sun Nov 19 11:47:38 2006
@@ -101,6 +101,7 @@
 import org.apache.directory.shared.ldap.message.ModifyDnResponseImpl;
 import org.apache.directory.shared.ldap.message.ModifyResponseImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.ScopeEnum;
 import org.apache.directory.shared.ldap.message.SearchResponseDoneImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
@@ -3574,7 +3575,7 @@
                         throw new DecoderException( "The scope is not in [0..2] : " + value.toString()
);
                     }
 
-                    searchRequest.setScope( scope );
+                    searchRequest.setScope( ScopeEnum.getScope( scope ) );
 
                     if ( IS_DEBUG )
                     {

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java?view=diff&rev=476896&r1=476895&r2=476896
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
Sun Nov 19 11:47:38 2006
@@ -598,20 +598,7 @@
         snickersMessage.setBase( searchRequest.getBaseObject() );
 
         // Twix : int scope -> Snickers : ScopeEnum scope
-        switch ( searchRequest.getScope() )
-        {
-            case LdapConstants.SCOPE_BASE_OBJECT:
-                snickersMessage.setScope( ScopeEnum.BASEOBJECT );
-                break;
-
-            case LdapConstants.SCOPE_SINGLE_LEVEL:
-                snickersMessage.setScope( ScopeEnum.SINGLELEVEL );
-                break;
-
-            case LdapConstants.SCOPE_WHOLE_SUBTREE:
-                snickersMessage.setScope( ScopeEnum.WHOLESUBTREE );
-                break;
-        }
+        snickersMessage.setScope( searchRequest.getScope() );
 
         // Twix : int derefAliases -> Snickers : DerefAliasesEnum derefAliases
         switch ( searchRequest.getDerefAliases() )

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java?view=diff&rev=476896&r1=476895&r2=476896
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java
Sun Nov 19 11:47:38 2006
@@ -30,6 +30,7 @@
 import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.codec.LdapMessage;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.message.ScopeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
 
@@ -59,7 +60,7 @@
     private LdapDN baseObject;
 
     /** The scope. It could be baseObject, singleLevel or wholeSubtree. */
-    private int scope;
+    private ScopeEnum scope;
 
     /**
      * The deref alias could be neverDerefAliases, derefInSearching,
@@ -225,7 +226,7 @@
      * 
      * @return Returns the scope.
      */
-    public int getScope()
+    public ScopeEnum getScope()
     {
         return scope;
     }
@@ -236,7 +237,7 @@
      * 
      * @param scope The scope to set.
      */
-    public void setScope( int scope )
+    public void setScope( ScopeEnum scope )
     {
         this.scope = scope;
     }
@@ -554,7 +555,7 @@
             Value.encode( buffer, LdapDN.getBytes( baseObject ) );
 
             // The scope
-            Value.encodeEnumerated( buffer, scope );
+            Value.encodeEnumerated( buffer, scope.getValue() );
 
             // The derefAliases
             Value.encodeEnumerated( buffer, derefAliases );
@@ -662,15 +663,15 @@
 
         switch ( scope )
         {
-            case LdapConstants.SCOPE_BASE_OBJECT:
+            case BASE_OBJECT:
                 sb.append( "base object" );
                 break;
 
-            case LdapConstants.SCOPE_SINGLE_LEVEL:
+            case SINGLE_LEVEL:
                 sb.append( "single level" );
                 break;
 
-            case LdapConstants.SCOPE_WHOLE_SUBTREE:
+            case WHOLE_SUBTREE:
                 sb.append( "whole subtree" );
                 break;
         }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ScopeEnum.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ScopeEnum.java?view=diff&rev=476896&r1=476895&r2=476896
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ScopeEnum.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ScopeEnum.java
Sun Nov 19 11:47:38 2006
@@ -22,106 +22,91 @@
 
 import javax.naming.directory.SearchControls;
 
-import org.apache.directory.shared.ldap.util.ValuedEnum;
-
-
 /**
  * Type-safe scope parameter enumeration.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Revision$
  */
-public class ScopeEnum extends ValuedEnum
+public enum ScopeEnum
 {
-    static final long serialVersionUID = 6354503944147675151L;
-
     /** Search scope parameter value for base object search */
-    public static final int BASEOBJECT_VAL = SearchControls.OBJECT_SCOPE;
+    BASE_OBJECT( SearchControls.OBJECT_SCOPE ),
 
     /** Search scope parameter value for single level search */
-    public static final int SINGLELEVEL_VAL = SearchControls.ONELEVEL_SCOPE;
+    SINGLE_LEVEL( SearchControls.ONELEVEL_SCOPE ),
 
     /** Search scope parameter value for whole subtree level search */
-    public static final int WHOLESUBTREE_VAL = SearchControls.SUBTREE_SCOPE;
-
-    /** LDAP search scope parameter value for base object search */
-    public static final int BASEOBJECT_LDAPVAL = 0;
-
-    /** LDAP search scope parameter value for single level search */
-    public static final int SINGLELEVEL_LDAPVAL = 1;
-
-    /** LDAP search scope parameter value for whole subtree level search */
-    public static final int WHOLESUBTREE_LDAPVAL = 2;
-
-    /** Search scope parameter enum for base object search */
-    public static final ScopeEnum BASEOBJECT = new ScopeEnum( "BASEOBJECT", BASEOBJECT_VAL
);
-
-    /** Search scope parameter enum for single level search */
-    public static final ScopeEnum SINGLELEVEL = new ScopeEnum( "SINGLELEVEL", SINGLELEVEL_VAL
);
-
-    /** Search scope parameter enum for whole subtree level search */
-    public static final ScopeEnum WHOLESUBTREE = new ScopeEnum( "WHOLESUBTREE", WHOLESUBTREE_VAL
);
+    WHOLE_SUBTREE( SearchControls.SUBTREE_SCOPE );
 
+    /** Stores the integer value of each element of the enumeration */
+    private int value;
 
     /**
      * Private construct so no other instances can be created other than the
      * public static constants in this class.
      * 
-     * @param a_name
-     *            a string name for the enumeration value.
-     * @param a_value
+     * @param value
      *            the integer value of the enumeration.
      */
-    private ScopeEnum(final String a_name, final int a_value)
+    private ScopeEnum( int value )
     {
-        super( a_name, a_value );
+        this.value = value;
     }
 
+    /**
+     * Gets the LdapValue for the scope enumeration as opposed to the JNDI value
+     * which is returned using getValue().
+     * 
+     * @return the LDAP enumeration value for the scope parameter on a search
+     *         request.
+     */
+    public int getValue()
+    {
+        return value;
+    }
 
     /**
      * Gets the type safe enumeration constant corresponding to a SearchControls
      * scope value.
      * 
-     * @param a_controls
+     * @param controls
      *            the SearchControls whose scope value we convert to enum
      * @return the SopeEnum for the scope int value
      */
-    public static ScopeEnum getScope( SearchControls a_controls )
+    public static ScopeEnum getScope( SearchControls controls )
     {
-        switch ( a_controls.getSearchScope() )
+        switch ( controls.getSearchScope() )
         {
             case ( SearchControls.OBJECT_SCOPE  ):
-                return BASEOBJECT;
+                return BASE_OBJECT;
+            
             case ( SearchControls.ONELEVEL_SCOPE  ):
-                return SINGLELEVEL;
+                return SINGLE_LEVEL;
+            
             case ( SearchControls.SUBTREE_SCOPE  ):
-                return WHOLESUBTREE;
+                return WHOLE_SUBTREE;
+            
             default:
                 throw new IllegalArgumentException( "Unrecognized search scope in SearchControls:
"
-                    + a_controls.getSearchScope() );
+                    + controls.getSearchScope() );
         }
     }
 
-
     /**
-     * Gets the LdapValue for the scope enumeration as opposed to the JNDI value
-     * which is returned using getValue().
-     * 
-     * @return the LDAP enumeration value for the scope parameter on a search
-     *         request.
+     * Gets the enum corresponding to the given integer value. 
+     *
+     * @param value The integer we want the corresponding enum
+     * @return The enumeration element associated with the given integer
      */
-    public int getLdapValue()
+    public static ScopeEnum getScope( int value )
     {
-        switch ( getValue() )
+        switch ( value )
         {
-            case ( BASEOBJECT_VAL ):
-                return BASEOBJECT_LDAPVAL;
-            case ( SINGLELEVEL_VAL ):
-                return SINGLELEVEL_LDAPVAL;
-            case ( WHOLESUBTREE_VAL ):
-                return WHOLESUBTREE_LDAPVAL;
-            default:
-                throw new IllegalArgumentException( "Unrecognized value: " + getValue() );
+            case 0: return BASE_OBJECT;
+            case 1: return SINGLE_LEVEL;
+            case 2: return WHOLE_SUBTREE;
+            default : return BASE_OBJECT;
         }
     }
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java?view=diff&rev=476896&r1=476895&r2=476896
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
Sun Nov 19 11:47:38 2006
@@ -472,17 +472,17 @@
         
         sb.append( "        scope : " );
         
-        switch ( scope.getValue() )
+        switch ( scope )
         {
-            case LdapConstants.SCOPE_BASE_OBJECT:
+            case BASE_OBJECT:
                 sb.append( "base object" );
                 break;
 
-            case LdapConstants.SCOPE_SINGLE_LEVEL:
+            case SINGLE_LEVEL:
                 sb.append( "single level" );
                 break;
 
-            case LdapConstants.SCOPE_WHOLE_SUBTREE:
+            case WHOLE_SUBTREE:
                 sb.append( "whole subtree" );
                 break;
         }

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=476896&r1=476895&r2=476896
==============================================================================
--- 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
Sun Nov 19 11:47:38 2006
@@ -37,6 +37,7 @@
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.search.ExtensibleMatchFilter;
 import org.apache.directory.shared.ldap.codec.search.SearchRequest;
+import org.apache.directory.shared.ldap.message.ScopeEnum;
 import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
 import org.apache.directory.shared.ldap.schema.OidNormalizer;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -139,7 +140,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_BASE_OBJECT, sr.getScope() );
+        assertEquals( ScopeEnum.BASE_OBJECT, sr.getScope() );
         assertEquals( LdapConstants.DEREF_FINDING_BASE_OBJ, sr.getDerefAliases() );
         assertEquals( 2, sr.getSizeLimit() );
         assertEquals( 3, sr.getTimeLimit() );
@@ -391,7 +392,7 @@
 
         assertEquals( 4, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );
@@ -703,7 +704,7 @@
 
         assertEquals( 4, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );

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=476896&r1=476895&r2=476896
==============================================================================
--- 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
Sun Nov 19 11:47:38 2006
@@ -39,6 +39,7 @@
 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.message.ScopeEnum;
 import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
 import org.apache.directory.shared.ldap.schema.OidNormalizer;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -148,7 +149,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 1000, sr.getSizeLimit() );
         assertEquals( 1000, sr.getTimeLimit() );
@@ -269,7 +270,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 1000, sr.getSizeLimit() );
         assertEquals( 1000, sr.getTimeLimit() );
@@ -397,7 +398,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 1000, sr.getSizeLimit() );
         assertEquals( 1000, sr.getTimeLimit() );
@@ -519,7 +520,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 1000, sr.getSizeLimit() );
         assertEquals( 1000, sr.getTimeLimit() );
@@ -642,7 +643,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 1000, sr.getSizeLimit() );
         assertEquals( 1000, sr.getTimeLimit() );
@@ -764,7 +765,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 1000, sr.getSizeLimit() );
         assertEquals( 1000, sr.getTimeLimit() );
@@ -880,7 +881,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 1000, sr.getSizeLimit() );
         assertEquals( 1000, sr.getTimeLimit() );
@@ -1003,7 +1004,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 1000, sr.getSizeLimit() );
         assertEquals( 1000, sr.getTimeLimit() );
@@ -1125,7 +1126,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 1000, sr.getSizeLimit() );
         assertEquals( 1000, sr.getTimeLimit() );
@@ -1249,7 +1250,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 1000, sr.getSizeLimit() );
         assertEquals( 1000, sr.getTimeLimit() );

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=476896&r1=476895&r2=476896
==============================================================================
--- 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
Sun Nov 19 11:47:38 2006
@@ -48,6 +48,7 @@
 import org.apache.directory.shared.ldap.codec.search.controls.SubEntryControl;
 import org.apache.directory.shared.ldap.message.Message;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.ScopeEnum;
 import org.apache.directory.shared.ldap.message.SearchResponseDoneImpl;
 import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
 import org.apache.directory.shared.ldap.schema.OidNormalizer;
@@ -168,7 +169,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 1000, sr.getSizeLimit() );
         assertEquals( 1000, sr.getTimeLimit() );
@@ -335,7 +336,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 1000, sr.getSizeLimit() );
         assertEquals( 1000, sr.getTimeLimit() );
@@ -512,7 +513,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 1000, sr.getSizeLimit() );
         assertEquals( 1000, sr.getTimeLimit() );
@@ -655,7 +656,7 @@
 
         assertEquals( 3, message.getMessageId() );
         assertEquals( "ou=users,ou=system", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_BASE_OBJECT, sr.getScope() );
+        assertEquals( ScopeEnum.BASE_OBJECT, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );
@@ -774,7 +775,7 @@
 
         assertEquals( 33, message.getMessageId() );
         assertEquals( "dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_BASE_OBJECT, sr.getScope() );
+        assertEquals( ScopeEnum.BASE_OBJECT, sr.getScope() );
         assertEquals( LdapConstants.DEREF_FINDING_BASE_OBJ, sr.getDerefAliases() );
         assertEquals( 2, sr.getSizeLimit() );
         assertEquals( 3, sr.getTimeLimit() );
@@ -924,7 +925,7 @@
 
         SearchRequest sr = message.getSearchRequest();
         assertEquals( "dc=my-domain,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_WHOLE_SUBTREE, sr.getScope() );
+        assertEquals( ScopeEnum.WHOLE_SUBTREE, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );
@@ -1050,7 +1051,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 1000, sr.getSizeLimit() );
         assertEquals( 1000, sr.getTimeLimit() );
@@ -1183,7 +1184,7 @@
 
         SearchRequest sr = message.getSearchRequest();
         assertEquals( "dc=my-domain,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_WHOLE_SUBTREE, sr.getScope() );
+        assertEquals( ScopeEnum.WHOLE_SUBTREE, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );
@@ -1373,7 +1374,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 1000, sr.getSizeLimit() );
         assertEquals( 1000, sr.getTimeLimit() );
@@ -2426,7 +2427,7 @@
 
         assertEquals( 4, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );
@@ -2511,7 +2512,7 @@
 
         assertEquals( 4, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );
@@ -2600,7 +2601,7 @@
 
         assertEquals( 4, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );
@@ -2873,7 +2874,7 @@
 
         assertEquals( 2, message.getMessageId() );
         assertEquals( "dc=pgpkeys", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_WHOLE_SUBTREE, sr.getScope() );
+        assertEquals( ScopeEnum.WHOLE_SUBTREE, sr.getScope() );
         assertEquals( LdapConstants.NEVER_DEREF_ALIASES, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );
@@ -2987,7 +2988,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "a=b", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );
@@ -3091,7 +3092,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "a=b", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );
@@ -3207,7 +3208,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "a=b", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );
@@ -3327,7 +3328,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "a=b", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );
@@ -3450,7 +3451,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "a=b", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );
@@ -3582,7 +3583,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "a=b", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );
@@ -3718,7 +3719,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "a=b", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );
@@ -3861,7 +3862,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "a=b", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );
@@ -4005,7 +4006,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "a=b", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );
@@ -4156,7 +4157,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "a=b", sr.getBaseObject().toString() );
-        assertEquals( LdapConstants.SCOPE_SINGLE_LEVEL, sr.getScope() );
+        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );



Mime
View raw message