blob: 157e54057275837fd5fd8948d6f901c7ef72beb0 [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 commonSetup SYSTEM "file:./../../../../config/properties.xml">
<!ENTITY commonBuild SYSTEM "file:./../../../../config/common.xml">
<!ENTITY jaxwsTools SYSTEM "file:./../../annotations/jaxwstools.xml">
<!ENTITY jbicommon SYSTEM "file:./../jbi_commons.xml">
<!ENTITY jbiproperties SYSTEM "file:./../jbi_commons.properties">
<!ENTITY testproperties SYSTEM "file:./build.properties">
]>
<project name="web-client" default="all" basedir=".">
&commonSetup;
&commonBuild;
&testproperties;
&jaxwsTools;
&jbicommon;
&jbiproperties;
<target name="all" depends="clean, setup-server, setup-client, deploy-provider-su, deploy-consumer-su, runtest, cleanup-client, cleanup-server"/>
<target name="clean" depends="init-common">
<antcall target="clean-common"/>
</target>
<target name="setup-server" depends="assemble-web, deploy-app, start-consumer-jms-binding"/>
<target name="setup-client" depends="assemble-client,deploy-client, start-provider-jms-binding"/>
<target name="cleanup-server" depends="undeploy-app, undeploy-consumer-su,stop-consumer-jms-binding"/>
<target name="cleanup-client" depends="undeploy-client, undeploy-provider-su,stop-provider-jms-binding"/>
<target name="assemble-web" depends="init-common, compile">
<echo message="Assembling web service module"/>
<antcall target="pkg-war">
<param name="war.classes" value="${build.classes.dir}"/>
<param name="war.file" value="${assemble.dir}/${appname}-web.war"/>
</antcall>
</target>
<target name="compile" depends="init-common">
<antcall target="compile-common">
<param name="src" value="provider/endpoint"/>
</antcall>
</target>
<target name="deploy-app">
<echo message="Deploying the web service"/>
<antcall target="deploy-war-common">
<param name="contextroot" value="${appname}"/>
</antcall>
</target>
<target name="deploy-consumer-su" depends="init-common">
<echo message="Creating QueueConnectionFactory for JMS Binding acting as a web service consumer"/>
<antcall target="create-jms-connection-factory">
<param name="jms.cf.name" value="MyQueueConnectionFactory"/>
</antcall>
<antcall target="create-jms-resource">
<param name="domain.admin.port" value="${admin.port}"/>
<param name="jms.res.type" value="${QueueConnectionFactory}"/>
<param name="jms.res.name" value="MyQueueConnectionFactory"/>
</antcall>
<echo message="deploying JMS Binding's consumer deployment "/>
<antcall target="deploy-jbi-component-su">
<param name="jbi-component-su-assembly" value="${jms-consumer-assembly}"/>
<param name="jbi-component-su" value="${jms-consumer-su}"/>
<param name="jbi-component-su-dir" value="${jms-consumer-su-dir}"/>
</antcall>
</target>
<target name="assemble-client" depends="init-common">
<echo message="Assembling web client"/>
<mkdir dir="${build.classes.dir}/webclient/WEB-INF/classes"/>
<mkdir dir="${assemble.dir}"/>
<echo message="wsimport -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://localhost:8080/jsr208-integration-web-client/CalculatorServicei?WSDL" />
<antcall target="wsimport">
<param name="wsimport.args"
value="-keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://localhost:8080/jsr208-integration-web-client/CalculatorService?WSDL"/>
</antcall>
<javac srcdir="consumer" destdir="${build.classes.dir}/webclient/WEB-INF/classes"
classpath="${env.APS_HOME}/lib/reporter.jar:${env.S1AS_HOME}/lib/j2ee.jar:${env.S1AS_HOME}/lib/webservices-rt.jar:${env.S1AS_HOME}/lib/webservices-tools.jar"
includes="webclient/**"/>
<copy file="./consumer/client-web.xml" tofile="${build.classes.dir}/webclient/WEB-INF/web.xml"/>
<copy file="./consumer/client-sun-web.xml" tofile="${build.classes.dir}/webclient/WEB-INF/sun-web.xml"/>
<jar destfile="${assemble.dir}/wsclient.war" basedir="${build.classes.dir}/webclient" includes="**"/>
</target>
<target name="deploy-client" depends="assemble-client">
<echo message="Deploying the client application"/>
<property name="client.war" value="${assemble.dir}/wsclient.war"/>
<echo message="Deploying ${wsdl.war} from ${basedir}." level="verbose"/>
<exec executable="${ASADMIN}">
<arg line="deploy"/>
<arg line="--user ${admin.user}"/>
<arg line="--passwordfile ${admin.password.file}"/>
<arg line="--port ${domain2.admin.port}"/>
<arg line="${client.war}"/>
</exec>
</target>
<target name="deploy-provider-su" depends="init-common">
<echo message="Creating physical destinations - queues : - provideroutgoingqueue and temporary_queue"/>
<antcall target="create-physical-queue">
<param name="queue.name" value="provideroutgoingqueue"/>
</antcall>
<antcall target="create-physical-queue">
<param name="queue.name" value="temporary_queue"/>
</antcall>
<echo message="Create QueueConnectionFactory for JMS Binding which is acting as a provider"/>
<antcall target="create-jms-connection-factory">
<param name="jms.cf.name" value="MyQueueConnectionFactory"/>
</antcall>
<antcall target="create-jms-resource">
<param name="domain.admin.port" value="${domain2.admin.port}"/>
<param name="jms.res.type" value="${QueueConnectionFactory}"/>
<param name="jms.res.name" value="MyQueueConnectionFactory"/>
</antcall>
<echo message="Create JMS resource for provideroutgoingqueue and temporary_queue"/>
<antcall target="create-jms-queue">
<param name="jms.queue.name" value="provideroutgoingqueue"/>
<param name="queue.name" value="provideroutgoingqueue"/>
</antcall>
<antcall target="create-jms-queue">
<param name="jms.queue.name" value="temporary_queue"/>
<param name="queue.name" value="temporary_queue"/>
</antcall>
<echo message="Deploy JMS Binding provider deployment"/>
<antcall target="deploy-jbi-component-su">
<param name="jbi-component-su-assembly" value="${jms-provider-assembly}"/>
<param name="jbi-component-su" value="${jms-provider-su}"/>
<param name="jbi-component-su-dir" value="${jms-provider-su-dir}"/>
<param name="jmx.port" value="${domain2.jmx.port}"/>
</antcall>
</target>
<target name="undeploy-client" depends="init-common">
<echo message="Undeploying client application"/>
<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 ${domain2.admin.port}"/>
<arg line="wsclient"/>
</exec>
</target>
<target name="undeploy-app" depends="init-common">
<echo message="Undeploying web service"/>
<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="${appname}-web"/>
</exec>
</target>
<target name="runtest" depends="init-common">
<echo message="Running the test client"/>
<mkdir dir="${build.classes.dir}/client"/>
<javac srcdir="." destdir="${build.classes.dir}/client"
classpath="${env.APS_HOME}/lib/reporter.jar"
includes="consumer/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}:${domain2.instance.port}/wsclient/webclient/RequestProcessor"/>
</java>
</target>
<target name="undeploy-consumer-su" depends="init-common">
<echo message="Undeploying JMS resource : MyQueueConnectionFactory"/>
<antcall target="delete-appserver-jms-resource">
<param name="domain.admin.port" value="${admin.port}"/>
<param name="jms.res.name" value="MyQueueConnectionFactory"/>
</antcall>
<!--<antcall target="delete-jms-resource">
<param name="jms.resource.name" value="MyQueueConnectionFactory"/>
</antcall>-->
<echo message="Undeploying JMS Binding consumer deployment"/>
<antcall target="undeploy-jbi-component-su">
<param name="jbi-component-su-assembly" value="${jms-consumer-assembly}"/>
</antcall>
</target>
<target name="undeploy-provider-su" depends="init-common">
<echo message="Undeploying JMS Resource :- provideroutgoingqueue and temporary_queue"/>
<antcall target="delete-jms-resource">
<param name="jms.resource.name" value="provideroutgoingqueue"/>
</antcall>
<antcall target="delete-jms-resource">
<param name="jms.resource.name" value="temporary_queue"/>
</antcall>
<echo message="Undeploying JMS resource : MyQueueConnectionFactory"/>
<antcall target="delete-appserver-jms-resource">
<param name="domain.admin.port" value="${domain2.admin.port}"/>
<param name="jms.res.name" value="MyQueueConnectionFactory"/>
</antcall>
<antcall target="delete-jms-resource">
<param name="jms.resource.name" value="MyQueueConnectionFactory"/>
</antcall>
<echo message="Deleting physical queues : provideroutgoingqueue , temporary_queue"/>
<antcall target="delete-physical-queue">
<param name="queue.name" value="provideroutgoingqueue"/>
</antcall>
<antcall target="delete-physical-queue">
<param name="queue.name" value="temporary_queue"/>
</antcall>
<echo message="Undeploying JMS Binding's provider deployment"/>
<antcall target="undeploy-jbi-component-su">
<param name="jbi-component-su-assembly" value="${jms-provider-assembly}"/>
<param name="jmx.port" value="${domain2.jmx.port}"/>
</antcall>
</target>
<target name="create-domain2" depends="init-common">
<property name="admin.command" value="create-domain"/>
<property name="operand.props" value="--adminport ${domain2.admin.port} --adminuser admin --passwordfile ${admin.password.file} --instanceport ${domain2.instance.port} --savemasterpassword=true --domainproperties domain.jmxPort=${domain2.jmx.port}:jms.port=${domain2.jms.port}:orb.listner.port=${domain2.orb.listner.port}:http.ssl.port=${domain2.http.ssl.port}:orb.mutualauth.port=${domain2.orb.mutualauth.port} ${domain.name}"/>
<exec executable="${ASADMIN}" failonerror="true">
<arg line="${admin.command} ${operand.props}" />
</exec>
</target>
<target name="start-domain2" depends="init-common">
<exec executable="${ASADMIN}" failonerror="true">
<arg line="start-domain --user ${admin.user} ${domain.name}"/>
</exec>
</target>
<target name="create-physical-queue" depends="init-common">
<exec executable="${env.S1AS_HOME}/imq/bin/imqcmd" failonerror="false">
<arg line="create dst -n ${queue.name} -t q -u admin -passfile ${broker.password.file} -b localhost:${imq.broker.port}"/>
</exec>
</target>
<target name="create-jms-resource" depends="init-common">
<exec executable="${env.S1AS_HOME}/bin/asadmin" failonerror="false">
<arg line="create-jms-resource --user ${admin.user} --passwordfile ${admin.password.file} --port ${domain.admin.port} --restype ${jms.res.type} ${jms.res.name}"/>
</exec>
</target>
<target name="create-jms-queue" depends="init-common">
<exec executable="${env.S1AS_HOME}/imq/bin/imqobjmgr" failonerror="false">
<arg line="add -l &quot;${jms.queue.name}&quot; -t q -o &quot;imqDestinationName=${queue.name}&quot; -j &quot;java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory&quot; -j &quot;java.naming.provider.url=file:/tmp/imqobjects&quot;"/>
</exec>
</target>
<target name="create-jms-connection-factory" depends="init-common">
<exec executable="${env.S1AS_HOME}/imq/bin/imqobjmgr" failonerror="true">
<arg line="add -f -l &quot;${jms.cf.name}&quot; -t qf -o &quot;imqAddressList=mq://localhost:${imq.broker.port}/jms&quot; -j &quot;java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory&quot; -j &quot;java.naming.provider.url=file:/tmp/imqobjects&quot;"/>
</exec>
</target>
<target name="delete-physical-queue" depends="init-common" >
<exec executable="${env.S1AS_HOME}/imq/bin/imqcmd" failonerror="false">
<arg line="destroy dst -f -n ${queue.name} -t q -passfile ${broker.password.file} -u admin -b localhost:${imq.broker.port}" />
</exec>
</target>
<target name="delete-jms-resource" depends="init-common">
<exec executable="${env.S1AS_HOME}/imq/bin/imqobjmgr" failonerror="false">
<arg line="delete -f -l &quot;${jms.resource.name}&quot; -j &quot;java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory&quot; -j &quot;java.naming.provider.url=file:/tmp/imqobjects&quot;"/>
</exec>
</target>
<target name="delete-appserver-jms-resource" depends="init-common">
<exec executable="${env.S1AS_HOME}/bin/asadmin" failonerror="false">
<arg line="delete-jms-resource --user ${admin.user} --passwordfile ${admin.password.file} --port ${domain.admin.port} ${jms.res.name}"/>
</exec>
</target>
<target name="delete-domain2" depends="init-common">
<exec executable="${ASADMIN}" failonerror="true">
<arg line="delete-domain domain2 " />
</exec>
</target>
<target name="stop-provider-jms-binding" depends="init-common">
<antcall target="stop-binding">
<param name="jmx.port" value="${domain2.jmx.port}"/>
<param name="jbi.component.name" value="SunJMSBinding"/>
</antcall>
</target>
<target name="start-provider-jms-binding" depends="init-common">
<antcall target="start-binding">
<param name="jmx.port" value="${domain2.jmx.port}"/>
<param name="jbi.component.name" value="SunJMSBinding"/>
</antcall>
</target>
<target name="stop-consumer-jms-binding" depends="init-common">
<antcall target="stop-binding">
<param name="jbi.component.name" value="SunJMSBinding"/>
</antcall>
</target>
<target name="start-consumer-jms-binding" depends="init-common">
<antcall target="start-binding">
<param name="jbi.component.name" value="SunJMSBinding"/>
</antcall>
</target>
</project>