<?xml version="1.0" encoding="UTF-8"?>
<!--
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common Development
and Distribution License("CDDL") (collectively, the "License"). You
may not use this file except in compliance with the License. You can
obtain a copy of the License at
or packager/legal/LICENSE.txt. See the License for the specific
language governing permissions and limitations under the License.
When distributing the software, include this License Header Notice in each
file and include the License file at packager/legal/LICENSE.txt.
GPL Classpath Exception:
Oracle designates this particular file as subject to the "Classpath"
exception as provided by Oracle in the GPL Version 2 section of the License
file that accompanied this code.
Modifications:
If applicable, add the following below the License Header, with the fields
enclosed by brackets [] replaced by your own identifying information:
"Portions Copyright [year] [name of copyright owner]"
Contributor(s):
If you wish your version of this file to be governed by only the CDDL or
only the GPL Version 2, indicate your decision by adding "[Contributor]
elects to include this software in this distribution under the [CDDL or GPL
Version 2] license." If you don't indicate a single choice of license, a
recipient has the option to distribute your version of this file under
either the CDDL, the GPL Version 2 or to extend the choice of license to
its licensees as provided above. However, if you add GPL Version 2 code
and therefore, elected the GPL Version 2 license, then the option applies
only if the new code is made subject to such option by the copyright
holder.
-->
<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">
<!-- 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"/ -->
</target>
<!-- <import file="nbproject/build-impl.xml"/>-->
<target name="copyJARS">
<echo message="Copying testng.jar to ${ant.home}/lib"/>
<fileset dir="${basedir}/lib">
<include name="**/testng*.*"/>
</fileset>
</copy>
</target>
<target name="default">
<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">
<echo message="ANT PROJECT ${ant.project.name}"/>
<!-- ant dir="web/strutsbasic" target="build"/ -->
<!-- ant dir="persistence/servlet-jpa-app" target="build"/ -->
</target>
<target name="compile-tests">
<!-- ant dir="web/strutsbasic" target="compile-tests"/ -->
<!-- ant dir="persistence/servlet-jpa-app" target="compile-tests"/ -->
</target>
<target name="deploy">
<!-- ant dir="web/strutsbasic" target="deploy"/ -->
<!-- ant dir="persistence/servlet-jpa-app" target="deploy"/ -->
</target>
<target name="undeploy">
<!-- ant dir="web/strutsbasic" target="undeploy"/ -->
<!-- ant dir="persistence/servlet-jpa-app" target="undeploy"/ -->
</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="There should not be any WAR file checked in."/>
<delete>
<fileset dir="." includes="**/*.war"/>
</delete>
</target>
<target name="-post-test-run">
<echo message="${startserver.log}"/>
</target>
<path id="path2testng">
<pathelement location="/lib/testng-5.0-jdk15.jar"/>
</path>
<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">
<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"/>-->
</testng>
<!-- <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>
</junitreport>
<echo message="Test Report available at ${test.report}/index.html"/>
</target>
<target name="initprops">
<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>
<delete>
<fileset dir="${basedir}" includes="*.zip"/>
</delete>
<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>