blob: 72adc733a593ce7058358994066dc30ae6e67932 [file] [log] [blame]
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE project [
<!--
Copyright (c) 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
-->
<!ENTITY commonSetup SYSTEM "file:./../../../config/properties.xml">
<!ENTITY commonBuild SYSTEM "file:./../../../config/common.xml">
<!ENTITY testproperties SYSTEM "file:./build.properties">
]>
<!--
Makes sure that the setting of APPCPATH prior to running the appclient
script behaves correctly.
This script builds an app client and a separate library jar that is not
bundled with the app client. The test does not deploy the app client but
simply invokes the app client jar directly.
-->
<project name="appcpath" default="usage" basedir=".">
&commonSetup;
&commonBuild;
&testproperties;
<import file="../appclient.xml"/>
<target name="init" depends="init-common">
<property name="lib.jar.file" value="${assemble.dir}/appcpathlib.jar"/>
</target>
<!--
No need to deploy (or undeploy) because we can use an undeployed stand-alone app
client to test this feature.
-->
<target name="all" depends="build,run"/>
<target name="clean" depends="init">
<antcall target="clean-common"/>
</target>
<target name="compile" depends="clean">
<antcall target="compile-common">
<param name="src" value="lib"/>
</antcall>
<antcall target="compile-common">
<param name="src" value="client"/>
</antcall>
<antcall target="compile-common">
<param name="src" value="${env.APS_HOME}/util/reporter"/>
</antcall>
</target>
<target name="build" depends="compile">
<mkdir dir="${assemble.dir}"/>
<!-- Build the stand-alone app client. -->
<antcall target="package-appclientjar-common">
<param name="appclientjar.files" value="${build.classes.dir}"/>
<param name="appclientjar.classes" value="**/client/*.class **/reporter/*.class"/>
<param name="appclient.jar" value="${assemble.dir}/${clientname}.jar"/>
</antcall>
<!-- Build the library jar. -->
<jar jarfile="${lib.jar.file}"
basedir="${build.classes.dir}"
update="true" includes ="**/lib/*.class"
/>
</target>
<target name="deploy">
<echo>The "deploy" target is not used in this test.</echo>
</target>
<target name="undeploy">
<echo>The "undeploy" target is not used in this test.</echo>
</target>
<target name="run" depends="init">
<echo>Testing stand-alone client...</echo>
<!--
Run the client with a nonsense setting for the APPCPATH env. var.
This test should fail.
-->
<runclient appcpath-setting="no-where" resultproperty="expectFailure" expectedOutcome="fail"/>
<!--
Now run with the correct setting for APPCPATH - pointing to the
previously-build library jar. This test should pass.
-->
<runclient appcpath-setting="${lib.jar.file}" resultproperty="expectSuccess" expectedOutcome="pass"/>
<condition property="result" value="passed" else="failed">
<and>
<equals arg1="${expectFailure}" arg2="1"/>
<equals arg1="${expectSuccess}" arg2="0"/>
</and>
</condition>
<echo>Test result: ${result}</echo>
</target>
<!--
The following macro executes the client with the APPCPATH set according
to the macro argument appcpath-setting.
-->
<macrodef name="runclient">
<attribute name="appcpath-setting"/>
<attribute name="resultproperty"/>
<attribute name="expectedOutcome" default="pass"/> <!-- either "pass" or "fail" -->
<sequential>
<property name="appclient.jar" value="${assemble.dir}/${appname}-client.jar"/>
<property name="generated.appclient.jar" value="${assemble.dir}/${appname}-client.jar"/>
<echo>With APPCPATH set to @{appcpath-setting} invoking...</echo>
<echo>appclient -client ${generated.appclient.jar} ${appclient.application.args}</echo>
<exec executable="${APPCLIENT}" failonerror="false" resultproperty="@{resultProperty}">
<arg line="-client ${generated.appclient.jar}"/>
<arg value="@{expectedOutcome}"/>
<env key="APPCPATH" value="@{appcpath-setting}"/>
</exec>
</sequential>
</macrodef>
<target name="usage">
<antcall target="usage-common"/>
</target>
</project>