| <!-- |
| |
| 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 |
| |
| --> |
| |
| <!-- |
| Targets to be shared by all unit tests |
| --> |
| |
| <!-- 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/deployment"/> |
| <property name="passwordFile" value="${testsRoot}/password.txt"/> |
| <property name="build" value="${testsRoot}/build"/> |
| <property name="virtual.server.name" value="server-foo"/> |
| <property name="http.listener.name" value="listener-foo"/> |
| <property name="http.port.2" value="8081"/> |
| <property name="listener.threads" value="100"/> |
| <property name="listener.address" value="0.0.0.0"/> |
| <property name="targetPlatform" value="${env.DEPL_TARGET}"/> |
| <property name="customtasks.src" value="${testsRoot}/util/customAntTasks"/> |
| <property name="customtasks.dest" value="${testsRoot}/util/build/customAntTasks"/> |
| <property name="customtasks.jar" value="${customtasks.dest}/customAntTasks.jar"/> |
| <property name="junit.jar" value="${env.APS_HOME}/devtests/deployment/junit-4.12.jar" /> |
| <property name="annotation.report.dir" value="${testsRoot}/annotation/report"/> |
| <property name="testDomain" value="depltest-domain"/> |
| <property name="testServer" value="depltest-server"/> |
| <property name="testCluster" value="depltest-cluster"/> |
| <property name="testClusterServer1" value="depltest-cluster-server1"/> |
| |
| <property name="deploy.clusterinstance1.httpport" value="2001"/> |
| <property name="deploy.serverinstance.httpport" value="2000"/> |
| <property name="deploy.clusterinstance1.orbport" value="2201"/> |
| <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}"/> |
| |
| <!-- |
| Change the value to control |
| whether deployment tests upload the file or not. |
| --> |
| <property name="use.upload" value="false"/> |
| |
| <!-- |
| The following property supports the special Windows process-start-up implementation. |
| On Windows, ant hangs when it runs an asadmin command that starts a process. This |
| workaround, using the Q/A ant Spawn task, avoids that problem. Also, see the |
| start-process target defined below. New tests or changes to existing tests |
| should NOT refer to the ${ASADMIN} script directly if the command starts a |
| process but, instead, should call the start-process task. |
| --> |
| <property name="start.process.delay.mins" value="1"/> |
| |
| <!-- |
| The tests use custom Ant tasks. The build of those tasks should occur before tests run. See the |
| util directory for its own build.xml and the source files. |
| --> |
| |
| |
| <target name="init" depends="init.os,init.tools,setAsadminArgs"> |
| <get src="https://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.jar" dest="${env.APS_HOME}/devtests/deployment/junit-4.12.jar" usetimestamp="true"/> |
| <property name="root" value="${basedir}"/> |
| |
| <available property="cluster.exists" file="${s1as.home}/domains/${testDomain}"/> |
| |
| <available property="SetupStarted" file="${build}/setupdone"/> |
| |
| <condition property="EE" value="true"> |
| <or> |
| <equals arg1="${env.DEPL_TARGET}" arg2="SERVER"/> |
| <equals arg1="${env.DEPL_TARGET}" arg2="CLUSTER"/> |
| </or> |
| </condition> |
| |
| <condition property="doCluster"> |
| <equals arg1="${env.DEPL_TARGET}" arg2="CLUSTER"/> |
| </condition> |
| |
| <condition property="doInstance"> |
| <equals arg1="${env.DEPL_TARGET}" arg2="SERVER"/> |
| </condition> |
| |
| <condition property="PE"> |
| <and> |
| <not> |
| <equals arg1="${targetPlatform}" arg2="SERVER"/> |
| </not> |
| <not> |
| <equals arg1="${targetPlatform}" arg2="CLUSTER"/> |
| </not> |
| </and> |
| </condition> |
| |
| <!-- |
| <condition property="s1as.secure" value="true"> |
| <or> |
| <equals arg1="${EE}" arg2="true"/> |
| <equals arg1="${env.SECURE}" arg2="true"/> |
| </or> |
| </condition> |
| --> |
| <property name="s1as.secure" value="false"/> |
| |
| <condition property="run.jsr88" value="false"> |
| <equals arg1="${run.jsr88}" arg2="false" /> |
| </condition> |
| |
| <condition property="jsr88.uri" value="deployer:Sun:AppServer::${admin.host}:${admin.port}:https"> |
| <equals arg1="${s1as.secure}" arg2="true"/> |
| </condition> |
| <property name="jsr88.uri" value="deployer:Sun:AppServer::${admin.host}:${admin.port}"/> |
| |
| <path id="gfv3.classpath"> |
| <fileset dir="${s1as.home}/modules"> |
| <include name="**/*.jar"/> |
| </fileset> |
| </path> |
| |
| <path id="test.compile.classpath"> |
| <pathelement location="${inst}/lib/j2ee.jar"/> |
| <pathelement location="${java.home}/lib/tools.jar"/> |
| </path> |
| |
| <!-- |
| See if the custom ant tasks jar file is up-to-date as compare to the source files. The |
| resulting property will control whether the tasks are compiled and the jar file built |
| because the init.customtasks task uses unless="customtasks.uptodate." |
| --> |
| <uptodate property="customtasks.uptodate" targetfile="${customtasks.jar}"> |
| <srcfiles dir="${customtasks.src}" includes="*.java"/> |
| </uptodate> |
| |
| <antcall target="init.customtasks"/> |
| <taskdef name="javaWithResult" classname="devtests.deployment.util.JavaWithResult" classpath="${customtasks.jar}"/> |
| |
| </target> |
| |
| <target name="setAsadminArgs"> |
| <condition property="ASADMIN-ARGS" value="--user ${admin.user} --passwordfile ${passwordFile} --port ${admin.port} --target ${testCluster}"> |
| <equals arg1="${targetPlatform}" arg2="CLUSTER"/> |
| </condition> |
| <condition property="ASADMIN-ARGS" value="--user ${admin.user} --passwordfile ${passwordFile} --port ${admin.port} --target ${testServer}"> |
| <equals arg1="${targetPlatform}" arg2="SERVER"/> |
| </condition> |
| <condition property="ASADMIN-ARGS" value="--user ${admin.user} --passwordfile ${passwordFile} --port ${admin.port}"> |
| <and> |
| <not> |
| <equals arg1="${targetPlatform}" arg2="SERVER"/> |
| </not> |
| <not> |
| <equals arg1="${targetPlatform}" arg2="CLUSTER"/> |
| </not> |
| </and> |
| </condition> |
| |
| <property name="deploy" value="deploy --upload=${use.upload}"/> |
| <property name="undeploy" value="undeploy"/> |
| <property name="deploydir" value="deploydir"/> |
| <property name="redeploy" value="redeploy --upload=${use.upload}"/> |
| </target> |
| |
| <target name="setAsadminArgsWithoutPassword"> |
| <condition property="ASADMIN-ARGS-NOPASSWD" value="--user ${admin.user} --port ${admin.port} --target ${testCluster}"> |
| <equals arg1="${targetPlatform}" arg2="CLUSTER"/> |
| </condition> |
| <condition property="ASADMIN-ARGS-NOPASSWD" value="--user ${admin.user} --port ${admin.port} --target ${testServer}"> |
| <equals arg1="${targetPlatform}" arg2="SERVER"/> |
| </condition> |
| <condition property="ASADMIN-ARGS-NOPASSWD" value="--user ${admin.user} --port ${admin.port}"> |
| <and> |
| <not> |
| <equals arg1="${targetPlatform}" arg2="SERVER"/> |
| </not> |
| <not> |
| <equals arg1="${targetPlatform}" arg2="CLUSTER"/> |
| </not> |
| </and> |
| </condition> |
| |
| <property name="deploy" value="deploy"/> |
| <property name="undeploy" value="undeploy"/> |
| <property name="deploydir" value="deploydir"/> |
| <property name="redeploy" value="redeploy"/> |
| </target> |
| |
| <target name="setHttpPort2"> |
| <condition property="depltest.port" value="${deploy.serverinstance.httpport}"> |
| <equals arg1="${targetPlatform}" arg2="SERVER"/> |
| </condition> |
| <condition property="depltest.port" value="${deploy.clusterinstance1.httpport}"> |
| <equals arg1="${targetPlatform}" arg2="CLUSTER"/> |
| </condition> |
| <condition property="depltest.port" value="${http.port}"> |
| <and> |
| <not> |
| <equals arg1="${targetPlatform}" arg2="SERVER"/> |
| </not> |
| <not> |
| <equals arg1="${targetPlatform}" arg2="CLUSTER"/> |
| </not> |
| </and> |
| </condition> |
| </target> |
| |
| <target name="setInstanceName"> |
| <condition property="depltest.instance.name" value="${testServer}"> |
| <equals arg1="${targetPlatform}" arg2="SERVER"/> |
| </condition> |
| |
| <condition property="depltest.instance.name" value="${testClusterServer1}"> |
| <equals arg1="${targetPlatform}" arg2="CLUSTER"/> |
| </condition> |
| <condition property="depltest.instance.name" value="server"> |
| <and> |
| <not> |
| <equals arg1="${targetPlatform}" arg2="SERVER"/> |
| </not> |
| <not> |
| <equals arg1="${targetPlatform}" arg2="CLUSTER"/> |
| </not> |
| </and> |
| </condition> |
| </target> |
| |
| <target name="setHttpPort"> |
| <condition property="depltest.port" value="${deploy.serverinstance.httpport}"> |
| <or> |
| <equals arg1="${targetPlatform}" arg2="SERVER"/> |
| <equals arg1="${targetPlatform}" arg2="CLUSTER"/> |
| </or> |
| </condition> |
| <condition property="depltest.port" value="${http.port}"> |
| <and> |
| <not> |
| <equals arg1="${targetPlatform}" arg2="SERVER"/> |
| </not> |
| <not> |
| <equals arg1="${targetPlatform}" arg2="CLUSTER"/> |
| </not> |
| </and> |
| </condition> |
| </target> |
| |
| |
| <target name="setOrbPort2"> |
| <condition property="depltest.orbport" value="${deploy.serverinstance.orbport}"> |
| <equals arg1="${targetPlatform}" arg2="SERVER"/> |
| </condition> |
| <condition property="depltest.orbport" value="${deploy.clusterinstance1.orbport}"> |
| <equals arg1="${targetPlatform}" arg2="CLUSTER"/> |
| </condition> |
| <condition property="depltest.orbport" value="${orb.port}"> |
| <and> |
| <not> |
| <equals arg1="${targetPlatform}" arg2="SERVER"/> |
| </not> |
| <not> |
| <equals arg1="${targetPlatform}" arg2="CLUSTER"/> |
| </not> |
| </and> |
| </condition> |
| <property name="appclient.targetservers" value="localhost:${depltest.orbport}"/> |
| </target> |
| |
| <target name="setOrbPort"> |
| <condition property="depltest.orbport" value="${deploy.serverinstance.orbport}"> |
| <or> |
| <equals arg1="${targetPlatform}" arg2="SERVER"/> |
| <equals arg1="${targetPlatform}" arg2="CLUSTER"/> |
| </or> |
| </condition> |
| <condition property="depltest.orbport" value="${orb.port}"> |
| <and> |
| <not> |
| <equals arg1="${targetPlatform}" arg2="SERVER"/> |
| </not> |
| <not> |
| <equals arg1="${targetPlatform}" arg2="CLUSTER"/> |
| </not> |
| </and> |
| </condition> |
| <property name="appclient.targetservers" value="localhost:${depltest.orbport}"/> |
| </target> |
| |
| <target name="setEnabled"> |
| <condition property="enabled" value="true"> |
| <not> |
| <isset property="enabled"/> |
| </not> |
| </condition> |
| </target> |
| |
| <!-- |
| The following target compiles all Java files that are used in custom Ant tasks and places them into a |
| jar file. Subsequent taskdefs can then refer to the jar file. |
| |
| Note that the compilation and construction of the jar file will occur only if the jar file is obsolete |
| compared to the java sources, thanks to the uptodate setting of customtasks.uptodate in the init target. |
| |
| Note also that we use a separate build directory so we can capture only the custom task .class files into |
| the jar and not all .class files under the util tree. |
| --> |
| <target name="init.customtasks" unless="customtasks.uptodate"> |
| <delete dir="${customtasks.dest}"/> |
| <mkdir dir="${customtasks.dest}"/> |
| <javac |
| srcdir="${customtasks.src}" |
| destdir="${customtasks.dest}" |
| includes="*.java" |
| > |
| <classpath> |
| <path location="${ant.publish.home}/lib/ant.jar"/> |
| <path location="${customtasks.dest}"/> <!-- for cross-dependencies, if any, among custom task classes and/or helpers --> |
| </classpath> |
| </javac> |
| <jar |
| destfile="${customtasks.jar}" |
| basedir="${customtasks.dest}" |
| includes="**/*.class" |
| /> |
| </target> |
| |
| <!-- asadmin commands --> |
| <!-- create-file-userusing asadmin @@FIXME Need to fix for EE--> |
| <!-- @param ${arg.list} (required) --> |
| <!-- @param ${password} (required) --> |
| <target name="common.createuser.asadmin" depends="setAsadminArgsWithoutPassword"> |
| <property name="user.password.file" value="asadminuserpassword.txt"/> |
| <echo file="${user.password.file}" append="false"> |
| AS_ADMIN_USERPASSWORD=${password} |
| AS_ADMIN_PASSWORD= |
| AS_ADMIN_MASTERPASSWORD=changeit |
| </echo> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="create-file-user ${ASADMIN-ARGS-NOPASSWD} --passwordfile ${user.password.file} --echo=true --terse=true ${arg.list}"/> |
| </antcall> |
| <delete file="${user.password.file}" failonerror="false"/> |
| </target> |
| |
| |
| <!-- set dotted name enable using asadmin --> |
| <target name="common.dotted.enable.ref.asadmin" depends="setInstanceName"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="set servers.server.${depltest.instance.name}.application-ref.${testName}.enabled=true"/> |
| </antcall> |
| <antcall target="dotted.enableAppOnInstance"> |
| <param name="testName" value="${testName}"/> |
| </antcall> |
| </target> |
| |
| <target name="common.dotted.disable.ref.asadmin" depends="setInstanceName"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="set servers.server.${depltest.instance.name}.application-ref.${testName}.enabled=false"/> |
| </antcall> |
| <antcall target="dotted.disableAppOnInstance"> |
| <param name="testName" value="${testName}"/> |
| </antcall> |
| </target> |
| |
| <target name="common.dotted.enable.application.asadmin"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="set applications.application.${testName}.enabled=true"/> |
| </antcall> |
| </target> |
| |
| <target name="common.dotted.disable.application.asadmin"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="set applications.application.${testName}.enabled=false"/> |
| </antcall> |
| </target> |
| |
| |
| <!-- enable using asadmin --> |
| <!-- @param ${arg.list} (required) --> |
| <target name="common.enable.asadmin" depends="setAsadminArgs"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="enable ${ASADMIN-ARGS} ${arg.list}"/> |
| </antcall> |
| <antcall target="enableAppOnInstance"> |
| <param name="testName" value="${testName}"/> |
| </antcall> |
| </target> |
| |
| <!-- disable using asadmin --> |
| <!-- @param ${arg.list} (required) --> |
| <target name="common.disable.asadmin" depends="setAsadminArgs"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="disable ${ASADMIN-ARGS} ${arg.list}"/> |
| </antcall> |
| <antcall target="disableAppOnInstance"> |
| <param name="testName" value="${testName}"/> |
| </antcall> |
| </target> |
| |
| <!-- create jms connection using asadmin --> |
| <target name="common.create.jms.connection" depends="setAsadminArgs"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="create-jms-resource ${ASADMIN-ARGS} --restype ${jms.factory.type} ${jms.factory.name}"/> |
| </antcall> |
| </target> |
| |
| <!-- delete jms connection using asadmin --> |
| <target name="common.delete.jms.connection" depends="setAsadminArgs"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="delete-jms-resource ${ASADMIN-ARGS} ${jms.factory.name}"/> |
| </antcall> |
| </target> |
| |
| <!-- create jms destination resource using asadmin --> |
| <target name="common.create.jms.resource" depends="setAsadminArgs"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="create-jmsdest ${ASADMIN-ARGS} --desttype ${dest.type} ${dest.name}"/> |
| </antcall> |
| |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="create-jms-resource ${ASADMIN-ARGS} --restype ${res.type} --property imqDestinationName=${dest.name} ${jms.resource.name}"/> |
| </antcall> |
| </target> |
| |
| |
| <!-- delete jms destination resource using asadmin --> |
| <target name="common.delete.jms.resource" depends="setAsadminArgs"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="delete-jms-resource ${ASADMIN-ARGS} ${jms.resource.name}"/> |
| </antcall> |
| |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="delete-jmsdest ${ASADMIN-ARGS} --desttype ${dest.type} ${dest.name}"/> |
| </antcall> |
| |
| </target> |
| |
| <!-- deploy/undeploy jms resources --> |
| <target name="common.deploy.jms" depends="init"> |
| <antcall target="common.create.jms.connection" /> |
| <antcall target="common.create.jms.resource" /> |
| </target> |
| |
| <target name="common.undeploy.jms" depends="init"> |
| <antcall target="common.delete.jms.connection" /> |
| <antcall target="common.delete.jms.resource" /> |
| </target> |
| |
| <target name="common.create.customresource"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="create-custom-resource ${ASADMIN-ARGS} --restype ${resource.type} |
| --factoryclass ${resource.factory.class} --property value=${resource.value} ${resource.name}"/> |
| </antcall> |
| </target> |
| |
| <target name="common.delete.customresource"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="delete-custom-resource ${ASADMIN-ARGS} ${resource.name}" /> |
| </antcall> |
| </target> |
| |
| <!-- deploy using asadmin --> |
| <!-- @param ${arg.list} (required) --> |
| <target name="common.deploy.asadmin" depends="setAsadminArgs"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="${deploy} ${ASADMIN-ARGS} ${arg.list}"/> |
| </antcall> |
| <antcall target="createAppRef"> |
| <param name="testName" value="${testName}"/> |
| </antcall> |
| </target> |
| |
| <target name="common.redeploy.asadmin" depends="setAsadminArgs"> |
| <antcall target="delAppRef"> |
| <param name="testName" value="${testName}"/> |
| </antcall> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="${deploy} ${ASADMIN-ARGS} --force=true ${arg.list}"/> |
| </antcall> |
| <antcall target="createAppRef"> |
| <param name="testName" value="${testName}"/> |
| </antcall> |
| </target> |
| |
| <!-- deploy using asadmin --> |
| <!-- @param ${arg.list} (required) --> |
| <target name="common.deploy.osgi.asadmin" depends="setAsadminArgs"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="${deploy} ${ASADMIN-ARGS} --type osgi ${arg.list}"/> |
| </antcall> |
| <antcall target="createAppRef"> |
| <param name="testName" value="${testName}"/> |
| </antcall> |
| </target> |
| |
| <target name="common.redeploy.osgi.asadmin" depends="setAsadminArgs"> |
| <antcall target="delAppRef"> |
| <param name="testName" value="${testName}"/> |
| </antcall> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="${deploy} ${ASADMIN-ARGS} --type osgi --force=true ${arg.list}"/> |
| </antcall> |
| <antcall target="createAppRef"> |
| <param name="testName" value="${testName}"/> |
| </antcall> |
| </target> |
| |
| <!-- undeploy using asadmin --> |
| <!-- @param ${arg.list} (required) --> |
| <target name="common.undeploy.asadmin" depends="setAsadminArgs"> |
| <antcall target="delAppRef"> |
| <param name="testName" value="${testName}"/> |
| </antcall> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="${undeploy} ${ASADMIN-ARGS} ${arg.list}"/> |
| </antcall> |
| </target> |
| |
| <!-- v3 redeploy using asadmin --> |
| <!-- @param ${arg.list} (required) --> |
| <target name="common.v3.redeploy.asadmin" depends="setAsadminArgs"> |
| <antcall target="delAppRef"> |
| <param name="testName" value="${testName}"/> |
| </antcall> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="${redeploy} ${ASADMIN-ARGS} ${arg.list}"/> |
| </antcall> |
| <antcall target="createAppRef"> |
| <param name="testName" value="${testName}"/> |
| </antcall> |
| </target> |
| |
| |
| <target name="createAppRef" depends="init,setEnabled" if="doCluster" unless="doRollingUpgrade"> |
| <echo message="Create Application Reference for ${testName}"/> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="create-application-ref --user ${admin.user} --passwordfile ${passwordFile} --port ${admin.port} --target ${testServer} --enabled ${enabled} ${testName}"/> |
| </antcall> |
| </target> |
| |
| <target name="delAppRef" depends="init" if="doCluster"> |
| <echo message="Delete Application Reference for ${testName}"/> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="delete-application-ref --user ${admin.user} --passwordfile ${passwordFile} --port ${admin.port} --target ${testServer} ${testName}"/> |
| </antcall> |
| </target> |
| |
| <target name="disableAppOnInstance" depends="init" if="doCluster"> |
| <echo message="Disable application for ${testName}"/> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="disable --user ${admin.user} --passwordfile ${passwordFile} --port ${admin.port} --target ${testServer} ${testName}"/> |
| </antcall> |
| </target> |
| |
| <target name="enableAppOnInstance" depends="init" if="doCluster" unless="doRollingUpgrade"> |
| <echo message="Enable application for ${testName}"/> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="enable --user ${admin.user} --passwordfile ${passwordFile} --port ${admin.port} --target ${testServer} ${testName}"/> |
| </antcall> |
| </target> |
| |
| <target name="dotted.enableAppOnInstance" depends="init" if="doCluster"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="set servers.server.${testServer}.application-ref.${testName}.enabled=true"/> |
| </antcall> |
| </target> |
| |
| <target name="dotted.disableAppOnInstance" depends="init" if="doCluster"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="set servers.server.${testServer}.application-ref.${testName}.enabled=false"/> |
| </antcall> |
| </target> |
| |
| <!-- deploydir using asadmin --> |
| <!-- @param ${arg.list} (required) --> |
| <target name="common.deploydir.asadmin" depends="setAsadminArgs"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="${deploydir} ${ASADMIN-ARGS} ${arg.list}"/> |
| </antcall> |
| </target> |
| |
| <!-- redeploydir using asadmin --> |
| <!-- @param ${arg.list} (required) --> |
| <target name="common.redeploydir.asadmin" depends="setAsadminArgs"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="${deploydir} ${ASADMIN-ARGS} --force=true ${arg.list}"/> |
| </antcall> |
| </target> |
| |
| <!-- redeploy using asadmin --> |
| <!-- @param ${arg.list} (required) --> |
| <target name="common.v3redeploy.asadmin" depends="setAsadminArgs"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="${redeploy} ${ASADMIN-ARGS} ${arg.list}"/> |
| </antcall> |
| </target> |
| |
| <!-- redeploydir using asadmin --> |
| <!-- @param ${arg.list} (required) --> |
| <target name="common.v3redeploydir.asadmin" depends="setAsadminArgs"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="${redeploy} ${ASADMIN-ARGS} ${arg.list}"/> |
| </antcall> |
| </target> |
| |
| |
| <!-- @param ${arg.list} (required) --> |
| <target name="common.getclientstubs.asadmin" depends="setAsadminArgs"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="get-client-stubs ${ASADMIN-ARGS} ${arg.list}"/> |
| </antcall> |
| </target> |
| |
| |
| <!-- run asadmin --> |
| <!-- @param ${arg.list} (required) --> |
| <target name="common.run.asadmin" depends="init"> |
| <echo message="${ASADMIN} ${arg.list}"/> |
| <exec executable="${ASADMIN}"> |
| <arg line="${arg.list}"/> |
| </exec> |
| </target> |
| |
| <!-- create virtual server using asadmin --> |
| <!-- @param ${arg.list} (required) --> |
| <target name="common.create.virtual.server.asadmin" depends="setAsadminArgs"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="create-virtual-server ${ASADMIN-ARGS} ${arg.list}"/> |
| </antcall> |
| </target> |
| |
| <!-- create http listener using asadmin --> |
| <!-- @param ${arg.list} (required) --> |
| <target name="common.create.http.listener.asadmin" depends="setAsadminArgs"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="create-http-listener ${ASADMIN-ARGS} ${arg.list}"/> |
| </antcall> |
| </target> |
| |
| <!-- delete virtual server using asadmin --> |
| <!-- @param ${arg.list} (required) --> |
| <target name="common.delete.virtual.server.asadmin" depends="setAsadminArgs"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="delete-virtual-server ${ASADMIN-ARGS} ${arg.list}"/> |
| </antcall> |
| </target> |
| |
| <!-- delete http listener using asadmin --> |
| <!-- @param ${arg.list} (required) --> |
| <target name="common.delete.http.listener.asadmin" depends="setAsadminArgs"> |
| <antcall target="common.run.asadmin"> |
| <param name="arg.list" |
| value="delete-http-listener ${ASADMIN-ARGS} ${arg.list}"/> |
| </antcall> |
| </target> |
| |
| <!-- jsr88 deployer commands --> |
| |
| <!-- deploy user jsr88 --> |
| <!-- @param ${arg.list} (required) --> |
| <target name="common.deploy.jsr88" > |
| <antcall target="common.run.jsr88"> |
| <param name="command" value="deploy"/> |
| <param name="arg.list" value="true ${arg.list}"/> |
| </antcall> |
| </target> |
| |
| <!-- use InputStream signature to deploy --> |
| <target name="common.deploy-stream.jsr88" > |
| <antcall target="common.run.jsr88"> |
| <param name="command" value="deploy-stream"/> |
| <param name="arg.list" value="true ${arg.list}"/> |
| </antcall> |
| </target> |
| |
| <!-- undeploy user jsr88 --> |
| <!-- @param ${arg.list} (required) --> |
| <target name="common.undeploy.jsr88" > |
| <antcall target="common.run.jsr88"> |
| <param name="command" value="undeploy"/> |
| <param name="arg.list" value="${arg.list}"/> |
| </antcall> |
| </target> |
| |
| <target name="common.run.positive"> |
| <antcall target="common.run"> |
| <param name="test-details" value="${desc}"/> |
| <param name="sub-url" value="${link}"/> |
| <param name="log-file" value="${log.id}"/> |
| <param name="state" value="true"/> |
| </antcall> |
| </target> |
| |
| <target name="common.run.negative"> |
| <antcall target="common.run"> |
| <param name="test-details" value="${desc}"/> |
| <param name="sub-url" value="${link}"/> |
| <param name="log-file" value="${log.id}"/> |
| <param name="state" value="false"/> |
| </antcall> |
| </target> |
| |
| <target name="common.run" depends="setHttpPort"> |
| <antcall target="checkAppOnServer"/> |
| <antcall target="checkAppOnCluster"> |
| <param name="link" value="${sub-url}"/> |
| <param name="state" value="${state}"/> |
| <param name="log.id" value="${log-file}"/> |
| <param name="details" value="${test-details}"/> |
| </antcall> |
| </target> |
| |
| <target name="checkAppOnServer"> |
| <antcall target="declare-test"> |
| <param name="description" value="${test-details} (server)"/> |
| </antcall> |
| <property name="url" value="http://${http.host}:${depltest.port}/${sub-url}"/> |
| <antcall target="runclient"> |
| <param name="arg.list" value="${url} ${state} ${extra.args}"/> |
| <param name="log.id" value="${log-file}"/> |
| </antcall> |
| </target> |
| |
| |
| <target name="checkAppOnCluster" depends="init" if="doCluster"> |
| <antcall target="declare-test"> |
| <param name="description" value="${desc} (cluster-inst1)"/> |
| </antcall> |
| <property name="clurl1" value="http://${http.host}:${deploy.clusterinstance1.httpport}/${link}"/> |
| <antcall target="runclient"> |
| <param name="arg.list" value="${clurl1} ${state} ${extra.args}"/> |
| <param name="log.id" value="${log.id}CL1"/> |
| </antcall> |
| </target> |
| |
| <!-- run jsr88 --> |
| <!-- @param ${arg.list} (required) --> |
| <!-- |
| <target name="common.run.jsr88" depends="init, compile.util"> |
| --> |
| <!-- to disable running jsr88 tests, set the property -Drun.jsr88=false --> |
| <target name="common.run.jsr88" depends="init, compile.util" unless="run.jsr88" > |
| <delete file="${testsRoot}/build/archives/DEPLOY_RESULT"/> |
| |
| <!-- |
| Due to differences in command line parsing on Windows and non-Windows systems we need |
| to pass the possibly-empty admin.password differently. |
| --> |
| <condition property="admin.password.arg" value=""${admin.password}"" else="${admin.password}"> |
| <os family="windows"/> |
| </condition> |
| |
| <echo message="JSR88Deployer ${command} ${jsr88.uri} ${admin.user} ${admin.password} ${arg.list}"/> |
| <javaWithResult |
| fork="true" |
| failonerror="false" |
| jvm="${JAVA}" |
| classname="devtests.deployment.util.JSR88Deployer" |
| resultproperty="deployActionResult"> |
| <arg value="${command}"/> |
| <arg value="${jsr88.uri}"/> |
| <arg value="${admin.user}"/> |
| <arg value="${admin.password.arg}"/> |
| <arg line="${arg.list}"/> |
| <!-- <arg line="${command} ${jsr88.uri} ${admin.user} "" ${arg.list}"/> --> |
| <classpath> |
| <path refid="gfv3.classpath"/> |
| <path location="${junit.jar}"/> |
| <path location="${env.APS_HOME}/devtests/deployment/util/build"/> |
| </classpath> |
| <sysproperty key="com.sun.aas.installRoot" value="${inst}"/> |
| <sysproperty key="deploymentTarget" value="${targetPlatform}"/> |
| <sysproperty key="server" value="${appserver.instance.name}"/> |
| <sysproperty key="java.library.path" value="${inst}/lib"/> |
| <sysproperty key="com.sun.aas.configRoot" value="${inst}/config"/> |
| <!-- |
| <jvmarg value="-Xdebug"/> |
| <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9999"/> |
| --> |
| </javaWithResult> |
| <condition property="deployFailed"> |
| <or> |
| <equals arg1="${deployActionResult}" arg2="-1"/> |
| <equals arg1="${deployActionResult}" arg2="1"/> |
| </or> |
| </condition> |
| <antcall target="deployActionFailed"> |
| <param name="indicator" value="${testsRoot}/build/archives/DEPLOY_RESULT"/> |
| </antcall> |
| </target> |
| |
| <target name="deployActionFailed" if="deployFailed"> |
| <touch file="${indicator}"/> |
| </target> |
| |
| <target name="compile.util"> |
| <ant dir="${env.APS_HOME}/devtests/deployment/util" target="compile"/> |
| </target> |
| |
| <target name="all" depends="init"> |
| <echo file="${testsRoot}/password.txt" append="false">AS_ADMIN_MASTERPASSWORD=changeit |
| </echo> |
| <delete file="client.log"/> |
| <touch file="client.log"/> |
| <record name="client.log" action="start"/> |
| <antcall target="preTestsRun"/> |
| <antcall target="restart.server"/> |
| <antcall target="private-all"> |
| <param name="build" value="${testsRoot}/build"/> |
| </antcall> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="stop-domain"/> |
| </exec> |
| <antcall target="postTestsRun"/> |
| <record name="client.log" action="stop"/> |
| <echo message="Grep the file client.log for exception/Exception and ensure that none is present"/> |
| </target> |
| <target name="tim-run" depends="init"> |
| <antcall target="preTestsRun"/> |
| <delete dir="${build}/setupdone"/> |
| <antcall target="private-all"> |
| <param name="build" value="${testsRoot}/build"/> |
| </antcall> |
| <antcall target="postTestsRun"/> |
| </target> |
| |
| <target name="all-ee" depends="init"> |
| <echo file="${testsRoot}/password.txt" append="false">AS_ADMIN_MASTERPASSWORD=changeit |
| </echo> |
| <delete file="client.log"/> |
| <touch file="client.log"/> |
| <record name="client.log" action="start"/> |
| <antcall target="preTestsRun"/> |
| <antcall target="setup"/> |
| <sleep seconds="60"/> |
| <delete dir="${build}/setupdone"/> |
| <antcall target="private-all"> |
| <param name="build" value="${testsRoot}/build"/> |
| </antcall> |
| <antcall target="unsetup"/> |
| <antcall target="postTestsRun"/> |
| <record name="client.log" action="stop"/> |
| <echo message="Grep the file client.log for exception/Exception and ensure that none is present"/> |
| </target> |
| |
| <target name="transform" depends="init"> |
| <style in="${root}/tests-results.xml" |
| out="${root}/results.html" extension=".html" |
| style="${testsRoot}/config/convert.xsl" destdir="."/> |
| <condition property="hasAnnotation"> |
| <!-- need a better way to check if annotation is executed for this run --> |
| <and> |
| <or> |
| <available file="${root}/annotation"/> |
| <available file="../../annotation"/> |
| <available file="./report"/> |
| </or> |
| <available file="${annotation.report.dir}"/> |
| </and> |
| </condition> |
| <antcall target="jutransform"/> |
| </target> |
| |
| <target name="jutransform" depends="init" if="hasAnnotation"> |
| <mkdir dir="${annotation.report.dir}/html"/> |
| <junitreport todir="${annotation.report.dir}"> |
| <fileset dir="${annotation.report.dir}"> |
| <include name="TEST-*.xml"/> |
| </fileset> |
| <report todir="${annotation.report.dir}/html"/> |
| </junitreport> |
| |
| <style in="${annotation.report.dir}/TESTS-TestSuites.xml" |
| out="${annotation.report.dir}/summary.txt" extension=".html" |
| style="${testsRoot}/config/juconvert.xsl" destdir="."/> |
| <concat destfile="results.html" append="true"> |
| <filelist dir="${annotation.report.dir}" files="summary.txt"/> |
| </concat> |
| </target> |
| |
| <target name="clean" depends="init"> |
| <delete dir="${testsRoot}/build"/> |
| <delete dir="${annotation.report.dir}"/> |
| </target> |
| |
| <!-- |
| Targets to process the test results |
| --> |
| <target name="processResult"> |
| <condition property="testPassed"> |
| <and> |
| <equals arg1="${result}" arg2="0" /> |
| <not> |
| <available file="${testsRoot}/build/archives/DEPLOY_RESULT"/> |
| </not> |
| </and> |
| </condition> |
| <condition property="testFailed"> |
| <or> |
| <equals arg1="${result}" arg2="-1"/> |
| <equals arg1="${result}" arg2="1"/> |
| <available file="${testsRoot}/build/archives/DEPLOY_RESULT"/> |
| </or> |
| </condition> |
| <condition property="statusProvided"> |
| <or> |
| <equals arg1="${result}" arg2="0"/> |
| <equals arg1="${result}" arg2="-1"/> |
| <equals arg1="${result}" arg2="1"/> |
| </or> |
| </condition> |
| <dirname property="antfile.dir" file="${ant.file}"/> |
| <basename property="current.dir" file="${antfile.dir}"/> |
| <antcall target="failed"> |
| <param name="testname" value="${current.dir}"/> |
| </antcall> |
| <antcall target="passed"> |
| <param name="testname" value="${current.dir}"/> |
| </antcall> |
| <antcall target="unknown"> |
| <param name="testname" value="${current.dir}"/> |
| </antcall> |
| </target> |
| |
| <!-- |
| Paramters: |
| testname - name of the test |
| result - numeric value of the exit status from the client |
| status - typically FAILED or UNKNOWN |
| log - the log file containing the client output |
| --> |
| <target name="writeLogToConsole"> |
| <tstamp> |
| <format property="failureNOW" pattern="dd-MMM-yyyy HH:mm:ss.SSS"/> |
| </tstamp> |
| <echo message="Test ${testname} ${status} at ${failureNOW} with return code ${result}"/> |
| <concat append="yes"> |
| <header trimleading="true"> |
| ================== Error output ================== |
| </header> |
| <footer trimleading="true"> |
| ================== End of error output ================== |
| </footer> |
| <fileset file="${log}"/> |
| </concat> |
| <concat destfile="${root}/tests-results.xml" append="yes"><result status="${status}" log="${log}"/></concat> |
| <concat destfile="${root}/tests-results.xml" append="yes"></test></concat> |
| </target> |
| |
| <target name="failed" if="testFailed"> |
| <antcall target="writeLogToConsole"> |
| <param name="status" value="FAILED"/> |
| </antcall> |
| </target> |
| |
| <target name="passed" if="testPassed"> |
| <echo message="Test ${testname} Passed"/> |
| <concat destfile="${root}/tests-results.xml" append="yes"><result status="PASSED" log="${log}"/></concat> |
| <concat destfile="${root}/tests-results.xml" append="yes"></test></concat> |
| </target> |
| |
| <target name="unknown" unless="statusProvided"> |
| <antcall target="writeLogToConsole"> |
| <param name="status" value="UNKNOWN"/> |
| </antcall> |
| </target> |
| |
| <!-- @param ${description} (required) --> |
| <target name="declare-test"> |
| <dirname property="antfile.dir" file="${ant.file}"/> |
| <basename property="current.dir" file="${antfile.dir}"/> |
| <echo message="Starting test ${current.dir} ${description}"/> |
| <concat destfile="${root}/tests-results.xml" append="yes"><test name="${current.dir}" description="${description}"></concat> |
| </target> |
| |
| <!-- |
| Targets private to this xml file only |
| --> |
| <target name="preTestsRun" depends="clean"> |
| <dirname property="antfile.dir" file="${ant.file}"/> |
| <basename property="current.dir" file="${antfile.dir}"/> |
| <echo message="Running all ${current.dir} devtests"/> |
| <mkdir dir="${testsRoot}/build/archives"/> |
| <delete file="${root}/tests-results.xml"/> |
| <concat destfile="${root}/tests-results.xml" append="yes"><tests></concat> |
| </target> |
| |
| <target name="restart.server"> |
| <echo message="Restarting server..."/> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="stop-domain"/> |
| </exec> |
| <antcall target="start-process"> |
| <param name="line" value="start-domain --user ${admin.user} --passwordfile ${passwordFile}"/> |
| </antcall> |
| </target> |
| |
| <target name="setup" depends="init" unless="cluster.exists"> |
| <antcall target="setupDomain"/> |
| <antcall target="setupInstance"/> |
| <antcall target="setupCluster"/> |
| <echo message="Running... asadmin list-instance"/> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="list-instances --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile}"/> |
| </exec> |
| <mkdir dir="${build}/setupdone"/> |
| </target> |
| |
| <target name="setupDomain"> |
| <echo message="Running... asadmin create-domain"/> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="create-domain --user ${admin.user} --nopassword=true --passwordfile ${passwordFile} --adminport ${admin.port} ${testDomain}"/> |
| </exec> |
| <echo message="Running... asadmin start-domain"/> |
| <antcall target="start-process"> |
| <param name="line" value="start-domain --user ${admin.user} --passwordfile ${passwordFile} ${testDomain}"/> |
| </antcall> |
| </target> |
| |
| <target name="setupInstance"> |
| <echo message="Running... asadmin create-instance"/> |
| <echo>But first, try asadmin uptime</echo> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg value="uptime"/> |
| </exec> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="create-local-instance --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} --systemproperties HTTP_LISTENER_PORT=${deploy.serverinstance.httpport}:HTTP_SSL_LISTENER_PORT=2100:IIOP_LISTENER_PORT=${deploy.serverinstance.orbport}:IIOP_SSL_LISTENER_PORT=2300:IIOP_SSL_MUTUALAUTH_PORT=2400:JMX_SYSTEM_CONNECTOR_PORT=2500:JMS_PROVIDER_PORT=2600:ASADMIN_LISTENER_PORT=2700 ${testServer}"/> |
| </exec> |
| <echo message="Running... asadmin start-instance"/> |
| <antcall target="start-process"> |
| <param name="line" value="start-local-instance --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} ${testServer}"/> |
| </antcall> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="list-instances --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile}"/> |
| </exec> |
| |
| </target> |
| |
| <target name="setupCluster" if="doCluster"> |
| <echo message="Running... asadmin create-cluster"/> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="create-cluster --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} ${testCluster}"/> |
| </exec> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="create-local-instance --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} --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> |
| <echo message="Running... asadmin start-cluster"/> |
| <antcall target="startCluster"/> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="list-instances --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile}"/> |
| </exec> |
| </target> |
| |
| <target name="start" depends="init" unless="SetupStarted"> |
| <echo message="Running... asadmin start-domain"/> |
| <antcall target="start-process"> |
| <param name="line" value="start-domain --user ${admin.user} --passwordfile ${passwordFile} ${testDomain}"/> |
| </antcall> |
| <antcall target="startInstance"/> |
| <antcall target="startCluster"/> |
| </target> |
| |
| <target name="startInstance"> |
| <echo message="Running... asadmin start-instance"/> |
| <antcall target="start-process"> |
| <param name="line" value="start-local-instance --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} ${testServer}"/> |
| </antcall> |
| </target> |
| |
| <target name="startCluster" if="doCluster"> |
| <echo message="Running... asadmin start-cluster"/> |
| <antcall target="start-process"> |
| <param name="line" value="start-cluster --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} ${testCluster}"/> |
| </antcall> |
| </target> |
| |
| <target name="stop" depends="init"> |
| <antcall target="stopInstance"/> |
| <antcall target="stopCluster"/> |
| <echo message="Running... asadmin stop-domain"/> |
| <exec executable="${ASADMIN}"> |
| <arg line="stop-domain ${testDomain}"/> |
| </exec> |
| </target> |
| |
| <target name="stopInstance"> |
| <echo message="Running... asadmin stop-instance"/> |
| <exec executable="${ASADMIN}"> |
| <arg line="stop-local-instance --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} ${testServer}"/> |
| </exec> |
| </target> |
| |
| <target name="stopCluster" if="doCluster"> |
| <echo message="Running... asadmin stop-cluster"/> |
| <exec executable="${ASADMIN}"> |
| <arg line="stop-cluster --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} ${testCluster}"/> |
| </exec> |
| </target> |
| |
| <target name="deleteCluster" if="doCluster"> |
| <!-- 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="stop-local-instance --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} ${testClusterServer1}"/> |
| </exec> |
| <echo message="Running... asadmin delete-instance"/> |
| <exec executable="${ASADMIN}"> |
| <arg line="delete-local-instance --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} ${testClusterServer1}"/> |
| </exec> |
| <echo message="Running... asadmin delete-cluster"/> |
| <exec executable="${ASADMIN}"> |
| <arg line="delete-cluster --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} ${testCluster}"/> |
| </exec> |
| </target> |
| |
| |
| <target name="deleteInstance"> |
| <exec executable="${ASADMIN}"> |
| <arg line="delete-local-instance --port ${admin.port} --user ${admin.user} --passwordfile ${passwordFile} ${testServer}"/> |
| </exec> |
| </target> |
| |
| <target name="unsetupDomain"> |
| <echo message="Running... asadmin stop-domain"/> |
| <exec executable="${ASADMIN}"> |
| <arg line="stop-domain ${testDomain}"/> |
| </exec> |
| <echo message="Running... asadmin delete-domain"/> |
| <exec executable="${ASADMIN}"> |
| <arg line="delete-domain ${testDomain}"/> |
| </exec> |
| <delete dir="${s1as.home}/domains/${testDomain}"/> |
| </target> |
| |
| <target name="unsetup" depends="init"> |
| <echo message="Cleaning up all the test setup"/> |
| <antcall target="stopInstance"/> |
| <antcall target="stopCluster"/> |
| <!-- Copy the server logs to preserve them (for error diagnosis) after we delete the instances and the domain. --> |
| <mkdir dir="server-logs"/> |
| <mkdir dir="server-logs/${testDomain}/logs"/> |
| <copy todir="server-logs/${testDomain}/logs"> |
| <fileset dir="${testDomain.dir}/logs" includes="*.log *.log.*"/> |
| </copy> |
| <mkdir dir="server-logs/${testServer}/logs"/> |
| <copy todir="server-logs/${testServer}/logs"> |
| <fileset dir="${testServer.dir}/logs" includes="*.log *.log.*"/> |
| </copy> |
| <antcall target="copyClusterLog"/> |
| <antcall target="deleteInstance"/> |
| <antcall target="deleteCluster"/> |
| <delete dir="${s1as.home}/nodeagents"/> |
| <antcall target="unsetupDomain"/> |
| </target> |
| |
| <target name="copyClusterLog" if="doCluster"> |
| <mkdir dir="server-logs/${testClusterServer1}/logs"/> |
| <copy todir="server-logs/${testClusterServer1}/logs"> |
| <fileset dir="${testClusterServer1.dir}/logs" includes="*.log *.log.*"/> |
| </copy> |
| </target> |
| |
| <target name="postTestsRun"> |
| <concat destfile="${root}/tests-results.xml" append="yes"></tests></concat> |
| <echo message="Processing tests results"/> |
| <antcall target="transform"/> |
| <loadfile srcFile="results.html" property="results"/> |
| <echo message="${results}"/> |
| </target> |
| |
| <target name="init.os"> |
| <tstamp> |
| <format property="start.time" pattern="MM/dd/yyyy hh:mm aa"/> |
| </tstamp> |
| <condition property="windows"> |
| <os family="windows" /> |
| </condition> |
| <condition property="unix"> |
| <os family="unix" /> |
| </condition> |
| <condition property="solaris"> |
| <equals arg1="${os.name}" arg2="SunOS"/> |
| </condition> |
| <condition property="linux"> |
| <equals arg1="${os.name}" arg2="Linux"/> |
| </condition> |
| </target> |
| |
| <target name="init.tools" depends="init.tools.unix, init.tools.windows"/> |
| <target name="init.tools.unix" if="unix"> |
| <property name="JAVA" value="${java.home}/bin/java"/> |
| <property name="ASADMIN" value="${s1as.home}/bin/asadmin"/> |
| <property name="WSCOMPILE" value="${s1as.home}/bin/wscompile"/> |
| <property name="APPCLIENT" value="${s1as.home}/bin/appclient"/> |
| </target> |
| <target name="init.tools.windows" if="windows"> |
| <property name="JAVA" value="${java.home}/bin/java.exe"/> |
| <property name="ASADMIN" value="${s1as.home}/bin/asadmin.bat"/> |
| <property name="WSCOMPILE" value="${s1as.home}/bin/wscompile.bat"/> |
| <property name="APPCLIENT" value="${s1as.home}/bin/appclient.bat"/> |
| </target> |
| |
| <!-- |
| Targets to be deprecated |
| --> |
| |
| <target name="prepare-jsr88" > |
| <ant dir="${env.APS_HOME}/devtests/deployment/jsr88/tester" target="compile"> |
| <property name="build" value="${build}"/> |
| </ant> |
| </target> |
| |
| <target name="jsr88-deploy" depends="prepare-jsr88" > |
| <java classname="tester.Deployer" fork="true"> |
| <jvmarg value="-Dcom.sun.aas.installRoot=${inst}"/> |
| <jvmarg value="-Djava.library.path=${inst}/lib"/> |
| <jvmarg value="-Dcom.sun.aas.configRoot=${inst}/config"/> |
| <classpath> |
| <pathelement path="${build}:${inst}/lib/j2ee.jar:${inst}/lib/appserv-rt.jar:${inst}/lib/appserv-admin.jar:${inst}/lib/dom.jar:${inst}/lib/xalan.jar:${inst}/lib/xercesImpl.jar"/> |
| </classpath> |
| <arg value="${deployablearchive}"/> |
| <arg value="${deploymentplan}"/> |
| <arg value="deployer:Sun:S1AS::${admin.host}:$(admin.port}"/> |
| <arg value="${admin.user}"/> |
| <arg value="${admin.password}"/> |
| </java> |
| </target> |
| |
| <target name="list"> |
| <echo message="All AVAILABLE modules"/> |
| <antcall target="common.run.jsr88"> |
| <param name="command" value="list"/> |
| <param name="arg.list" value="all"/> |
| </antcall> |
| <echo message="All RUNNING modules"/> |
| <antcall target="common.run.jsr88"> |
| <param name="command" value="list"/> |
| <param name="arg.list" value="running"/> |
| </antcall> |
| <echo message="All NON-RUNNING modules"/> |
| <antcall target="common.run.jsr88"> |
| <param name="command" value="list"/> |
| <param name="arg.list" value="nonrunning"/> |
| </antcall> |
| </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"> |
| <!-- |
| Set a property to the target to invoke, depending on the platform type. |
| --> |
| <condition property="start-target" value="start-process-windows"> |
| <isset property="windows"/> |
| </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"> |
| <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"> |
| <exec executable="${ASADMIN}" failonerror="true"> |
| <arg line="${line}"/> |
| </exec> |
| </target> |