| <!-- |
| |
| Copyright (c) 2010, 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 |
| |
| --> |
| |
| <target name="clean-common"> |
| <echo message="common.xml: Cleaning test build files: ${build.base.dir}" |
| level="verbose"/> |
| <delete dir="${build.base.dir}"/> |
| </target> |
| |
| <target name="common-setup"> |
| <mkdir dir="${TEST_HOME_WEB}/common/classes"/> |
| <javac srcdir="${TEST_HOME_WEB}/common" |
| destdir="${TEST_HOME_WEB}/common/classes" |
| debug="on" |
| failonerror="true"/> |
| </target> |
| |
| <target name="common-unsetup"> |
| <delete dir="${TEST_HOME_WEB}/common/classes" failonerror="false"/> |
| </target> |
| |
| <target name="compile-common"> |
| <mkdir dir="${build.base.dir}"/> |
| <echo message="common.xml: Compiling test source files" level="verbose"/> |
| <javac srcdir="${basedir}/src" |
| destdir="${build.base.dir}" |
| classpath="${env.S1AS_HOME}/modules/jakarta.servlet.jar:${env.S1AS_HOME}/osgi/felix/bin/felix.jar:${env.S1AS_HOME}/modules/jersey-core.jar" |
| debug="on" |
| failonerror="true"/> |
| </target> |
| |
| <target name="package"> |
| <exec executable="mvn" failonerror="false" resultproperty="PackageFailure"> |
| <arg value="package"/> |
| </exec> |
| |
| <!-- Check if the packaging has failed and set the Failure property accordingly --> |
| <condition property="FailStatus" value="${package.fail.status}"> |
| <not> |
| <equals arg1="${PackageFailure}" arg2="0"/> |
| </not> |
| </condition> |
| |
| <antcall target="report"/> |
| </target> |
| |
| <target name="package-war"> |
| <echo message="Creating ${appname}.war file"/> |
| <copy toDir="${build.classes.dir}/WEB-INF/classes" failonerror="false"> |
| <fileset dir="${build.base.dir}"/> |
| </copy> |
| <jar destfile="${destfile}" manifest="${manifest.mf}"> |
| <fileset dir="${build.classes.dir}" |
| excludes="**/main/**" |
| /> |
| </jar> |
| <delete dir="${build.classes.dir}/WEB-INF/classes" failonerror="false"/> |
| </target> |
| |
| <target name="deploy-application"> |
| <echo message="common.xml: Deploying Application : ${app.path}" |
| level="verbose"/> |
| <antcall target="autodeploy-app"/> |
| <!-- <antcall target="asadmin-deploy-app"/ --> |
| </target> |
| |
| <target name="autodeploy-app"> |
| <copy file="${app.path}" todir="${deploy.dir}" failonerror="false"/> |
| <sleep seconds="10"/> |
| </target> |
| |
| <target name="asadmin-deploy-app"> |
| <echo message="Deploying ${app.path}" level="verbose"/> |
| <exec executable="${ASADMIN}" failonerror="false" resultproperty="DeploymentFailure"> |
| <arg line="--user ${admin.user}"/> |
| <arg line="--host ${admin.host}"/> |
| <arg line="--port ${admin.port}"/> |
| <arg line="deploy"/> |
| <arg line="--type osgi"/> |
| <arg line="${app.path}"/> |
| </exec> |
| |
| <!-- Check if the deployment has failed and set the failure status accordingly --> |
| <condition property="FailStatus" value="${deployment.fail.status}"> |
| <not> |
| <equals arg1="${DeploymentFailure}" arg2="0"/> |
| </not> |
| </condition> |
| |
| <antcall target="report"/> |
| </target> |
| |
| <target name="undeploy-application"> |
| <echo message="common.xml: Undeploying Application : ${appname}" |
| level="verbose"/> |
| <antcall target="autoundeploy-app"/> |
| <!-- <antcall target="asadmin-undeploy-app"/ --> |
| </target> |
| |
| <target name="autoundeploy-app"> |
| <delete file="${deploy.dir}/${appname}.war" failonerror="false"/> |
| <sleep seconds="7"/> |
| </target> |
| |
| <target name="asadmin-undeploy-app"> |
| <echo message="Deploying ${appname}" level="verbose"/> |
| <exec executable="${ASADMIN}" failonerror="false" resultproperty="DeploymentFailure"> |
| <arg line="--user ${admin.user}"/> |
| <arg line="--host ${admin.host}"/> |
| <arg line="--port ${admin.port}"/> |
| <arg line="undeploy"/> |
| <arg line="${appname}"/> |
| </exec> |
| |
| <!-- Check if the deployment has failed and set the failure status accordingly --> |
| <condition property="FailStatus" value="${deployment.fail.status}"> |
| <not> |
| <equals arg1="${DeploymentFailure}" arg2="0"/> |
| </not> |
| </condition> |
| |
| <antcall target="report"/> |
| </target> |
| |
| <target name="report" if="FailStatus"> |
| <java classname="Reporter"> |
| <classpath> |
| <pathelement path="${TEST_HOME_WEB}/common/classes"/> |
| </classpath> |
| <arg value="${testname}"/> |
| <arg value="${FailStatus}"/> |
| <arg value="${TestResultFile}"/> |
| </java> |
| </target> |
| |
| <target name="test"> |
| <java classname="TestClient"> |
| <classpath> |
| <pathelement path="${TEST_HOME_WEB}/common/classes"/> |
| </classpath> |
| <arg value="${testURL}"/> |
| <arg value="${testname}"/> |
| <arg value="${TestResultFile}"/> |
| </java> |
| </target> |
| |
| <target name="generateSummary"> |
| <java classname="Reporter"> |
| <classpath> |
| <pathelement path="${TEST_HOME_WEB}/common/classes"/> |
| </classpath> |
| <arg value="${TestResultFile}"/> |
| <arg value="${TestSummaryFile}"/> |
| </java> |
| </target> |