blob: 5f9b44d415e9e6668d0909f8a341002f61429906 [file] [log] [blame]
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright (c) 1997, 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
-->
<!DOCTYPE project [
<!ENTITY commonSetup SYSTEM "../../../../../config/properties.xml">
<!ENTITY commonBuild SYSTEM "../../../../../config/common.xml">
<!ENTITY eecommonBuild SYSTEM "../../../../../config/ee-common.xml">
<!ENTITY commonRun SYSTEM "../../../../../config/run.xml">
<!ENTITY timerCommon SYSTEM "file:./../timer-common.xml">
<!ENTITY reporting SYSTEM "../../../../../config/report.xml">
]>
<project name="devtests.ejb.ee.timer" default="usage" basedir=".">
<property file="build.properties"/>
&commonSetup;
&commonBuild;
&eecommonBuild;
&commonRun;
&timerCommon;
&reporting;
<property name="verbose" value="false"/>
<target name="all" depends="clean-results,build,setup,run,unsetup,dev-report"/>
<target name="test" depends="build,setup,run,unsetup"/>
<target name="setup" depends="init-common">
<antcall target="start-database"/>
<ant target="startDomain"/>
<antcall target="setup-database"/>
<antcall target="setup-cluster"/>
<antcall target="asadmin-common">
<param name="admin.command" value="create-resource-ref"/>
<param name="operand.props"
value="--target ${cluster-name} jdbc/mypool"/>
</antcall>
<antcall target="asadmin-common">
<param name="admin.command" value="create-resource-ref"/>
<param name="operand.props"
value="--target ${instance-name-3} jdbc/mypool"/>
</antcall>
</target>
<target name="unsetup" depends="init-common">
<antcall target="save-logs"/>
<antcall target="unsetup-database"/>
<antcall target="unsetup-cluster"/>
<antcall target="stop-database"/>
<ant target="stopDomain"/>
</target>
<target name="setup-cluster" depends="init-common">
<antcall target="create-cluster-common">
<param name="cluster.name" value="${cluster-name}"/>
</antcall>
<antcall target="create-local-instance-common">
<param name="cluster.name" value="${cluster-name}"/>
<param name="instance.name" value="${instance-name-1}"/>
</antcall>
<antcall target="create-local-instance-common">
<param name="cluster.name" value="${cluster-name}"/>
<param name="instance.name" value="${instance-name-2}"/>
</antcall>
<!-- create standalone instance -->
<antcall target="asadmin-common">
<param name="admin.command" value="create-local-instance"/>
<param name="operand.props" value="${instance-name-3}"/>
</antcall>
<!-- start cluster -->
<antcall target="start-cluster-common">
<param name="cluster.name" value="${cluster-name}"/>
</antcall>
<!-- start standalone instance -->
<antcall target="start-local-instance-common">
<param name="instance.name" value="${instance-name-3}"/>
</antcall>
</target>
<target name="unsetup-cluster" depends="init-common">
<antcall target="stop-cluster-common">
<param name="cluster.name" value="${cluster-name}"/>
</antcall>
<antcall target="stop-local-instance-common">
<param name="instance.name" value="${instance-name-3}"/>
</antcall>
<antcall target="delete-local-instance-common">
<param name="instance.name" value="${instance-name-1}"/>
</antcall>
<antcall target="delete-local-instance-common">
<param name="instance.name" value="${instance-name-2}"/>
</antcall>
<antcall target="delete-local-instance-common">
<param name="instance.name" value="${instance-name-3}"/>
</antcall>
<antcall target="delete-cluster-common">
<param name="cluster.name" value="${cluster-name}"/>
</antcall>
</target>
<target name="start-database" depends="init-common">
<echo message="Starting database --dbport ${db.port}"/>
<echo message="${ASADMIN}"/>
<!-- spawn is added to prevent a hang on Windows -->
<exec spawn="true" executable="${ASADMIN}" failonerror="false">
<arg line="start-database --dbport ${db.port}"/>
</exec>
<!-- execute.sql.common sometimes failed due to cannot-connect. So -->
<!-- wait for the db to be fully up -->
<sleep seconds="3"/>
</target>
<target name="stop-database" depends="init-common">
<echo message="Stopping database --dbport ${db.port}"/>
<exec executable="${ASADMIN}" failonerror="false">
<arg line="stop-database --dbport ${db.port}"/>
</exec>
</target>
<target name="build" depends="compile, package">
</target>
<target name="compile" depends="init-common">
<mkdir dir="${build.classes.dir}"/>
<javac fork="true" includeAntRuntime="false" destdir="${build.classes.dir}" debug="true"
classpath="${build.classes.dir}:${env.S1AS_HOME}/lib/javaee.jar:${env.APS_HOME}/lib/reportbuilder.jar:${env.APS_HOME}/lib/reporter.jar"
srcdir="${env.APS_HOME}/devtests/admin/cli/src" includes="**/AdminBaseDevTest.java">
</javac>
<javac fork="true" includeAntRuntime="false"
classpath="${build.classes.dir}:${env.S1AS_HOME}/lib/javaee.jar:${env.APS_HOME}/lib/reportbuilder.jar:${env.APS_HOME}/lib/reporter.jar"
destdir="${build.classes.dir}" debug="true" srcdir="src" includes="**/*.java">
</javac>
</target>
<target name="package" depends="init-common">
<mkdir dir="${assemble.dir}"/>
<jar destfile="${assemble.dir}/${ejb-jar-name}"
basedir="${build.classes.dir}"
includes="eetimer/StartupSingletonBean*.class, eetimer/CreateTimersBean*.class" />
</target>
<target name="run" depends="init-common">
<antcall target="list-timers"/>
<antcall target="migrate-timers"/>
</target>
<macrodef name="run-client">
<attribute name="main-class" default="NOT_SET"/>
<sequential>
<java
classpath="${build.classes.dir}:${env.S1AS_HOME}/lib/javaee.jar:${env.APS_HOME}/lib/reportbuilder.jar:${env.APS_HOME}/lib/reporter.jar"
classname="@{main-class}" fork="true">
<!--
<jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9009"/>
-->
<jvmarg value="-Dverbose=${verbose}"/>
<jvmarg value="-Dejb-jar-path=${assemble.dir}/${ejb-jar-name}"/>
<jvmarg value="-Dejb-jar-name=${ejb-jar-name}"/>
<jvmarg value="-Dcluster-name=${cluster-name}"/>
<jvmarg value="-Dinstance-name-1=${instance-name-1}"/>
<jvmarg value="-Dinstance-name-2=${instance-name-2}"/>
<jvmarg value="-Dinstance-name-3=${instance-name-3}"/>
</java>
</sequential>
</macrodef>
<target name="list-timers" depends="init-common">
<run-client main-class="eetimer.ListTimersTest"/>
</target>
<target name="migrate-timers" depends="init-common">
<antcall target="-disable-gms" />
<run-client main-class="eetimer.MigrateTimersTest"/>
</target>
<target name="-disable-gms">
<antcall target="asadmin-common-ignore-fail">
<param name="admin.command" value="set" />
<param name="operand.props" value="clusters.cluster.${cluster-name}.gms-enabled=false"/>
</antcall>
<antcall target="restart-server" />
<antcall target="stop-cluster-common">
<param name="cluster.name" value="${cluster-name}"/>
</antcall>
<antcall target="start-cluster-common">
<param name="cluster.name" value="${cluster-name}"/>
</antcall>
</target>
<target name="clean" depends="init-common">
<antcall target="clean-common"/>
</target>
<target name="clean-results" depends="init-common">
<delete>
<fileset dir="${env.APS_HOME}" includes="test_results*"/>
</delete>
<delete>
<fileset dir="." includes="*.output"/>
</delete>
</target>
<target name="usage">
<antcall target="usage-common"/>
</target>
</project>