directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r524887 - in /directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci: ACIItemChekerTest.java ACIItemParserTest.java
Date Mon, 02 Apr 2007 18:59:20 GMT
Author: seelmann
Date: Mon Apr  2 11:59:19 2007
New Revision: 524887

URL: http://svn.apache.org/viewvc?view=rev&rev=524887
Log:
Added some more tests for DIRSERVER-891

Modified:
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ACIItemChekerTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ACIItemParserTest.java

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ACIItemChekerTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ACIItemChekerTest.java?view=diff&rev=524887&r1=524886&r2=524887
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ACIItemChekerTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ACIItemChekerTest.java
Mon Apr  2 11:59:19 2007
@@ -21,6 +21,8 @@
 package org.apache.directory.shared.ldap.aci;
 
 
+import java.text.ParseException;
+
 import org.apache.directory.shared.ldap.aci.ACIItemChecker;
 
 import junit.framework.TestCase;
@@ -247,4 +249,99 @@
 
         checker.parse( spec );
     }
+    
+    
+    /**
+     * 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 } , "
+//            + "rangeOfValues (cn=ErsinEr) }  , grantsAndDenials { grantBrowse } } }, userClasses
{  allUsers  , name { \"ou=people,cn=ersin\" }, "
+//            + "subtree {{ minimum 7, maximum 9, base \"ou=system\" }, { base \"ou=ORGANIZATIONUNIT\","
+//            + " maximum   2, minimum  1 } } }  }  }   ";
+//        try
+//        {
+//            checker.parse( spec );
+//            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 } , "
+//            + "rangeOfValues (cn=ErsinEr) }  , grantsAndDenials { grantBrowse } } }, userClasses
{  allUsers  , name { \"ou=people,cn=ersin\" }, "
+//            + "subtree {{ minimum 7, maximum 9, base \"ou=system\" }, { base \"ou=ORGANIZATIONUNIT\","
+//            + " maximum   2, minimum  1 } } }  }  }   ";
+//        try
+//        {
+//            checker.parse( spec );
+//            fail("Expected ParseException, invalid protected item 'attributeValue { must_be_a_name_value_pair
}'");
+//        }
+//        catch ( ParseException e )
+//        {
+//            // Expected
+//        }
+    }
+    
+    
+    /**
+     * Test case for DIRSERVER-891
+     */
+    public void testIncomplete()
+    {
+        String spec;
+        
+        spec = "{ }";
+        try
+        {
+            checker.parse( spec );
+            fail("Expected ParseException, ACIItem is incomplete'");
+        }
+        catch ( ParseException e )
+        {
+            // Expected
+        }
+        
+//        spec = "{ identificationTag \"id2\" }";
+//        try
+//        {
+//            checker.parse( spec );
+//            fail("Expected ParseException, ACIItem is incomplete'");
+//        }
+//        catch ( ParseException e )
+//        {
+//            // Expected
+//        }
+//        
+//        spec = "{ identificationTag \"id2\", precedence 14 } ";
+//        try
+//        {
+//            checker.parse( spec );
+//            fail("Expected ParseException, ACIItem is incomplete'");
+//        }
+//        catch ( ParseException e )
+//        {
+//            // Expected
+//        }
+//        
+//        spec = "{ identificationTag \"id2\", precedence 14, authenticationLevel none }
";
+//        try
+//        {
+//            checker.parse( spec );
+//            fail("Expected ParseException, ACIItem is incomplete'");
+//        }
+//        catch ( ParseException e )
+//        {
+//            // Expected
+//        }
+    }
+    
 }

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?view=diff&rev=524887&r1=524886&r2=524887
==============================================================================
--- 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
Mon Apr  2 11:59:19 2007
@@ -420,4 +420,98 @@
 
         parser.parse( spec );
     }
+    
+    
+    /**
+     * 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 } , "
+            + "rangeOfValues (cn=ErsinEr) }  , grantsAndDenials { grantBrowse } } }, userClasses
{  allUsers  , name { \"ou=people,cn=ersin\" }, "
+            + "subtree {{ minimum 7, maximum 9, base \"ou=system\" }, { base \"ou=ORGANIZATIONUNIT\","
+            + " maximum   2, minimum  1 } } }  }  }   ";
+        try
+        {
+            parser.parse( spec );
+            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 } , "
+            + "rangeOfValues (cn=ErsinEr) }  , grantsAndDenials { grantBrowse } } }, userClasses
{  allUsers  , name { \"ou=people,cn=ersin\" }, "
+            + "subtree {{ minimum 7, maximum 9, base \"ou=system\" }, { base \"ou=ORGANIZATIONUNIT\","
+            + " maximum   2, minimum  1 } } }  }  }   ";
+        try
+        {
+            parser.parse( spec );
+            fail("Expected ParseException, invalid protected item 'attributeValue { must_be_a_name_value_pair
}'");
+        }
+        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'");
+        }
+        catch ( ParseException e )
+        {
+            // Expected
+        }
+        
+        spec = "{ identificationTag \"id2\" }";
+        try
+        {
+            parser.parse( spec );
+            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'");
+        }
+        catch ( ParseException e )
+        {
+            // Expected
+        }
+        
+        spec = "{ identificationTag \"id2\", precedence 14, authenticationLevel none } ";
+        try
+        {
+            parser.parse( spec );
+            fail("Expected ParseException, ACIItem is incomplete'");
+        }
+        catch ( ParseException e )
+        {
+            // Expected
+        }
+    }
 }



Mime
View raw message