Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 1 | <!-- |
| 2 | |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 3 | Copyright (c) 2017, 2021 Oracle and/or its affiliates. All rights reserved. |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 4 | |
| 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 | |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 19 | <property name="target-to-run" value="sqetests" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 20 | |
| 21 | <target name="runtest" depends="init-common"> |
| 22 | <record name="runtest.output" action="start" /> |
| 23 | <parallel> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 24 | <sequential> |
| 25 | <waitfor maxwait="5" maxwaitunit="minute" checkevery="500"> |
| 26 | <or> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 27 | <http url="http://localhost:80" /> |
| 28 | <http url="http://localhost:1024" /> |
| 29 | <http url="http://${http.host}:${http.port}" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 30 | </or> |
| 31 | </waitfor> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 32 | <antcall target="${target-to-run}" /> |
| 33 | <antcall target="report" /> |
| 34 | <antcall target="mail" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 35 | </sequential> |
| 36 | </parallel> |
| 37 | <record name="runtest.output" action="stop" /> |
| 38 | </target> |
| 39 | |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 40 | <!-- Setup and Restart the server instance --> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 41 | <target name="restart-server-instance-common"> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 42 | <antcall target="stopDomain" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 43 | <sleep seconds="5" /> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 44 | <antcall target="startDomain" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 45 | </target> |
| 46 | |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 47 | <target name="startDomain" depends="startDomainUnix, startDomainWindows" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 48 | |
| 49 | <target name="startDomainUnix" depends="init-common" if="isUnix"> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 50 | <echo message="Starting DAS" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 51 | <exec executable="${ASADMIN}"> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 52 | <arg line="start-domain" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 53 | </exec> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 54 | <echo message="run.xml:doing wait for ${http.host}:${http.port}..." /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 55 | <waitfor timeoutproperty="unableToStart"> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 56 | <http url="http://${http.host}:${http.port}" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 57 | </waitfor> |
| 58 | <condition property="dumpStack"> |
| 59 | <and> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 60 | <isset property="unableToStart" /> |
| 61 | <available file="${env.JAVA_HOME}/bin/jps" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 62 | </and> |
| 63 | </condition> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 64 | <echo message="run.xml:DONE doing wait for ${http.host}:${http.port}..." /> |
| 65 | <antcall target="dumpThreadStack" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 66 | </target> |
| 67 | |
| 68 | <target name="startDomainWindows" depends="init-common" if="isWindows"> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 69 | <echo message="Starting DAS" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 70 | <exec executable="${ASADMIN}" spawn="true"> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 71 | <arg line="start-domain" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 72 | </exec> |
| 73 | <waitfor timeoutproperty="unableToStart"> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 74 | <http url="http://${http.host}:${http.port}" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 75 | </waitfor> |
| 76 | <condition property="dumpStack"> |
| 77 | <and> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 78 | <isset property="unableToStart" /> |
| 79 | <available file="${env.JAVA_HOME}/bin/jps" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 80 | </and> |
| 81 | </condition> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 82 | <antcall target="dumpThreadStack" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 83 | </target> |
| 84 | |
| 85 | <target name="dumpThreadStack" if="dumpStack"> |
| 86 | <exec executable="${env.JAVA_HOME}/bin/jps" output="pid.out.file"> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 87 | <arg value="-v" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 88 | </exec> |
David Matějček | f4dc06a | 2021-05-17 12:10:57 +0200 | [diff] [blame] | 89 | |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 90 | <loadfile srcfile="pid.out.file" property="pid.out"> |
| 91 | <filterchain> |
| 92 | <linecontains> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 93 | <contains value="ASMain" /> |
| 94 | <contains value="${env.S1AS_HOME}" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 95 | </linecontains> |
| 96 | <tokenfilter> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 97 | <replaceregex pattern="^(\d+) ASMain (.*)" replace="\1" /> |
| 98 | <trim /> |
| 99 | <ignoreblank /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 100 | </tokenfilter> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 101 | <striplinebreaks /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 102 | </filterchain> |
| 103 | </loadfile> |
David Matějček | f4dc06a | 2021-05-17 12:10:57 +0200 | [diff] [blame] | 104 | |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 105 | <echo>Dumping the thread stack for Appserver instance with PID - "${pid.out}"</echo> |
| 106 | <exec executable="${env.JAVA_HOME}/bin/jstack"> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 107 | <arg value="${pid.out}" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 108 | </exec> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 109 | <delete file="pid.out.file" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 110 | </target> |
| 111 | |
| 112 | <target name="stopDomain" depends="init-common"> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 113 | <echo message="run.xml:stopping domain..." /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 114 | <exec executable="${ASADMIN}" failonerror="true"> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 115 | <arg line="stop-domain" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 116 | </exec> |
| 117 | </target> |
| 118 | |
| 119 | <target name="delete-domain-common" depends="init-common"> |
| 120 | <exec executable="${ASADMIN}"> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 121 | <arg line="delete-domain" /> |
| 122 | <arg line="--domaindir ${admin.domain.dir}" /> |
| 123 | <arg line="${admin.domain}" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 124 | </exec> |
| 125 | </target> |
| 126 | |
| 127 | <target name="create-domain-common" depends="init-common"> |
| 128 | <exec executable="${ASADMIN}"> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 129 | <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 Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 135 | <arg line="--domainproperties orb.listener.port=${orb.port}" /> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 136 | <arg line="${admin.domain}" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 137 | </exec> |
| 138 | </target> |
| 139 | |
| 140 | <target name="cleanAS"> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 141 | <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 Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 145 | </target> |
| 146 | |
| 147 | <target name="start-clean-server"> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 148 | <antcall target="stopDomain" /> |
| 149 | <antcall target="cleanAS" /> |
| 150 | <antcall target="startDomain" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 151 | </target> |
| 152 | |
| 153 | |
| 154 | <target name="restart-instance-common"> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 155 | <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 Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 161 | |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 162 | <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 Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 168 | |
| 169 | </target> |
| 170 | |
| 171 | <macrodef name="run-test"> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 172 | <attribute name="classname" /> |
| 173 | <attribute name="classpath" /> |
| 174 | <element name="arguments" optional="yes" /> |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 175 | <sequential> |
| 176 | <java classname="@{classname}" classpath="@{classpath}" fork="true"> |
arjantijms | 9f5bb74 | 2021-02-28 19:00:48 +0100 | [diff] [blame] | 177 | <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 Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 184 | </java> |
| 185 | </sequential> |
| 186 | </macrodef> |
| 187 | |