blob: 5642397fbe8b74f846190843ef8ec1961884d463 [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">
<!ENTITY jwsSetup SYSTEM "file:./../jwsSetup.xml">
]>
<project name="jws-showArgs" default="usage" basedir=".">
&commonSetup;
&commonBuild;
&testproperties;
&jwsSetup;
<!--
This test is intended for Java Web Start launching only. In fact,
the main test will fail if launched using the appclient script because
the customized JNLP adds a JAR that is neither in the EAR's library
directory nor in a JAR's manifest Class-Path.
-->
<property name="summaryFilePath" value="testSummary.txt"/>
<target name="all" depends="init-report,build,deploy,run,undeploy,report"/>
<target name="clean" depends="init-common">
<antcall target="clean-common"/>
</target>
<!-- In this example there are only .java files for the client -->
<target name="compile" depends="clean">
<antcall target="compile-common">
<param name="src" value="client"/>
</antcall>
</target>
<target name="build">
<antcall target="build.ear"/> <!-- also builds the client -->
</target>
<target name="build.ear" depends="build.clients,build.other.jar">
<antcall target="spc-ear-common">
<!--
<param name="application.xml" value="ear/application-with-client-at-top-level.xml"/>
-->
<param name="application.xml" value="ear/application-with-client-2-at-subdir.xml"/>
</antcall>
</target>
<!--
other.jar contains a class used from the client. We package it
separately so we can refer to it from the custom JNLP document. This
makes sure that the custom JNLP is being processed correctly and,
therefore, other.jar is being downloaded correctly.
-->
<target name="build.other.jar" depends="compile">
<antcall target="package-other-jar">
<param name="appclientjar.files" value="${build.classes.dir}"/>
<param name="other.classes" value="**/other/**/*.class" />
</antcall>
</target>
<target name="build.clients" depends="build.client,build.client2"/>
<target name="build.client" depends="compile">
<antcall target="spc-package-appclientjar-common">
<param name="appclientjar.files" value="${build.classes.dir}"/>
<param name="other.classes" value="**/other/**/*.class"/>
<param name="application-client.xml" value="client/application-client.xml"/>
<param name="sun-application-client.xml" value="client/sun-application-client.xml"/>
<param name="appclientjar.classes" value="**/client/*.class" />
<param name="appclient.jar" value="${assemble.dir}/${appname}-client.jar"/>
</antcall>
</target>
<target name="build.client2" depends="compile">
<!--
Add client 2 to a subdirectory of the EAR directory.
-->
<mkdir dir="${assemble.dir}"/>
<mkdir dir="${assemble.dir}/client2"/>
<antcall target="spc-package-appclientjar-common">
<param name="appclientjar.files" value="${build.classes.dir}"/>
<param name="application-client.xml" value="client2/application-client.xml"/>
<param name="sun-application-client.xml" value="client2/sun-application-client.xml"/>
<param name="appclientjar.classes" value="**/client2/*.class" />
<param name="appclient.jar" value="${assemble.dir}/client2/${appname}-client2.jar"/>
<param name="appclient.manifest" value="./client2/MANIFEST.MF"/>
</antcall>
</target>
<target name="spc-ear-common">
<delete file="${assemble.dir}/${appname}.ear"/>
<mkdir dir="${assemble.dir}"/>
<mkdir dir="${build.classes.dir}/META-INF"/>
<copy file="${sun-application.xml}" tofile="${build.classes.dir}/META-INF/sun-application.xml" failonerror="false"/>
<ear earfile="${assemble.dir}/${appname}App.ear"
appxml="${application.xml}">
<fileset dir="${assemble.dir}">
<include name="*.jar"/>
<include name="client2/*.jar"/>
<include name="*.war"/>
</fileset>
<fileset dir="${build.classes.dir}">
<include name="META-INF/sun-application.xml"/>
</fileset>
<fileset dir="${env.APS_HOME}/lib" includes="reporter.jar"/>
</ear>
</target>
<!--
Build the client JAR to include the custom JNLP.
-->
<target name="spc-package-appclientjar-common">
<mkdir dir="${assemble.dir}"/>
<property name="appclient.manifest" value="./client/MANIFEST.MF"/>
<delete file="${appclient.jar}"/>
<echo message="common.xml: Generating appclient-jar inside build directory"
level="verbose"/>
<mkdir dir="${build.classes.dir}/META-INF"/>
<copy file="./client/myLaunch.jnlp" toDir="${build.classes.dir}" failonerror="true" verbose="true"/>
<copy file="./client/myExt.jnlp" toDir="${build.classes.dir}" failonerror="true" verbose="true"/>
<copy file="${application-client.xml}"
tofile="${build.classes.dir}/META-INF/application-client.xml"
failonerror="false"/>
<delete file="${build.classes.dir}/META-INF/sun-application-client.xml"/>
<copy file="${sun-application-client.xml}" tofile="${build.classes.dir}/META-INF/sun-application-client.xml"
failonerror="false"/>
<jar jarfile="${appclient.jar}" basedir="${appclientjar.files}"
update="true" includes="${appclientjar.classes} **/*.jnlp" excludes="${other.classes}"
manifest="${appclient.manifest}">
<metainf dir="${build.classes.dir}/META-INF">
<include name="application-client.xml"/>
<include name="sun-application-client.xml"/>
</metainf>
</jar>
</target>
<target name="package-other-jar">
<mkdir dir="${assemble.dir}"/>
<jar jarfile="${assemble.dir}/other.jar" basedir="${appclientjar.files}"
includes="${other.classes}"/>
</target>
<target name="deploy"
depends="init-common">
<antcall target="deploy.ear"/>
<!-- <antcall target="deploy.client"/>
<antcall target="deploy.client2"/>-->
</target>
<target name="deploy.ear" depends="build.ear">
<antcall target="deploy-common"/>
</target>
<target name="deploy.client" depends="build.client">
<antcall target="deploy-common">
<param name="deployed.app" value="${assemble.dir}/${appname}-client.jar"/>
</antcall>
</target>
<target name="deploy.client2" depends="build.client2">
<exec executable="${ASADMIN}" failonerror="true">
<arg line="deploy"/>
<arg line="${as.props}"/>
<arg line="--upload=true"/>
<arg line="--retrieve ${assemble.dir}"/>
<arg line="--target ${appserver.instance.name}"/>
<arg line="${assemble.dir}/${appname}-client2.jar"/>
</exec>
</target>
<target name="undeploy" depends="init-common">
<antcall target="undeploy.ear"/>
<!-- <antcall target="undeploy.clients"/>-->
</target>
<target name="undeploy.ear" depends="init-common">
<antcall target="undeploy-common"/>
</target>
<target name="undeploy.client" depends="init-common">
<antcall target="undeploy-client-common"/>
</target>
<target name="undeploy.client2" depends="init-common">
<exec executable="${ASADMIN}" failonerror="false">
<arg line="undeploy"/>
<arg line="${as.props}"/>
<arg line="--target ${appserver.instance.name}"/>
<arg line="${appname}-client2"/>
</exec>
</target>
<target name="init-report">
<delete failonerror="false" file="${summaryFilePath}"/>
</target>
<target name="report">
<concat>
<fileset dir="." includes="${summaryFilePath}"/>
</concat>
</target>
<target name="run" depends="init-common">
<!-- <antcall target="test.standalone.client"/>-->
<antcall target="test.embedded.clients"/>
</target>
<target name="test.standalone.client">
<antcall target="test.client">
<param name="urlpath" value="/${clientname}"/>
</antcall>
</target>
<target name="test.embedded.clients">
<antcall target="run-jws-client">
<param name="clientname" value="showArgs-client"/>
<param name="appclient.application.args" value="clientWithOther"/>
<param name="expectedFragment" value="From other.Other"/>
<param name="testName" value="JavaWSWithOther"/>
</antcall>
<antcall target="run-jws-client">
<param name="clientname" value="client2/showArgs-client2"/>
<param name="appclient.application.args" value="thisWillShowItWorked"/>
<param name="expectedFragment" value="${appclient.application.args}"/>
<param name="testName" value="JavaWS-client2"/>
</antcall>
</target>
<target name="run-jws-client">
<property name="use.javaws" value="true"/>
<tempfile property="clientOutputFile" prefix="appclient" suffix=".txt"/>
<antcall target="launch-appclient-javaws">
<param name="javaws.lib.jar" value="${env.APS_HOME}/lib/AntExtras.jar"/>
<param name="clientOutputFile" value="${clientOutputFile}"/>
<param name="clientname" value="${clientname}"/>
<param name="appclient.application.args" value="${appclient.application.args}"/>
</antcall>
<loadresource property="runclientCommonOutput">
<file file="${clientOutputFile}"/>
</loadresource>
<echo>${runclientCommonOutput}</echo>
<antcall target="jws-check-runclient-output">
<param name="expectedFragment" value="${expectedFragment}"/>
<param name="testName" value="${testName}"/>
</antcall>
<delete file="${clientOutputFile}"/>
</target>
<target name="usage">
<antcall target="usage-common"/>
</target>
<target name="jws-check-runclient-output" depends="init-common" >
<echo message="checking runclient output..."/>
<condition property="isClientOutputDirty">
<or>
<not>
<contains string="${runclientCommonOutput}" substring="${expectedFragment}" casesensitive="yes"/>
</not>
<contains string="${runclientCommonOutput}" substring="exception" casesensitive="no"/>
</or>
</condition>
<antcall target="jws-check-runclient-clean" inheritAll="true">
<param name="testName" value="${testName}"/>
</antcall>
<antcall target="jws-check-runclient-dirty" inheritAll="true">
<param name="testName" value="${testName}"/>
</antcall>
</target>
<target name="jws-check-runclient-clean" unless="isClientOutputDirty">
<echo file="${summaryFilePath}" append="true" >
[PASS] ${testName}</echo>
</target>
<target name="jws-check-runclient-dirty" if="isClientOutputDirty">
<echo file="${summaryFilePath}" append="true" >
[FAIL] ${testName}</echo>
</target>
</project>