blob: c6b420015b5fb42d115d402b85dcddb5e8436c4e [file] [log] [blame]
<!--
Copyright (c) 2017, 2021 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
-->
<property name="target-to-run" value="sqetests" />
<target name="runtest" depends="init-common">
<record name="runtest.output" action="start" />
<parallel>
<sequential>
<waitfor maxwait="5" maxwaitunit="minute" checkevery="500">
<or>
<http url="http://localhost:80" />
<http url="http://localhost:1024" />
<http url="http://${http.host}:${http.port}" />
</or>
</waitfor>
<antcall target="${target-to-run}" />
<antcall target="report" />
<antcall target="mail" />
</sequential>
</parallel>
<record name="runtest.output" action="stop" />
</target>
<!-- Setup and Restart the server instance -->
<target name="restart-server-instance-common">
<antcall target="stopDomain" />
<sleep seconds="5" />
<antcall target="startDomain" />
</target>
<target name="startDomain" depends="startDomainUnix, startDomainWindows" />
<target name="startDomainUnix" depends="init-common" if="isUnix">
<echo message="Starting DAS" />
<exec executable="${ASADMIN}">
<arg line="start-domain" />
</exec>
<echo message="run.xml:doing wait for ${http.host}:${http.port}..." />
<waitfor timeoutproperty="unableToStart">
<http url="http://${http.host}:${http.port}" />
</waitfor>
<condition property="dumpStack">
<and>
<isset property="unableToStart" />
<available file="${env.JAVA_HOME}/bin/jps" />
</and>
</condition>
<echo message="run.xml:DONE doing wait for ${http.host}:${http.port}..." />
<antcall target="dumpThreadStack" />
</target>
<target name="startDomainWindows" depends="init-common" if="isWindows">
<echo message="Starting DAS" />
<exec executable="${ASADMIN}" spawn="true">
<arg line="start-domain" />
</exec>
<waitfor timeoutproperty="unableToStart">
<http url="http://${http.host}:${http.port}" />
</waitfor>
<condition property="dumpStack">
<and>
<isset property="unableToStart" />
<available file="${env.JAVA_HOME}/bin/jps" />
</and>
</condition>
<antcall target="dumpThreadStack" />
</target>
<target name="dumpThreadStack" if="dumpStack">
<exec executable="${env.JAVA_HOME}/bin/jps" output="pid.out.file">
<arg value="-v" />
</exec>
<loadfile srcfile="pid.out.file" property="pid.out">
<filterchain>
<linecontains>
<contains value="ASMain" />
<contains value="${env.S1AS_HOME}" />
</linecontains>
<tokenfilter>
<replaceregex pattern="^(\d+) ASMain (.*)" replace="\1" />
<trim />
<ignoreblank />
</tokenfilter>
<striplinebreaks />
</filterchain>
</loadfile>
<echo>Dumping the thread stack for Appserver instance with PID - "${pid.out}"</echo>
<exec executable="${env.JAVA_HOME}/bin/jstack">
<arg value="${pid.out}" />
</exec>
<delete file="pid.out.file" />
</target>
<target name="stopDomain" depends="init-common">
<echo message="run.xml:stopping domain..." />
<exec executable="${ASADMIN}" failonerror="true">
<arg line="stop-domain" />
</exec>
</target>
<target name="delete-domain-common" depends="init-common">
<exec executable="${ASADMIN}">
<arg line="delete-domain" />
<arg line="--domaindir ${admin.domain.dir}" />
<arg line="${admin.domain}" />
</exec>
</target>
<target name="create-domain-common" depends="init-common">
<exec executable="${ASADMIN}">
<arg line="create-domain" />
<arg line="--domaindir ${admin.domain.dir}" />
<arg line="--adminport ${admin.port}" />
<arg line="--instanceport ${http.port}" />
<arg line="--user ${admin.user}" />
<arg line="--passwordfile ${admin.password.file}" />
<arg line="--domainproperties orb.listener.port=${orb.port}" />
<arg line="${admin.domain}" />
</exec>
</target>
<target name="cleanAS">
<echo message="run.xml:deleting domain: ${admin.domain}..." />
<antcall target="delete-domain-common" />
<echo message="run.xml:creating domain: ${admin.domain}..." />
<antcall target="create-domain-common" />
</target>
<target name="start-clean-server">
<antcall target="stopDomain" />
<antcall target="cleanAS" />
<antcall target="startDomain" />
</target>
<target name="restart-instance-common">
<echo message="Restarting remote server instance,until this gets fixed" />
<exec executable="${ASADMIN}" failonerror="false">
<arg line="stop-instance" />
<arg line="${as.props}" />
<arg line="${appserver.instance.name}" />
</exec>
<sleep seconds="30" />
<exec executable="${ASADMIN}" failonerror="false">
<arg line="start-instance" />
<arg line="${as.props}" />
<arg line="${appserver.instance.name}" />
</exec>
</target>
<macrodef name="run-test">
<attribute name="classname" />
<attribute name="classpath" />
<element name="arguments" optional="yes" />
<sequential>
<java classname="@{classname}" classpath="@{classpath}" fork="true">
<jvmarg value="-Das.props=${as.props}" />
<jvmarg value="-Dadmin.user=${admin.user}" />
<jvmarg value="-Dadmin.port=${admin.port}" />
<jvmarg value="-Dhttp.port=${http.port}" />
<jvmarg value="-Dhttps.port=${https.port}" />
<jvmarg value="-Dhttp.host=${http.host}" />
<arguments />
</java>
</sequential>
</macrodef>