blob: e96bb205e4cbb8be40acb81ec658174055086098 [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="WebNBean" default="usage" basedir=".">
&commonBuild;
<property name="contextRoot" value="webnbean"/>
<property name="testName" value="WebNBean"/>
<property name="appName" value="foo"/>
<target name="prepare" depends="init">
<property name="portable.war" value="${build}/${testName}-portable.war"/>
<property name="portable.jar" value="${build}/${testName}-portable.jar"/>
<property name="portable.ear" value="${build}/${testName}-portable.ear"/>
<property name="all.war" value="${build}/${testName}.war"/>
<property name="A.war" value="${build}/${testName}A.war"/>
<property name="B.war" value="${build}/${testName}B.war"/>
<property name="C.war" value="${build}/${testName}C.war"/>
<property name="all.jar" value="${build}/${testName}.jar"/>
<property name="all.ear" value="${build}/${testName}.ear"/>
<property name="deployplan.jar" value="${build}/${testName}-deployplan.jar"/>
<property name="warName" value="${testName}_war"/>
<property name="warNameA" value="${testName}A"/>
<property name="warNameB" value="${testName}B"/>
<property name="warNameC" value="${testName}C"/>
<property name="ejbName" value="${testName}_ejb"/>
<property name="testWar" value="${build}/${warName}.war"/>
<property name="testEjb" value="${build}/${ejbName}.jar"/>
</target>
<target name="compile" depends="prepare">
<mkdir dir="${build}"/>
<javac srcdir="."
destdir="${build}"
debug="on"
failonerror="true">
<classpath refid="gfv3.classpath"/>
</javac>
</target>
<target name="assemble" depends="compile">
<!-- didn't deal with appclient yet -->
<war destfile="${portable.war}" webxml="web.xml">
<classes dir="${build}" excludes="justclient/**,justbean/JustSessionBean.class,**/*.*ar"/>
</war>
<war destfile="${all.war}" webxml="web.xml">
<webinf file="glassfish-web.xml"/>
<classes dir="${build}" excludes="justclient/**,justbean/JustSessionBean.class,**.*ar"/>
</war>
<war destfile="${A.war}" webxml="weba/web.xml">
<webinf file="weba/glassfish-web.xml"/>
<classes dir="${build}" excludes="justclient/**,justbean/JustSessionBean.class,**.*ar"/>
</war>
<war destfile="${B.war}" webxml="webb/web.xml">
<webinf file="webb/glassfish-web.xml"/>
<classes dir="${build}" excludes="justclient/**,justbean/JustSessionBean.class,**.*ar"/>
</war>
<war destfile="${C.war}" webxml="webc/web.xml">
<webinf file="webc/glassfish-web.xml"/>
<classes dir="${build}" excludes="justclient/**,justbean/JustSessionBean.class,**.*ar"/>
</war>
<jar destfile="${portable.jar}">
<metainf file="ejb-jar.xml"/>
<fileset dir="${build}" excludes="justclient/**,justweb/**,**.*ar"/>
</jar>
<jar destfile="${all.jar}">
<metainf dir="${basedir}" includes="ejb-jar.xml,glassfish-ejb-jar.xml"/>
<fileset dir="${build}" excludes="justclient/**,justweb/**,**.*ar"/>
</jar>
<ear destfile="${portable.ear}" appxml="portable.application.xml">
<fileset dir="${build}" includes="**-portable.war,**-portable.jar"/>
</ear>
<ear destfile="${all.ear}" appxml="application.xml">
<metainf file="glassfish-application.xml"/>
<fileset dir="${build}" includes="${testName}.jar,${testName}.war"/>
</ear>
<copy file="${all.war}" tofile="${testWar}"/>
<copy file="${all.jar}" tofile="${testEjb}"/>
<copy file="glassfish-web.xml" tofile="${portable.war}.glassfish-web.xml"/>
<copy file="glassfish-ejb-jar.xml" tofile="${portable.jar}.glassfish-ejb-jar.xml"/>
<copy file="glassfish-application.xml" tofile="${build}/glassfish-application.xml"/>
<jar destfile="${deployplan.jar}"
basedir="${build}" includes="**.xml"/>
</target>
<target name="deploy.asadmin" depends="prepare">
<antcall target="common.deploy.asadmin">
<param name="arg.list" value="${all.ear}"/>
<param name="testName" value="${appName}"/>
</antcall>
</target>
<target name="redeploy.asadmin" depends="prepare">
<antcall target="common.redeploy.asadmin">
<param name="arg.list" value="${all.ear}"/>
<param name="testName" value="${appName}"/>
</antcall>
</target>
<target name="undeploy.asadmin">
<antcall target="common.undeploy.asadmin">
<param name="arg.list" value="${appName}"/>
<param name="testName" value="${appName}"/>
</antcall>
</target>
<target name="deploy.asadmin.war" depends="prepare">
<antcall target="common.deploy.asadmin">
<param name="arg.list" value="--deploymentorder 102 ${testWar}"/>
<param name="testName" value="${warName}"/>
</antcall>
</target>
<target name="deploy.asadmin.war.a" depends="prepare">
<antcall target="common.deploy.asadmin">
<param name="arg.list" value="--deploymentorder 102 ${A.war}"/>
<param name="testName" value="${warName}A"/>
</antcall>
</target>
<target name="deploy.asadmin.war.b" depends="prepare">
<antcall target="common.deploy.asadmin">
<param name="arg.list" value="--deploymentorder 102 ${B.war}"/>
<param name="testName" value="${warName}B"/>
</antcall>
</target>
<target name="deploy.asadmin.war.c" depends="prepare">
<antcall target="common.deploy.asadmin">
<param name="arg.list" value="--deploymentorder 102 ${C.war}"/>
<param name="testName" value="${warName}C"/>
</antcall>
</target>
<target name="deploy.asadmin.ejb" depends="prepare">
<antcall target="common.deploy.asadmin">
<param name="arg.list" value="--deploymentorder 101 ${testEjb}"/>
<param name="testName" value="${ejbName}"/>
</antcall>
</target>
<target name="undeploy.asadmin.war" depends="prepare">
<antcall target="common.undeploy.asadmin">
<param name="arg.list" value="${warName}"/>
<param name="testName" value="${warName}"/>
</antcall>
</target>
<target name="undeploy.asadmin.war.a" depends="prepare">
<antcall target="common.undeploy.asadmin">
<param name="arg.list" value="${warNameA}"/>
<param name="testName" value="${warName}A"/>
</antcall>
</target>
<target name="undeploy.asadmin.war.b" depends="prepare">
<antcall target="common.undeploy.asadmin">
<param name="arg.list" value="${warNameB}"/>
<param name="testName" value="${warName}B"/>
</antcall>
</target>
<target name="undeploy.asadmin.war.c" depends="prepare">
<antcall target="common.undeploy.asadmin">
<param name="arg.list" value="${warNameC}"/>
<param name="testName" value="${warName}C"/>
</antcall>
</target>
<target name="undeploy.asadmin.ejb" depends="prepare">
<antcall target="common.undeploy.asadmin">
<param name="arg.list" value="${ejbName}"/>
<param name="testName" value="${ejbName}"/>
</antcall>
</target>
<target name="enable.asadmin">
<antcall target="common.enable.asadmin">
<param name="arg.list"
value="${appName}"/>
<param name="testName" value="${appName}"/>
</antcall>
</target>
<target name="disable.asadmin">
<antcall target="common.disable.asadmin">
<param name="arg.list"
value="${appName}"/>
<param name="testName" value="${appName}"/>
</antcall>
</target>
<target name="deploy.jsr88" depends="prepare">
<antcall target="common.deploy.jsr88">
<param name="arg.list" value="${portable.ear} ${deployplan.jar}"/>
</antcall>
</target>
<target name="deploy-stream.jsr88" depends="prepare">
<antcall target="common.deploy-stream.jsr88">
<param name="arg.list" value="${portable.ear} ${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="${appName} ${portable.ear} ${deployplan.jar}"/>
</antcall>
</target>
<target name="redeploy-stream.jsr88" depends="prepare">
<antcall target="common.run.jsr88">
<param name="command" value="redeploy-stream"/>
<param name="arg.list" value="${appName} ${portable.ear} ${deployplan.jar}"/>
</antcall>
</target>
<target name="undeploy.jsr88">
<antcall target="common.undeploy.jsr88">
<param name="arg.list" value="${appName}"/>
</antcall>
</target>
<!-- as it's not easy to implement the undeploy-stream using the
current JSR88 Deployer, let's just undeploy all -->
<target name="undeploy-stream.jsr88">
<antcall target="common.undeploy.jsr88">
<param name="arg.list" value="all"/>
</antcall>
</target>
<target name="start.jsr88">
<antcall target="common.run.jsr88">
<param name="command" value="start"/>
<param name="arg.list" value="${appName}"/>
</antcall>
</target>
<target name="stop.jsr88">
<antcall target="common.run.jsr88">
<param name="command" value="stop"/>
<param name="arg.list" value="${appName}"/>
</antcall>
</target>
<target name="deploy.autodeploy">
</target>
<target name="run" depends="run.positive"/>
<target name="run.positive" depends="setHttpPort">
<antcall target="common.run.positive">
<param name="link" value="${contextRoot}/justweb"/>
<param name="log.id" value="${log.id}"/>
</antcall>
</target>
<target name="run.negative" depends="setHttpPort">
<antcall target="common.run.negative">
<param name="link" value="${contextRoot}/justweb"/>
<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="ear.earwithall2.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" depends="private-all-pe-ee, private-all-ee"/>
<!-- the following is run in both PE and EE environment -->
<target name="private-all-pe-ee">
<antcall target="assemble"/>
<antcall target="deploy.asadmin"/>
<antcall target="run.positive">
<param name="log.id" value="1"/>
<param name="desc" value="ear/earwithall2 Test asadmin deploy"/>
</antcall>
<antcall target="disable.asadmin"/>
<antcall target="run.negative">
<param name="desc" value="ear/earwithall2 Test asadmin disable"/>
<param name="log.id" value="2"/>
</antcall>
<antcall target="enable.asadmin"/>
<antcall target="run.positive">
<param name="desc" value="ear/earwithall2 Test asadmin enable"/>
<param name="log.id" value="3"/>
</antcall>
<antcall target="redeploy.asadmin"/>
<antcall target="run.positive">
<param name="desc" value="ear/earwithall2 Test asadmin redeploy"/>
<param name="log.id" value="4"/>
</antcall>
<antcall target="undeploy.asadmin"/>
<antcall target="deploy.jsr88"/>
<antcall target="run.positive">
<param name="desc" value="ear/earwithall2 Test jsr88 deploy"/>
<param name="log.id" value="5"/>
</antcall>
<antcall target="stop.jsr88"/>
<antcall target="run.negative">
<param name="desc" value="ear/earwithall2 Test jsr88 stopped state"/>
<param name="log.id" value="6"/>
</antcall>
<antcall target="start.jsr88"/>
<antcall target="run.positive">
<param name="desc" value="ear/earwithall2 Test jsr88 started state"/>
<param name="log.id" value="7"/>
</antcall>
<antcall target="stop.jsr88"/>
<antcall target="redeploy.jsr88"/>
<antcall target="run.negative">
<param name="desc" value="ear/earwithall2 Test jsr88 redeploy stop"/>
<param name="log.id" value="8"/>
</antcall>
<antcall target="start.jsr88"/>
<antcall target="redeploy.jsr88"/>
<antcall target="run.positive">
<param name="desc" value="ear/earwithall2 Test jsr88 redeploy start"/>
<param name="log.id" value="9"/>
</antcall>
<antcall target="undeploy.jsr88"/>
<antcall target="deploy-stream.jsr88"/>
<antcall target="run.positive">
<param name="desc" value="ear/earwithall2 Test jsr88 deploy using InputStream"/>
<param name="log.id" value="10"/>
</antcall>
<antcall target="redeploy-stream.jsr88"/>
<antcall target="run.positive">
<param name="desc" value="ear/earwithall2 Test jsr88 redeploy using InputStream"/>
<param name="log.id" value="11"/>
</antcall>
<antcall target="undeploy-stream.jsr88"/>
</target>
<target name="addInstanceRef" depends="prepare">
<!-- create-app-ref to remote instance server -->
<antcall target="common.run.asadmin">
<param name="arg.list"
value="create-application-ref --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} --target ${testServer} ${appName}"/>
</antcall>
</target>
<target name="delInstanceRef" depends="prepare">
<!-- delete-app-ref to remote instance server -->
<antcall target="common.run.asadmin">
<param name="arg.list"
value="delete-application-ref --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} --target ${testServer} ${appName}"/>
</antcall>
</target>
<target name="addClusterRefs" depends="prepare" if="doCluster">
<!-- create-app-ref to cluster -->
<antcall target="common.run.asadmin">
<param name="arg.list"
value="create-application-ref --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} --target ${testCluster} ${appName}"/>
</antcall>
</target>
<target name="delClusterRefs" depends="prepare" if="doCluster">
<!-- delete-app-ref to remote instance server -->
<antcall target="common.run.asadmin">
<param name="arg.list"
value="delete-application-ref --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} --target ${testCluster} ${appName}"/>
</antcall>
</target>
<!-- the following is run only in EE environment -->
<target name="private-all-ee" depends="prepare" if="EE">
<echo message="Running tests specific to EE"/>
<!-- deployment to Domain -->
<antcall target="common.run.asadmin">
<param name="arg.list"
value="deploy --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} --target domain ${all.ear}"/>
</antcall>
<antcall target="addInstanceRef"/>
<antcall target="addClusterRefs"/>
<antcall target="run.positive">
<param name="log.id" value="10"/>
<param name="desc" value="ear/earwithall2 Test create-application-ref"/>
</antcall>
<antcall target="delInstanceRef"/>
<antcall target="delClusterRefs"/>
<antcall target="run.negative">
<param name="log.id" value="11"/>
<param name="desc" value="ear/earwithall2 Test delete-application-ref"/>
</antcall>
<antcall target="addInstanceRef"/>
<antcall target="addClusterRefs"/>
<antcall target="common.run.asadmin">
<param name="arg.list"
value="deploy --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} --force=true --target domain ${all.ear}"/>
</antcall>
<antcall target="run.positive">
<param name="log.id" value="12"/>
<param name="desc" value="ear/earwithall2 Test redeploy to domain"/>
</antcall>
<antcall target="common.run.asadmin">
<param name="arg.list"
value="disable --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} --target domain ${appName}"/>
</antcall>
<antcall target="run.negative">
<param name="log.id" value="13"/>
<param name="desc" value="ear/earwithall2 Test disable on domain"/>
</antcall>
<antcall target="common.run.asadmin">
<param name="arg.list"
value="enable --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} --target domain ${appName}"/>
</antcall>
<antcall target="run.positive">
<param name="log.id" value="14"/>
<param name="desc" value="ear/earwithall2 Test enable domain"/>
</antcall>
<!-- undeploy from Domain -->
<antcall target="common.run.asadmin">
<param name="arg.list"
value="undeploy --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} --target domain ${appName}"/>
</antcall>
</target>
<target name="clobber" depends="clean">
<delete file="${portable.war}"/>
<delete file="${portable.jar}"/>
<delete file="${portable.ear}"/>
<delete file="${all.war}"/>
<delete file="${all.jar}"/>
<delete file="${all.ear}"/>
<delete file="${testWar}"/>
<delete file="${testEjb}"/>
<delete file="${deployplan.war}"/>
<delete dir="${build}"/>
</target>
<target name="usage">
<antcall target="all"/>
</target>
<target name="depl-order" depends="assemble" unless="EE">
<echo message="depl-order"/>
<antcall target="declare-test">
<param name="description" value="test deployment order"/>
</antcall>
<antcall target="deploy.asadmin.war"/>
<antcall target="deploy.asadmin.ejb"/>
<antcall target="restart.server"/>
<javaWithResult
fork="true"
failonerror="false"
jvm="${JAVA}"
classname="ear.earwithall2.TestDeplOrder"
output="${build}/${log.id}.output.log"
resultproperty="result">
<classpath>
<path location="${inst}/lib/j2ee.jar"/>
<path location="${build}"/>
</classpath>
<arg line="${env.S1AS_HOME}/domains/domain1/logs/server.log"/>
</javaWithResult>
<antcall target="processResult">
<param name="result" value="${result}"/>
</antcall>
<antcall target="undeploy.asadmin.war"/>
<antcall target="undeploy.asadmin.ejb"/>
<antcall target="deploy.asadmin.war.a"/>
<antcall target="deploy.asadmin.war.c"/>
<antcall target="deploy.asadmin.war.b"/>
<antcall target="restart.server"/>
<javaWithResult
fork="true"
failonerror="false"
jvm="${JAVA}"
classname="ear.earwithall2.TestDeplOrder2"
output="${build}/${log.id}.output2.log"
resultproperty="result">
<classpath>
<path location="${inst}/lib/j2ee.jar"/>
<path location="${build}"/>
</classpath>
<arg line="${env.S1AS_HOME}/domains/domain1/logs/server.log"/>
</javaWithResult>
<antcall target="undeploy.asadmin.war.a"/>
<antcall target="undeploy.asadmin.war.c"/>
<antcall target="undeploy.asadmin.war.b"/>
</target>
</project>