blob: c6b420015b5fb42d115d402b85dcddb5e8436c4e [file] [log] [blame]
Vinay Vishal57171472018-09-18 20:22:00 +05301<!--
2
arjantijms9f5bb742021-02-28 19:00:48 +01003 Copyright (c) 2017, 2021 Oracle and/or its affiliates. All rights reserved.
Vinay Vishal57171472018-09-18 20:22:00 +05304
5 This program and the accompanying materials are made available under the
6 terms of the Eclipse Public License v. 2.0, which is available at
7 http://www.eclipse.org/legal/epl-2.0.
8
9 This Source Code may also be made available under the following Secondary
10 Licenses when the conditions for such availability set forth in the
11 Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
12 version 2 with the GNU Classpath Exception, which is available at
13 https://www.gnu.org/software/classpath/license.html.
14
15 SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
17-->
18
arjantijms9f5bb742021-02-28 19:00:48 +010019<property name="target-to-run" value="sqetests" />
Vinay Vishal57171472018-09-18 20:22:00 +053020
21<target name="runtest" depends="init-common">
22 <record name="runtest.output" action="start" />
23 <parallel>
Vinay Vishal57171472018-09-18 20:22:00 +053024 <sequential>
25 <waitfor maxwait="5" maxwaitunit="minute" checkevery="500">
26 <or>
arjantijms9f5bb742021-02-28 19:00:48 +010027 <http url="http://localhost:80" />
28 <http url="http://localhost:1024" />
29 <http url="http://${http.host}:${http.port}" />
Vinay Vishal57171472018-09-18 20:22:00 +053030 </or>
31 </waitfor>
arjantijms9f5bb742021-02-28 19:00:48 +010032 <antcall target="${target-to-run}" />
33 <antcall target="report" />
34 <antcall target="mail" />
Vinay Vishal57171472018-09-18 20:22:00 +053035 </sequential>
36 </parallel>
37 <record name="runtest.output" action="stop" />
38</target>
39
arjantijms9f5bb742021-02-28 19:00:48 +010040<!-- Setup and Restart the server instance -->
Vinay Vishal57171472018-09-18 20:22:00 +053041<target name="restart-server-instance-common">
arjantijms9f5bb742021-02-28 19:00:48 +010042 <antcall target="stopDomain" />
Vinay Vishal57171472018-09-18 20:22:00 +053043 <sleep seconds="5" />
arjantijms9f5bb742021-02-28 19:00:48 +010044 <antcall target="startDomain" />
Vinay Vishal57171472018-09-18 20:22:00 +053045</target>
46
arjantijms9f5bb742021-02-28 19:00:48 +010047<target name="startDomain" depends="startDomainUnix, startDomainWindows" />
Vinay Vishal57171472018-09-18 20:22:00 +053048
49<target name="startDomainUnix" depends="init-common" if="isUnix">
arjantijms9f5bb742021-02-28 19:00:48 +010050 <echo message="Starting DAS" />
Vinay Vishal57171472018-09-18 20:22:00 +053051 <exec executable="${ASADMIN}">
arjantijms9f5bb742021-02-28 19:00:48 +010052 <arg line="start-domain" />
Vinay Vishal57171472018-09-18 20:22:00 +053053 </exec>
arjantijms9f5bb742021-02-28 19:00:48 +010054 <echo message="run.xml:doing wait for ${http.host}:${http.port}..." />
Vinay Vishal57171472018-09-18 20:22:00 +053055 <waitfor timeoutproperty="unableToStart">
arjantijms9f5bb742021-02-28 19:00:48 +010056 <http url="http://${http.host}:${http.port}" />
Vinay Vishal57171472018-09-18 20:22:00 +053057 </waitfor>
58 <condition property="dumpStack">
59 <and>
arjantijms9f5bb742021-02-28 19:00:48 +010060 <isset property="unableToStart" />
61 <available file="${env.JAVA_HOME}/bin/jps" />
Vinay Vishal57171472018-09-18 20:22:00 +053062 </and>
63 </condition>
arjantijms9f5bb742021-02-28 19:00:48 +010064 <echo message="run.xml:DONE doing wait for ${http.host}:${http.port}..." />
65 <antcall target="dumpThreadStack" />
Vinay Vishal57171472018-09-18 20:22:00 +053066</target>
67
68<target name="startDomainWindows" depends="init-common" if="isWindows">
arjantijms9f5bb742021-02-28 19:00:48 +010069 <echo message="Starting DAS" />
Vinay Vishal57171472018-09-18 20:22:00 +053070 <exec executable="${ASADMIN}" spawn="true">
arjantijms9f5bb742021-02-28 19:00:48 +010071 <arg line="start-domain" />
Vinay Vishal57171472018-09-18 20:22:00 +053072 </exec>
73 <waitfor timeoutproperty="unableToStart">
arjantijms9f5bb742021-02-28 19:00:48 +010074 <http url="http://${http.host}:${http.port}" />
Vinay Vishal57171472018-09-18 20:22:00 +053075 </waitfor>
76 <condition property="dumpStack">
77 <and>
arjantijms9f5bb742021-02-28 19:00:48 +010078 <isset property="unableToStart" />
79 <available file="${env.JAVA_HOME}/bin/jps" />
Vinay Vishal57171472018-09-18 20:22:00 +053080 </and>
81 </condition>
arjantijms9f5bb742021-02-28 19:00:48 +010082 <antcall target="dumpThreadStack" />
Vinay Vishal57171472018-09-18 20:22:00 +053083</target>
84
85<target name="dumpThreadStack" if="dumpStack">
86 <exec executable="${env.JAVA_HOME}/bin/jps" output="pid.out.file">
arjantijms9f5bb742021-02-28 19:00:48 +010087 <arg value="-v" />
Vinay Vishal57171472018-09-18 20:22:00 +053088 </exec>
David Matějčekf4dc06a2021-05-17 12:10:57 +020089
Vinay Vishal57171472018-09-18 20:22:00 +053090 <loadfile srcfile="pid.out.file" property="pid.out">
91 <filterchain>
92 <linecontains>
arjantijms9f5bb742021-02-28 19:00:48 +010093 <contains value="ASMain" />
94 <contains value="${env.S1AS_HOME}" />
Vinay Vishal57171472018-09-18 20:22:00 +053095 </linecontains>
96 <tokenfilter>
arjantijms9f5bb742021-02-28 19:00:48 +010097 <replaceregex pattern="^(\d+) ASMain (.*)" replace="\1" />
98 <trim />
99 <ignoreblank />
Vinay Vishal57171472018-09-18 20:22:00 +0530100 </tokenfilter>
arjantijms9f5bb742021-02-28 19:00:48 +0100101 <striplinebreaks />
Vinay Vishal57171472018-09-18 20:22:00 +0530102 </filterchain>
103 </loadfile>
David Matějčekf4dc06a2021-05-17 12:10:57 +0200104
Vinay Vishal57171472018-09-18 20:22:00 +0530105 <echo>Dumping the thread stack for Appserver instance with PID - "${pid.out}"</echo>
106 <exec executable="${env.JAVA_HOME}/bin/jstack">
arjantijms9f5bb742021-02-28 19:00:48 +0100107 <arg value="${pid.out}" />
Vinay Vishal57171472018-09-18 20:22:00 +0530108 </exec>
arjantijms9f5bb742021-02-28 19:00:48 +0100109 <delete file="pid.out.file" />
Vinay Vishal57171472018-09-18 20:22:00 +0530110</target>
111
112<target name="stopDomain" depends="init-common">
arjantijms9f5bb742021-02-28 19:00:48 +0100113 <echo message="run.xml:stopping domain..." />
Vinay Vishal57171472018-09-18 20:22:00 +0530114 <exec executable="${ASADMIN}" failonerror="true">
arjantijms9f5bb742021-02-28 19:00:48 +0100115 <arg line="stop-domain" />
Vinay Vishal57171472018-09-18 20:22:00 +0530116 </exec>
117</target>
118
119<target name="delete-domain-common" depends="init-common">
120 <exec executable="${ASADMIN}">
arjantijms9f5bb742021-02-28 19:00:48 +0100121 <arg line="delete-domain" />
122 <arg line="--domaindir ${admin.domain.dir}" />
123 <arg line="${admin.domain}" />
Vinay Vishal57171472018-09-18 20:22:00 +0530124 </exec>
125</target>
126
127<target name="create-domain-common" depends="init-common">
128 <exec executable="${ASADMIN}">
arjantijms9f5bb742021-02-28 19:00:48 +0100129 <arg line="create-domain" />
130 <arg line="--domaindir ${admin.domain.dir}" />
131 <arg line="--adminport ${admin.port}" />
132 <arg line="--instanceport ${http.port}" />
133 <arg line="--user ${admin.user}" />
134 <arg line="--passwordfile ${admin.password.file}" />
Vinay Vishal57171472018-09-18 20:22:00 +0530135 <arg line="--domainproperties orb.listener.port=${orb.port}" />
arjantijms9f5bb742021-02-28 19:00:48 +0100136 <arg line="${admin.domain}" />
Vinay Vishal57171472018-09-18 20:22:00 +0530137 </exec>
138</target>
139
140<target name="cleanAS">
arjantijms9f5bb742021-02-28 19:00:48 +0100141 <echo message="run.xml:deleting domain: ${admin.domain}..." />
142 <antcall target="delete-domain-common" />
143 <echo message="run.xml:creating domain: ${admin.domain}..." />
144 <antcall target="create-domain-common" />
Vinay Vishal57171472018-09-18 20:22:00 +0530145</target>
146
147<target name="start-clean-server">
arjantijms9f5bb742021-02-28 19:00:48 +0100148 <antcall target="stopDomain" />
149 <antcall target="cleanAS" />
150 <antcall target="startDomain" />
Vinay Vishal57171472018-09-18 20:22:00 +0530151</target>
152
153
154<target name="restart-instance-common">
arjantijms9f5bb742021-02-28 19:00:48 +0100155 <echo message="Restarting remote server instance,until this gets fixed" />
156 <exec executable="${ASADMIN}" failonerror="false">
157 <arg line="stop-instance" />
158 <arg line="${as.props}" />
159 <arg line="${appserver.instance.name}" />
160 </exec>
Vinay Vishal57171472018-09-18 20:22:00 +0530161
arjantijms9f5bb742021-02-28 19:00:48 +0100162 <sleep seconds="30" />
163 <exec executable="${ASADMIN}" failonerror="false">
164 <arg line="start-instance" />
165 <arg line="${as.props}" />
166 <arg line="${appserver.instance.name}" />
167 </exec>
Vinay Vishal57171472018-09-18 20:22:00 +0530168
169</target>
170
171<macrodef name="run-test">
arjantijms9f5bb742021-02-28 19:00:48 +0100172 <attribute name="classname" />
173 <attribute name="classpath" />
174 <element name="arguments" optional="yes" />
Vinay Vishal57171472018-09-18 20:22:00 +0530175 <sequential>
176 <java classname="@{classname}" classpath="@{classpath}" fork="true">
arjantijms9f5bb742021-02-28 19:00:48 +0100177 <jvmarg value="-Das.props=${as.props}" />
178 <jvmarg value="-Dadmin.user=${admin.user}" />
179 <jvmarg value="-Dadmin.port=${admin.port}" />
180 <jvmarg value="-Dhttp.port=${http.port}" />
181 <jvmarg value="-Dhttps.port=${https.port}" />
182 <jvmarg value="-Dhttp.host=${http.host}" />
183 <arguments />
Vinay Vishal57171472018-09-18 20:22:00 +0530184 </java>
185 </sequential>
186</macrodef>
187