incubator-graffito-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raph...@apache.org
Subject svn commit: r220025 - in /incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/security/impl: TestPermissions.java TestRdbmsPolicy.java
Date Thu, 21 Jul 2005 09:39:25 GMT
Author: raphael
Date: Thu Jul 21 02:39:23 2005
New Revision: 220025

URL: http://svn.apache.org/viewcvs?rev=220025&view=rev
Log:
Fix use of enum variable to allow compilation underjdk 1.5

Modified:
    incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/security/impl/TestPermissions.java
    incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/security/impl/TestRdbmsPolicy.java

Modified: incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/security/impl/TestPermissions.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/security/impl/TestPermissions.java?rev=220025&r1=220024&r2=220025&view=diff
==============================================================================
--- incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/security/impl/TestPermissions.java
(original)
+++ incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/security/impl/TestPermissions.java
Thu Jul 21 02:39:23 2005
@@ -40,7 +40,7 @@
 /**
  * This unit test comes from Jetspeed 2. It used to check if the J2 security
  * components are well integrated with Graffito
- *  
+ *
  */
 
 public class TestPermissions extends AbstractSecurityTestcase
@@ -53,7 +53,7 @@
      */
     public void setUp() throws Exception
     {
-        super.setUp();        
+        super.setUp();
         try
         {
             cmsAccessController = (CmsAccessController) ctx.getBean("org.apache.portals.graffito.security.CmsAccessController");
@@ -101,44 +101,44 @@
      */
     public void testgetPermission()
     {
-                
+
         Permissions permissions = pms.getPermissions("/files/subfolder1");
-        
-        Enumeration enum = permissions.elements();
+
+        Enumeration enum1 = permissions.elements();
         int count = 0;
-        while (enum.hasMoreElements())
+        while (enum1.hasMoreElements())
         {
-            CmsPermission permission = (CmsPermission) enum.nextElement();            
+            CmsPermission permission = (CmsPermission) enum1.nextElement();
             System.out.println("Permission found - actions : " + permission.getActions()
+ " name : " + permission.getName());
             Iterator fullPathIterator = permission.getPrincipalFullPaths().iterator();
             while (fullPathIterator.hasNext())
             {
                 String fullPath = (String) fullPathIterator.next();
-                System.out.println("          fullPath : " + fullPath);                
+                System.out.println("          fullPath : " + fullPath);
             }
-            
+
             count++;
         }
         assertTrue("Invalid number of permissions for '/files/subfolder1", count == 2);
-       
-    }  
-    
+
+    }
+
     /**
      * Test isRecursive
      */
     public void testisRecursive()
     {
-                
+
         CmsPermissionImpl perm = new CmsPermissionImpl("/files/subfolder1/-", "view");
         assertTrue("Permission /files/subfolder1/- is not recursive", perm.isRecursive()
);
-        
+
         perm = new CmsPermissionImpl("/files/subfolder1", "view");
         assertFalse("Permission /files/subfolder1 is  recursive", perm.isRecursive() );
-        
+
         perm = new CmsPermissionImpl("/files/subfolder1/*", "view");
         assertFalse("Permission  /files/subfolder1/* is  recursive", perm.isRecursive() );
-       
-    }     
+
+    }
     /**
      * <p>
      * Initialize user test object.
@@ -157,16 +157,16 @@
 
         UserPrincipal user = new UserPrincipalImpl("anon");
         UserPrincipal user2 = new UserPrincipalImpl("christophe");
-        
+
         CmsPermissionImpl perm1 = new CmsPermissionImpl("/files/test.xml", "edit");
         CmsPermissionImpl perm2 = new CmsPermissionImpl("/files/subfolder1/-", "view");
         CmsPermissionImpl perm3 = new CmsPermissionImpl("/files/subfolder1/*", "edit");
         CmsPermissionImpl perm4 = new CmsPermissionImpl("/files/subfolder2/-", "view");
         CmsPermissionImpl perm5 = new CmsPermissionImpl("/files/subfolder3/*", "view,insert");
-        
+
         try
         {
-            
+
             pms.addPermission(perm1);
             pms.addPermission(perm2);
             pms.addPermission(perm3);
@@ -178,7 +178,7 @@
             pms.grantPermission(user, perm4);
             pms.grantPermission(user, perm5);
             pms.grantPermission(user2, perm2);
-            
+
         }
         catch (SecurityException sex)
         {
@@ -187,9 +187,9 @@
     }
 
     /**
-     * 
+     *
      * Destroy user test object.
-     * 
+     *
      * @throws Exception when it is not possible to clean up
      */
     protected void destroyUser() throws Exception

Modified: incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/security/impl/TestRdbmsPolicy.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/security/impl/TestRdbmsPolicy.java?rev=220025&r1=220024&r2=220025&view=diff
==============================================================================
--- incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/security/impl/TestRdbmsPolicy.java
(original)
+++ incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/security/impl/TestRdbmsPolicy.java
Thu Jul 21 02:39:23 2005
@@ -38,7 +38,7 @@
 /**
  * This unit test comes from Jetspeed 2. It used to check if the J2 security
  * components are well integrated with Graffito
- *  
+ *
  */
 
 public class TestRdbmsPolicy extends AbstractSecurityTestcase
@@ -51,7 +51,7 @@
      */
     public void setUp() throws Exception
     {
-        super.setUp();        
+        super.setUp();
         try
         {
             cmsAccessController = (CmsAccessController) ctx.getBean("org.apache.portals.graffito.security.CmsAccessController");
@@ -96,7 +96,7 @@
 
     /**
      * Test simple permission on one document
-     *  
+     *
      */
     public void testSimplePermission()
     {
@@ -111,7 +111,7 @@
     /**
      * Test permissions with wild card (eg. /file/*) & with recursive setting
      * (eg. /files/- )
-     *  
+     *
      */
     public void testAdvancedPermission()
     {
@@ -127,35 +127,35 @@
         assertTrue("did not authorize view permission on the Folder.", cmsAccessController.hasPermission(
                 "/files/subfolder2/foo/anotherdoc.xml", "view"));
         assertTrue("did not authorize insert permission on the document.", cmsAccessController.hasPermission(
-                "/files/subfolder3/test.xml", "insert"));   
+                "/files/subfolder3/test.xml", "insert"));
         assertTrue("did not authorize view permission on the document.", cmsAccessController.hasPermission(
                 "/files/subfolder3/test.xml", "view"));
         assertFalse("Permission error - should not update the document .", cmsAccessController.hasPermission(
-                "/files/subfolder3/test.xml", "update"));        
-        
+                "/files/subfolder3/test.xml", "update"));
+
     }
 
-    
+
     /**
      * Test getPermissions
-     * 
-     *  
+     *
+     *
      */
     public void testgetPermission()
     {
         CmsRequestContext cmsRequestContext = contextManager.getCurrentCmsRequestContext();
         Subject subject = cmsRequestContext.getSubject();
-        Permissions permissions = pms.getPermissions(subject.getPrincipals());        
-        Enumeration enum = permissions.elements();
-        while (enum.hasMoreElements())
+        Permissions permissions = pms.getPermissions(subject.getPrincipals());
+        Enumeration enum1 = permissions.elements();
+        while (enum1.hasMoreElements())
         {
-            Permission permission = (Permission) enum.nextElement();
-            
+            Permission permission = (Permission) enum1.nextElement();
+
             System.out.println("Permission found - actions : " + permission.getActions()
+ " name : " + permission.getName());
         }
-        
-       
-    }    
+
+
+    }
     /**
      * <p>
      * Initialize user test object.
@@ -177,7 +177,7 @@
         CmsPermissionImpl perm2 = new CmsPermissionImpl("/files/subfolder1/*", "view");
         CmsPermissionImpl perm3 = new CmsPermissionImpl("/files/subfolder2/-", "view");
         CmsPermissionImpl perm4 = new CmsPermissionImpl("/files/subfolder3/*", "view,insert");
-        
+
         try
         {
             pms.addPermission(perm1);
@@ -196,9 +196,9 @@
     }
 
     /**
-     * 
+     *
      * Destroy user test object.
-     * 
+     *
      * @throws Exception when it is not possible to clean up
      */
     protected void destroyUser() throws Exception



Mime
View raw message