blob: 6aee5636e8451cc73ea83099f2d57325f9653312 [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">
]>
<project name="virtualserverApp" default="usage" basedir=".">
&commonBuild;
<property name="contextRoot" value="war"/>
<property name="testName" value="virtualserver"/>
<property name="url2"
value="http://${http.host}:${http.port.2}/${contextRoot}/${testName}"/>
<target name="prepare" depends="init">
<property name="portable.war" value="${build}/${testName}-portable.war"/>
<property name="all.war" value="${build}/${testName}.war"/>
<property name="deployplan.jar" value="${build}/${testName}-deployplan.jar"/>
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="prepare">
<javac srcdir="."
destdir="${build}"
debug="on"
failonerror="true">
<classpath refid="test.compile.classpath"/>
</javac>
</target>
<target name="assemble" depends="compile">
<war destfile="${portable.war}" webxml="web.xml">
<classes dir="${build}"/>
</war>
<jar destfile="${deployplan.jar}">
<fileset dir="${basedir}" includes="sun-web.xml"/>
</jar>
<war destfile="${all.war}" webxml="web.xml">
<webinf dir="." includes="sun-web.xml"/>
<classes dir="${build}"/>
</war>
</target>
<target name="create.virtual.server">
<antcall target="common.create.virtual.server.asadmin">
<param name="arg.list"
value="--hosts ${http.host} ${virtual.server.name}"/>
</antcall>
</target>
<target name="create.http.listener">
<antcall target="common.create.http.listener.asadmin">
<param name="arg.list"
value="--listeneraddress ${listener.address} --listenerport ${http.port.2} --defaultvs ${virtual.server.name} --servername ${http.host} --acceptorthreads ${listener.threads} ${http.listener.name}"/>
</antcall>
</target>
<target name="delete.virtual.server">
<antcall target="common.delete.virtual.server.asadmin">
<param name="arg.list"
value="${virtual.server.name}"/>
</antcall>
</target>
<target name="delete.http.listener">
<antcall target="common.delete.http.listener.asadmin">
<param name="arg.list"
value="${http.listener.name}"/>
</antcall>
</target>
<target name="deploy.asadmin" depends="prepare">
<antcall target="common.deploy.asadmin">
<param name="arg.list"
value="--virtualservers ${virtual.server.name} ${all.war}"/>
</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}/${testName}"/>
<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="virtualserver.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 location="${inst}/lib/j2ee.jar"/>
<path location="${build}"/>
</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">
<!-- test that the app is deployed to the newly
created virtual server -->
<antcall target="declare-test">
<param name="description" value="war/virtualserver Test asadmin deploy1"/>
</antcall>
<antcall target="assemble"/>
<antcall target="create.virtual.server"/>
<antcall target="create.http.listener"/>
<antcall target="restart.server"/>
<antcall target="deploy.asadmin"/>
<antcall target="run.positive"><param name="log.id" value="1"/></antcall>
<!-- test that the app is not deployed to the default virtual server -->
<antcall target="declare-test">
<param name="description" value="war/virtualserver Test asadmin deploy2"/>
</antcall>
<antcall target="run.negative"><param name="log.id" value="2"/></antcall>
<antcall target="undeploy.asadmin"/>
<antcall target="delete.http.listener"/>
<antcall target="delete.virtual.server"/>
<antcall target="restart.server"/>
</target>
<target name="clobber" depends="clean">
<delete file="${portable.war}"/>
<delete file="${all.war}"/>
<delete file="${deployplan.war}"/>
<delete dir="${build}"/>
</target>
<target name="usage">
<antcall target="all"/>
</target>
</project>