<?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="common-impl" default="all" basedir=".">
<property file="${ws.root}/build.properties"/>
<!--<property name="test.class.output" value="${ws.root}/classes/${testsuite.name}/test"/>-->
<target name="clean">
<delete dir="${ws.root}/classes"/>
<delete dir="${result.output}"/>
<delete dir="${ws.root}/dist"/>
<echo message="There should not be any WAR file checked in."/>
<delete>
<fileset dir="." includes="**/*.war"/>
</delete>
</target>
<path id="run.testng.classpath">
<fileset dir="${glassfish.home}/modules">
<include name="**/hk2*.jar"/>
<include name="**/glassfish-api.jar"/>
<include name="**/amx-all.jar"/>
<include name="**/gf-client.jar"/>
</fileset>
<pathelement location="${class.output}"/>
<pathelement location="${test.class.output}"/>
</path>
<path id = "boot.classpath">
<fileset dir="${glassfish.home}/modules/endorsed">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="class.path">
<fileset dir="${glassfish.home}/modules">
<include name="**/*.jar"/>
</fileset>
<pathelement location="${class.output}"/>
<pathelement location="${test.class.output}"/>
<pathelement path="${plugin_classpath}"/>
</path>
<!-- TestNG class fileset -->
<path id="path2testng">
<pathelement location="${ws.root}/lib/testng-5.0-jdk15.jar"/>
</path>
<classpath>
<pathelement path="${plugin_classpath}"/>
</classpath>
</taskdef>
<target name="compile-tests"
description="compile the test ng example">
<echo message="compiling test client to ${test.class.output}"/>
<mkdir dir="${test.class.output}"/>
<javac debug="true"
fork="true"
source="1.5"
target="1.5"
classpathref="class.path"
destdir="${test.class.output}">
</javac>
</target>
<target name="compile-util"
description="compile the test ng util">
<mkdir dir="${test.class.output}"/>
<javac debug="true"
fork="true"
source="1.5"
target="1.5"
classpathref="class.path"
destdir="${test.class.output}">
</javac>
</target>
<!-- Generate the TestNG report -->
<target name="report">
<delete dir="${result.output}"/>
<mkdir dir="${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>
</target>
<target name="archive-type">
<echo message="archive-type is ${archive.type}"/>
<condition property="archive.war">
</condition>
<condition property="archive.ear">
</condition>
<condition property="archive.appclient_ear">
</condition>
<condition property="archive.jar">
</condition>
</target>
<target name="build-impl">
<antcall target="build-war"/>
<antcall target="build-ear"/>
<antcall target="build-appclient-ear"/>
<antcall target="build-jar"/>
</target>
<target name="compile-single">
<delete dir="$class.output}"/>
<mkdir dir="${class.output}"/>
<javac debug="true"
fork="true"
source="1.5"
target="1.5"
classpathref="class.path"
srcdir="src"
destdir="${class.output}"/>
</target>
<echo message="Now creating a war file ${dist.dir}/${app.file.ext}"/>
<delete dir="${class.output}"/>
<delete dir="${dist.dir}"/>
<delete file="${app.file.ext}"/>
<mkdir dir="${class.output}"/>
<mkdir dir="${dist.dir}"/>
<javac debug="true"
fork="true"
source="1.5"
target="1.5"
classpathref="class.path"
failonerror="false"
destdir="${class.output}"/>
<mkdir dir="${class.output}/META-INF"/>
<classes dir="${class.output}">
<include name="**/*.class"/>
<include name="**/persistence.xml"/>
<include name="**/*.properties"/>
</classes>
prefix="images"/>-->
<webinf dir="metadata">
<include name="**/*.xml"/>
<exclude name="**/persistence.xml"/>
</webinf>
</war>
<!-- antcall target="update-war-struts"/ -->
<!-- copy file="${dist.dir}/${app.file.ext}" tofile="./${app.file.ext}"/ -->
</target>
<lib dir="${ws.root}/web/lib/struts-1.2.9">
<include name="**/*.jar"/>
</lib>
</war>
</target>
<echo message="Now creating a jar file ${dist.dir}/${app.file.ext}"/>
<delete dir="${class.output}"/>
<delete dir="${dist.dir}"/>
<mkdir dir="${class.output}"/>
<mkdir dir="${dist.dir}"/>
<echo message="Now compiling"/>
<javac debug="true"
fork="true"
source="1.5"
target="1.5"
classpathref="class.path"
destdir="${class.output}"/>
<echo message="Now creating a war file ${dist.dir}/${app.file.ext}"/>
basedir="${class.output}"/>
</target>
<delete dir="${class.output}"/>
<delete dir="${dist.dir}"/>
<delete file="${app.file.ext}"/>
<mkdir dir="${class.output}"/>
<mkdir dir="${dist.dir}"/>
<javac debug="true"
fork="true"
source="1.5"
target="1.5"
classpathref="class.path"
failonerror="false"
destdir="${class.output}"/>
<echo message="war.classes ============== : ${war.classes}"/>
<webinf dir="metadata">
<include name="**/web.xml"/>
</webinf>
</war>
<mkdir dir="${class.output}/META-INF"/>
<copy file="metadata/ejb-jar.xml" tofile="${class.output}/META-INF/ejb-jar.xml" failonerror="false"/>
<copy file="metadata/sun-ejb-jar.xml" tofile="${class.output}/META-INF/sun-ejb-jar.xml" failonerror="false"/>
<copy file="metadata/sun-cmp-mappings.xml" tofile="${class.output}/META-INF/sun-cmp-mappings.xml" failonerror="false"/>
basedir="${class.output}"
excludes="**/*Servlet.class"/>
</ear>
<echo message="Packaged Archive at ${dist.dir}/${app.file.ext}"/>
</target>
<delete dir="${class.output}"/>
<delete dir="${dist.dir}"/>
<delete file="${app.file.ext}"/>
<mkdir dir="${class.output}"/>
<mkdir dir="${dist.dir}"/>
<javac debug="true"
fork="true"
source="1.5"
target="1.5"
classpathref="class.path"
failonerror="false"
destdir="${class.output}"/>
<mkdir dir="${class.output}/META-INF"/>
<copy file="metadata/sun-application-client.xml" tofile="${class.output}/META-INF/sun-application-client.xml" failonerror="false"/>
<jar destfile="${dist.dir}/${app.file}-client.jar"
<metainf dir="${class.output}/META-INF">
<include name="sun-application-client.xml"/>
</metainf>
</jar>
<delete dir="${class.output}/META-INF"/>
basedir="${class.output}"
</ear>
</target>
<target name="checkTestNGXML">
</target>
<target name="runtest-impl">
<antcall target="runtest-impl-class"/>
<antcall target="runtest-impl-xml"/>
</target>
<target name="runtest-impl-class" depends="setOSConditions,asenv-unix,asenv-windows,checkTestNGXML" unless="testng.xml.present">
<echo message="=============Starting TestNG test at ${test.class.output} ============"/>
<mkdir dir="${result.output}"/>
suitename="${testsuite.name}"
testname="${testng.test.name}"
classpathref="run.testng.classpath">
<jvmarg value="-Dhttp.host=${glassfish.http.host}" />
<jvmarg value="-Dhttp.port=${glassfish.http.port}" />
<jvmarg value="-Djava.endorsed.dirs=${glassfish.home}/modules/endorsed" />
<jvmarg value="-DASADMIN=${ASADMIN}" />
</testng>
</target>
<target name="runtest-impl-xml" depends="setOSConditions,asenv-unix,asenv-windows,checkTestNGXML" if="testng.xml.present">
<echo message="=============Starting TestNG test at ${test.class.output} from testng.xml ============"/>
<mkdir dir="${result.output}"/>
<testng outputdir="${result.output}"
suitename="${testsuite.name}"
testname="${testng.test.name}"
classpathref="run.testng.classpath">
<jvmarg value="-Dhttp.host=${glassfish.http.host}" />
<jvmarg value="-Dhttp.port=${glassfish.http.port}" />
<jvmarg value="-Djava.endorsed.dirs=${glassfish.home}/modules/endorsed" />
<jvmarg value="-DASADMIN=${ASADMIN}" />
<jvmarg value="-DAPPCLIENT=${APPCLIENT}" />
</testng>
</target>
<!-- the following targets are for running the embedded tests -->
<target name="runtest-embedded-class" depends="setOSConditions,asenv-unix,asenv-windows,checkTestNGXML" unless="testng.xml.present">
<echo message="=============Starting TestNG test at ${test.class.output} ============"/>
<mkdir dir="${result.output}"/>
suitename="${testsuite.name}"
testname="${testng.test.name}"
classpathref="embedded.testng.classpath">
<jvmarg value="-Dhttp.host=${glassfish.http.host}" />
<jvmarg value="-Dhttp.port=${glassfish.http.port}" />
<jvmarg value="-Djava.endorsed.dirs=${glassfish.home}/modules/endorsed" />
<jvmarg value="-DASADMIN=${ASADMIN}" />
</testng>
</target>
<path id="embedded.testng.classpath">
<fileset dir="${glassfish.home}/lib/embedded">
<include name="**/glassfish-embedded-static-shell.jar"/>
</fileset>
<pathelement location="${class.output}"/>
<pathelement location="${test.class.output}"/>
</path>
<!-- the following targets are for running the wsit tests -->
<path id="wsit.classpath">
</path>
<condition property="wsjar.available">
<and>
<available file="${glassfish.home}/modules/webservices-osgi.jar"/>
<available file="${glassfish.home}/modules/jaxb-osgi.jar"/>
</and>
</condition>
<classpath refid="class.path"/>
<classpath refid="wsit.classpath"/>
</taskdef>
</target>
<target name="runwsittest-impl">
<antcall target="runwsittest-impl-class"/>
<antcall target="runwsittest-impl-xml"/>
</target>
<echo message="=============Starting TestNG test at ${test.class.output} ============"/>
<mkdir dir="${result.output}"/>
suitename="${testsuite.name}"
testname="${testng.test.name}"
classpathref="wsit.classpath" classpath="${build.classes.home}:${basedir}/etc">
<jvmarg value="-Dhttp.host=${glassfish.http.host}" />
<jvmarg value="-Dhttp.port=${glassfish.http.port}" />
<jvmarg value="-Djava.endorsed.dirs=${glassfish.home}/modules/endorsed" />
<bootclasspath classpathref="boot.class.path"/>
</testng>
</target>
<echo message="=============Starting TestNG test at ${test.class.output} from testng.xml ============"/>
<mkdir dir="${result.output}"/>
<testng outputdir="${result.output}"
suitename="${testsuite.name}"
testname="${testng.test.name}"
classpathref="wsit.classpath" classpath="${build.classes.home}:${basedir}/etc">
<jvmarg value="-Dhttp.host=${glassfish.http.host}" />
<jvmarg value="-Dhttp.port=${glassfish.http.port}" />
<jvmarg value="-Djava.endorsed.dirs=${glassfish.home}/modules/endorsed" />
<bootclasspath classpathref="boot.class.path"/>
</testng>
</target>
</project>