blob: 86baf5aa632ee1bb20894f02c927307eaea352cc [file] [log] [blame]
<?xml version="1.0"?>
<!--
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
-->
<!DOCTYPE project [
<!ENTITY commonAnnotations SYSTEM "file:./../../ejb_annotations/annotations-common.xml">
<!ENTITY commonSetup SYSTEM "file:./../../../../config/properties.xml">
<!ENTITY commonBuild SYSTEM "file:./../../../../config/common.xml">
<!ENTITY common SYSTEM "file:./../common.xml">
]>
<project name="EJB3_SSL_CACERT" default="core" basedir=".">
&commonAnnotations;
&commonSetup;
&commonBuild;
&common;
<property name="src-name" value="endpoint/HelloImpl.java"/>
<property name="client-src-name" value="client/Client.java"/>
<property name="app-client-parameters" value="-xml ${env.S1AS_HOME}/domains/${admin.domain}/config/glassfish-acc.xml"/>
<target name="test-build">
<basename file="${src-name}" property="server" suffix=".java"/>
<dirname file="${src-name}" property="directory"/>
<basename file="${directory}" property="pkg-name"/>
<antcall target="test-compile"/>
<echo message="Building with package ${pkg-name}"/>
<jar destfile="${env.APS_HOME}/build/module/archive/${server}.jar"
basedir="${env.APS_HOME}/build/module/classes"
includes="${pkg-name}/**">
<metainf dir="${pkg-name}"
includes="*.xml"/>
</jar>
</target>
<target name="test-deploy" depends="test-build">
<basename file="${src-name}" property="server" suffix=".java"/>
<basename file="${server}" property="port" suffix="EJB"/>
<!-- FIXME: Reproducer for the following exception:
java.lang.NullPointerException
at java.base/java.io.File.<init>(File.java:361)
at org.glassfish.webservices.WebServicesDeployer.doWebServicesDeployment(WebServicesDeployer.java:612)
at org.glassfish.webservices.WebServicesDeployer.prepare(WebServicesDeployer.java:167)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:929)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:414)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:199)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:467)
-->
<exec executable="${env.S1AS_HOME}/bin/asadmin" failonerror="true">
<arg line="deploy --port ${admin.port} --user ${admin.user} --passwordfile ${admin.password.file} ${env.APS_HOME}/build/module/archive/${server}.jar"/>
</exec>
</target>
<target name="test-undeploy">
<basename file="${src-name}" property="server" suffix=".java"/>
<basename file="${server}" property="port" suffix="EJB"/>
<exec executable="${env.S1AS_HOME}/bin/asadmin" failonerror="true">
<arg line="undeploy --port ${admin.port} --user ${admin.user} --passwordfile ${admin.password.file} ${server}"/>
</exec>
</target>
<target name="test-prepare-client">
<basename file="${src-name}" property="server" suffix=".java"/>
<basename file="${server}" property="port" suffix="EJB"/>
<antcall target="clean"/>
<mkdir dir="${env.APS_HOME}/build/module/classes"/>
<echo message="Create appclient jar file"/>
<exec executable="${env.S1AS_HOME}/bin/wsimport">
<arg line="-keep -d ${env.APS_HOME}/build/module/classes localwsdl/${server}Service.wsdl"/>
</exec>
<antcall target="compile-client"/>
<antcall target="unjar-client-utils"/>
<jar destfile="${env.APS_HOME}/build/module/archive/HelloAppClient.jar">
<fileset dir="${env.APS_HOME}/build/module/classes"/>
<fileset dir="." includes="localwsdl/**"/>
<manifest>
<attribute name="Main-Class" value="client.Client"/>
</manifest>
</jar>
</target>
<target name="test-run">
<basename file="${src-name}" property="server" suffix=".java"/>
<basename file="${server}" property="port" suffix="EJB"/>
<exec executable="${env.S1AS_HOME}/bin/appclient">
<arg line="-client ${env.APS_HOME}/build/module/archive/HelloAppClient.jar FAILURE ejb-ssl-cacert-no-certificate-test"/>
</exec>
<antcall target="runclient-invalid-secure">
<param name="appname" value="Hello"/>
<param name="appclient.application.args"
value="FAILURE ejb-ssl-cacert-invalid-certificate-test"/>
</antcall>
<antcall target="runclient-secure">
<param name="appname" value="Hello"/>
<param name="appclient.application.args"
value="SUCCESS ejb-ssl-cacert-valid-certificate-test"/>
</antcall>
</target>
<target name="all" depends="clean, test-deploy, test-prepare-client, test-run, test-undeploy">
</target>
<target name="report-success">
<echo message="Test passed"/>
</target>
<target name="report-failure">
<echo message="Test failed"/>
</target>
</project>