blob: cb79d2ea3d6a0dee87cfe56c2f1c61e82778579b [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 1997, 2018 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-V3-CommunityTests" default="default" basedir=".">
<property file="build.properties"/>
<property file="${basedir}/gfproject/derby.properties"/>
<import file="${basedir}/gfproject/db-targets.xml"/>
<description>Builds, tests, and runs the project V3 Quicklook</description>
<target name="all" depends="clean">
<record name="allrun.output" action="start"/>
<!-- resolveArtifact artifactId="testng" property="testng.jar"/>
<echo message="testng jar value: ${testng.jar}"/ -->
<!-- antcall target="setup.toplink"/ -->
<antcall target="start-server"/>
<antcall target="startDerby"/>
<antcall target="build"/>
<antcall target="deploy"/>
<antcall target="runtest"/>
<antcall target="undeploy"/>
<antcall target="stop-server"/>
<antcall target="stopDerby"/>
<!-- antcall target="report"/ -->
<record name="allrun.output" action="stop"/>
</target>
<!-- <import file="nbproject/build-impl.xml"/>-->
<target name="copyJARS">
<echo message="Copying testng.jar to ${ant.home}/lib"/>
<copy todir="${ant.home}/lib" verbose="true">
<fileset dir="${basedir}/lib">
<include name="**/testng*.*"/>
</fileset>
</copy>
</target>
<target name="default">
<echo message="ANT.HOME is ${ant.home}"/>
<antcall target="copyJARS"/>
<echo message="ant build (Compiles and Packages testsuites)"/>
<echo message="ant deploy (Deploys test to GlassFish server)"/>
<echo message="ant compile-tests (Compiles TestNG test)"/>
<echo message="ant runtest (Runs TestNG test)"/>
<echo message="ant report (Creates TestNG Report)"/>
<echo message="ant archive (Creates zip of testbase}"/>
<echo message=""/>
</target>
<target name="build">
<record name="build.output" action="start"/>
<echo message="ANT PROJECT ${ant.project.name}"/>
<ant dir="web/helloworld" target="build"/>
<ant dir="web/jsfastrologer" target="build"/>
<ant dir="web/jsfinjection" target="build"/>
<ant dir="jdbc/jdbcusertx" target="build"/>
<!-- ant dir="web/strutsbasic" target="build"/ -->
<!-- ant dir="persistence/servlet-jpa-app" target="build"/ -->
<!--<ant dir="ejb30/hello" target="build"/>
<ant dir="adminweb/basic" target="build"/>-->
<record name="build.output" action="stop"/>
</target>
<target name="compile-tests">
<record name="compiletests.output" action="start"/>
<ant dir="web/helloworld" target="compile-tests"/>
<ant dir="web/jsfastrologer" target="compile-tests"/>
<ant dir="web/jsfinjection" target="compile-tests"/>
<ant dir="jdbc/jdbcusertx" target="compile-tests"/>
<!-- ant dir="web/strutsbasic" target="compile-tests"/ -->
<!-- ant dir="persistence/servlet-jpa-app" target="compile-tests"/ -->
<record name="compiletests.output" action="stop"/>
</target>
<target name="deploy">
<record name="deploy.output" action="start"/>
<ant dir="web/helloworld" target="deploy"/>
<ant dir="web/jsfastrologer" target="deploy"/>
<ant dir="web/jsfinjection" target="deploy"/>
<ant dir="jdbc/jdbcusertx" target="deploy"/>
<!-- ant dir="web/strutsbasic" target="deploy"/ -->
<!-- ant dir="persistence/servlet-jpa-app" target="deploy"/ -->
<record name="deploy.output" action="stop"/>
</target>
<target name="undeploy">
<record name="undeploy.output" action="start"/>
<ant dir="web/helloworld" target="undeploy"/>
<ant dir="web/jsfastrologer" target="undeploy"/>
<ant dir="web/jsfinjection" target="undeploy"/>
<ant dir="jdbc/jdbcusertx" target="undeploy"/>
<!-- ant dir="web/strutsbasic" target="undeploy"/ -->
<!-- ant dir="persistence/servlet-jpa-app" target="undeploy"/ -->
<record name="undeploy.output" action="stop"/>
</target>
<target name="noproject">
<delete includeemptydirs="true">
<fileset dir="${basedir}">
<include name="**/nbproject"/>
</fileset>
</delete>
</target>
<!-- Target is re-definted here as 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"/>
<include name="**/*.log"/>
</fileset>
</delete>
<delete>
<fileset dir="${basedir}" includes="*.zip"/>
</delete>
<echo message="Deleting all WAR/EAR in local testsuite directories!!!"/>
<echo message="There should not be any WAR file checked in."/>
<delete>
<fileset dir="." includes="**/*.war"/>
</delete>
</target>
<target name="-post-test-run">
<loadfile property="startserver.log" srcFile="${glassfish.home}/domains/domain1/logs/server.log"/>
<echo message="${startserver.log}"/>
</target>
<path id="path2testng">
<pathelement location="./lib/testng-5.0-jdk15.jar"/>
</path>
<taskdef name="testng" classname="org.testng.TestNGAntTask">
<classpath>
<pathelement path="${plugin_classpath}"/>
</classpath>
</taskdef>
<!-- Target is re-definted here as didn't want to specify ws.root property -->
<target name="runtest" depends="compile-tests,initprops">
<record name="runtestng.output" action="start"/>
<echo message="=============Starting TestNG functional tests from testng.xml ============"/>
<property name="hasTestNGXML" value="true"/>
<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}"/>
<sysproperty key="basedir" value="${basedir}"/>
<!--<classfileset dir="classes/test" includes="**/SeleniumTest.class"/>-->
<xmlfileset dir="." includes="testng.xml"/>
</testng>
<record name="runtestng.output" action="stop"/>
<!-- <antcall target="-post-test-run"/>-->
</target>
<!-- Generate the TestNG report -->
<target name="report" depends="initprops">
<echo message="Generating report at ${test.report}"/>
<junitreport todir="${test.report}">
<fileset dir=".">
<include name="**/test-output/**/*.xml"/>
<!--<exclude name="**/testng-failed.xml"/>-->
</fileset>
<report format="noframes" todir="${test.report}"/>
</junitreport>
<echo message="Test Report available at ${test.report}/index.html"/>
</target>
<target name="initprops">
<property name="build.class.dir" value="${basedir}/classes/test"/>
<property name="test.report" value="${basedir}/test-output"/>
<mkdir dir="${test.report}"/>
<path id="run.testng.classpath">
<!-- fileset dir="${basedir}/lib">
<include name="**/*.jar"/>
</fileset -->
<pathelement path="${plugin_classpath}"/>
<pathelement location="${build.class.dir}"/>
</path>
</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="start-server" depends="setOSConditions" if="v3">
<echo>+-----------------------------+</echo>
<echo>| |</echo>
<echo>| S T A R T I N G GLASSFISH |</echo>
<echo>| |</echo>
<echo>+-----------------------------+</echo>
<antcall target="start-server-unix"/>
<antcall target="start-server-windows"/>
</target>
<target name="start-server-windows" if="isWindows">
<exec executable="cmd" spawn="true">
<arg value="/c"/>
<arg value="${glassfish.home}/bin/asadmin.bat"/>
<arg value="start-domain"/>
</exec>
</target>
<target name="start-server-unix" if="isUnix">
<exec executable="${glassfish.home}/bin/asadmin">
<arg value="start-domain"/>
</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>
</project>