On 7/10/2010 4:24 AM, Nirmal Fernando wrote:
Hi All,

In order to run the tests I've created in XplainStatisticsTest.java class,
I need read and write permissions to user's testing directory's
extinout folder.

Currently in derby_tests.policy file, it doesn't provide IO permissions to
extinout folder under user's testing directory.

So I like to request from the community to approve the above mentioned
permission grant.

It is interesting to me that it is junit.jar that needs the permission. I would have expected it to be derbytools.jar or derbyTesting.jar.

I think it it is fine to add this to the default testing policy file as it only affects the testing jar and is for a specific directory referenced just in the tests. Generally I only make a separate specific test policy file if it is one of the product jars that requires increased permissions beyond what is documented, so that that permission requirement doesn't creep into the product in general.


After adding that permission derby_tests.policy file's relevant portion
looks like following:

// JUnit jar file tries to read junit.properties in the user's
// home directory and seems to require permission to read the
// property user.home as well.
// junit.swingui.TestRunner writes to .junitsession on exit.
grant codeBase "${derbyTesting.junit}" {
     permission java.util.PropertyPermission "user.home", "read";
     permission java.io.FilePermission
"${user.home}${/}junit.properties", "read";
     permission java.io.FilePermission "${user.home}${/}.junitsession", "write";

     // This permission is needed when running the tests using ant 1.7
     permission java.io.FilePermission "${user.dir}${/}*", "write";
        //DERBY-4587 PlanExporter tool needs this permission in order to run 
its tests
        permission java.io.FilePermission "${user.dir}${/}extinout${/}-",
"read, write";

     // These permissions are needed when testing code instrumented with EMMA.
     permission java.util.PropertyPermission "${emma.active}user.dir", "read";
     permission java.io.FilePermission
"${emma.active}${user.dir}${/}coverage.ec", "read, write";
     permission java.lang.RuntimePermission "${emma.active}writeFileDescriptor";
};


Thanks.



Reply via email to