dev@glassfish.java.net

URGENT: Ming Zhang: Changes to QL build scripts for simple-bv-servlet test with SecurityManager enabled

From: Ed Burns <Ed.Burns_at_Sun.COM>
Date: Mon, 13 Jul 2009 16:56:50 -0400

Ming, please review this change-bundle and let me know if I can check it
in. It allows QL to pass with SecurityManager enabled.

Issue: simple-bv-servlet QL test fails with SecurityManager enabled

SECTION: Modified Files

M build.xml

- re-add the import of the v3-targets.xml file

- modify the all_wd_security target to call

+ <antcall target="add-quicklook-policy-grants" />

  before doing the tests and to call

+ <antcall target="remove-quicklook-policy-grants" />

  after doing the tests.

M gfproject/v3-targets.xml

- add the add-quicklook-policy-grants, and
  remove-quicklook-policy-grants targets. The former moves aside the
  glassfish.home server.policy and creates a new one from the
  concatenation of the old one and the new file
  bean-validator/simple-bv-servlet/simple-bv-servlet.policy. The latter
  replaces the modified server.policy file with the one saved aside by
  the former.

A bean-validator/simple-bv-servlet/simple-bv-servlet.policy.

- Contains a single grant that lets the simple-bv-servlet application
  run when the security manager is enabled.

SECTION: Diffs

Index: gfproject/v3-targets.xml
===================================================================
--- gfproject/v3-targets.xml (revision 29027)
+++ gfproject/v3-targets.xml (working copy)
@@ -89,6 +89,23 @@
     </exec>
 </target>
 
+<target name="add-quicklook-policy-grants">
+ <move file="${glassfish.home}/domains/domain1/config/server.policy"
+ tofile="${glassfish.home}/domains/domain1/config/server_policy.orig"/>
+ <concat append="true"
+ destfile="${glassfish.home}/domains/domain1/config/server.policy">
+ <fileset file="${glassfish.home}/domains/domain1/config/server_policy.orig"/>
+ <fileset file="${basedir}/bean-validator/simple-bv-servlet/simple-bv-servlet.policy"/>
+ </concat>
+</target>
+
+<target name="remove-quicklook-policy-grants">
+ <delete file="${glassfish.home}/domains/domain1/config/server.policy"/>
+ <move file="${glassfish.home}/domains/domain1/config/server_policy.orig"
+ tofile="${glassfish.home}/domains/domain1/config/server.policy"/>
+</target>
+
+
 <target name="disable-security-manager" depends="setOSConditions,asenv-unix,asenv-windows">
     <exec executable="${ASADMIN}">
         <arg line="delete-jvm-options"/>
Index: bean-validator/simple-bv-servlet/simple-bv-servlet.policy
===================================================================
--- bean-validator/simple-bv-servlet/simple-bv-servlet.policy (revision 0)
+++ bean-validator/simple-bv-servlet/simple-bv-servlet.policy (revision 0)
@@ -0,0 +1,4 @@
+
+grant codeBase "file:${com.sun.aas.instanceRoot}/applications/simple-bv-servlet/-" {
+ permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+};
Index: build.xml
===================================================================
--- build.xml (revision 29027)
+++ build.xml (working copy)
@@ -40,6 +40,7 @@
     <property file="build.properties"/>
      <property file="${basedir}/gfproject/derby.properties"/>
      <import file="${basedir}/gfproject/db-targets.xml"/>
+ <import file="${basedir}/gfproject/v3-targets.xml"/>
     
     <description>Builds, tests, and runs the project V3 Quicklook</description>
     <target name="all_wd" depends="clean">
@@ -60,6 +61,7 @@
 
     <target name="all_wd_security" depends="clean">
         <record name="allrun.output" action="start"/>
+ <antcall target="add-quicklook-policy-grants" />
         <antcall target="start-derby"/>
         <antcall target="start-server-felix"/>
         <antcall target="enable-security-manager"/>
@@ -70,6 +72,7 @@
         <antcall target="quicklook-summary"/>
         <antcall target="stop-server"/>
         <antcall target="stop-derby"/>
+ <antcall target="remove-quicklook-policy-grants" />
         <antcall target="testng-summary"/>
         <copy file="test-output/emailable-report.html" tofile="test-output/QL-WP-report.html"/>
         <record name="allrun.output" action="stop"/>

--