db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r639059 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting: junit/SecurityManagerSetup.java unitTests/junit/SystemPrivilegesPermissionTest.java
Date Wed, 19 Mar 2008 23:06:40 GMT
Author: djd
Date: Wed Mar 19 16:06:33 2008
New Revision: 639059

URL: http://svn.apache.org/viewvc?rev=639059&view=rev
Log:
DERBY-3548 Change SystemPrivilegesPermissionTest to only perform the fixture that tests using
Subject if that class is available on the current virtual machine. Allows the test to pass
and run useful fixtures in J2ME/CDC/Foundation 1.1

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/SystemPrivilegesPermissionTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java?rev=639059&r1=639058&r2=639059&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
Wed Mar 19 16:06:33 2008
@@ -37,6 +37,17 @@
  *
  */
 public final class SecurityManagerSetup extends TestSetup {
+    
+    /**
+     * Does the JVM support Subjects for
+     * authorization through Java security manager.
+     * J2ME/CDC/Foundation 1.1 does not support Subjects.
+     */
+    public static final boolean JVM_HAS_SUBJECT_AUTHORIZATION;
+    static {
+        JVM_HAS_SUBJECT_AUTHORIZATION = JDBC.haveClass("javax.security.auth.Subject");
+    }
+    
 	
 	private static final Properties classPathSet = new Properties();
     

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/SystemPrivilegesPermissionTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/SystemPrivilegesPermissionTest.java?rev=639059&r1=639058&r2=639059&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/SystemPrivilegesPermissionTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/SystemPrivilegesPermissionTest.java
Wed Mar 19 16:06:33 2008
@@ -154,16 +154,15 @@
         TestSuite suite = new TestSuite(
                 SystemPrivilegesPermissionTest.class,
                 "SystemPrivilegesPermissionTest");
-         return new SecurityManagerSetup(suite, POLICY_FILE_NAME);
+        
+        if (SecurityManagerSetup.JVM_HAS_SUBJECT_AUTHORIZATION)
+        {
+            suite.addTest(new SecurityManagerSetup(
+                new SystemPrivilegesPermissionTest("policyTestSystemGrants"),
+                POLICY_FILE_NAME));
+        }
+        return suite;
     }
-
-    /**
-     * Test case that does a check of the XXX
-     */
-    public void testIsSecurityManager() {
-        assertSecurityManager();
-     }
-
     
     /**
      * Tests SystemPrincipal.
@@ -301,11 +300,11 @@
                                 p.getActions());
                     }
                 }
-                
-                
-                
             }
         }
+    }
+    
+    public void policyTestSystemGrants() {
 
         // test SystemPermission for authorized user against policy file
         



Mime
View raw message