Sun Microsystems 1.2 Granting or Denying Security Permissions, Granting Security Permissions

Models: 1.2

1 130
Download 130 pages 63.94 Kb
Page 84
Image 84

CODE EXAMPLE 4-17Test Description for a Double Duty Test (Continued)

<THEAD><TR><TH SCOPE="col">Item</TH><TH SCOPE= "col">Value</TH></TR></THEAD>

<TR>

<TD SCOPE="row"> <B>title</B> </TD> <TD> checking double duty test</TD> </TR>

<TR>

<TD SCOPE="row"> <B>source</B> </TD>

<TD> <A HREF="Test.java">Test.java</A> </TD> </TR>

<TR>

<TD SCOPE="row"> <B>executeClass</B> </TD> <TD> sample.pkg.Test</TD>

</TR>

<TR>

<TD SCOPE="row"> <B>DoubleDutySecurity</B> </TD> <TD> yes </TD>

</TR>

</TABLE>

</BODY>

</HTML

Granting or Denying Security Permissions

A security test might require that certain permissions be granted (or denied) for the test to pass. The test is run or not run according to the permissions that a test writer grants or denies.

Granting Security Permissions

When writing security tests, a test writer can specify the permissions that the security policy must grant in the protection domain for the test application to execute and pass. A test writer can specify the required security permissions by including a grant attribute in the test description. If the security policy doesn’t grant the specified permissions, the test must be filtered out of the test run.

For example, a test application is written based on the assumption that following permissions are granted:

javax.microedition.io.Connector.file.read

javax.microedition.io.Connector.file.write

64 Java ME TCK Framework Developer’s Guide • July 2007

Page 84
Image 84
Sun Microsystems 1.2 manual Granting or Denying Security Permissions, Granting Security Permissions