0N/A<?xml version="1.0" encoding="UTF-8"?>
1949N/A<!--
0N/A
0N/A DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0N/A
0N/A Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
0N/A
0N/A The contents of this file are subject to the terms of either the GNU
0N/A General Public License Version 2 only ("GPL") or the Common Development
0N/A and Distribution License("CDDL") (collectively, the "License"). You
0N/A may not use this file except in compliance with the License. You can
0N/A obtain a copy of the License at
0N/A https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
0N/A or packager/legal/LICENSE.txt. See the License for the specific
0N/A language governing permissions and limitations under the License.
0N/A
0N/A When distributing the software, include this License Header Notice in each
0N/A file and include the License file at packager/legal/LICENSE.txt.
1472N/A
1472N/A GPL Classpath Exception:
1472N/A Oracle designates this particular file as subject to the "Classpath"
0N/A exception as provided by Oracle in the GPL Version 2 section of the License
0N/A file that accompanied this code.
0N/A
0N/A Modifications:
0N/A If applicable, add the following below the License Header, with the fields
0N/A enclosed by brackets [] replaced by your own identifying information:
0N/A "Portions Copyright [year] [name of copyright owner]"
0N/A
1405N/A Contributor(s):
0N/A If you wish your version of this file to be governed by only the CDDL or
0N/A only the GPL Version 2, indicate your decision by adding "[Contributor]
0N/A elects to include this software in this distribution under the [CDDL or GPL
3178N/A Version 2] license." If you don't indicate a single choice of license, a
3178N/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">
<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>