blob: 44888d630fdfd171c997e44ac4e1b03eacb2d2c8 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2021 Contributors to Eclipse Foundation.
Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->
<project name="GlassFish-QuickLook" default="all" basedir=".">
<property environment="env" />
<property file="build.properties" />
<property file="${basedir}/gfproject/derby.properties" />
<import file="${basedir}/gfproject/db-targets.xml" />
<import file="${basedir}/gfproject/utils.xml" />
<description>Builds, tests, and runs the project Quicklook</description>
<target name="initprops">
<property name="build.class.dir" value="${basedir}/classes/test" />
<property name="Java_SE" value="${basedir}/classes/EJB_remoteview/app" />
<property name="test.report" value="${basedir}/test-output" />
<mkdir dir="${test.report}" />
<path id="junit.path">
<pathelement path="${plugin_classpath}" />
</path>
<typedef name="junitreport" classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator" classpathref="junit.path" />
<path id="run.testng.classpath">
<fileset dir="${glassfish.home}/modules">
<include name="**/hk2*.jar" />
<include name="**/glassfish-api.jar" />
<include name="**/amx-core.jar" />
<include name="**/amx-javaee.jar" />
<include name="**/management-api.jar" />
</fileset>
<fileset dir="${glassfish.home}/lib">
<include name="**/gf-client.jar" />
</fileset>
<pathelement path="${plugin_classpath}" />
<pathelement location="${Java_SE}" />
<pathelement location="${build.class.dir}" />
</path>
<path id="embedded.testng.classpath">
<fileset dir="${glassfish.home}/lib/embedded">
<include name="**/glassfish-embedded-static-shell.jar" />
</fileset>
<pathelement location="${build.class.dir}" />
<pathelement location="${build.class.dir}/../EJB_Embedded/app" />
</path>
</target>
<target name="all_cluster">
<record name="${basedir}/allrun.output" action="start" />
<antcall target="start-server-felix" />
<antcall target="build-cluster" />
<antcall target="runtest">
<param name="testng.xml" value="testng/testng_cluster.xml" />
</antcall>
<antcall target="stop-server" />
<antcall target="testng-summary" />
<record name="${basedir}/allrun.output" action="stop" />
</target>
<target name="all_embedded">
<record name="${basedir}/embeddedrun.output" action="start" />
<ant dir="ejb/embedded" target="build" />
<antcall target="runtest-embedded">
<param name="testng.xml" value="testng/testng_em.xml" />
</antcall>
<record name="${basedir}/embeddedrun.output" action="stop" />
</target>
<target name="build-cluster">
<ant dir="cluster/clustersetup" target="build" />
<ant dir="cluster/helloworld" target="build" />
<ant dir="cluster/clusterteardown" target="build" />
</target>
<!-- target name="all_wd" depends="clean" -->
<target name="all_wd">
<record name="${basedir}/allrun.output" action="start" />
<echo>+-----------------------------+</echo>
<echo>| |</echo>
<echo>| R u n n i n g |</echo>
<echo>| all_wd |</echo>
<echo>| Web Profile |</echo>
<echo>+-----------------------------+</echo>
<property name="env.security_manager" value="OFF" />
<antcall target="verify-xml" />
<antcall target="start-derby" />
<antcall target="start-server-felix" />
<antcall target="build-deploy" />
<antcall target="runtest">
<param name="testng.xml" value="testng/testng_web_profile.xml" />
</antcall>
<antcall target="undeploy" />
<antcall target="quicklook-summary_wd" />
<antcall target="stop-server" />
<antcall target="stop-derby" />
<copy file="test-output/emailable-report.html" tofile="test-output/QL-WP-report.html" />
<antcall target="check-logged-messages" />
<antcall target="testng-summary_wd" />
<record name="${basedir}/allrun.output" action="stop" />
</target>
<target name="all_wd_security">
<record name="${basedir}/allrun.output" action="start" />
<echo>+-----------------------------+</echo>
<echo>| |</echo>
<echo>| R u n n i n g |</echo>
<echo>| all_wd_security |</echo>
<echo>| Web Profile |</echo>
<echo>+-----------------------------+</echo>
<antcall target="add-quicklook-policy-grants" />
<property name="env.security_manager" value="ON" />
<antcall target="start_server_with_security_manager_enabled" />
<antcall target="build-deploy" />
<antcall target="runtest">
<param name="testng.xml" value="testng/testng_web_profile.xml" />
</antcall>
<antcall target="undeploy" />
<antcall target="quicklook-summary_wd" />
<antcall target="remove-quicklook-policy-grants" />
<antcall target="stop_server_with_security_manager_enabled" />
<copy file="test-output/emailable-report.html" tofile="test-output/QL-WP-report.html" />
<antcall target="check-logged-messages" />
<antcall target="testng-summary_wd" />
<record name="${basedir}/allrun.output" action="stop" />
</target>
<!-- Target for testing glassfish distribution (containing EJB) -->
<target name="all" depends="clean">
<record name="${basedir}/allrun.output" action="start" />
<echo>+-----------------------------+</echo>
<echo>| |</echo>
<echo>| R u n n i n g |</echo>
<echo>| all |</echo>
<echo>| |</echo>
<echo>+-----------------------------+</echo>
<property name="env.security_manager" value="OFF" />
<antcall target="verify-xml" />
<antcall target="start-derby" />
<antcall target="start-server-felix" />
<antcall target="build-deploy-gd" />
<antcall target="build-deploy" />
<antcall target="build-cluster" />
<antcall target="runtest">
<param name="testng.xml" value="testng/testng_full_profile.xml" />
</antcall>
<antcall target="undeploy" />
<antcall target="undeploy-gd" />
<antcall target="quicklook-summary" />
<antcall target="stop-server" />
<antcall target="stop-derby" />
<copy file="test-output/emailable-report.html" tofile="test-output/QL-GP-report.html" failonerror="false" />
<antcall target="check-logged-messages" />
<antcall target="testng-summary" />
<record name="${basedir}/allrun.output" action="stop" />
</target>
<!-- Target for testing glassfish distribution (containing EJB) -->
<target name="all_ri" depends="clean">
<record name="${basedir}/allrun.output" action="start" />
<echo>+-----------------------------+</echo>
<echo>| |</echo>
<echo>| R u n n i n g |</echo>
<echo>| all_ri |</echo>
<echo>| |</echo>
<echo>+-----------------------------+</echo>
<property name="env.security_manager" value="OFF" />
<antcall target="verify-xml" />
<antcall target="start-derby" />
<antcall target="start-server-felix" />
<antcall target="build-deploy" />
<antcall target="build-deploy-gd" />
<antcall target="runtest">
<param name="testng.xml" value="testng/testng_ri.xml" />
</antcall>
<antcall target="undeploy" />
<antcall target="undeploy-gd" />
<antcall target="quicklook-summary" />
<antcall target="stop-server" />
<antcall target="stop-derby" />
<copy file="test-output/emailable-report.html" tofile="test-output/QL-GP-report.html" failonerror="false" />
<antcall target="check-logged-messages" />
<antcall target="testng-summary" />
<record name="${basedir}/allrun.output" action="stop" />
</target>
<!-- Target for testing glassfish distribution (GD) (containing EJB) -->
<target name="all_gd_security" depends="clean">
<record name="${basedir}/allrun.output" action="start" />
<echo>+-----------------------------+</echo>
<echo>| |</echo>
<echo>| R u n n i n g |</echo>
<echo>| all_gd_security |</echo>
<echo>| Full Profile |</echo>
<echo>+-----------------------------+</echo>
<antcall target="add-quicklook-policy-grants" />
<property name="env.security_manager" value="ON" />
<antcall target="verify-xml" />
<antcall target="start-derby" />
<antcall target="start-server-felix" />
<antcall target="enable-security-manager" />
<antcall target="stop-server" />
<antcall target="start-server-felix" />
<antcall target="build-deploy" />
<antcall target="build-deploy-gd" />
<antcall target="runtest">
<param name="testng.xml" value="testng/testng_full_profile.xml" />
</antcall>
<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" />
<copy file="test-output/emailable-report.html" tofile="test-output/QL-GP-report.html" failonerror="false" />
<antcall target="check-logged-messages" />
<antcall target="testng-summary" />
<record name="${basedir}/allrun.output" action="stop" />
</target>
<!-- Target for testing glassfish distribution (containing EJB) -->
<target name="dev_debug" depends="clean">
<record name="${basedir}/allrun.output" action="start" />
<echo>+-----------------------------+</echo>
<echo>| |</echo>
<echo>| R u n n i n g |</echo>
<echo>| dev_debug |</echo>
<echo>| Full Profile |</echo>
<echo>+-----------------------------+</echo>
<antcall target="verify-xml" />
<antcall target="start-derby" />
<antcall target="build-deploy" />
<antcall target="runtest">
<param name="testng.xml" value="testng/testng_debug.xml" />
</antcall>
<antcall target="undeploy" />
<antcall target="stop-derby" />
<antcall target="check-logged-messages" />
<antcall target="testng-summary" />
<record name="${basedir}/allrun.output" action="stop" />
</target>
<!-- S T A R T S E R V E R -->
<target name="start_server_with_security_manager_enabled">
<property name="env.security_manager" value="ON" />
<antcall target="verify-xml" />
<antcall target="start-derby" />
<antcall target="start-server-felix" />
<antcall target="enable-security-manager" />
<antcall target="stop-server" />
<antcall target="start-server-felix" />
</target>
<target name="stop_server_with_security_manager_enabled">
<property name="env.security_manager" value="ON" />
<antcall target="disable-security-manager" />
<antcall target="stop-server" />
<antcall target="stop-derby" />
</target>
<target name="start-server-hk2" depends="setOSConditions">
<echo>+-----------------------------+</echo>
<echo>| |</echo>
<echo>| S T A R T I N G GLASSFISH |</echo>
<echo>| in HK2 mode |</echo>
<echo>| |</echo>
<echo>+-----------------------------+</echo>
<antcall target="start-server-hk2-unix" />
<antcall target="start-server-hk2-windows" />
</target>
<target name="start-server-hk2-windows" if="isWindows">
<exec executable="cmd" spawn="true">
<env key="GlassFish_Platform" value="HK2" />
<arg value="/c" />
<arg value="${glassfish.home}\bin\asadmin.bat" />
<arg value="start-domain" />
</exec>
</target>
<target name="start-server-hk2-unix" if="isUnix">
<exec executable="${glassfish.home}/bin/asadmin">
<env key="GlassFish_Platform" value="HK2" />
<arg value="start-domain" />
</exec>
</target>
<target name="start-server-felix" depends="setOSConditions">
<echo>+-----------------------------+</echo>
<echo>| |</echo>
<echo>| S T A R T I N G GLASSFISH |</echo>
<echo>| in Felix mode |</echo>
<echo>| |</echo>
<echo>+-----------------------------+</echo>
<antcall target="start-server-felix-unix" />
<antcall target="start-server-felix-windows" />
</target>
<target name="start-server-felix-windows" if="isWindows">
<exec executable="cmd" spawn="true">
<arg value="/c" />
<arg value="${glassfish.home}\bin\asadmin.bat" />
<arg value="start-domain" />
<arg value="domain1" />
</exec>
<waitfor maxwait="30" maxwaitunit="second" checkevery="500">
<http url="http://localhost:4848/" />
</waitfor>
</target>
<target name="start-server-felix-unix" if="isUnix">
<exec executable="${glassfish.home}/bin/asadmin">
<arg value="start-domain" />
<arg value="domain1" />
</exec>
</target>
<!-- B U I L D & D E P L O Y T E S T A R C H I V E S -->
<target name="build-deploy">
<record name="${basedir}/build.output" action="start" />
<echo message="ANT PROJECT ${ant.project.name}" />
<run-quicklook-test path="amx" target="build" />
<run-quicklook-test path="admin" target="build" />
<run-quicklook-test path="admincli" target="build" />
<!-- For now GlassFish 7 doesn't have an admin console
<run-quicklook-test path="adminconsole" target="build" />
-->
<run-quicklook-test path="rest" target="build" />
<!--<run-quicklook-test path="osgitest/basicosgi" target="build"/>-->
<run-quicklook-test path="web/helloworld" target="build-deploy" />
<run-quicklook-test path="web/jsfastrologer" target="build-deploy" />
<run-quicklook-test path="web/jsfinjection" target="build-deploy" />
<run-quicklook-test path="jdbc/jdbcusertx" target="build-deploy" />
<run-quicklook-test path="persistence/jpainjectemf" target="build-deploy" />
<run-quicklook-test path="persistence/jpavalidation" target="build-deploy" />
<run-quicklook-test path="security/helloworld" target="build-deploy" />
<run-quicklook-test path="security/basicauth" target="build-deploy" />
<run-quicklook-test path="ejb/slsbnicmt" target="build-deploy" />
<run-quicklook-test path="ejb/sfulnoi" target="build-deploy" />
<run-quicklook-test path="bean-validator/simple-bv-servlet" target="build-deploy" />
<run-quicklook-test path="weld/numberguess" target="build-deploy" />
<run-quicklook-test path="weld/osgiweld" target="build-deploy" />
<run-quicklook-test path="weld/extensions" target="build-deploy" />
<record name="${basedir}/build.output" action="stop" />
</target>
<target name="build-deploy-gd">
<echo message="Glassfish Full Profile Build Deploy" />
<run-quicklook-test path="ejb/remoteview" target="build-deploy" />
<run-quicklook-test path="ejb/singleton" target="build-deploy" />
<run-quicklook-test path="ejb/cmp" target="build-deploy" />
<run-quicklook-test path="ejb/mdb" target="build" />
<run-quicklook-test path="jms/injection" target="build-deploy" />
<run-quicklook-test path="wsit/JaxwsFromWsdl" target="build-deploy" />
<run-quicklook-test path="wsit/jsr109tester" target="build-deploy" />
<run-quicklook-test path="security/appperms" target="build-deploy" />
</target>
<!-- R U N T E S T S -->
<!-- Target is re-definted here as didn't want to specify ws.root property -->
<target name="runtest" depends="initprops,setOSConditions,asenv-unix,asenv-windows">
<record name="${basedir}/runtestng.output" action="start" />
<echo message="${line.separator}${line.separator}" />
<echo message="=============================================================================" />
<echo message="= =" />
<echo message="= S t a r t i n g TestNG f u n c t i o n a l t e s t s =" />
<echo message="= =" />
<echo message="= TEST FILE = ${testng.xml} =" />
<echo message="= BASEDIR = ${basedir} =" />
<echo message="= =" />
<echo message="=============================================================================" />
<echo message="${line.separator}${line.separator}" />
<property name="hasTestNGXML" value="true" />
<loadfile property="tests" srcfile="${testng.xml}">
<filterchain>
<linecontainsregexp>
<regexp pattern="test name"/>
</linecontainsregexp>
</filterchain>
</loadfile>
<echo message="${line.separator}${line.separator}" />
<echo message="=============================================================================" />
<echo message="= R u n n i n g t h e f o l l o w i n g t e s t s: =" />
<echo message="= From TEST FILE = ${testng.xml} =" />
<echo message="${tests}" />
<echo message="=============================================================================" />
<mkdir dir="${test.report}" />
<testng outputdir="${test.report}" classpathref="run.testng.classpath">
<jvmarg value="-Djava.compiler=NONE" />
<jvmarg value="-Dhttp.host=${glassfish.http.host}" />
<jvmarg value="-Dhttp.port=${glassfish.http.port}" />
<jvmarg value="-DASADMIN=${ASADMIN}" />
<jvmarg value="-DAPPCLIENT=${APPCLIENT}" />
<jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<sysproperty key="glassfish.home" value="${glassfish.home}" />
<sysproperty key="BASEDIR" value="${basedir}" />
<xmlfileset dir="." includes="${testng.xml}" />
</testng>
<record name="${basedir}/runtestng.output" action="stop" />
</target>
<target name="runtest-embedded" depends="initprops">
<record name="${basedir}/runtestng.output" action="start" />
<mkdir dir="${test.report}" />
<testng outputdir="${test.report}" classpathref="embedded.testng.classpath">
<jvmarg value="-Djava.compiler=NONE" />
<sysproperty key="glassfish.home" value="${glassfish.home}" />
<sysproperty key="BASEDIR" value="${basedir}" />
<xmlfileset dir="." includes="${testng.xml}" />
</testng>
<record name="${basedir}/runtestng.output" action="stop" />
</target>
<!-- U N D E P L O Y T E S T A R C H I V E S -->
<target name="undeploy">
<record name="${basedir}/undeploy.output" action="start" />
<run-quicklook-test path="web/helloworld" target="undeploy" />
<run-quicklook-test path="web/jsfastrologer" target="undeploy" />
<run-quicklook-test path="web/jsfinjection" target="undeploy" />
<run-quicklook-test path="jdbc/jdbcusertx" target="undeploy" />
<run-quicklook-test path="persistence/jpainjectemf" target="undeploy" />
<run-quicklook-test path="persistence/jpavalidation" target="undeploy" />
<run-quicklook-test path="security/helloworld" target="undeploy" />
<run-quicklook-test path="security/basicauth" target="undeploy" />
<run-quicklook-test path="ejb/slsbnicmt" target="undeploy" />
<run-quicklook-test path="ejb/sfulnoi" target="undeploy" />
<run-quicklook-test path="bean-validator/simple-bv-servlet" target="undeploy" />
<run-quicklook-test path="weld/numberguess" target="undeploy" />
<run-quicklook-test path="weld/osgiweld" target="undeploy" />
<run-quicklook-test path="weld/extensions" target="undeploy" />
<run-quicklook-test path="jms/injection" target="undeploy" />
<record name="${basedir}/undeploy.output" action="stop" />
</target>
<target name="undeploy-gd">
<run-quicklook-test path="ejb/singleton" target="undeploy" />
<run-quicklook-test path="ejb/remoteview" target="undeploy" />
<run-quicklook-test path="ejb/cmp" target="undeploy" />
<!-- <ant dir="wsit/JaxwsFromWsdl" target="undeploy"/>
<ant dir="wsit/jsr109tester" target="undeploy"/>-->
<run-quicklook-test path="security/appperms" target="undeploy" />
</target>
<!-- Target is re-defined here as someone (who?) didn't want to specify ws.root property -->
<target name="clean">
<delete dir="${basedir}/classes" />
<delete verbose="true" includeemptydirs="true">
<fileset dir="${basedir}" includes="**/classes" />
</delete>
<delete dir="${basedir}/test-output" includeemptydirs="true" />
<delete dir="${basedir}/dist" includeemptydirs="true" />
<delete includeemptydirs="true">
<fileset dir="${basedir}">
<include name="**/*.output" />
</fileset>
</delete>
</target>
<!-- S U M M A R Y -->
<!-- Generate the TestNG report -->
<target name="report" depends="initprops">
<echo message="Generating report at ${test.report}" />
<mkdir dir="${test.report}" />
<junitreport todir="${test.report}">
<fileset dir=".">
<include name="${test.report}/**/*.xml" />
</fileset>
<report format="noframes" todir="${test.report}" />
</junitreport>
<echo message="Test Report available at ${test.report}/index.html" />
</target>
<!-- Fail the build unless the expected number of tests has passed -->
<target name="assert.expected.passed.test.count">
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${maven.repo.local}/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
<if>
<isset property="expected.passed.test.count" />
<then>
<echo>perform the assertion</echo>
<sequential>
<property name="test.report.dir" value="${basedir}/test-output" />
<loadfile property="report.summary" srcFile="${test.report.dir}/index.html" />
<propertyregex property="actual.passed.test.count" input="${report.summary}" regexp="(?s)(.*)(invocation-passed...td..em.Total./em../td..td..em.)([0-9]{1,6})(.*)" select="\3" />
<math result="passed.test.count.difference" datatype="int" operation="subtract" operand1="${actual.passed.test.count}" operand2="${expected.passed.test.count}" />
<propertyregex property="actual.lessthan.expected" input="${passed.test.count.difference}" regexp="^-.*" replace="actual.lessthan.expected" />
<fail if="actual.lessthan.expected" status="-1" message="
--JOB FAILED!-- Fewer than expected tests passed. Expected: ${expected.passed.test.count} Actual: ${actual.passed.test.count}" />
</sequential>
</then>
</if>
</target>
<!-- added few messages in order to show testng summary of wsit related tests along with final summary as wsit tests are ran seperately as a workaround for GLASSFISH-21672 -->
<target name="testng-summary">
<loadfile srcfile="runtestng.output" property="testng_output">
<filterchain>
<tailfilter lines="6" />
</filterchain>
</loadfile>
<loadfile srcfile="wsit/JaxwsFromWsdl/wsit1run.output" property="testng1_output">
<filterchain>
<tailfilter lines="3" />
</filterchain>
</loadfile>
<loadfile srcfile="wsit/jsr109tester/wsit2run.output" property="testng2_output">
<filterchain>
<tailfilter lines="3" />
</filterchain>
</loadfile>
<echo message=" JaxwsFromWsdl Tests" />
<echo message="${testng1_output}" />
<echo message=" Jsr109tester Tests" />
<echo message="${testng2_output}" />
<echo message="${testng_output}" />
</target>
<!-- created new target for web-distribution summary as it is different from glassfish distribution summary-->
<target name="testng-summary_wd">
<loadfile srcfile="runtestng.output" property="testng_output">
<filterchain>
<tailfilter lines="6" />
</filterchain>
</loadfile>
<echo message="${testng_output}" />
</target>
<!-- added few messages in order to show testng summary of wsit related tests along with final summary as wsit tests are ran seperately as a workaround for GLASSFISH-21672 -->
<target name="quicklook-summary">
<tstamp>
<format property="end.timestamp" pattern="EE MM/dd/yyyy HH:mm:ss zz" />
</tstamp>
<echo file="quicklook_summary.txt" message=" Test completed: ${end.timestamp} ${line.separator}" />
<loadfile srcfile="runtestng.output" property="testng_output">
<filterchain>
<tailfilter lines="4" skip="1" />
<tokenfilter>
<replacestring from="[testng]" to="" />
</tokenfilter>
</filterchain>
</loadfile>
<loadfile srcfile="wsit/JaxwsFromWsdl/wsit1run.output" property="testng1_output">
<filterchain>
<tailfilter lines="4" skip="1" />
<tokenfilter>
<replacestring from="[testng]" to="" />
<replacestring from="QuickLookTests" to="JaxwsFromWsdl Tests" />
</tokenfilter>
</filterchain>
</loadfile>
<loadfile srcfile="wsit/jsr109tester/wsit2run.output" property="testng2_output">
<filterchain>
<tailfilter lines="4" skip="1" />
<tokenfilter>
<replacestring from="[testng]" to="" />
<replacestring from="QuickLookTests" to=" Jsr109tester Tests" />
</tokenfilter>
</filterchain>
</loadfile>
<echo file="quicklook_summary.txt" append="true" message="${testng_output}" />
<echo file="quicklook_summary.txt" append="true" message="${testng1_output}" />
<echo file="quicklook_summary.txt" append="true" message="${testng2_output}" />
<antcall target="build-version" />
<available file="test-output/emailable-report.html" property="report.present" />
<antcall target="quicklook-report" />
<delete file="version.output" />
</target>
<target name="quicklook-summary_wd">
<tstamp>
<format property="end.timestamp" pattern="EE MM/dd/yyyy HH:mm:ss zz" />
</tstamp>
<echo file="quicklook_summary.txt" message=" Test completed: ${end.timestamp} ${line.separator}" />
<loadfile srcfile="runtestng.output" property="testng_output">
<filterchain>
<tailfilter lines="4" skip="1" />
<tokenfilter>
<replacestring from="[testng]" to="" />
</tokenfilter>
</filterchain>
</loadfile>
<echo file="quicklook_summary.txt" append="true" message="${testng_output}" />
<antcall target="build-version" />
<available file="test-output/emailable-report.html" property="report.present" />
<antcall target="quicklook-report" />
<delete file="version.output" />
</target>
<target name="quicklook-report" if="report.present">
<loadfile srcfile="version.output" property="build_version">
<filterchain>
<headfilter lines="1" />
</filterchain>
</loadfile>
<exec executable="hostname" outputproperty="host.name" />
<property name="titleTime" value="&lt;H1&gt; GF QuickLook Test Results &lt;/H1&gt; &lt;HR&gt; Build Info: ${build_version} &lt;p&gt; Test Completed at: ${end.timestamp}" />
<property name="confRow1" value="&lt;TABLE class=param&gt; &lt;TR&gt; &lt;TD&gt;OS arch&lt;/TD&gt; &lt;TD&gt;Java version &lt;/TD&gt; &lt;TD&gt;Machine Name &lt;/TD&gt; &lt;TD&gt;Security Manager&lt;/TD&gt; &lt;/TR&gt;" />
<property name="confRow2" value="&lt;TR&gt; &lt;TD&gt;${os.name}-${os.arch}&lt;/TD&gt; &lt;TD&gt;${java.version}&lt;/TD&gt; &lt;TD&gt;${host.name}&lt;/TD&gt; &lt;TD&gt;${env.security_manager}&lt;/TD&gt; &lt;/TR&gt; &lt;/TABLE&gt;" />
<replace file="test-output/emailable-report.html" token="&lt;body&gt;" value="&lt;body&gt; ${titleTime} ${confRow1} ${confRow2} &lt;HR&gt; &lt;p&gt;" />
</target>
<target name="archive" depends="initprops,clean">
<tstamp>
<!--<format property="TODAY_UK" pattern="d-MMMM-yyyy" locale="en,UK"/>-->
</tstamp>
<property name="final.src.name" value="glassfish_testng_${DSTAMP}.zip" />
<delete>
<fileset dir="${basedir}" includes="*.zip" />
</delete>
<delete file="{final.src.name}" failonerror="false" />
<zip zipfile="${final.src.name}" basedir=".">
<exclude name="${test.report}/**" />
<exclude name="${build.class.dir}/**" />
<exclude name="**/*.log" />
<exclude name="**/*.output" />
<exclude name="**/*.war" />
<exclude name="**/*.class" />
<exclude name="**/CVS" />
<exclude name="**/nbproject" />
</zip>
</target>
<target name="setOSConditions">
<condition property="isUnix">
<os family="unix" />
</condition>
<condition property="isWindows">
<os family="windows" />
</condition>
</target>
<target name="asenv-unix" if="isUnix">
<property name="asenv_conf" value="${glassfish.home}/config/asenv.conf" />
<property name="ASADMIN" value="${glassfish.home}/bin/asadmin" />
<property name="APPCLIENT" value="${glassfish.home}/bin/appclient" />
</target>
<target name="asenv-windows" if="isWindows">
<property name="asenv_conf" value="${glassfish.home}/config/asenv.bat" />
<property name="ASADMIN" value="${glassfish.home}\bin\asadmin.bat" />
<property name="APPCLIENT" value="${glassfish.home}\bin\appclient.bat" />
</target>
<target name="build-version" depends="setOSConditions">
<antcall target="build-version-unix" />
<antcall target="build-version-windows" />
</target>
<target name="build-version-unix" if="isUnix">
<exec executable="${glassfish.home}/bin/asadmin" output="version.output">
<arg value="version" />
</exec>
</target>
<target name="build-version-windows" if="isWindows">
<exec executable="cmd" output="version.output">
<arg value="/c" />
<arg value="${glassfish.home}\bin\asadmin.bat" />
<arg value="version" />
</exec>
</target>
<target name="stop-server" depends="setOSConditions">
<echo message="stopping server" />
<antcall target="stop-server-unix" />
<antcall target="stop-server-windows" />
</target>
<target name="stop-server-windows" if="isWindows">
<exec executable="cmd">
<arg value="/c" />
<arg value="${glassfish.home}\bin\asadmin.bat" />
<arg value="stop-domain" />
</exec>
</target>
<target name="stop-server-unix" if="isUnix">
<exec executable="${glassfish.home}/bin/asadmin">
<arg value="stop-domain" />
</exec>
</target>
<target name="verify-xml" depends="setOSConditions">
<echo message="Verify Domain.xml" />
<antcall target="verify-xml-unix" />
<antcall target="verify-xml-windows" />
</target>
<target name="verify-xml-unix" if="isUnix">
<exec executable="${glassfish.home}/bin/asadmin">
<arg value="verify-domain-xml" />
</exec>
</target>
<target name="verify-xml-windows" if="isWindows">
<exec executable="cmd">
<arg value="/c" />
<arg value="${glassfish.home}\bin\asadmin.bat" />
<arg value="verify-domain-xml" />
</exec>
</target>
<!-- D E F S -->
<presetdef name="javac">
<javac includeantruntime="false" />
</presetdef>
<taskdef name="testng" classname="org.testng.TestNGAntTask">
<classpath>
<pathelement path="${plugin_classpath}" />
</classpath>
</taskdef>
<macrodef name="run-quicklook-test" xmlns:if="ant:if" xmlns:unless="ant:unless">
<attribute name="path" />
<attribute name="target" />
<sequential>
<local name="do-run-test" />
<condition property="do-run-test" else="false">
<or>
<equals arg1="${env.quicklook}" arg2="@{path}" />
<not>
<isset property="env.quicklook" />
</not>
</or>
</condition>
<sequential if:true="${do-run-test}">
<local name="absolute.path" />
<property name="absolute.path" location="@{path}" />
<echo message="${line.separator}" />
<echo message=" *************************" />
<echo message=" * @{target} @{path} " />
<echo message=" * Path: ${absolute.path} " />
<echo message=" *************************" />
<echo message="${line.separator}" />
<ant dir="@{path}" target="@{target}"/>
</sequential>
</sequential>
</macrodef>
</project>