blob: 77c051308f1183b1bd0597dfa5ed2694d38413b3 [file] [log] [blame]
<!--
Copyright (c) 2017, 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
-->
<!-- GLOBAL PROPERTIES -->
<property name="autodeployDir" value="${appserver.instance.dir}/autodeploy"/>
<property name="clientStubsDir" value="${build}/${untaggedName}Client-stubs"/>
<property name="testClusterServer2" value="depltest-cluster-server2"/>
<property name="deploy.clusterinstance2.httpport" value="2002"/>
<property name="deploy.clusterinstance2.orbport" value="2202"/>
<!--
HANDLING COMMANDS TARGETS, usable for making versioning scenarios
-->
<!--
Deploys the given version if not registred, force=true can be supply to redeploy.
@param ${versionExpression} (optional)
@param ${xmlVersionIdentifier} (optional)
@param ${dontUseNameOption} (optional)
@param ${force} (optional)
-->
<target name="deploy.version">
<antcall target="del.ref.registred"/>
<antcall target="deploy.version.unregistred"/>
</target>
<!--
Deploys the given version from it's directory if not registred, force=true can be supply to redeploy.
@param ${versionExpression} (optional)
@param ${xmlVersionIdentifier} (optional)
@param ${dontUseNameOption} (optional)
@param ${force} (optional)
-->
<target name="deploydir.version" depends="process.appname,create.version,unzip.version,deploy.version"/>
<!--
Redeploys the given version
@param ${versionExpression} (optional)
-->
<target name="redeploy.version" depends="process.appname,prepare.cluster">
<antcall target="common.redeploy.asadmin">
<param name="arg.list" value="--name ${appName} ${build}/${appName}.${packaging}"/>
</antcall>
</target>
<!--
Enables the given version
@param ${versionExpression} (optional)
-->
<target name="enable.version" depends="process.appname,prepare.cluster">
<antcall target="common.enable.asadmin">
<param name="arg.list" value="${appName}"/>
</antcall>
</target>
<!--
Enables the given version on ${testClusterServer1} or ${testClusterServer2}
Used by rolling-upgrade scenario
@param ${versionExpression} (optional)
-->
<target name="enable.version.clusterInstance1" if="doRollingUpgrade" depends="prepare.httpport.clusterInstance1">
<antcall target="enable.version">
<param name="ASADMIN-ARGS" value="--user ${admin.user} --passwordfile ${passwordFile} --port ${admin.port} --target ${testClusterServer1}"/>
</antcall>
</target>
<target name="enable.version.clusterInstance2" if="doRollingUpgrade" depends="prepare.httpport.clusterInstance2">
<antcall target="enable.version">
<param name="ASADMIN-ARGS" value="--user ${admin.user} --passwordfile ${passwordFile} --port ${admin.port} --target ${testClusterServer2}"/>
</antcall>
</target>
<!--
Disables the given version(s)
@param ${versionExpression} (optional)
-->
<target name="disable.version" depends="process.appname,prepare.cluster">
<antcall target="common.disable.asadmin">
<param name="arg.list" value="${appName}"/>
</antcall>
</target>
<!--
Undeploys the given version(s)
@param ${versionExpression} (optional)
-->
<target name="undeploy.version" depends="process.appname,prepare.cluster">
<antcall target="common.undeploy.asadmin">
<param name="arg.list" value="${appName}"/>
</antcall>
</target>
<!--
Deploys the given version with JSR88 API that use a File
@param ${versionExpression} (optional)
@param ${xmlVersionIdentifier} (optional)
-->
<target name="deploy.version.jsr88" depends="prepare.version.jsr88,common.deploy.jsr88"/>
<!--
Deploys the given version with the JSR88 API that use an Inputstream.
@param ${versionExpression} (optional)
@param ${xmlVersionIdentifier} (optional)
-->
<target name="deploy.version-stream.jsr88" depends="prepare.version.jsr88,common.deploy-stream.jsr88"/>
<!--
Redeploys the given version with JSR88 API that use a File
@param ${versionExpression} (optional)
-->
<target name="redeploy.version.jsr88" depends="prepare.version.jsr88">
<antcall target="common.run.jsr88">
<param name="command" value="redeploy"/>
<param name="arg.list" value="true ${arg.list}"/>
</antcall>
</target>
<!--
Redeploys the given version with the JSR88 API that use a Inputstream.
@param ${versionExpression} (optional)
-->
<target name="redeploy.version-stream.jsr88" depends="prepare.version.jsr88">
<antcall target="common.run.jsr88">
<param name="command" value="redeploy-stream"/>
<param name="arg.list" value="true ${arg.list}"/>
</antcall>
</target>
<!--
Deploys the given version with autodeploy directory, available only in PE mode
@param ${versionExpression} (optional)
@param ${xmlVersionIdentifier} (optional)
-->
<target name="autodeploy.version" if="PE">
<antcall target="_autodeploy.version"/>
</target>
<!-- the parent target intend to block the dependency resolution if PE isn't defined -->
<target name="_autodeploy.version" depends="process.appname,create.version">
<!-- Copy the module in the autodeploy directory -->
<copy file="${build}/${appName}.${packaging}" todir="${autodeployDir}"/>
<!-- Wait for the module deployment (timout 10s) -->
<waitfor maxwait="6" maxwaitunit="second" checkevery="500">
<available file="${autodeployDir}/${appName}.${packaging}_deployed"/>
</waitfor>
<!-- clean the autodeploy directory -->
<delete file="${autodeployDir}/${appName}.${packaging}"/>
<delete file="${autodeployDir}/${appName}.${packaging}_deployed"/>
<delete file="${autodeployDir}/.autodeploystatus/${appName}.${packaging}"/>
</target>
<!--
TESTS TARGETS, usable for making versioning scenarios
-->
<!--
Test that the given version is running
@param ${versionExpression} (optional)
@param ${description} (optional, but very important for investigations)
This target duplicate the run.positive, to have the possible to run the
deployment scenario without performing the tests.
-->
<target name="run.positive.deploy" if="withTest">
<antcall target="run.positive"/>
</target>
<!--
Test that the given version is running or not running
@param ${versionExpression} (optional)
@param ${description} (optional, but very important for investigations)
-->
<target name="run" depends="run.positive"/>
<target name="run.positive" depends="prepare.client, prepare.run, common.run.positive"/>
<target name="run.negative" depends="prepare.client, prepare.run, common.run.negative"/>
<!--
Test that the given version is running on ${testClusterServer1} or ${testClusterServer2}
Used by rolling-upgrade scenario
@param ${test-details} (required)
-->
<target name="run.positive.clusterInstance1" if="doRollingUpgrade" depends="prepare.clusterInstance1,prepare.run.positive.clusterInstances,runclient"/>
<target name="run.positive.clusterInstance2" if="doRollingUpgrade" depends="prepare.clusterInstance2,prepare.run.positive.clusterInstances,runclient"/>
<!--
Test that the given version is registred or not on the ${testServer} target.
In clustering mode, the default target that is used is ${testCluster},
but we have also to test the ${testServer} references.
@param ${versionExpression} (optional)
@param ${description} (optional, but very important for investigations)
-->
<target name="test.registred.cluster" if="doCluster">
<antcall target="show-component-status.asadmin">
<param name="direction" value="true"/>
<param name="targetName" value="${testServer}"/>
</antcall>
</target>
<target name="test.notregistred.cluster" if="doCluster">
<antcall target="show-component-status.asadmin">
<param name="direction" value="false"/>
<param name="targetName" value="${testServer}"/>
</antcall>
</target>
<!--
Test that the given version is registred or not
@param ${versionExpression} (optional)
@param ${description} (optional, but very important for investigations)
-->
<target name="test.registred">
<antcall target="show-component-status.asadmin">
<param name="direction" value="true"/>
</antcall>
<antcall target="test.registred.cluster"/>
</target>
<target name="test.notregistred">
<antcall target="show-component-status.asadmin">
<param name="direction" value="false"/>
</antcall>
<antcall target="test.notregistred.cluster"/>
</target>
<!--
PROPERTIES PROCESSING TARGETS, not directly usable for making scenarios
-->
<target name="process.versionExpression" unless="versionExpression">
<condition property="versionExpression" value="">
<not><isset property="versionExpression"/></not>
</condition>
</target>
<target name="process.classpath">
<condition property="classpath" value="">
<not><isset property="classpath"/></not>
</condition>
</target>
<target name="process.jvmargs">
<condition property="jvm.args" value="">
<not><isset property="jvm.args"/></not>
</condition>
</target>
<target name="process.appname" unless="appName" depends="process.versionExpression">
<condition property="appName"
value="${untaggedName}" else="${untaggedName}:${versionExpression}">
<equals arg1="${versionExpression}" arg2=""/>
</condition>
</target>
<target name="process.enabled" unless="enabled">
<condition property="enabled" value="">
<not><isset property="enabled"/></not>
</condition>
</target>
<target name="process.xmlversionidentifier" unless="xmlVersionIdentifier">
<condition property="xmlVersionIdentifier" value="">
<not><isset property="xmlVersionIdentifier"/></not>
</condition>
</target>
<target name="process.registred">
<condition property="notRegistred">
<or>
<and>
<isset property="result"/>
<equals arg1="${result}" arg2="1"/>
</and>
</or>
</condition>
</target>
<target name="process.hasToDeploy">
<condition property="hasToDeploy">
<or>
<isset property="notRegistred"/>
<and>
<isset property="force"/>
<istrue value="${force}"/>
</and>
</or>
</condition>
</target>
<target name="process.versionexpression">
<condition property="versionExpression" value="">
<not><isset property="versionExpression"/></not>
</condition>
</target>
<target name="process.result">
<condition property="newResult" value="0">
<and>
<equals arg1="${result}" arg2="1"/>
<equals arg1="${direction}" arg2="false"/>
<isset property="direction"/>
</and>
</condition>
<condition property="newResult" value="1">
<and>
<equals arg1="${result}" arg2="0"/>
<isset property="direction"/>
<equals arg1="${direction}" arg2="false"/>
</and>
</condition>
<condition property="newResult" value="${result}">
<or>
<not><isset property="direction"/></not>
<equals arg1="${direction}" arg2="true"/>
</or>
</condition>
<antcall target="processResult">
<param name="result" value="${newResult}"/>
<param name="log" value="${build}/${log.next}.output.log"/>
</antcall>
</target>
<target name="_process.target">
<condition property="targetName" value="${testServer}">
<and>
<isset property="EE"/>
<not><isset property="doCluster"/></not>
</and>
</condition>
<condition property="targetName" value="${testCluster}">
<isset property="doCluster"/>
</condition>
<condition property="targetName" value="server">
<not><isset property="target"/></not>
</condition>
</target>
<target name="process.target" depends="_process.target">
<property name="target" value="--target=${targetName}"/>
</target>
<target name="process.xml.delete.flag">
<condition property="hasToDeleteXmlFlag">
<equals arg1="${xmlVersionIdentifier}" arg2=""/>
</condition>
</target>
<target name="process.xml.create.flag" depends="process.versionExpression">
<condition property="hasToCreateXmlFlag">
<not><equals arg1="${xmlVersionIdentifier}" arg2=""/></not>
</condition>
</target>
<!--
CONFIGURATION TARGETS, not directly usable for making scenarios
-->
<target name="prepare.update.xml.identifier" depends="process.xmlversionidentifier" if="hasToUpdateXmlVersion">
<property name="archiveFile" value="${build}/${appName}.${packaging}"/>
</target>
<target name="prepare.is.version.registred" depends="process.appname,process.target">
<property name="outputLog" value="${build}/test-is-version-registred.log"/>
<property name="errorLog" value="${outputLog}"/>
<property name="arg2.list" value="show-component-status ${target} ${appName}"/>
</target>
<target name="prepare.has.version.registred" depends="process.appname,process.target">
<property name="outputLog" value="${build}/test-has-version-registred.log"/>
<property name="errorLog" value="${outputLog}"/>
<property name="arg2.list" value="show-component-status ${target} ${untaggedName}:*"/>
</target>
<target name="prepare.is.ref.registred" if="doCluster" depends="process.appname">
<property name="outputLog" value="${build}/test-is-ref-registred.log"/>
<property name="errorLog" value="${outputLog}"/>
<property name="arg2.list" value="show-component-status --target ${testServer} ${appName}"/>
</target>
<target name="prepare.has.ref.registred" if="doCluster">
<property name="outputLog" value="${build}/test-has-ref-registred.log"/>
<property name="errorLog" value="${outputLog}"/>
<property name="arg2.list" value="show-component-status --target ${testServer} ${untaggedName}:*"/>
</target>
<target name="prepare.del.all.version.registred" unless="notRegistred" depends="process.target">
<property name="outputLog" value="${build}/clean-scenario.log"/>
<property name="errorLog" value="${outputLog}"/>
<property name="arg.list" value="undeploy ${target} ${untaggedName}:*"/>
</target>
<target name="prepare.clean.scenario.cluster" if="doCluster" unless="notRegistred" depends="process.target">
<property name="outputLog" value="${build}/clean-scenario.log"/>
<property name="errorLog" value="${outputLog}"/>
<property name="arg.list" value="delete-application-ref --target=${testServer} ${untaggedName}:*"/>
</target>
<target name="prepare.run" depends="increment.log.next,process.versionexpression">
<loadproperties srcFile="log.properties"/>
<property name="extra.args" value="${versionExpression}"/>
<property name="desc" value="${description} - logID=${log.next}"/>
<property name="log.id" value="${log.next}"/>
</target>
<target name="prepare.cluster" if="doCluster" depends="process.versionExpression,process.xmlversionidentifier">
<condition property="testIdentifier" value="${versionExpression}" else="${xmlVersionIdentifier}">
<or>
<equals arg1="${versionExpression}" arg2="${xmlVersionIdentifier}"/>
<and>
<not><isset property="dontUseNameOption"/></not>
<not><equals arg1="${versionExpression}" arg2="${xmlVersionIdentifier}"/></not>
<not><equals arg1="${versionExpression}" arg2=""/></not>
</and>
</or>
</condition>
<condition property="testName" value="${untaggedName}:${testIdentifier}" else="${untaggedName}">
<not><equals arg1="${testIdentifier}" arg2=""/></not>
</condition>
</target>
<target name="prepare.show-component-status.asadmin" depends="process.appname, process.target">
<property name="arg.list" value="show-component-status ${target} ${appName}"/>
<property name="desc" value="${description}"/>
</target>
<target name="prepare.get-client-stubs.asadmin" depends="process.appname,process.target">
<property name="arg.list" value="get-client-stubs --appname=${appName} ${stubsPath}"/>
<property name="desc" value="${description}"/>
</target>
<target name="prepare.version.jsr88" depends="process.appname,create.version">
<property name="arg.list" value="${build}/${appName}.${packaging}"/>
</target>
<target name="prepare.appclient.preparator">
<property name="classname" value="${preparatorClassName}"/>
<property name="outputLog" value="${build}/getJwsClientStubs.log"/>
<property name="classpath" value="${build}"/>
<property name="arg.list" value="http://${http.host}:${depltest.port}/${untaggedName} ${build}"/>
</target>
<target name="prepare.runclient">
<!-- set jvm.args="" if notset previously -->
<condition property="jvm.args" value="${jvm.arguments}" else="">
<isset property="jvm.arguments"/>
</condition>
<!-- build the classpath property -->
<condition property="classpath" value="${build}" else="${runClientClassPath}">
<not><isset property="runClientClassPath"/></not>
</condition>
<property name="classname" value="${classRunclient}"/>
<property name="outputLog" value="${build}/${log.id}.output.log"/>
</target>
<target name="prepare.run.positive.clusterInstances" if="doRollingUpgrade" depends="increment.log.next,process.versionExpression">
<loadproperties srcFile="log.properties"/>
<property name="direction" value="true"/>
<property name="url" value="http://${http.host}:${depltest.port}/${link}"/>
<property name="arg.list" value="${url} ${direction} ${versionExpression}"/>
<property name="log.id" value="${log.next}"/>
<antcall target="declare-test">
<param name="description" value="${test-details} logID=${log.next}"/>
</antcall>
</target>
<target name="prepare.httpport.clusterInstance1" if="doRollingUpgrade">
<property name="depltest.port" value="${deploy.clusterinstance1.httpport}"/>
</target>
<target name="prepare.httpport.clusterInstance2" if="doRollingUpgrade">
<property name="depltest.port" value="${deploy.clusterinstance2.httpport}"/>
</target>
<target name="prepare.clusterInstance1" if="doRollingUpgrade" depends="prepare.httpport.clusterInstance1">
<property name="test-details" value="${description} (instance1)"/>
</target>
<target name="prepare.clusterInstance2" if="doRollingUpgrade" depends="prepare.httpport.clusterInstance2">
<property name="test-details" value="${description} (instance2)"/>
<property name="depltest.port" value="${deploy.clusterinstance2.httpport}"/>
</target>
<!--
INTERNAL TESTS TARGET, not directly usable for making scenarios
-->
<!--
if the given version isn't registred, the property notRegistred will be created.
@param ${versionExpression} (optional)
-->
<target name="is.version.registred" depends="prepare.is.version.registred,exec.asadmin2,process.registred"/>
<!--
if no version are registred, the property notRegistred will be created.
@param ${versionExpression} (optional)
-->
<target name="has.version.registred" depends="prepare.has.version.registred,exec.asadmin2,process.registred"/>
<!--
if the given version ref isn't registred, the property notRegistred will be created.
@param ${versionExpression} (optional)
-->
<target name="is.ref.registred" depends="prepare.is.ref.registred,exec.asadmin2,process.registred"/>
<!--
if no version ref(s) are registred, the property notRegistred will be created.
@param ${versionExpression} (optional)
-->
<target name="has.ref.registred" depends="prepare.has.ref.registred,exec.asadmin2,process.registred"/>
<!--
INTERNAL CLEANING TARGET
-->
<!--
Undeploys and delete all the versions and their references, only if registred
Very usefull for writing scenarios
-->
<target name="clean.scenario">
<antcall target="clean.scenario.cluster"/>
<antcall target="_clean.scenario"/>
</target>
<target name="_clean.scenario" depends="prepare,has.version.registred,del.all.version.registred"/>
<target name="clean.scenario.cluster" if="doCluster" unless="doRollingUpgrade">
<antcall target="_clean.scenario.cluster"/>
</target>
<target name="_clean.scenario.cluster" depends="prepare, has.ref.registred, del.all.ref.registred"/>
<!-- del all the version references if registred -->
<target name="del.all.ref.registred" if="doCluster" unless="notRegistred">
<antcall target="_del.all.ref.registred"/>
</target>
<target name="_del.all.ref.registred" depends="prepare.clean.scenario.cluster, exec.asadmin"/>
<!-- del the given version reference if registred -->
<target name="del.ref.registred" if="doCluster" unless="doRollingUpgrade">
<antcall target="_del.ref.registred"/>
</target>
<target name="_del.ref.registred" unless="notRegistred" depends="prepare.cluster,is.ref.registred">
<antcall target="delAppRef"/>
</target>
<!-- del all the version if registred -->
<target name="del.all.version.registred" unless="notRegistred">
<antcall target="_del.all.version.registred"/>
</target>
<target name="_del.all.version.registred" depends="prepare.del.all.version.registred, exec.asadmin"/>
<!--
INTERNAL TARGETS, not directly usable for making scenarios
-->
<!--
Performs a test with a show-component-status command
Test result is based on return code
@param ${xmlVersionIdentifier} (optional)
-->
<target name="show-component-status.asadmin" depends="prepare.show-component-status.asadmin, asadmin.with.result"/>
<!--
Performs a test with a get-client-stubs command, available only in PE mode
Test result is based on return code
@param ${xmlVersionIdentifier} (optional)
-->
<target name="get-client-stubs.asadmin" if="PE">
<antcall target="_get-client-stubs.asadmin"/>
</target>
<target name="_get-client-stubs.asadmin" depends="prepare.get-client-stubs.asadmin, asadmin.with.result"/>
<!--
Performs a test with an asadmin command
@param ${outputLog} (required)
@param ${errorLog} (required)
@param ${arg.list} (required)
-->
<target name="asadmin.with.result" depends="declare.test,exec.asadmin,process.result"/>
<!--
Deploys a version if not registred or if force=true is provided
@param ${force} (optional)
@param ${dontUseNameOption} (optional)
@param ${xmlVersionIdentifier} (optional)
@param ${versionExpression} (optional)
-->
<target name="deploy.version.unregistred" if="hasToDeploy" depends="is.version.registred,prepare.cluster,process.enabled,process.hasToDeploy">
<!-- retrieve the force param -->
<condition property="forceState" value="true" else="false">
<and>
<isset property="force"/>
<istrue value="${force}"/>
</and>
</condition>
<!-- build ${useNameOption} -->
<condition property="useNameOption" value="true">
<not><isset property="dontUseNameOption"/></not>
</condition>
<antcall target="create.version"/>
<antcall target="deployWithNameOption"/>
<antcall target="deployWithoutNameOption"/>
</target>
<target name="deployWithNameOption" if="useNameOption">
<antcall target="common.deploy.asadmin">
<param name="arg.list" value="
--enabled ${enabled}
--force=${forceState}
--name=${appName}
${build}/${appName}.${packaging}"/>
</antcall>
</target>
<target name="deployWithoutNameOption" if="dontUseNameOption">
<antcall target="common.deploy.asadmin">
<param name="arg.list" value="
--enabled ${enabled}
--force=${forceState}
${build}/${appName}.${packaging}"/>
</antcall>
</target>
<!--
Creates a version archive, if the archive already exist, we just update it
@param ${xmlVersionIdentifier} (optional)
@param ${versionExpression} (optional)
-->
<target name="create.version" depends="prepare, process.appname">
<condition property="fileNotExist">
<not><available file="${build}/${appName}.${packaging}"/></not>
</condition>
<!-- archive creation -->
<antcall target="assemble.non-existent">
<param name="archiveFile" value="${build}/${appName}.${packaging}"/>
<param name="classPath" value="${build}"/>
</antcall>
<!-- update the xmlVersionIdentifier if needed to avoid unexpected behavior -->
<condition property="hasToUpdateXmlVersion" value="true">
<and>
<!-- file exists -->
<not><isset property="fileNotExist"/></not>
<or>
<available file="${build}/${appName}-hasXmlVersion"/>
<and>
<isset property="xmlVersionIdentifier"/>
<not><equals arg1="${xmlVersionIdentifier}" arg2=""/></not>
</and>
</or>
</and>
</condition>
<antcall target="update.xml.identifier"/>
</target>
<!--
Updates a version archive: modify the xmlVersionIdentifier if needed
@param ${gfDDDir} (required)
@param ${gfDDFile} (required)
@param ${packaging} (required)
@param ${xmlVersionIdentifier} (optional)
@param ${versionExpression} (optional)
-->
<target name="update.xml.identifier" if="hasToUpdateXmlVersion" depends="prepare.update.xml.identifier">
<!-- extract only the GFDD -->
<unzip src="${archiveFile}" dest="${build}">
<patternset>
<include name="${gfDDDir}/${gfDDFile}"/>
</patternset>
<mapper type="flatten"/>
</unzip>
<antcall target="generate.xml.identifier">
<param name="xmlFile" value="${build}/${gfDDFile}"/>
</antcall>
<!-- creates the new archive -->
<zip destfile="${build}/tmp.${packaging}">
<zipfileset src="${archiveFile}">
<exclude name="${gfDDDir}/${gfDDFile}"/>
</zipfileset>
<zipfileset dir="${build}" prefix="${gfDDDir}">
<include name="${gfDDFile}"/>
</zipfileset>
</zip>
<!-- clean some files -->
<delete file="${archiveFile}"/>
<move file="${build}/tmp.${packaging}" tofile="${archiveFile}"/>
<delete file="${build}/${gfDDFile}" failonerror="false"/>
<antcall target="delete.xml.flag"/>
</target>
<!-- the flag is delete only when an empty value has been written -->
<target name="delete.xml.flag" if="hasToDeleteXmlFlag" depends="process.xml.delete.flag">
<delete file="${build}/${appName}-hasXmlVersion" failonerror="false"/>
</target>
<!-- the flag is created only when a non-empty value is written -->
<target name="create.xml.flag" if="hasToCreateXmlFlag" depends="process.xml.create.flag">
<touch file="${build}/${appName}-hasXmlVersion"/>
</target>
<!--
Updates the ${xmlVersionIdentifier} value in the appropriate GlassFish DD
-->
<target name="generate.xml.identifier" depends="process.xmlversionidentifier,create.xml.flag">
<replaceregexp file="${xmlFile}"
match="&lt;version-identifier&gt;(.*)&lt;&#47;version-identifier&gt;"
replace="&lt;version-identifier&gt;${xmlVersionIdentifier}&lt;&#47;version-identifier&gt;"
byline="true"/>
</target>
<!-- Unzip a the given version's archive for a directory deployment -->
<target name="unzip.version">
<unzip src="${build}/${appName}.${packaging}"
dest="${build}/${appName}">
</unzip>
</target>
<!--
TESTS DECLARATIONS
These targets are used only with the following targets: test.registred, test.notregistred
-->
<target name="declare.test" depends="increment.log.next">
<loadproperties srcFile="log.properties"/>
<condition property="runPositive">
<or>
<not><isset property="direction"/></not>
<equals arg1="${direction}" arg2="true"/>
</or>
</condition>
<condition property="runNegative">
<and>
<equals arg1="${direction}" arg2="false"/>
<isset property="direction"/>
</and>
</condition>
<property name="outputLog" value="${build}/${log.next}.output.log"/>
<property name="errorLog" value="${outputLog}"/>
<!--
add informations to the log : what we are expecting
(a sucess or a fail)
-->
<antcall target="declare.test.positive"/>
<antcall target="declare.test.negative"/>
</target>
<target name="declare.test.positive" if="runPositive" depends="setHttpPort">
<echo message="expected to succeed => " file="${outputLog}"/>
<antcall target="declare-test">
<param name="description" value="${desc} - logID=${log.next} - (${targetName}) - (sucess expected)"/>
</antcall>
</target>
<target name="declare.test.negative" if="runNegative" depends="setHttpPort">
<echo message="expected to fail => " file="${outputLog}"/>
<antcall target="declare-test">
<param name="description" value="${desc} - logID=${log.next} - (${targetName}) - (fail expected)"/>
</antcall>
</target>
<!--
INTERNAL EXECUTION TARGETS
-->
<!--
@param ${outputLog} (required)
@param ${errorLog} (required)
@param ${arg.list} (required)
-->
<target name="exec.asadmin" depends="prepare">
<exec executable="${ASADMIN}"
resultproperty="result"
failonerror="false"
output="${outputLog}"
error="${errorLog}"
append="yes">
<arg line="${arg.list}"/>
</exec>
</target>
<!--
This target duplicates the previous as it's used to perform an asadmin command
before the real one. (for internal tests targets)
@param ${outputLog} (required)
@param ${errorLog} (required)
@param ${arg2.list} (required)
-->
<target name="exec.asadmin2" depends="prepare">
<exec executable="${ASADMIN}"
resultproperty="result"
failonerror="false"
output="${outputLog}"
error="${errorLog}"
append="yes">
<arg line="${arg2.list}"/>
</exec>
</target>
<!--
This target is used to launch Java classes (clients, and others like for appclient)
@param ${outputLog} (required)
@param ${arg.list} (required)
@param ${classname} (required)
-->
<target name="java.with.result" depends="process.classpath,process.jvmargs">
<javaWithResult
fork="true"
failonerror="false"
jvm="${JAVA}"
classname="${classname}"
classpath="${inst}/lib/gf-client.jar:${classpath}"
output="${outputLog}"
append="yes"
resultproperty="result">
<jvmarg line="${jvm.args}"/>
<arg line="${arg.list}"/>
</javaWithResult>
</target>
<!--
OTHER TARGETS
-->
<!--
prepare.client: this target intends to call the appropriate target before
the call to runClient target
-->
<target name="prepare.client" depends="init">
<condition property="isAppClient" value="true">
<and>
<isset property="appType"/>
<equals arg1="${appType}" arg2="appClient"/>
</and>
</condition>
<antcall target="prepare.client.appclient"/>
</target>
<!--
prepare.client.appclient: this target is called before the runClient one.
It performs some extra processes needed for appclient.
-->
<target name="prepare.client.appclient" if="isAppClient">
<antcall target="_prepare.client.appclient"/>
</target>
<target name="_prepare.client.appclient" depends="setHttpPort,process.appname,prepare.appclient.preparator,java.with.result"/>
<!--
This target is called with the following targets common.run, common.run.positive, common.run.negative
-->
<target name="runclient" depends="prepare.runclient,java.with.result,process.result"/>
<target name="delete.log.next">
<delete file="log.properties"/>
</target>
<target name="increment.log.next">
<propertyfile file="log.properties">
<entry key="log.next" default="0" type="int" operation="+" value="1"/>
</propertyfile>
</target>
<target name="assemble.non-existent" if="fileNotExist">
<antcall target="assemble"/>
</target>
<target name="clobber" depends="clean, delete.log.next">
<delete dir="${build}"/>
</target>
<target name="usage">
<antcall target="all"/>
</target>
<target name="_private-all" unless="doRollingUpgrade">
<antcall target="main-all"/>
</target>
<target name="private-rollingUpgrade" if="doRollingUpgrade" depends="init">
<antcall target="main-rollingUpgrade"/>
</target>
<target name="private-all" depends="delete.log.next">
<antcall target="private-rollingUpgrade"/>
<antcall target="_private-all"/>
<antcall target="delete.log.next"/>
</target>