directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r619906 - in /directory/shared/trunk/ldap/src: main/java/org/apache/directory/shared/ldap/aci/ test/java/org/apache/directory/shared/ldap/aci/
Date Fri, 08 Feb 2008 15:14:23 GMT
Author: pamarcelot
Date: Fri Feb  8 07:14:21 2008
New Revision: 619906

URL: http://svn.apache.org/viewvc?rev=619906&view=rev
Log:
Porting Stefan Seelmann's commit #618085 (Fixed ACI toString() methods, removed printToBuffer()
method, added tests for toString() methods) to trunk.

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/GrantAndDenial.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemPermission.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ACIItemParserTest.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/GrantAndDenial.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/GrantAndDenial.java?rev=619906&r1=619905&r2=619906&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/GrantAndDenial.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/GrantAndDenial.java
Fri Feb  8 07:14:21 2008
@@ -123,7 +123,7 @@
     private final boolean grant;
 
 
-    private GrantAndDenial(MicroOperation microOperation, int code, boolean grant)
+    private GrantAndDenial( MicroOperation microOperation, int code, boolean grant )
     {
         this.microOperation = microOperation;
         this.code = code;
@@ -170,18 +170,6 @@
 
     public String toString()
     {
-        return "[" + code + "] " + name;
-    }
-    
-    
-    /**
-     * Converts this item into its string representation as stored
-     * in directory.
-     *
-     * @param buffer the string buffer
-     */
-    public void printToBuffer( StringBuilder buffer )
-    {
-        buffer.append( getName() );
+        return name;
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemPermission.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemPermission.java?rev=619906&r1=619905&r2=619906&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemPermission.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemPermission.java
Fri Feb  8 07:14:21 2008
@@ -50,7 +50,8 @@
      * @param userClasses
      *            the collection of {@link UserClass}es
      */
-    public ItemPermission( int precedence, Collection<GrantAndDenial> grantsAndDenials,
Collection<UserClass> userClasses )
+    public ItemPermission( int precedence, Collection<GrantAndDenial> grantsAndDenials,
+        Collection<UserClass> userClasses )
     {
         super( precedence, grantsAndDenials );
 
@@ -69,18 +70,8 @@
 
     public String toString()
     {
-        return "itemPermission: precedence=" + getPrecedence() + ", " + "userClasses=" +
userClasses + ", "
-            + "grantsAndDenials=" + getGrantsAndDenials();
-    }
-    
-    /**
-     * Converts this item into its string representation as stored
-     * in directory.
-     *
-     * @param buffer the string buffer
-     */
-    public void printToBuffer( StringBuilder buffer )
-    {
+        StringBuilder buffer = new StringBuilder();
+
         buffer.append( "{ " );
 
         if ( getPrecedence() >= 0 && getPrecedence() <= 255 )
@@ -89,14 +80,14 @@
             buffer.append( getPrecedence() );
             buffer.append( ", " );
         }
-        
+
         buffer.append( "userClasses { " );
-        
+
         boolean isFirst = true;
-        
-        for ( UserClass userClass:userClasses )
+
+        for ( UserClass userClass : userClasses )
         {
-            if ( isFirst ) 
+            if ( isFirst )
             {
                 isFirst = false;
             }
@@ -105,14 +96,14 @@
                 buffer.append( ", " );
             }
 
-            userClass.printToBuffer( buffer );
+            buffer.append( userClass.toString() );
         }
-        
+
         buffer.append( " }, grantsAndDenials { " );
-        
+
         isFirst = true;
-        
-        for ( GrantAndDenial grantAndDenial:getGrantsAndDenials() )
+
+        for ( GrantAndDenial grantAndDenial : getGrantsAndDenials() )
         {
             if ( isFirst )
             {
@@ -123,9 +114,11 @@
                 buffer.append( ", " );
             }
 
-            grantAndDenial.printToBuffer( buffer );
+            buffer.append( grantAndDenial.toString() );
         }
-        
+
         buffer.append( " } }" );
+
+        return buffer.toString();
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java?rev=619906&r1=619905&r2=619906&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java
Fri Feb  8 07:14:21 2008
@@ -70,7 +70,6 @@
     {
     }
 
-    
     /**
      * The contents of entries (possibly a family member) which are restricted
      * to those that have object class values that satisfy the predicate defined
@@ -92,7 +91,7 @@
          * @param classes
          *            refinement
          */
-        public Classes(ExprNode classes)
+        public Classes( ExprNode classes )
         {
             this.classes = classes;
         }
@@ -126,12 +125,12 @@
          */
         public String toString()
         {
-        	StringBuilder buf = new StringBuilder();
-        	
-        	buf.append( "classes " );
-        	classes.printRefinementToBuffer( buf );
-        	
-        	return buf.toString();
+            StringBuilder buf = new StringBuilder();
+
+            buf.append( "classes " );
+            classes.printRefinementToBuffer( buf );
+
+            return buf.toString();
         }
     }
 
@@ -247,44 +246,21 @@
 
             return false;
         }
-        
-        
-        public void printToBuffer( StringBuilder buffer )
-        {
-            buffer.append( "{ " );
-            boolean isFirst = true;
-            
-            for ( String attributeType:attributeTypes )
-            {
-                if ( isFirst ) 
-                {
-                    isFirst = false;
-                }
-                else
-                {
-                    buffer.append( ", " );
-                }
 
-                buffer.append( attributeType );
-            }
-            
-            buffer.append( " }" );
-        }
 
-        
         /**
          * @see Object#toString()
          */
         public String toString()
         {
-        	StringBuilder buf = new StringBuilder();
-        	
+            StringBuilder buf = new StringBuilder();
+
             buf.append( "{ " );
             boolean isFirst = true;
-            
-            for ( String attributeType:attributeTypes )
+
+            for ( String attributeType : attributeTypes )
             {
-                if ( isFirst ) 
+                if ( isFirst )
                 {
                     isFirst = false;
                 }
@@ -295,10 +271,10 @@
 
                 buf.append( attributeType );
             }
-            
+
             buf.append( " }" );
-        	
-        	return buf.toString();
+
+            return buf.toString();
         }
     }
 
@@ -325,7 +301,7 @@
 
         public String toString()
         {
-            return "attributeType: " + attributeTypes;
+            return "attributeType " + super.toString();
         }
     }
 
@@ -351,7 +327,7 @@
 
         public String toString()
         {
-            return "allAttributeValues: " + attributeTypes;
+            return "allAttributeValues " + super.toString();
         }
     }
 
@@ -381,7 +357,7 @@
 
         public String toString()
         {
-            return "selfValue: " + attributeTypes;
+            return "selfValue " + super.toString();
         }
     }
 
@@ -434,16 +410,16 @@
 
         public String toString()
         {
-        	StringBuilder buf = new StringBuilder();
-        	
+            StringBuilder buf = new StringBuilder();
+
             buf.append( "attributeValue {" );
-            
+
             for ( Iterator<Attribute> it = attributes.iterator(); it.hasNext(); )
             {
                 Attribute attribute = it.next();
                 buf.append( attribute.getID() );
                 buf.append( '=' );
-                
+
                 try
                 {
                     buf.append( attribute.get( 0 ) );
@@ -452,16 +428,16 @@
                 {
                     // doesn't occur here, it is an Attribute
                 }
-                
-                if ( it.hasNext() ) 
+
+                if ( it.hasNext() )
                 {
                     buf.append( ", " );
                 }
             }
-            
+
             buf.append( " }" );
 
-            return "attributeValue: " + attributes;
+            return buf.toString();
         }
     }
 
@@ -521,26 +497,26 @@
 
         public String toString()
         {
-        	StringBuilder buf = new StringBuilder();
-        	
-        	buf.append( "maxValueCount {" );
-
-        	boolean isFirst = true;
-        	
-            for ( MaxValueCountItem item:items )
-            {
-            	if ( isFirst )
-            	{
-            		isFirst = false;
-            	}
-            	else
-            	{
-            		buf.append( ", " );
-            	}
-            	
+            StringBuilder buf = new StringBuilder();
+
+            buf.append( "maxValueCount {" );
+
+            boolean isFirst = true;
+
+            for ( MaxValueCountItem item : items )
+            {
+                if ( isFirst )
+                {
+                    isFirst = false;
+                }
+                else
+                {
+                    buf.append( ", " );
+                }
+
                 buf.append( item.toString() );
             }
-            
+
             buf.append( "}" );
 
             return buf.toString();
@@ -564,7 +540,7 @@
          * @param filter
          *            the expression
          */
-        public RangeOfValues(ExprNode filter)
+        public RangeOfValues( ExprNode filter )
         {
             if ( filter == null )
             {
@@ -603,10 +579,11 @@
 
         public String toString()
         {
-        	StringBuilder buf = new StringBuilder();
-            buf.append( "rangeOfValues: " );
+            StringBuilder buf = new StringBuilder();
+
+            buf.append( "rangeOfValues " );
             buf.append( filter.toString() );
-            
+
             return buf.toString();
         }
     }
@@ -634,7 +611,7 @@
          * @param value
          *            The maximum number of immediate subordinates
          */
-        public MaxImmSub(int value)
+        public MaxImmSub( int value )
         {
             this.value = value;
         }
@@ -668,7 +645,7 @@
 
         public String toString()
         {
-            return "maxImmSub: " + value;
+            return "maxImmSub " + value;
         }
     }
 
@@ -693,7 +670,7 @@
          * 
          * @param items the collection of {@link RestrictedByItem}s.
          */
-        public RestrictedBy( Collection<RestrictedByItem> items)
+        public RestrictedBy( Collection<RestrictedByItem> items )
         {
             this.items = Collections.unmodifiableCollection( items );
         }
@@ -727,28 +704,28 @@
 
         public String toString()
         {
-        	StringBuilder buf = new StringBuilder();
-        	
+            StringBuilder buf = new StringBuilder();
+
             buf.append( "restrictedBy {" );
 
             boolean isFirst = true;
-            
-            for ( RestrictedByItem item:items )
+
+            for ( RestrictedByItem item : items )
             {
-            	if ( isFirst )
-            	{
-            		isFirst = false;
-            	}
-            	else
-            	{
-            		buf.append( ", " );
-            	}
-            	
+                if ( isFirst )
+                {
+                    isFirst = false;
+                }
+                else
+                {
+                    buf.append( ", " );
+                }
+
                 buf.append( item.toString() );
             }
-            
+
             buf.append( '}' );
-            
+
             return buf.toString();
         }
     }
@@ -774,7 +751,7 @@
          *            the maximum count of the attribute allowed
          */
 
-        public MaxValueCountItem(String attributeType, int maxCount)
+        public MaxValueCountItem( String attributeType, int maxCount )
         {
             this.attributeType = attributeType;
             this.maxCount = maxCount;
@@ -801,7 +778,7 @@
 
         public String toString()
         {
-            return "attributeType=" + attributeType + ", maxCount=" + maxCount;
+            return "{ type " + attributeType + ", maxCount " + maxCount + " }";
         }
     }
 
@@ -826,7 +803,7 @@
          *            the attribute type only whose values are allowed in
          *            <tt>attributeType</tt>.
          */
-        public RestrictedByItem(String attributeType, String valuesIn)
+        public RestrictedByItem( String attributeType, String valuesIn )
         {
             this.attributeType = attributeType;
             this.valuesIn = valuesIn;
@@ -854,7 +831,7 @@
 
         public String toString()
         {
-            return "{attributeType=" + attributeType + ", valuesIn=" + valuesIn + "}";
+            return "{ type " + attributeType + ", valuesIn " + valuesIn + " }";
         }
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java?rev=619906&r1=619905&r2=619906&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java
Fri Feb  8 07:14:21 2008
@@ -58,16 +58,6 @@
     protected UserClass()
     {
     }
-    
-    
-    /**
-     * Converts this item into its string representation as stored
-     * in directory.
-     *
-     * @param buffer the string buffer
-     */
-    public abstract void printToBuffer( StringBuilder buffer );
-    
 
     /**
      * Every directory user (with possible requirements for
@@ -87,12 +77,6 @@
         {
             return "allUsers";
         }
-        
-        
-        public void printToBuffer( StringBuilder buffer )
-        {
-            buffer.append( "allUsers" );
-        }
     }
 
     /**
@@ -114,12 +98,6 @@
         {
             return "thisEntry";
         }
-        
-        
-        public void printToBuffer( StringBuilder buffer )
-        {
-            buffer.append( "thisEntry" );
-        }
     }
 
     /**
@@ -174,16 +152,12 @@
 
         public String toString()
         {
-            return names.toString();
-        }
-        
-        
-        public void printToBuffer( StringBuilder buffer )
-        {
+            StringBuilder buffer = new StringBuilder();
+
             boolean isFirst = true;
             buffer.append( "{ " );
-            
-            for ( javax.naming.Name name:names )
+
+            for ( javax.naming.Name name : names )
             {
                 if ( isFirst )
                 {
@@ -193,13 +167,15 @@
                 {
                     buffer.append( ", " );
                 }
-                
+
                 buffer.append( '"' );
                 buffer.append( name.toString() );
                 buffer.append( '"' );
             }
-            
+
             buffer.append( " }" );
+
+            return buffer.toString();
         }
     }
 
@@ -225,14 +201,7 @@
 
         public String toString()
         {
-            return "name: " + super.toString();
-        }
-        
-        
-        public void printToBuffer( StringBuilder buffer )
-        {
-            buffer.append( "name " );
-            super.printToBuffer( buffer );
+            return "name " + super.toString();
         }
     }
 
@@ -261,14 +230,7 @@
 
         public String toString()
         {
-            return "userGroup: " + super.toString();
-        }
-        
-        
-        public void printToBuffer( StringBuilder buffer )
-        {
-            buffer.append( "userGroup " );
-            super.printToBuffer( buffer );
+            return "userGroup " + super.toString();
         }
     }
 
@@ -291,7 +253,8 @@
          */
         public Subtree( Collection<SubtreeSpecification> subtreeSpecs )
         {
-            this.subtreeSpecifications = Collections.unmodifiableCollection( new ArrayList<SubtreeSpecification>(
subtreeSpecs ) );
+            this.subtreeSpecifications = Collections.unmodifiableCollection( new ArrayList<SubtreeSpecification>(
+                subtreeSpecs ) );
         }
 
 
@@ -323,16 +286,12 @@
 
         public String toString()
         {
-            return "subtree: " + subtreeSpecifications;
-        }
-        
-        
-        public void printToBuffer( StringBuilder buffer )
-        {
+            StringBuilder buffer = new StringBuilder();
+
             boolean isFirst = true;
             buffer.append( "subtree { " );
-            
-            for ( SubtreeSpecification ss:subtreeSpecifications )
+
+            for ( SubtreeSpecification ss : subtreeSpecifications )
             {
                 if ( isFirst )
                 {
@@ -342,11 +301,13 @@
                 {
                     buffer.append( ", " );
                 }
-                
+
                 ss.printToBuffer( buffer );
             }
-            
+
             buffer.append( " }" );
+
+            return buffer.toString();
         }
     }
 }

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ACIItemParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ACIItemParserTest.java?rev=619906&r1=619905&r2=619906&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ACIItemParserTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ACIItemParserTest.java
Fri Feb  8 07:14:21 2008
@@ -23,8 +23,6 @@
 
 import java.text.ParseException;
 
-import org.apache.directory.shared.ldap.aci.ACIItemParser;
-
 import junit.framework.TestCase;
 
 
@@ -64,6 +62,13 @@
     }
 
 
+    private void checkItemToString( String spec, ACIItem item ) throws Exception
+    {
+        // try to parse the result of item.toString() again
+        parser.parse( item.toString() );
+    }
+
+
     /**
      * Tests the parser with a rangeOfValues with a nested filter.
      */
@@ -73,16 +78,16 @@
             + "itemOrUserFirst itemFirst  :{ protectedItems  "
             + "{ rangeOfValues (&(&(|(|(cn=ccc)(!(cn=ddd))(&(cn=aaa)(cn=bbb))))))
" + "}  , itemPermissions {  } } }";
 
-        parser.parse( spec );
-        
-        
+        ACIItem item = parser.parse( spec );
+        checkItemToString( spec, item );
+
         spec = " { identificationTag \"id8\", precedence 0, authenticationLevel simple "
             + ", itemOrUserFirst userFirst: { userClasses { allUsers }, userPermissions {
"
             + " { protectedItems { rangeOfValues (&(cn=test)(sn=test)) }, grantsAndDenials
{ grantAdd } }, "
-            + "{ protectedItems { rangeOfValues (|(!(cn=aaa))(sn=bbb)) }, grantsAndDenials
{ grantAdd } } "
-            + " } } }";
-        
-        parser.parse( spec );
+            + "{ protectedItems { rangeOfValues (|(!(cn=aaa))(sn=bbb)) }, grantsAndDenials
{ grantAdd } } " + " } } }";
+
+        item = parser.parse( spec );
+        checkItemToString( spec, item );
     }
 
 
@@ -100,7 +105,8 @@
             + "{ precedence 10, userClasses {allUsers  , userGroup { \"1.2=y,z=t\"  , \"a=b,c=d\"
} "
             + " , subtree { { base \"ou=people\" } } }   , grantsAndDenials  {  denyCompare
 , grantModify } } } }}";
 
-        parser.parse( spec );
+        ACIItem item = parser.parse( spec );
+        checkItemToString( spec, item );
     }
 
 
@@ -116,7 +122,8 @@
             + "userPermissions { { protectedItems{ entry  , attributeType { cn  , ou }  ,
attributeValue {x=y,m=n,k=l} , "
             + "rangeOfValues (cn=ErsinEr) }  , grantsAndDenials { grantBrowse } } } }  }
  ";
 
-        parser.parse( spec );
+        ACIItem item = parser.parse( spec );
+        checkItemToString( spec, item );
     }
 
 
@@ -126,7 +133,8 @@
             + "itemOrUserFirst userFirst: { " + "userClasses { allUsers }, "
             + "userPermissions { { protectedItems {entry}, " + "grantsAndDenials { grantAdd
} } } } }";
 
-        parser.parse( spec );
+        ACIItem item = parser.parse( spec );
+        checkItemToString( spec, item );
     }
 
 
@@ -136,7 +144,8 @@
             + "itemOrUserFirst userFirst: { " + "userClasses { allUsers, name { \"ou=blah\"
} }, "
             + "userPermissions { { protectedItems {entry}, " + "grantsAndDenials { grantAdd
} } } } }";
 
-        parser.parse( spec );
+        ACIItem item = parser.parse( spec );
+        checkItemToString( spec, item );
     }
 
 
@@ -151,7 +160,8 @@
             + "{ precedence 10, userClasses {allUsers  , userGroup { \"1.2=y,z=t\"  , \"a=b,c=d\"
} "
             + " , subtree { { base \"ou=people\" } } }   , grantsAndDenials  {  denyCompare
 , grantModify } } } }}";
 
-        parser.parse( spec );
+        ACIItem item = parser.parse( spec );
+        checkItemToString( spec, item );
     }
 
 
@@ -164,7 +174,8 @@
             + "userPermissions { { protectedItems{ entry  , attributeType { cn  , ou }  ,
attributeValue {x=y,m=n,k=l} , "
             + "rangeOfValues (cn=ErsinEr) }  , grantsAndDenials { grantBrowse } } } }  }
  ";
 
-        parser.parse( spec );
+        ACIItem item = parser.parse( spec );
+        checkItemToString( spec, item );
     }
 
 
@@ -223,7 +234,8 @@
             + "{ precedence 10, userClasses {allUsers  , userGroup { \"1.2=y,z=t\"  , \"a=b,c=d\"
} "
             + " , subtree { { base \"ou=people\" } } }   , grantsAndDenials  {  denyCompare
 , grantModify } } } }}";
 
-        parser.parse( spec );
+        ACIItem item = parser.parse( spec );
+        checkItemToString( spec, item );
     }
 
 
@@ -260,7 +272,8 @@
             + "userPermissions { { grantsAndDenials { grantBrowse }, protectedItems{ entry
 , attributeType { cn  , ou }  , attributeValue {x=y,m=n,k=l} , "
             + "rangeOfValues (cn=ErsinEr) }  } } }  }   ";
 
-        parser.parse( spec );
+        ACIItem item = parser.parse( spec );
+        checkItemToString( spec, item );
     }
 
 
@@ -294,7 +307,8 @@
             + "rangeOfValues (cn=ErsinEr) }  , grantsAndDenials { grantBrowse } } } }, "
             + " identificationTag \"id2\"   , authenticationLevel none, precedence 14 } 
 ";
 
-        parser.parse( spec );
+        ACIItem item = parser.parse( spec );
+        checkItemToString( spec, item );
     }
 
 
@@ -348,7 +362,8 @@
             + "subtree {{ base \"ou=system\" }, { base \"ou=ORGANIZATIONUNIT\","
             + "minimum  1, maximum   2 } } } }  }   ";
 
-        parser.parse( spec );
+        ACIItem item = parser.parse( spec );
+        checkItemToString( spec, item );
     }
 
 
@@ -362,7 +377,8 @@
             + " attributeValue { ou=people  , cn=Ersin  }  , rangeOfValues (cn=ErsinEr) ,
"
             + "classes and : { item: xyz , or:{item:X,item:Y}   }}  " + " }}";
 
-        parser.parse( spec );
+        ACIItem item = parser.parse( spec );
+        checkItemToString( spec, item );
     }
 
 
@@ -393,7 +409,8 @@
             + "maxValueCount { { type 10.11.12, maxCount 10 }, { maxCount 20, type 11.12.13
 } } "
             + " }  , grantsAndDenials { grantBrowse } } } }  }   ";
 
-        parser.parse( spec );
+        ACIItem item = parser.parse( spec );
+        checkItemToString( spec, item );
     }
 
 
@@ -406,7 +423,21 @@
             + "restrictedBy { { type 10.11.12, valuesIn ou }, { valuesIn cn, type 11.12.13
 } } "
             + " }  , grantsAndDenials { grantBrowse } } } }  }   ";
 
-        parser.parse( spec );
+        ACIItem item = parser.parse( spec );
+        checkItemToString( spec, item );
+    }
+
+
+    public void testMaxImmSubComponentsOrderDoesNotMatter() throws Exception
+    {
+        String spec = "{ identificationTag \"id2\"   , precedence 14, authenticationLevel
none  , "
+            + "itemOrUserFirst userFirst:  { userClasses {  allUsers  , name { \"ou=people,cn=ersin\"
}, "
+            + "subtree {{ base \"ou=system\" }, { base \"ou=ORGANIZATIONUNIT\"," + "minimum
 1, maximum   2 } } }  , "
+            + "userPermissions { { protectedItems{ entry  , maxImmSub 5 "
+            + " }  , grantsAndDenials { grantBrowse } } } }  }   ";
+
+        ACIItem item = parser.parse( spec );
+        checkItemToString( spec, item );
     }
 
 
@@ -418,17 +449,18 @@
             + "subtree {{ minimum 7, maximum 9, base \"ou=system\" }, { base \"ou=ORGANIZATIONUNIT\","
             + " maximum   2, minimum  1 } } }  }  }   ";
 
-        parser.parse( spec );
+        ACIItem item = parser.parse( spec );
+        checkItemToString( spec, item );
     }
-    
-    
+
+
     /**
      * Test case for DIRSERVER-891
      */
     public void testInvalidAttributeValue()
     {
         String spec;
-        
+
         // no name-value-pair
         spec = "{ identificationTag \"id2\"   , precedence 14, authenticationLevel none 
, "
             + "itemOrUserFirst userFirst:  { userPermissions { { protectedItems{ entry  ,
attributeType { cn  , ou }  , attributeValue { must_be_a_name_value_pair } , "
@@ -438,13 +470,13 @@
         try
         {
             parser.parse( spec );
-            fail("Expected ParseException, invalid protected item 'attributeValue { must_be_a_name_value_pair
}'");
+            fail( "Expected ParseException, invalid protected item 'attributeValue { must_be_a_name_value_pair
}'" );
         }
         catch ( ParseException e )
         {
             // Expected
         }
-        
+
         // no name-value-pair
         spec = "{ identificationTag \"id2\"   , precedence 14, authenticationLevel none 
, "
             + "itemOrUserFirst userFirst:  { userPermissions { { protectedItems{ entry  ,
attributeType { cn  , ou }  , attributeValue { x=y,m=n,k=l,x } , "
@@ -454,60 +486,60 @@
         try
         {
             parser.parse( spec );
-            fail("Expected ParseException, invalid protected item 'attributeValue { must_be_a_name_value_pair
}'");
+            fail( "Expected ParseException, invalid protected item 'attributeValue { x=y,m=n,k=l,x
}'" );
         }
         catch ( ParseException e )
         {
             // Expected
         }
     }
-    
-    
+
+
     /**
      * Test case for DIRSERVER-891
      */
     public void testIncomplete()
     {
         String spec;
-        
+
         spec = "{ }";
         try
         {
             parser.parse( spec );
-            fail("Expected ParseException, ACIItem is incomplete'");
+            fail( "Expected ParseException, ACIItem is incomplete'" );
         }
         catch ( ParseException e )
         {
             // Expected
         }
-        
+
         spec = "{ identificationTag \"id2\" }";
         try
         {
             parser.parse( spec );
-            fail("Expected ParseException, ACIItem is incomplete'");
+            fail( "Expected ParseException, ACIItem is incomplete'" );
         }
         catch ( ParseException e )
         {
             // Expected
         }
-        
+
         spec = "{ identificationTag \"id2\", precedence 14 } ";
         try
         {
             parser.parse( spec );
-            fail("Expected ParseException, ACIItem is incomplete'");
+            fail( "Expected ParseException, ACIItem is incomplete'" );
         }
         catch ( ParseException e )
         {
             // Expected
         }
-        
+
         spec = "{ identificationTag \"id2\", precedence 14, authenticationLevel none } ";
         try
         {
             parser.parse( spec );
-            fail("Expected ParseException, ACIItem is incomplete'");
+            fail( "Expected ParseException, ACIItem is incomplete'" );
         }
         catch ( ParseException e )
         {



Mime
View raw message