The following is an example of a grant attribute and permissions added to a test description file.

CODE EXAMPLE 4-18grant Attribute Entry and Security Permissions

<TR>

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

<TD> javax.microedition.io.Connector.file.read javax.microedition.io.Connector.file.write </TD> </TR>

The value of the grant attribute is a list of space-separated permissions (in the example, javax.microedition.io.Connector.file.read and javax.microedition.io.Connector.file.write) that must be granted by the security policy for this test application to execute and pass. If these permissions are not granted for the test application, the test application must be filtered out.

The following is an example of a test description file that includes the grant attribute and permissions.

CODE EXAMPLE 4-19Test Description That Grants Permissions for a Security Test

<TITLE>Test Specifications and Descriptions for Test</TITLE> </HEAD>

<BODY>

<H1>Test Specifications and Descriptions for Test</H1> <HR>

<a name="Test"></a>

<TABLE BORDER=1 SUMMARY="Javatest Test Description" CLASS= TestDescription>

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

<TR>

<TD SCOPE="row"> <B>title</B> </TD> <TD> checking grant permission</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>grant</B> </TD>

<TD> javax.microedition.io.Connector.file.read

Chapter 4 Writing Tests 65

Page 85
Image 85
Sun Microsystems 1.2 manual Body