blob: 2adf139e7bfc068ce564ed13fcea910031ce84fb [file] [log] [blame]
<?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
-->
<project name="Plain EJB invocation from JBI" default="all" basedir=".">
<property environment="env"/>
<property file="build.properties"/>
<target name="all" depends="clean, setup, runtest, undeploy">
<antcall target="clean"/>
</target>
<target name="setup">
<antcall target="compile-entapp"/>
<antcall target="wsgen-sun-http-binding"/>
<antcall target="build-serviceassembly"/>
<antcall target="deploy-serviceassembly"/>
</target>
<target name="runtest">
<!-- Build the client -->
<exec executable="${env.S1AS_HOME}/bin/wsimport">
<arg line="-d"/>
<arg line="build"/>
<arg line="-keep"/>
<arg line="service-assembly/sun-http-binding/${ejb.webservice.name}Service.wsdl"/>
</exec>
<exec executable="${env.S1AS_HOME}/bin/wsimport">
<arg line="-d"/>
<arg line="build"/>
<arg line="-keep"/>
<arg line="service-assembly/sun-http-binding/${web.webservice.name}Service.wsdl"/>
</exec>
<javac srcdir="client" includes="Client.java" destdir="build" classpath="${client.classpath}" debug="true"/>
<java classname="client.Client" classpath="${client.classpath}" fork="true"/>
</target>
<target name="clean">
<exec dir="${ent.app}" executable="${env.ANT_HOME}/bin/ant">
<arg line="clean"/>
</exec>
<delete dir="build"/>
<delete includeemptydirs="true" failonerror="false">
<fileset dir="service-assembly/sun-http-binding" includes="*.wsdl, *.xsd"/>
<fileset dir="service-assembly/sun-http-binding/entapp"/>
</delete>
</target>
<target name="undeploy">
<antcall target="undeploy-serviceassembly"/>
</target>
<target name="compile-entapp">
<exec dir="${ent.app}" executable="${env.ANT_HOME}/bin/ant"/>
<!--
<ant dir="${ent.app}"/>
-->
<!-- Add jbi.xml file to the .ear file -->
<jar destfile="${ent.app}/dist/EntApp.ear"
basedir="service-assembly/sun-javaee-engine"
includes="META-INF/jbi.xml"
update="true"
/>
</target>
<target name="wsgen-sun-http-binding">
<!-- generate WSDL for the EJB web service -->
<exec executable="${env.S1AS_HOME}/bin/wsgen">
<arg line="-cp"/>
<arg line="${ent.app}/${ejb.module}/build/ear-module"/>
<arg line="${ejb.webservice.class}"/>
<arg line="-wsdl"/>
<arg line="-d"/>
<arg line="service-assembly/sun-http-binding"/>
</exec>
<!-- Replace REPLACE_WITH_ACTUAL_URL with some value -->
<replace file="service-assembly/sun-http-binding/${ejb.webservice.name}Service.wsdl">
<replacetoken>REPLACE_WITH_ACTUAL_URL</replacetoken>
<replacevalue>http://localhost:12000/entapp/ejb/HelloEJB</replacevalue>
</replace>
<!-- generate WSDL for the Servlet web service -->
<exec executable="${env.S1AS_HOME}/bin/wsgen">
<arg line="-cp"/>
<arg line="${ent.app}/${web.module}/build/ear-module/WEB-INF/classes"/>
<arg line="${web.webservice.class}"/>
<arg line="-wsdl"/>
<arg line="-d"/>
<arg line="service-assembly/sun-http-binding"/>
</exec>
<!-- Replace REPLACE_WITH_ACTUAL_URL with some value -->
<replace file="service-assembly/sun-http-binding/${web.webservice.name}Service.wsdl">
<replacetoken>REPLACE_WITH_ACTUAL_URL</replacetoken>
<replacevalue>http://localhost:12000/entapp/web/HelloEJB</replacevalue>
</replace>
</target>
<target name="build-serviceassembly">
<mkdir dir="build"/>
<!-- Build the service unit & assembly jars -->
<jar destfile="build/sun-http-binding.jar"
basedir="service-assembly/sun-http-binding"
includes="*.wsdl, *.xsd, META-INF/jbi.xml"
/>
<jar destfile="build/EntApp.zip"
basedir="build"
includes="sun-http-binding.jar"
/>
<jar destfile="build/EntApp.zip"
update="true"
basedir="${ent.app}/dist"
includes="EntApp.ear"
/>
<jar destfile="build/EntApp.zip"
basedir="service-assembly"
includes="META-INF/jbi.xml"
update="true"
/>
</target>
<target name="deploy-serviceassembly">
<exec executable="${asadmin.command}">
<arg line="deploy-jbi-service-assembly"/>
<arg line="build/EntApp.zip"/>
</exec>
<exec executable="${asadmin.command}">
<arg line="start-jbi-service-assembly"/>
<arg line="EntApp"/>
</exec>
</target>
<target name="undeploy-serviceassembly">
<exec executable="${asadmin.command}">
<arg line="stop-jbi-service-assembly"/>
<arg line="EntApp"/>
</exec>
<exec executable="${asadmin.command}">
<arg line="shut-down-jbi-service-assembly"/>
<arg line="EntApp"/>
</exec>
<exec executable="${asadmin.command}">
<arg line="undeploy-jbi-service-assembly"/>
<arg line="EntApp"/>
</exec>
</target>
<target name="restart-ejbmodule">
<exec executable="${asadmin.command}">
<arg line="disable"/>
<arg line="${ejb.module}"/>
</exec>
<exec executable="${asadmin.command}">
<arg line="enable"/>
<arg line="${ejb.module}"/>
</exec>
</target>
</project>