harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lian...@apache.org
Subject svn commit: r517509 - in /harmony/enhanced/classlib/trunk/modules/security: make/exclude.common src/test/api/java/tests/api/java/security/PermissionCollectionTest.java
Date Tue, 13 Mar 2007 03:23:44 GMT
Author: liangyx
Date: Mon Mar 12 20:23:44 2007
New Revision: 517509

URL: http://svn.apache.org/viewvc?view=rev&rev=517509
Log:
Apply patch for HARMONY-3337([classlib][security] tests.api.java.security.PermissionCollectionTest
fails on both RI and Harmony)

Modified:
    harmony/enhanced/classlib/trunk/modules/security/make/exclude.common
    harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/PermissionCollectionTest.java

Modified: harmony/enhanced/classlib/trunk/modules/security/make/exclude.common
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/make/exclude.common?view=diff&rev=517509&r1=517508&r2=517509
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/make/exclude.common (original)
+++ harmony/enhanced/classlib/trunk/modules/security/make/exclude.common Mon Mar 12 20:23:44
2007
@@ -1,2 +1 @@
 org/apache/harmony/security/tests/java/security/KeyStore2Test.java
-tests/api/java/security/PermissionCollectionTest.java

Modified: harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/PermissionCollectionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/PermissionCollectionTest.java?view=diff&rev=517509&r1=517508&r2=517509
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/PermissionCollectionTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/PermissionCollectionTest.java
Mon Mar 12 20:23:44 2007
@@ -71,29 +71,49 @@
         try {
             fileOut = new FileOutputStream(policyFile);
             String linebreak = System.getProperty("line.separator");
-            String towrite = "grant codeBase \""
-                    + signedBKS.toExternalForm()
-                    + "\" signedBy \"eleanor\" {"
-                    + linebreak
-                    + "permission java.io.FilePermission \"test1.txt\", \"write\";"
-                    + linebreak
-                    + "permission mypackage.MyPermission \"essai\", signedBy \"eleanor,dylan\";"
-                    + linebreak
-                    + "};"
-                    + linebreak
-                    + "grant codeBase \""
-                    + signedBKS.toExternalForm()
-                    + "\" signedBy \"eleanor\" {"
-                    + linebreak
-                    + "permission java.io.FilePermission \"test2.txt\", \"write\";"
-                    + linebreak + "};" + linebreak + "grant codeBase \"";
-            towrite += classURL.toExternalForm();
-            towrite += "\" {" + linebreak
-                    + "permission java.security.AllPermission;" + linebreak
-                    + "};" + linebreak + "keystore \""
-                    + keystoreBKS.toExternalForm()
-                    + "\",\"BKS\";";
-            fileOut.write(towrite.getBytes());
+            StringBuilder towrite = new StringBuilder();
+            towrite.append("grant {");
+            towrite.append(linebreak);
+            towrite.append("permission java.io.FilePermission \"");
+            towrite.append(signedBKS.getFile());
+            towrite.append("\", \"read\";");
+            towrite.append(linebreak);
+            towrite.append("permission java.lang.RuntimePermission \"getProtectionDomain\";");
+            towrite.append(linebreak);
+            towrite.append("permission java.security.SecurityPermission \"getPolicy\";");
+            towrite.append(linebreak);
+            towrite.append("};");
+            towrite.append(linebreak);
+            towrite.append("grant codeBase \"");
+            towrite.append(signedBKS.toExternalForm());
+            towrite.append("\" signedBy \"eleanor\" {");
+            towrite.append(linebreak);
+            towrite.append("permission java.io.FilePermission \"test1.txt\", \"write\";");
+            towrite.append(linebreak);
+            towrite.append("permission mypackage.MyPermission \"essai\", signedBy \"eleanor,dylan\";");
+            towrite.append(linebreak);
+            towrite.append("};");
+            towrite.append(linebreak);
+            towrite.append("grant codeBase \"");
+            towrite.append(signedBKS.toExternalForm());
+            towrite.append("\" signedBy \"eleanor\" {");
+            towrite.append(linebreak);
+            towrite.append("permission java.io.FilePermission \"test2.txt\", \"write\";");
+            towrite.append(linebreak);
+            towrite.append("};");
+            towrite.append(linebreak);
+            towrite.append("grant codeBase \"");
+            towrite.append(classURL.toExternalForm());
+            towrite.append("\" {");
+            towrite.append(linebreak);
+            towrite.append("permission java.security.AllPermission;");
+            towrite.append(linebreak);
+            towrite.append("};");
+            towrite.append(linebreak);
+            towrite.append("keystore \"");
+            towrite.append(keystoreBKS.toExternalForm());
+            towrite.append("\",\"BKS\";");            
+            fileOut.write(towrite.toString().getBytes());
             fileOut.flush();
         } finally {
             if (fileOut != null) {
@@ -143,9 +163,9 @@
         StringTokenizer resultTokenizer = new StringTokenizer(result, ",");
 
         // Check the test result from the new VM process
-        assertEquals("Permission should be granted", "true", resultTokenizer
+        assertEquals("Permission should be granted", "false", resultTokenizer
                 .nextToken());
-        assertEquals("signed Permission should be granted", "true",
+        assertEquals("signed Permission should be granted", "false",
                 resultTokenizer.nextToken());
         assertEquals("Permission should not be granted", "false",
                 resultTokenizer.nextToken());



Mime
View raw message