| <?xml version="1.0" encoding="ISO-8859-1"?> |
| <!-- |
| |
| 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 |
| |
| --> |
| |
| <!-- configuration --> |
| <property environment="env"/> |
| <property file="${env.APS_HOME}/config.properties"/> |
| <property file="${env.APS_HOME}/../bootstrap/bootstrap.properties"/> |
| <property name="inst" value="${env.S1AS_HOME}"/> |
| <property name="java.home" value="${env.JAVA_HOME}"/> |
| <property name="s1as.home" value="${env.S1AS_HOME}"/> |
| <property name="testsRoot" value="${env.APS_HOME}/devtests/jms"/> |
| <property name="passwordFile" value="${testsRoot}/password.txt"/> |
| <property name="mqPasswordFile" value="${testsRoot}/mqpassword.txt"/> |
| <property name="testDomain" value="jmstest-domain"/> |
| <property name="testServer" value="jmstest-server"/> |
| <property name="testCluster" value="jmstest-cluster"/> |
| <property name="testClusterServer1" value="jmstest-cluster-server1"/> |
| <property name="testClusterServer2" value="jmstest-cluster-server2"/> |
| |
| <property name="deploy.clusterinstance1.httpport" value="2001"/> |
| <property name="deploy.clusterinstance2.httpport" value="2002"/> |
| <property name="deploy.serverinstance.httpport" value="2000"/> |
| <property name="deploy.clusterinstance1.orbport" value="2201"/> |
| <property name="deploy.clusterinstance2.orbport" value="2202"/> |
| <property name="deploy.serverinstance.orbport" value="2200"/> |
| |
| <property name="testDomain.dir" value="${s1as.home}/domains/${testDomain}"/> |
| <property name="node.dir" value="localhost-${testDomain}"/> |
| <property name="testServer.dir" value="${s1as.home}/nodes/${node.dir}/${testServer}"/> |
| <property name="testClusterServer1.dir" value="${s1as.home}/nodes/${node.dir}/${testClusterServer1}"/> |
| |
| <property name="start.process.delay.mins" value="1"/> |
| |
| <target name="setOSProps" depends="setUnixProps, setWindowsProps"/> |
| |
| <target name="detectOS"> |
| <condition property="isWindows"> |
| <os family="windows" /> |
| </condition> |
| </target> |
| |
| <target name="setUnixProps" if="isWindows" depends="detectOS"> |
| <property name="IMQCMD" value="${env.S1AS_HOME}/../mq/bin/imqcmd.exe"/> |
| </target> |
| |
| <target name="setWindowsProps" unless="isWindows" depends="detectOS"> |
| <property name="IMQCMD" value="${env.S1AS_HOME}/../mq/bin/imqcmd"/> |
| </target> |
| |
| <target name="setupCluster" depends="init-common"> |
| <echo message="Running... asadmin create-cluster"/> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="--port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} create-cluster ${testCluster}"/> |
| </exec> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="--port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} create-local-instance --cluster ${testCluster} --systemproperties HTTP_LISTENER_PORT=${deploy.clusterinstance1.httpport}:HTTP_SSL_LISTENER_PORT=2101:IIOP_LISTENER_PORT=${deploy.clusterinstance1.orbport}:IIOP_SSL_LISTENER_PORT=2301:IIOP_SSL_MUTUALAUTH_PORT=2401:JMX_SYSTEM_CONNECTOR_PORT=2501:JMS_PROVIDER_PORT=2601:ASADMIN_LISTENER_PORT=2701 ${testClusterServer1}"/> |
| </exec> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="--port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} set configs.config.${testCluster}-config.jms-service.type=${jmsServiceType}"/> |
| </exec> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="--port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} set configs.config.${testCluster}-config.jms-service.start-args="-vmargs -Xmx256m""/> |
| </exec> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="--port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} create-local-instance --cluster ${testCluster} --systemproperties HTTP_LISTENER_PORT=${deploy.clusterinstance2.httpport}:HTTP_SSL_LISTENER_PORT=2102:IIOP_LISTENER_PORT=${deploy.clusterinstance2.orbport}:IIOP_SSL_LISTENER_PORT=2302:IIOP_SSL_MUTUALAUTH_PORT=2402:JMX_SYSTEM_CONNECTOR_PORT=2502:JMS_PROVIDER_PORT=2602:ASADMIN_LISTENER_PORT=2702 ${testClusterServer2}"/> |
| </exec> |
| <echo message="Running... asadmin start-cluster"/> |
| <antcall target="startCluster"/> |
| <exec executable="${ASADMIN}"> |
| <arg line="--port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} list-instances"/> |
| </exec> |
| <echo message="Wait 3 minutes for jms service ready"/> |
| <sleep seconds="180"/> |
| <!--<antcall target="pingClusterJMS"/>--> |
| </target> |
| |
| <target name="pingClusterJMS"> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="--port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} jms-ping --target ${testCluster}"/> |
| </exec> |
| </target> |
| |
| <target name="startCluster"> |
| <echo message="Running... asadmin start-cluster"/> |
| <antcall target="start-process"> |
| <param name="line" value="--port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} start-instance ${testClusterServer1}"/> |
| </antcall> |
| <waitfor timeoutproperty="unableToStart"> |
| <http url="http://localhost:${deploy.clusterinstance1.httpport}"/> |
| </waitfor> |
| <antcall target="start-process"> |
| <param name="line" value="--port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} start-instance ${testClusterServer2}"/> |
| </antcall> |
| <waitfor timeoutproperty="unableToStart"> |
| <http url="http://localhost:${deploy.clusterinstance2.httpport}"/> |
| </waitfor> |
| </target> |
| |
| <target name="stopCluster"> |
| <echo message="Running... asadmin stop-cluster"/> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="--port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} stop-cluster ${testCluster}"/> |
| </exec> |
| </target> |
| |
| <target name="deleteCluster"> |
| <!-- stop-cluster does not work so use stop-instance to make sure |
| instance is stopped before deleting it --> |
| <echo message="Running... asadmin stop-instance"/> |
| <exec executable="${ASADMIN}"> |
| <arg line="--port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} stop-local-instance ${testClusterServer2}"/> |
| </exec> |
| <exec executable="${ASADMIN}"> |
| <arg line="--port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} stop-local-instance ${testClusterServer1}"/> |
| </exec> |
| <echo message="Running... asadmin delete-instance"/> |
| <exec executable="${ASADMIN}"> |
| <arg line="--port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} delete-local-instance ${testClusterServer2}"/> |
| </exec> |
| <exec executable="${ASADMIN}"> |
| <arg line="--port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} delete-local-instance ${testClusterServer1}"/> |
| </exec> |
| <echo message="Running... asadmin delete-cluster"/> |
| <exec executable="${ASADMIN}"> |
| <arg line="--port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} delete-cluster ${testCluster}"/> |
| </exec> |
| </target> |
| |
| <target name="deploy-common-cluster" depends="init-common"> |
| <echo message="Deploying to Cluster..."/> |
| <property name="deployed.app" value="${assemble.dir}/${appname}App.ear"/> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="--port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} deploy --force --target ${testCluster} ${deployed.app}"/> |
| </exec> |
| <echo message="Deployment on target cluster ${testCluster} successful"/> |
| </target> |
| |
| <target name="undeploy-common-cluster" depends="init-common"> |
| <echo message="Undeploying from Cluster..."/> |
| <property name="deployedapp.name" value="${appname}App"/> |
| <property name="extra-params" value=""/> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="--port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} undeploy --target ${testCluster} ${deployedapp.name}"/> |
| </exec> |
| </target> |
| |
| <!-- |
| On Windows, ant hangs when it runs an asadmin command that starts a process. |
| To work around that, this task distinguishes between Windows and non-Windows |
| systems and uses a custom ant task for Windows. |
| |
| Any test that needs to start a process should NOT use ${ASADMIN} directly |
| but should call this start-process target instead. Pass the command line |
| to be run as <param name="line" value="..."/>. |
| --> |
| |
| <target name="start-process" depends="init-common"> |
| <!-- |
| Set a property to the target to invoke, depending on the platform type. |
| --> |
| <condition property="start-target" value="start-process-windows"> |
| <isset property="isWindows"/> |
| </condition> |
| <condition property="start-target" value="start-process-non-windows"> |
| <not> |
| <isset property="start-target"/> |
| </not> |
| </condition> |
| |
| <!-- |
| Invoke the target just chosen. |
| --> |
| <antcall target="${start-target}"/> |
| </target> |
| |
| |
| <!-- |
| The following task works around the Windows/Ant problem that causes |
| the ant script to hang when it runs an asadmin command that starts |
| a new process. |
| --> |
| <target name="start-process-windows" depends="init-common"> |
| <taskdef name="spawn" |
| classname="SpawnTask" |
| classpath="${env.APS_HOME}/lib"/> |
| <echo>Executing asadmin command: ${line}</echo> |
| <spawn executable="${ASADMIN}" failifexecutionfails="false"> |
| <arg line="${line}"/> |
| </spawn> |
| <echo message=" ...Waiting for process(es) to be up ...(sleeping for ${start.process.delay.mins} minutes) " /> |
| <sleep minutes="${start.process.delay.mins}"/> |
| <echo message=" Process(es) now assumed to be started."/> |
| </target> |
| |
| <!-- |
| For non-Windows systems, ant works fine when invoking asadmin to start a |
| process, so do it that way for those systems. |
| --> |
| <target name="start-process-non-windows" depends="init-common"> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="${line}"/> |
| </exec> |
| </target> |