| <?xml version="1.0" encoding="ISO-8859-1"?> | |
| <!DOCTYPE project [ | |
| <!-- | |
| 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 | |
| --> | |
| <!ENTITY commonBuild SYSTEM "./../../config/common.xml"> | |
| ]> | |
| <project name="miscellaneousTestForJSR88" default="usage" basedir="."> | |
| &commonBuild; | |
| <property name="appClientName" value="appclienttest"/> | |
| <property name="appClientJarFile" value="${build}/${appClientName}.jar"/> | |
| <property name="appClientModuleName" value="testAppClient"/> | |
| <property name="webServicesWorkaroundCheckWarFile" value="exampleFromJ2EETutorial/cb/provided-wars/jaxrpc-coffee-distributor.war"/> | |
| <path id="jsr88.exec.classpath"> | |
| <path refid="gfv3.classpath"/> | |
| <pathelement location="${env.APS_HOME}/devtests/deployment/util/build"/> | |
| <pathelement location="${inst}/jdk/lib/tools.jar"/> | |
| </path> | |
| <target name="prepare" depends="init"> | |
| <mkdir dir="${build}"/> | |
| </target> | |
| <target name="compile" depends="prepare"> | |
| <javac srcdir="." | |
| destdir="${build}" | |
| includes="*.java" | |
| debug="on" | |
| failonerror="true"> | |
| <classpath> | |
| <path refid="gfv3.classpath"/> | |
| <path refid="test.compile.classpath"/> | |
| <pathelement location="../../util/build"/> <!-- need this to find the JSR88Deployer --> | |
| </classpath> | |
| </javac> | |
| </target> | |
| <!-- | |
| Run all the tests. | |
| --> | |
| <target name="run" depends="compile,assemble"> | |
| <antcall target="runTestProgressObjectImpl"/> | |
| <antcall target="runGetModulesTest"/> | |
| <antcall target="runOpenJarWorkaroundTest"/> | |
| </target> | |
| <!-- | |
| The test for the ProgressObjectImpl class is a very simple Java class with | |
| a few methods. No archives or deployments or undeployments are needed. | |
| The test run should throw no exceptions if the code functions correctly. | |
| --> | |
| <target name="runTestProgressObjectImpl"> | |
| <antcall target="declare-test"> | |
| <param name="description" value="jsr88/misc - Test ProgressObjectImpl class (for correct management of listener list to avoid concurrent update errors)"/> | |
| </antcall> | |
| <javaWithResult classname="TestProgressObjectImpl" | |
| fork="true" | |
| failonerror="false" | |
| output="${build}/TestProgressObjectImpl.log" | |
| dir="${build}" | |
| resultProperty="result" | |
| > | |
| <classpath> | |
| <path refid="jsr88.exec.classpath"/> | |
| <pathelement path="${build}"/> | |
| </classpath> | |
| </javaWithResult> | |
| <antcall target="processResult"> | |
| <param name="result" value="${result}"/> | |
| <param name="log" value="${build}/TestProgressObjectImpl.log"/> | |
| </antcall> | |
| </target> | |
| <target name="assemble" depends="compile"> | |
| <antcall target="buildAppClientJar"/> | |
| </target> | |
| <target name="buildAppClientJar"> | |
| <!-- | |
| Create the application-client.xml file. | |
| --> | |
| <jar | |
| destfile="${appClientJarFile}"> | |
| <fileset dir="${basedir}" includes="**/application-client.xml **/sun-application-client.xml"/> | |
| </jar> | |
| </target> | |
| <!-- | |
| To test the ability to get information about the modules through JSR88, first deploy an app client | |
| (which exposed a bug), then use JSR88 to retrieve information about app client components, then undeploy | |
| the app client. | |
| --> | |
| <target name="runGetModulesTest" depends="assemble"> | |
| <antcall target="declare-test"> | |
| <param name="description" value="jsr88/misc - Test ApplicationsConfigMBean class (for correct handling of app client object-type and enabled)"/> | |
| </antcall> | |
| <!-- | |
| Deploy an app client so we can test the bug fix. | |
| --> | |
| <antcall target="common.deploy.asadmin"> | |
| <param name="arg.list" value="--name ${appClientModuleName} ${appClientJarFile}"/> | |
| </antcall> | |
| <javaWithResult | |
| fork="true" | |
| failonerror="false" | |
| jvm="${JAVA}" | |
| classname="SimpleJSR88Client" | |
| resultproperty="result" | |
| > | |
| <sysproperty key="jsr88client.user" value="${admin.user}"/> | |
| <sysproperty key="jsr88client.password" value="${admin.password}"/> | |
| <sysproperty key="jsr88client.host" value="${admin.host}"/> | |
| <sysproperty key="jsr88client.port" value="${admin.port}"/> | |
| <sysproperty key="com.sun.aas.installRoot" value="${inst}"/> | |
| <classpath> | |
| <pathelement location="${inst}/lib/j2ee.jar"/> | |
| <pathelement location="${build}"/> | |
| <path refid="jsr88.exec.classpath"/> | |
| </classpath> | |
| <!-- | |
| The first command line argument to SimpleJSR88Client is the function to be performed. | |
| --> | |
| <arg line="getAvailableAppClientModules"/> | |
| </javaWithResult> | |
| <!-- | |
| Undeploy the app client that we just deployed. | |
| --> | |
| <antcall target="common.undeploy.asadmin"> | |
| <param name="arg.list" value="${appClientModuleName}"/> | |
| </antcall> | |
| <antcall target="processResult"> | |
| <param name="result" value="${result}"/> | |
| <param name="log" value="${build}/GetModulesTest.log"/> | |
| </antcall> | |
| </target> | |
| <!-- | |
| This test checks on a workaround that avoids a bug in J2SE that opens a jar file but never closes it. | |
| This happens during web services compilation during deployment (in some cases) and the open jar file | |
| prevents the app server from completely undeploying the app. A later attempt to deploy the app | |
| again fails because of the open jar file. The administrator must shut down and restart the app | |
| server to clear the open jar and permit the later deployment to succeed. | |
| Deployment has worked around this problem, and this test makes sure the workaround continues to work. | |
| --> | |
| <target name="runOpenJarWorkaroundTest" depends="init"> | |
| <antcall target="declare-test"> | |
| <param name="description" value="jsr88/misc - Test workaround of J2SE bug that leaves a jar file open during deployment"/> | |
| </antcall> | |
| <!-- | |
| Run the test program that deploys, undeploys, and deploys again. | |
| --> | |
| <javaWithResult | |
| fork="true" | |
| failonerror="false" | |
| output="${build}/TestOpenJarFileWorkaround.log" | |
| jvm="${JAVA}" | |
| classname="TestOpenJarFileWorkaround" | |
| resultproperty="result" | |
| > | |
| <sysproperty key="jsr88client.user" value="${admin.user}"/> | |
| <sysproperty key="jsr88client.password" value="${admin.password}"/> | |
| <sysproperty key="jsr88client.host" value="${admin.host}"/> | |
| <sysproperty key="jsr88client.port" value="${admin.port}"/> | |
| <sysproperty key="com.sun.aas.installRoot" value="${inst}"/> | |
| <sysproperty key="java.endorsed.dirs" value="${inst}/lib/endorsed"/> | |
| <classpath> | |
| <pathelement location="${inst}/lib/j2ee.jar"/> | |
| <pathelement location="${build}"/> | |
| <pathelement location="../../util/build"/> <!-- need this to find the JSR88Deployer --> | |
| <path refid="jsr88.exec.classpath"/> | |
| </classpath> | |
| <!-- | |
| The command line arguments are host, port, user, password, and the war to deploy. | |
| --> | |
| <arg line="${admin.host} ${admin.port} ${admin.user} ${admin.password} ${webServicesWorkaroundCheckWarFile}"/> | |
| </javaWithResult> | |
| <antcall target="processResult"> | |
| <param name="result" value="${result}"/> | |
| <param name="log" value="${build}/TestOpenJarFileWorkaround.log"/> | |
| </antcall> | |
| </target> | |
| <target name="private-all"> | |
| <antcall target="run"/> | |
| </target> | |
| <target name="clobber" depends="clean"> | |
| <delete dir="${build}"/> | |
| </target> | |
| <target name="usage"> | |
| <antcall target="all"/> | |
| </target> | |
| </project> |