Hello Ming,
Please review these changes to allow Web Beans QuickLook test to run
with SecurityManager enabled:
A webbeans/numberguess/numberguess.policy
- Contains a single grant that lets the test
run when the security manager is enabled.
M build.xml
- import v3-targets.xml
- added Web Beans test to both testng (already in testng_gd.xml).
M testng.xml
- added Web Beans test to this suite
M gfproject/v3-targets.xml
- targets for adding / removing policy grants
SECTION: Diffs
Index: webbeans/numberguess/numberguess.policy
===================================================================
--- webbeans/numberguess/numberguess.policy (revision 0)
+++ webbeans/numberguess/numberguess.policy (revision 0)
@@ -0,0 +1,4 @@
+
+grant codeBase
"file:${com.sun.aas.instanceRoot}/applications/numberguess/-" {
+ permission java.lang.reflect.ReflectPermission
"suppressAccessChecks";
+};
Index: build.xml
===================================================================
--- build.xml (revision 32118)
+++ build.xml (working copy)
@@ -41,6 +41,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" -->
@@ -63,6 +64,7 @@
<target name="all_wd_security" depends="clean">
<record name="allrun.output" action="start"/>
+ <antcall target="add-quicklook-policy-grants" />
<property name="env.security_manager" value="ON"/>
<antcall target="start_server_with_security_manager_enabled" />
@@ -73,6 +75,7 @@
<antcall target="undeploy"/>
<antcall target="quicklook-summary"/>
+ <antcall target="remove-quicklook-policy-grants" />
<antcall target="stop_server_with_security_manager_enabled" />
<antcall target="testng-summary"/>
@@ -121,6 +124,7 @@
<!-- Target for testing glassfish distribution (containing EJB) -->
<target name="all_gd_security" depends="clean">
<record name="allrun.output" action="start"/>
+ <antcall target="add-quicklook-policy-grants" />
<property name="env.security_manager" value="ON"/>
<antcall target="start-derby"/>
<antcall target="start-server-felix"/>
@@ -134,6 +138,7 @@
<antcall target="undeploy"/>
<antcall target="undeploy-gd"/>
<antcall target="quicklook-summary"/>
+ <antcall target="remove-quicklook-policy-grants" />
<antcall target="disable-security-manager"/>
<antcall target="stop-server"/>
<antcall target="stop-derby"/>
@@ -172,6 +177,7 @@
<ant dir="ejb/slsbnicmt" target="build-deploy"/>
<ant dir="ejb/sfulnoi" target="build-deploy"/>
<ant dir="bean-validator/simple-bv-servlet" target="build-deploy"/>
+ <ant dir="webbeans/numberguess" target="build-deploy"/>
<record name="build.output" action="stop"/>
</target>
@@ -182,7 +188,6 @@
<ant dir="ejb/cmp" target="build-deploy"/>
<ant dir="ejb/mdb" target="build"/>
<ant dir="wsit/JaxwsFromWsdl" target="build-deploy"/>
- <ant dir="webbeans/numberguess" target="build-deploy"/>
</target>
<target name="undeploy">
@@ -197,6 +202,7 @@
<ant dir="ejb/slsbnicmt" target="undeploy"/>
<ant dir="ejb/sfulnoi" target="undeploy"/>
<ant dir="bean-validator/simple-bv-servlet" target="undeploy"/>
+ <ant dir="webbeans/numberguess" target="undeploy"/>
<record name="undeploy.output" action="stop"/>
</target>
@@ -205,7 +211,6 @@
<ant dir="ejb/remoteview" target="undeploy"/>
<ant dir="ejb/cmp" target="undeploy"/>
<ant dir="wsit/JaxwsFromWsdl" target="undeploy"/>
- <ant dir="webbeans/numberguess" target="undeploy"/>
</target>
Index: testng.xml
===================================================================
--- testng.xml (revision 32118)
+++ testng.xml (working copy)
@@ -114,6 +114,11 @@
<class name="test.bv.servlet.simple.SimpleBVServletTestNG" />
</classes>
</test>
+ <test name="webbeans_numberguess">
+ <classes>
+ <class name="test.web.numberguess.NumberGuessTestNG" />
+ </classes>
+ </test>
<test name="asadmin_tests">
<classes>
<class name="test.admin.JvmOptionTests"/>
Index: gfproject/v3-targets.xml
===================================================================
--- gfproject/v3-targets.xml (revision 32022)
+++ gfproject/v3-targets.xml (working copy)
@@ -84,6 +84,22 @@
<echo message="${message1}"/>
</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}/webbeans/numberguess/numberguess.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="jrubyHomeCon"
depends="setOSConditions,asenv-unix,asenv-windows">
<echo message="asconf ${asenv_conf}"/>
<loadfile property="asconf_jruby" srcfile="${asenv_conf}"
failonerror="false">