blob: a5be6efc617397bd75d44a80a33d8746ea6b2c98 [file] [log] [blame]
<!--
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 jaxrpctargets SYSTEM "../common/targets.xml">
<!ENTITY commonSetup SYSTEM "file:./../../../config/properties.xml">
<!ENTITY commonBuild SYSTEM "file:./../../../config/common.xml">
<!ENTITY testproperties SYSTEM "file:./build.properties">
]>
<project name="jaxrpc-hello-ejb" default="all" basedir=".">
<property name="appname" value="MyHelloEJBService"/>
<property environment="env" />
<property file="${env.APS_HOME}/config.properties"/>
<property file="samplebuild.properties"/>
&jaxrpctargets;
&commonSetup;
&commonBuild;
&testproperties;
<path id="class.path">
<fileset dir="${env.S1AS_HOME}/modules">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${env.S1AS_HOME}/modules/endorsed">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${env.APS_HOME}/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="all" depends="clean,deploy,assemble-client,deploy-client,runtest,undeploy"/>
<target name="create-ejb-jar" description="Packages the EJB JAR file">
<echo message="Creating the EJB JAR...."/>
<delete file="${assemble.ear}/${ejbjar.file}" />
<delete dir="${assemble.ear}/META-INF" />
<copy todir="${assemble.ear}">
<fileset dir="${build}/"
includes="**/*.class"
excludes="**/*Client.class, **/*.wsdl, **/*mapping.xml"/>
</copy>
<copy file="${build}/MyHelloService.wsdl" todir="${assemble.ear}/META-INF/wsdl" />
<copy file="${build}/mapping.xml" todir="${assemble.ear}/${build}/" />
<copy file="webservices.xml" todir="${assemble.ear}/META-INF" />
<copy file="ejb-jar.xml" todir="${assemble.ear}/META-INF" />
<copy file="sun-ejb-jar.xml" todir="${assemble.ear}/META-INF" />
<jar destfile="${assemble.ear}/${ejbjar.file}"
>
<fileset dir="${assemble.ear}" includes="META-INF/**, build/**,helloservice/**" />
</jar>
<copy file="${assemble.ear}/${ejbjar.file}" todir="." />
</target>
<target name="build" depends="build-service"
description="Executes the targets needed to build the service.">
</target>
<target name="create-ear" depends="create-ejb-jar"
description="Executes the targets needed to create the ejb jar.">
<jar destfile="${assemble.ear}/${ear.file}"
>
<fileset dir="${assemble.ear}" includes="${ejbjar.file}" />
</jar>
</target>
<target name="deploy" depends="set-asadmin,build,create-ear">
<echo message="admin password file ${admin.password.file}"/>
<echo message="admin user ${admin.user}"/>
<echo message="admin host ${admin.host}"/>
<echo message="admin port ${admin.port}"/>
<echo message="Deploying ${ear.file} from ${basedir}." level="verbose"/>
<exec executable="${ASADMIN}">
<arg line="deploy"/>
<arg line="--user ${admin.user}"/>
<arg line="--passwordfile ${admin.password.file}"/>
<arg line="--host ${admin.host}"/>
<arg line="--port ${admin.port}"/>
<arg line="${assemble.ear}/${ear.name}"/>
</exec>
</target>
<target name="assemble-client" depends="init-common">
<mkdir dir="${build.classes.dir}/webclient/WEB-INF/classes"/>
<antcall target="run-wscompile">
<param name="param1" value="-gen:client -d ${build.classes.dir}/webclient/WEB-INF/classes -keep -s ${build.classes.dir}/webclient/WEB-INF/classes -classpath ${build.classes.dir}/webclient/WEB-INF/classes ${config.wsdl.file}"/>
</antcall>
<replace file="webclient/Client.java" value="${http.host}" token="HTTP_HOST"/>
<replace file="webclient/Client.java" value="${http.port}" token="HTTP_PORT"/>
<javac srcdir="." destdir="${build.classes.dir}/webclient/WEB-INF/classes"
includes="webclient/**">
<classpath refid="class.path"/>
</javac>
<copy file="client-web.xml" tofile="${build.classes.dir}/webclient/WEB-INF/web.xml"/>
<copy file="build/mapping.xml" tofile="${build.classes.dir}/webclient/WEB-INF/hello-mapping.xml"/>
<copy file="build/MyHelloService.wsdl" tofile="${build.classes.dir}/webclient/WEB-INF/wsdl/hello.wsdl"/>
<copy file="config-wsdl.xml" tofile="${build.classes.dir}/webclient/WEB-INF/hello-config.xml"/>
<copy file="client-sun-web.xml" tofile="${build.classes.dir}/webclient/WEB-INF/sun-web.xml"/>
<mkdir dir="${assemble.dir}"/>
<jar destfile="${assemble.dir}/wsclient.war" basedir="${build.classes.dir}/webclient" includes="**"/>
</target>
<target name="deploy-client" depends="init-common">
<property name="client.war" value="${assemble.dir}/wsclient.war"/>
<echo message="Deploying wsclient.war from ${assemble.dir}." level="verbose"/>
<exec executable="${ASADMIN}">
<arg line="deploy"/>
<arg line="--user ${admin.user}"/>
<arg line="--passwordfile ${admin.password.file}"/>
<arg line="--host ${admin.host}"/>
<arg line="--port ${admin.port}"/>
<arg line="${client.war}"/>
</exec>
</target>
<target name="undeploy-client" depends="init-common">
<exec executable="${ASADMIN}">
<arg line="undeploy"/>
<arg line="--user ${admin.user}"/>
<arg line="--passwordfile ${admin.password.file}"/>
<arg line="--host ${admin.host}"/>
<arg line="--port ${admin.port}"/>
<arg line="wsclient"/>
</exec>
</target>
<target name="undeploy" depends="undeploy-ear,undeploy-client"/>
<target name="undeploy-ear" depends="init-common">
<echo message="Undeploying ${ear.file} from ${basedir}." level="verbose"/>
<exec executable="${ASADMIN}">
<arg line="undeploy"/>
<arg line="--user ${admin.user}"/>
<arg line="--passwordfile ${admin.password.file}"/>
<arg line="--host ${admin.host}"/>
<arg line="--port ${admin.port}"/>
<arg line="${earname}"/>
</exec>
</target>
<target name="runtest" depends="init-common">
<mkdir dir="${build.classes.dir}/client"/>
<javac srcdir="." destdir="${build.classes.dir}/client"
classpath="${env.APS_HOME}/lib/reporter.jar"
includes="client/**"/>
<unjar src="${env.APS_HOME}/lib/reporter.jar" dest="${build.classes.dir}/client"/>
<java classname="client.TestClient">
<classpath>
<pathelement path="${build.classes.dir}/client"/>
</classpath>
<arg value="http://${http.host}:${http.port}/wsclient/RequestProcessor"/>
</java>
<!--restore the tokens back in file-->
<replace file="webclient/Client.java" token="${http.host}" value="HTTP_HOST"/>
<replace file="webclient/Client.java" token="${http.port}" value="HTTP_PORT"/>
</target>
</project>