blob: 4d74acf86798c8b3a07253fb42d6119e71f74d8a [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="servletonlyApp" default="usage" basedir=".">
&commonBuild;
<property name="contextRoot" value="war"/>
<property name="altContextRoot" value="altwar"/>
<property name="testName" value="servletonly"/>
<property name="initial.changeable.value" value="first"/>
<property name="second.changeable.value" value="second"/>
<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="gfv3.classpath" />
</javac>
</target>
<target name="generate-changeable-class" depends="prepare">
<echo file="${basedir}/ChangeableClass.java">
package servletonly;
public class ChangeableClass {
public static String changeableValue() {
return "${expectedChangeableValue}";
}
}
</echo>
</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="glassfish-web.xml,sun-web.xml"/>
</jar>
<!--
The manifest in the next task specifies a Main-Class. It is not used except
to make sure the app client sniffer does not claim the web
module simply because it has a Main-Class setting.
-->
<war destfile="${all.war}" webxml="web.xml" manifest="META-INF/MANIFEST.MF">
<webinf dir="." includes="glassfish-web.xml, sun-web.xml"/>
<classes dir="${build}" excludes="**-portable.war, **-deployplan.jar"/>
</war>
<copy file="alt-glassfish-web.xml" tofile="${build}/archive/alt-glassfish-web.xml"/>
</target>
<target name="deploy.asadmin" depends="prepare">
<antcall target="common.deploy.asadmin">
<param name="arg.list" value="${all.war}"/>
<param name="testName" value="${testName}"/>
</antcall>
</target>
<target name="deploy.asadmin.altdd" depends="prepare">
<antcall target="common.deploy.asadmin">
<param name="arg.list" value="--runtimealtdd ${build}/archive/alt-glassfish-web.xml ${all.war}"/>
<param name="testName" value="${testName}"/>
</antcall>
</target>
<target name="redeploy.asadmin" depends="prepare">
<antcall target="common.redeploy.asadmin">
<param name="arg.list" value="${all.war}"/>
<param name="testName" value="${testName}"/>
</antcall>
</target>
<target name="v3.redeploy.asadmin" depends="prepare">
<antcall target="common.v3.redeploy.asadmin">
<param name="arg.list"
value="--name ${testName} ${all.war}"/>
</antcall>
</target>
<target name="undeploy.asadmin">
<antcall target="common.undeploy.asadmin">
<param name="arg.list" value="${testName}"/>
<param name="testName" value="${testName}"/>
</antcall>
</target>
<target name="enable.asadmin">
<antcall target="common.enable.asadmin">
<param name="arg.list"
value="${testName}"/>
</antcall>
</target>
<target name="disable.asadmin">
<antcall target="common.disable.asadmin">
<param name="arg.list"
value="${testName}"/>
</antcall>
</target>
<target name="deploy.jsr88" depends="prepare">
<antcall target="common.deploy.jsr88">
<param name="arg.list" value="${portable.war} ${deployplan.jar}"/>
</antcall>
</target>
<target name="redeploy.jsr88" depends="prepare">
<antcall target="common.run.jsr88">
<param name="command" value="redeploy"/>
<param name="arg.list" value="servletonly-portable ${portable.war} ${deployplan.jar}"/>
</antcall>
</target>
<target name="undeploy.jsr88">
<antcall target="common.undeploy.jsr88">
<param name="arg.list" value="servletonly-portable"/>
</antcall>
</target>
<target name="start.jsr88">
<antcall target="common.run.jsr88">
<param name="command" value="start"/>
<param name="arg.list" value="servletonly-portable"/>
</antcall>
</target>
<target name="stop.jsr88">
<antcall target="common.run.jsr88">
<param name="command" value="stop"/>
<param name="arg.list" value="servletonly-portable"/>
</antcall>
</target>
<target name="run" depends="run.positive"/>
<target name="run.positive" depends="setHttpPort">
<property name="extra.args" value=""/>
<antcall target="common.run.positive">
<param name="link" value="${contextRoot}/${testName}"/>
<param name="log.id" value="${log.id}"/>
<param name="extra.args" value="${extra.args}"/>
</antcall>
</target>
<target name="run.positive.altdd" depends="setHttpPort">
<property name="extra.args" value=""/>
<antcall target="common.run.positive">
<param name="link" value="${altContextRoot}/${testName}"/>
<param name="log.id" value="${log.id}"/>
<param name="extra.args" value="${extra.args}"/>
</antcall>
</target>
<target name="run.negative" depends="setHttpPort">
<property name="extra.args" value=""/>
<antcall target="common.run.negative">
<param name="link" value="${contextRoot}/${testName}"/>
<param name="log.id" value="${log.id}"/>
<param name="extra.args" value="${extra.args}"/>
</antcall>
</target>
<target name="runclient" depends="init">
<property name="extra.args" value=""/>
<echo message="TestClient ${arg.list}"/>
<javaWithResult
fork="true"
failonerror="false"
jvm="${JAVA}"
classname="servletonly.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">
<antcall target="generate-changeable-class">
<param name="expectedChangeableValue" value="${initial.changeable.value}"/>
</antcall>
<antcall target="assemble"/>
<antcall target="deploy.asadmin"/>
<antcall target="run.positive">
<param name="log.id" value="1.1"/>
<param name="desc" value="war/servletonly Test asadmin deploy"/>
<param name="extra.args" value="${initial.changeable.value}"/>
</antcall>
<antcall target="test-reload"/>
<antcall target="redeploy.asadmin"/>
<antcall target="run.positive">
<param name="log.id" value="2"/>
<param name="desc" value="war/servletonly Test asadmin redeploy"/>
</antcall>
<antcall target="v3.redeploy.asadmin"/>
<antcall target="run.positive">
<param name="log.id" value="3"/>
<param name="desc" value="war/servletonly Test v3 asadmin redeploy"/>
</antcall>
<antcall target="disable.asadmin"/>
<antcall target="run.negative">
<param name="log.id" value="4"/>
<param name="desc" value="war/servletonly Test asadmin disable"/>
</antcall>
<antcall target="enable.asadmin"/>
<antcall target="run.positive">
<param name="log.id" value="5"/>
<param name="desc" value="war/servletonly Test asadmin enable"/>
</antcall>
<antcall target="common.dotted.disable.ref.asadmin">
<param name="testName" value="${testName}"/>
</antcall>
<antcall target="run.negative">
<param name="log.id" value="6"/>
<param name="desc" value="war/servletonly Test asadmin dotted disable ref"/>
</antcall>
<antcall target="common.dotted.enable.ref.asadmin">
<param name="testName" value="${testName}"/>
</antcall>
<antcall target="run.positive">
<param name="log.id" value="7"/>
<param name="desc" value="war/servletonly Test asadmin dotted enableref "/>
</antcall>
<antcall target="common.dotted.disable.application.asadmin">
<param name="testName" value="${testName}"/>
</antcall>
<antcall target="run.negative">
<param name="log.id" value="8"/>
<param name="desc" value="war/servletonly Test asadmin dotted disable application"/>
</antcall>
<antcall target="common.dotted.enable.application.asadmin">
<param name="testName" value="${testName}"/>
</antcall>
<antcall target="run.positive">
<param name="log.id" value="9"/>
<param name="desc" value="war/servletonly Test asadmin dotted enable application"/>
</antcall>
<antcall target="common.dotted.disable.application.asadmin">
<param name="testName" value="${testName}"/>
</antcall>
<antcall target="common.dotted.disable.ref.asadmin">
<param name="testName" value="${testName}"/>
</antcall>
<antcall target="run.negative">
<param name="log.id" value="10"/>
<param name="desc" value="war/servletonly Test asadmin dotted disable ref and application"/>
</antcall>
<antcall target="common.dotted.enable.application.asadmin">
<param name="testName" value="${testName}"/>
</antcall>
<antcall target="run.negative">
<param name="log.id" value="11"/>
<param name="desc" value="war/servletonly Test asadmin dotted disable ref and enable application"/>
</antcall>
<antcall target="common.dotted.disable.application.asadmin">
<param name="testName" value="${testName}"/>
</antcall>
<antcall target="common.dotted.enable.ref.asadmin">
<param name="testName" value="${testName}"/>
</antcall>
<antcall target="run.negative">
<param name="log.id" value="12"/>
<param name="desc" value="war/servletonly Test asadmin dotted disable application and enable ref"/>
</antcall>
<antcall target="common.dotted.enable.application.asadmin">
<param name="testName" value="${testName}"/>
</antcall>
<antcall target="run.positive">
<param name="log.id" value="13"/>
<param name="desc" value="war/servletonly Test asadmin dotted enable application and enable ref"/>
</antcall>
<antcall target="undeploy.asadmin"/>
<antcall target="deploy.asadmin.altdd"/>
<antcall target="run.positive.altdd">
<param name="log.id" value="14"/>
<param name="desc" value="war/servletonly Test asadmin deploy with runtime altdd"/>
</antcall>
<antcall target="undeploy.asadmin"/>
<antcall target="deploy.jsr88"/>
<antcall target="run.positive">
<param name="log.id" value="15"/>
<param name="desc" value="war/servletonly Test jsr88 deploy"/>
</antcall>
<antcall target="stop.jsr88"/>
<antcall target="run.negative">
<param name="log.id" value="16"/>
<param name="desc" value="war/servletonly Test jsr88 stopped state"/>
</antcall>
<antcall target="start.jsr88"/>
<antcall target="run.positive">
<param name="log.id" value="17"/>
<param name="desc" value="war/servletonly Test jsr88 started state"/>
</antcall>
<antcall target="stop.jsr88"/>
<antcall target="redeploy.jsr88"/>
<antcall target="run.negative">
<param name="log.id" value="18"/>
<param name="desc" value="war/servletonly Test jsr88 redeploy stop"/>
</antcall>
<antcall target="start.jsr88"/>
<antcall target="redeploy.jsr88"/>
<antcall target="run.positive">
<param name="log.id" value="19"/>
<param name="desc" value="war/servletonly Test jsr88 redeploy start"/>
</antcall>
<antcall target="undeploy.jsr88"/>
</target>
<target name="test-reload" depends="test-reload-PE"/>
<!-- test .reload feature -->
<target name="test-reload-PE" if="PE">
<antcall target="generate-changeable-class">
<param name="expectedChangeableValue" value="${second.changeable.value}"/>
</antcall>
<antcall target="compile"/>
<copy file="${build}/servletonly/ChangeableClass.class"
overwrite="true"
todir="${s1as.home}/domains/domain1/applications/${testName}/WEB-INF/classes/servletonly"/>
<!-- Make sure the .reload file will have a later timestamp. -->
<sleep seconds="2"/>
<touch file="${s1as.home}/domains/domain1/applications/${testName}/.reload"/>
<!-- Give the server time to see the .reload file and to redeploy the app. -->
<sleep seconds="5"/>
<antcall target="run.positive">
<param name="log.id" value="1.2"/>
<param name="desc" value="war/servletonly Test .reload"/>
<param name="extra.args" value="${second.changeable.value}"/>
</antcall>
</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>