blob: 8410fe9d6bfa7985487e5a2f5e5d63f726d6d2da [file] [log] [blame]
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE project [
<!--
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
-->
<!ENTITY commonBuild SYSTEM "./../../config/common.xml">
]>
<!--
Test directory deployment for ear with directory structure such
as foo.ear/bar.war
-->
<project name="directoryDeploy-withEarSuffix" default="all" basedir=".">
&commonBuild;
<property name="testName" value="dirDeployWithEarSuffix"/>
<property name="contextRoot" value="${testName}Web"/>
<property name="ear.build.dir" value="${build}/${testName}.ear"/>
<property name="ejb.build.dir"
value="${ear.build.dir}/${testName}Ejb.jar"/>
<property name="web.build.dir"
value="${ear.build.dir}/${testName}Web.war"/>
<property name="client.build.dir" value="${build}/client"/>
<target name="prepare" depends="init">
<mkdir dir="${build}" />
<mkdir dir="${ear.build.dir}" />
<mkdir dir="${ejb.build.dir}" />
<mkdir dir="${web.build.dir}" />
<mkdir dir="${web.build.dir}/WEB-INF/classes" />
<mkdir dir="${client.build.dir}" />
</target>
<target name="compile" depends="prepare">
<javac srcdir="../ear/ejb" destdir="${ejb.build.dir}">
<classpath refid="gfv3.classpath"/>
</javac>
<javac srcdir="../ear/war" destdir="${web.build.dir}/WEB-INF/classes">
<classpath>
<path refid="gfv3.classpath"/>
<path location="${ejb.build.dir}"/>
</classpath>
</javac>
<javac destdir="${client.build.dir}/">
<src path="../client"/>
<include name="TestClient.java"/>
<classpath refid="gfv3.classpath"/>
</javac>
</target>
<target name="assemble" depends="compile">
<copy file="../ear/descriptor/web.xml" todir="${web.build.dir}/WEB-INF"/>
<copy file="../ear/descriptor/sun-web.xml"
todir="${web.build.dir}/WEB-INF"
failonerror="false"/>
<copy todir="${web.build.dir}">
<fileset dir="../ear/war" includes="*.jsp, *.html"/>
</copy>
<copy todir="${web.build.dir}/WEB-INF/classes">
<fileset dir="../ear/war" includes="*properties"/>
</copy>
<mkdir dir="${ejb.build.dir}/META-INF"/>
<copy file="../ear/descriptor/ejb-jar.xml"
todir="${ejb.build.dir}/META-INF"/>
<copy file="../ear/descriptor/sun-ejb-jar.xml"
todir="${ejb.build.dir}/META-INF"
failonerror="false"/>
<mkdir dir="${ear.build.dir}/META-INF"/>
<!-- application.xml is optional
<copy file="../ear/descriptor/application.xml"
todir="${ear.build.dir}/META-INF"/>
-->
<copy file="../ear/descriptor/sun-application.xml"
todir="${ear.build.dir}/META-INF"
failonerror="false"/>
</target>
<target name="deploydir.asadmin" depends="prepare">
<antcall target="common.deploydir.asadmin">
<param name="arg.list"
value="--name ${testName} ${build}/${testName}.ear"/>
</antcall>
</target>
<target name="redeploydir.asadmin" depends="prepare">
<antcall target="common.redeploydir.asadmin">
<param name="arg.list"
value="--name ${testName} ${build}/${testName}.ear"/>
</antcall>
</target>
<target name="undeploy.asadmin">
<antcall target="common.undeploy.asadmin">
<param name="arg.list"
value="${testName}"/>
</antcall>
</target>
<target name="run" depends="run.positive"/>
<target name="run.positive" depends="setHttpPort">
<property name="url" value="http://${http.host}:${depltest.port}/${contextRoot}"/>
<antcall target="runclient">
<param name="arg.list" value="${url} true"/>
<param name="log.id" value="${log.id}"/>
</antcall>
</target>
<target name="run.negative" depends="setHttpPort">
<property name="url" value="http://${http.host}:${depltest.port}/${contextRoot}/${testName}"/>
<antcall target="runclient">
<param name="arg.list" value="${url} false"/>
<param name="log.id" value="${log.id}"/>
</antcall>
</target>
<target name="runclient" depends="init">
<echo message="TestClient ${arg.list}"/>
<javaWithResult
fork="true"
failonerror="false"
jvm="${JAVA}"
classname="directorydeploy.client.TestClient"
output="${build}/${log.id}.output.log"
resultproperty="result">
<jvmarg value="-Dorg.omg.CORBA.ORBInitialHost=${http.host}"/>
<jvmarg value="-Dorg.omg.CORBA.ORBInitialPort=${orb.port}"/>
<classpath>
<path refid="gfv3.classpath"/>
<path location="${client.build.dir}"/>
</classpath>
<arg line="${arg.list}"/>
</javaWithResult>
<antcall target="processResult">
<param name="result" value="${result}"/>
<param name="log" value="${build}/${log.id}.output.log"/>
</antcall>
</target>
<target name="private-all">
<antcall target="assemble"/>
<antcall target="declare-test">
<param name="description" value="directorydeploy/earWithSuffix Test asadmin deploydir"/>
</antcall>
<antcall target="deploydir.asadmin"/>
<antcall target="run.positive"><param name="log.id" value="1"/></antcall>
<antcall target="declare-test">
<param name="description" value="directorydeploy/earWithSuffix Test asadmin redeploydir"/>
</antcall>
<antcall target="redeploydir.asadmin"/>
<antcall target="run.positive"><param name="log.id" value="2"/></antcall>
<antcall target="declare-test">
<param name="description" value="directorydeploy/earWithSuffix Test asadmin undeploydir"/>
</antcall>
<antcall target="undeploy.asadmin"/>
<antcall target="run.negative"><param name="log.id" value="3"/></antcall>
</target>
<target name="clobber" depends="clean">
<delete dir="${build}"/>
</target>
</project>