| <project name="services" default="deployServer"> |
| |
| <import file="${basedir}/build/buildInitialize.xml" /> |
| <import file="${basedir}/build/testInitialize.xml" /> |
| <import file="${basedir}/build/serviceInitialize.xml" /> |
| |
| <target name="createServerConfigurationFile" depends="initialize, decideserverproperties"> |
| <!-- Select which parser library to use --> |
| <condition property="ClientParserLib" value="${xml4c.xmlParserLibraryName}"> |
| <istrue value="${testconf.client.parser.xml4c}"/> |
| </condition> |
| <condition property="ClientParserLib" value="${xerces.xmlParserLibraryName}"> |
| <istrue value="${testconf.client.parser.xerces}"/> |
| </condition> |
| |
| <dirname file="${axiscppconffile}" property="axisCPPConfFilePath"/> |
| <mkdir dir="${axisCPPConfFilePath}"/> |
| <echo file="${axiscppconffile}"># The comment character is '#' |
| # Available directives are as follows |
| # |
| # WSDDFilePath: The path to the server wsdd |
| # LogPath: The path to the axis log |
| # XMLParser: The xml parser library |
| # NodeName: Node name |
| # ListenPort: Listening port |
| # |
| LogPath:${dir.test.generated}/server/ServerLog.taw |
| WSDDFilePath:${wsdd.file} |
| Transport_http:${dir.libraries}/${libraryPrefix}${HTTP.transportLibraryName}${librarySuffix} |
| Channel_HTTP:${dir.libraries}/${libraryPrefix}${HTTP.ChannelLibraryName}${librarySuffix} |
| XMLParser:${dir.libraries}/${libraryPrefix}${ClientParserLib}${librarySuffix} |
| </echo> |
| </target> |
| |
| |
| <target name="runserver" depends="initialize, decideserverproperties"> |
| <echo> |
| line="${startargs}" |
| key="AXISCPP_DEPLOY" value="${axiscpp_deploy}/server" |
| key="${serverenv.env}" value="${dir.xmlParser}/bin${path.separator}${dir.xmlParser}/lib${path.separator}${serverenv.env.value}" |
| key="AXISCPP_STARTUP_TRACE" value="${dir.test.generated}/server/StartupTrace.taw" |
| </echo> |
| <exec executable="${serverexecutable}" spawn="true"> |
| <arg line="${startargs}" /> |
| <env key="AXISCPP_DEPLOY" value="${axiscpp_deploy}/server" /> |
| <env key="${serverenv.env}" value="${dir.xmlParser}/bin${path.separator}${dir.xmlParser}/lib${path.separator}${serverenv.env.value}" /> |
| <env key="AXISCPP_STARTUP_TRACE" value="${dir.test.generated}/server/StartupTrace.taw"/> |
| </exec> |
| </target> |
| |
| |
| <target name="stopserver" depends="initialize, decideserverproperties"> |
| <!-- This is necessary since stoppping apache2 is a problem sometimes. |
| The user will have to manually stop the server in this case.--> |
| <if> |
| <isset property="stopargs" /> |
| <then> |
| <exec executable="${serverexecutable}"> |
| <arg line="${stopargs}" /> |
| <env key="${serverenv.env1}" |
| value="${serverenv.env1.value}" /> |
| <env key="${serverenv.env2}" |
| value="${serverenv.env2.value}" /> |
| </exec> |
| <sleep seconds="3" /> |
| </then> |
| <else> |
| <antcall target="stopAxisServer"/> |
| <echo message="WARNING!" /> |
| <echo message="this script can't stop this server (${serverexecutable}). |
| If the server is started stop it yourself and then run ant again" /> |
| </else> |
| </if> |
| </target> |
| |
| |
| <target name="deployServer" |
| depends="initialize, stopserver, createServerConfigurationFile, createServerWSDDFile, runserver, deployServices" |
| description="Build and deploy services for tests" /> |
| |
| <target name="undeployServer" |
| depends="initialize, undeployServices, stopserver" |
| description="Undeploy services and stop server"/> |
| |
| <target name="createServerWSDDFile"> |
| <dirname file="${wsdd.file}" property="WSDDFilePath"/> |
| <mkdir dir="${WSDDFilePath}"/> |
| |
| <condition property="dir.adminService" value="${dir.release}/bin"> |
| <or> |
| <equals arg1="${platform}" arg2="Win32"/> |
| <equals arg1="${platform}" arg2="Win64"/> |
| </or> |
| </condition> |
| |
| <condition property="dir.adminService" value="${dir.release}/lib"> |
| <not> |
| <or> |
| <equals arg1="${platform}" arg2="Win32"/> |
| <equals arg1="${platform}" arg2="Win64"/> |
| </or> |
| </not> |
| </condition> |
| |
| <echo file="${wsdd.file}"><?xml version="1.0" encoding="UTF-8"?> |
| <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:C="http://xml.apache.org/axis/wsdd/providers/C" xmlns:CPP="http://xml.apache.org/axis/wsdd/providers/CPP"> |
| <globalConfiguration> |
| </globalConfiguration> |
| <service name="AxisAdmin" provider="CPP:DOCUMENT" description="Axis C++ Admin Service"> |
| <parameter name="className" value="${dir.adminService}/${libraryPrefix}${adminServiceLibraryName}${librarySuffix}"/> |
| </service> |
| </deployment> |
| |
| </echo> |
| </target> |
| |
| <target name="deployServices" depends="initialize, setServiceList"> |
| <echo message="buildservice: ${service.list}"/> |
| <foreach target="deployService" |
| param="service_property" |
| inheritall="true"> |
| <path refid="service_properties" /> |
| <param name="dir.release" value="${dir.release}"/> |
| </foreach> |
| </target> |
| |
| <target name="undeployServices" depends="initialize, setServiceList"> |
| <echo message="buildservice: ${service.list}"/> |
| <foreach target="undeployService" |
| param="service_property" |
| inheritall="true"> |
| <path refid="service_properties" /> |
| <param name="dir.release" value="${dir.release}"/> |
| </foreach> |
| </target> |
| |
| <target name="setServiceList" |
| depends="setServiceListType,setIndividualService,setFromServiceList,setAllServices" /> |
| <target name="setServiceListType"> |
| <condition property="allService"> |
| <and> |
| <not> |
| <isset property="service.name" /> |
| </not> |
| <not> |
| <isset property="service.list" /> |
| </not> |
| </and> |
| </condition> |
| </target> |
| |
| |
| <!-- |
| Create a list of just 1 Service from command line parameter -Dservice.name= |
| --> |
| <target name="setIndividualService" if="service.name"> |
| <echo message="setIndividual ${service.name}" /> |
| <path id="service_properties"> |
| <fileset dir="${dir.autotests}/tests/server" |
| includes="${service.name}.xml" /> |
| </path> |
| </target> |
| |
| <!-- |
| Create a list of Services from a properties file unless an individual Service has been specified too |
| --> |
| <target name="setFromServiceList" if="service.list" unless="service.name"> |
| <echo message="setFromList ${service.list}" /> |
| <path id="service_properties"> |
| <fileset dir="${dir.autotests}/tests/server" |
| includesfile="${service.list}" /> |
| </path> |
| </target> |
| |
| |
| <!-- |
| Create a list of all the Services |
| --> |
| <target name="setAllServices" if="allService"> |
| <echo message="setAll ${dir.autotests}/tests/server" /> |
| <path id="service_properties"> |
| <fileset dir="${dir.autotests}/tests/server" includes="*.xml" /> |
| </path> |
| </target> |
| |
| <target name="prepareAdminClient"> |
| <mkdir dir="${dir.test.generated}/AdminClient"/> |
| |
| <!-- Select which parser library to use --> |
| <condition property="ClientParserLib" value="${xml4c.xmlParserLibraryName}"> |
| <istrue value="${testconf.client.parser.xml4c}"/> |
| </condition> |
| <condition property="ClientParserLib" value="${xerces.xmlParserLibraryName}"> |
| <istrue value="${testconf.client.parser.xerces}"/> |
| </condition> |
| |
| <condition property="adminconffile" value="${dir.test.generated}/AdminClient/axiscpp.conf"> |
| <isset property="windows"/> |
| </condition> |
| <condition property="adminconffile" value="${dir.test.generated}/AdminClient/etc/axiscpp.conf"> |
| <not> |
| <isset property="windows"/> |
| </not> |
| </condition> |
| <condition property="ClientLogPath" value="${dir.test.generated}/server/${serviceLang}/${serviceName}/AdminClientLog.taw"> |
| <isset property="serviceName"/> |
| </condition> |
| <condition property="ClientLogPath" value="${dir.test.generated}/AdminClient/AdminClientLog.taw"> |
| <not> |
| <isset property="serviceName"/> |
| </not> |
| </condition> |
| <dirname file="${adminconffile}" property="adminconffilePath"/> |
| <mkdir dir="${adminconffilePath}"/> |
| <echo file="${adminconffile}"># The comment character is '#' |
| # Available directives are as follows |
| # |
| # ClientLogPath: The path to the axis log |
| # XMLParser: The xml parser library |
| # Transport_http: The HTTP Transport library |
| # Channel_HTTP: The HTTP (non-SSL) Channel library |
| # |
| ClientLogPath:${ClientLogPath} |
| XMLParser:${dir.libraries}/${libraryPrefix}${ClientParserLib}${librarySuffix} |
| Transport_http:${dir.libraries}/${libraryPrefix}${transportLibraryName}${librarySuffix} |
| Channel_HTTP:${dir.libraries}/${libraryPrefix}${HTTP.ChannelLibraryName}${librarySuffix} |
| </echo> |
| </target> |
| |
| <target name="deployService" |
| depends="setPropertiesForService, generateServerStubs, compileService, generateWSDDService, prepareAdminClient"> |
| <antcall target="runAdminClient" inheritall="true"> |
| <param name="wsddFile" value="${dir.test.generated}/server/${serviceLang}/${serviceName}/deploy.wsdd"/> |
| </antcall> |
| </target> |
| |
| <target name="runAdminClient"> |
| <exec executable="${dir.release}/bin/${adminClientExecutableName}${executableSuffix}" |
| |
| failifexecutionfails="true"> |
| <arg line="localhost ${testPort} "${wsddFile}"" /> |
| <env key="PATH" |
| path="${dir.xmlParser}/bin${path.separator}${dir.libraries}${path.separator}${java.library.path}" /> |
| <env key="LD_LIBRARY_PATH" |
| path="${dir.libraries}${path.separator}${dir.xmlParser}/lib" /> |
| <env key="LIBPATH" |
| path="${dir.libraries}${path.separator}${dir.xmlParser}/lib" /> |
| <env key="SHLIB_PATH" |
| path="${dir.libraries}${path.separator}${dir.xmlParser}/lib" /> |
| <env key="AXISCPP_DEPLOY" value="${dir.test.generated}/AdminClient" /> |
| </exec> |
| </target> |
| |
| <target name="undeployService" |
| depends="setPropertiesForService, prepareAdminClient"> |
| <antcall target="runAdminClient" inheritall="true"> |
| <param name="wsddFile" value="${dir.test.generated}/server/${serviceLang}/${serviceName}/undeploy.wsdd" /> |
| </antcall> |
| </target> |
| |
| |
| <target name="setPropertiesForService" |
| depends="loadServerXMLProperties,setServiceName,setServiceDesc,setServiceCode,setServiceLang,setServiceWsdl" /> |
| |
| |
| <target name="loadServerXMLProperties"> |
| <echo message="Loading XML file ${service_property}" /> |
| <xmlproperty file="${service_property}" keepRoot="true" /> |
| </target> |
| |
| <target name="setServiceName" if="service.name"> |
| <propertycopy property="serviceName" from="service.name" /> |
| </target> |
| |
| |
| <target name="setServiceDesc" if="service.description"> |
| <propertycopy property="serviceDesc" from="service.description" /> |
| </target> |
| |
| <target name="setServiceCode" if="service.serviceCode"> |
| <propertycopy property="serviceCode" from="service.serviceCode" /> |
| <if> |
| <isset property="service.serviceHeader" /> |
| <then> |
| <propertycopy property="serviceHeader" from="service.serviceHeader" /> |
| </then> |
| </if> |
| </target> |
| |
| |
| <target name="setServiceLang" if="service.serviceLang"> |
| <propertycopy property="serviceLang" from="service.serviceLang" /> |
| </target> |
| |
| |
| <target name="setServiceWsdl" if="service.wsdl"> |
| <propertycopy property="serviceWsdl" from="service.wsdl" /> |
| </target> |
| |
| |
| <target name="cleanService"> |
| <delete dir="${dir.test.generated}/${serviceLang}/${serviceName}" /> |
| </target> |
| |
| |
| <target name="setServiceLanguage"> |
| <condition property="generated.lang" value="c++"> |
| <equals arg1="${serviceLang}" arg2="cpp" /> |
| </condition> |
| </target> |
| |
| <target name="generateServerStubs" depends="setServiceLanguage"> |
| <!-- Make directory in which all generated code shall be placed --> |
| <echo message="${dir.test.generated}/server/${serviceLang}/${serviceName}" /> |
| <mkdir dir="${dir.test.generated}/server/${serviceLang}/${serviceName}" /> |
| <!-- Setup classpath for WSDL2Ws --> |
| <path id="cp"> |
| <fileset dir="${dir.wsdl2ws}" includes="wsdl2ws.jar" /> |
| <fileset dir="${dir.axisJARs}" includes="*.jar" /> |
| </path> |
| <!-- Run WSDL2Ws --> |
| <java classname="org.apache.axis.wsdl.wsdl2ws.WSDL2Ws" fork="true"> |
| <classpath refid="cp" /> |
| <arg value="${dir.autotests}/wsdls/${serviceWsdl}" /> |
| <arg value="-o${dir.test.generated}/server/${serviceLang}/${serviceName}" /> |
| <arg value="-l${generated.lang}" /> |
| <arg value="-sserver" /> |
| </java> |
| </target> |
| |
| |
| <target name="compileService"> |
| <!-- Deleting the service template generated by WSDL2Ws if service.removeFile property is set - AXISCPP-948 --> |
| <if> |
| <isset property="service.removeFile" /> |
| <then> |
| <delete file="${dir.test.generated}/server/${serviceLang}/${serviceName}/${service.removeFile}" failonerror="false" /> |
| </then> |
| </if> |
| |
| <copy file="${dir.autotests}/server/${serviceLang}/${serviceCode}" |
| tofile="${dir.test.generated}/server/${serviceLang}/${serviceName}/${serviceCode}" |
| overwrite="true" /> |
| <propertycopy property="serviceCode" from="service.serviceCode" /> |
| <if> |
| <isset property="service.serviceHeader"/> |
| <then> |
| <copy file="${dir.autotests}/server/${serviceLang}/${serviceHeader}" |
| tofile="${dir.test.generated}/server/${serviceLang}/${serviceName}/${serviceHeader}" |
| overwrite="true"/> |
| </then> |
| </if> |
| |
| <if> |
| <not> |
| <isset property="aix" /> |
| </not> |
| <then> |
| |
| <cc failonerror="false" |
| incremental="false" |
| outfile="${dir.test.generated}/server/${serviceLang}/${serviceName}/${serviceName}" |
| objdir="${dir.test.generated}/server/${serviceLang}/${serviceName}" |
| exceptions="true" |
| outtype="shared" |
| subsystem="console"> |
| |
| <!-- Compilers --> |
| <compiler refid="VisualC++" /> |
| <compiler refid="SolarisCC"/> |
| <compiler refid="Linuxgcc"/> |
| |
| <!-- Linkers --> |
| <linker refid="VisualC++Linker" /> |
| <linker refid="SolarisLinker"/> |
| <linker refid="LinuxLinker"/> |
| |
| |
| <!-- Axis Client .lib file location, or UNIX shared object --> |
| <!-- This lib is needed when building a service on windows where |
| AxisUserAPI implementation is needed --> |
| <libset dir="${dir.lib}" libs="${serverEngineLibraryName}" /> |
| |
| <!-- Files to be compiled --> |
| <includepath path="${dir.include}" /> |
| |
| <fileset dir="${dir.test.generated}/server/${serviceLang}/${serviceName}"> |
| <include name="*.cpp" /> |
| </fileset> |
| </cc> |
| </then> |
| <else> |
| <cc failonerror="false" |
| incremental="false" |
| outfile="${dir.test.generated}/server/${serviceLang}/${serviceName}/${libraryPrefix}${serviceName}${librarySuffix}" |
| objdir="${dir.test.generated}/server/${serviceLang}/${serviceName}" |
| exceptions="true" |
| subsystem="console"> |
| |
| <!-- Compilers --> |
| <compiler refid="AIXxlc"/> |
| |
| <!-- Linkers --> |
| <linker refid="AIXLinker"/> |
| |
| <libset dir="${dir.lib}" libs="${serverEngineLibraryName}" /> |
| |
| <!-- Files to be compiled --> |
| <includepath path="${dir.include}" /> |
| <fileset dir="${dir.test.generated}/server/${serviceLang}/${serviceName}"> |
| <include name="*.cpp" /> |
| </fileset> |
| </cc> |
| </else> |
| </if> |
| |
| </target> |
| |
| |
| <target name="generateWSDDService"> |
| <xmlproperty file="${dir.test.generated}/server/${serviceLang}/${serviceName}/deploy.wsdd" |
| collapseAttributes="true" /> |
| <echo file="${dir.test.generated}/server/${serviceLang}/${serviceName}/deploy.wsdd"><?xml version="1.0" encoding="UTF-8"?> |
| <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:CPP="http://xml.apache.org/axis/wsdd/providers/CPP"> |
| <service name="${serviceName}" provider="${deployment.service.provider}" description="Axis C++ web service" > |
| <parameter name="className" value="${dir.test.generated}/server/${serviceLang}/${serviceName}/${libraryPrefix}${serviceName}${librarySuffix}"/> |
| </service> |
| </deployment> |
| </echo> |
| <echo file="${dir.test.generated}/server/${serviceLang}/${serviceName}/undeploy.wsdd"><?xml version="1.0" encoding="UTF-8"?> |
| <undeployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:CPP="http://xml.apache.org/axis/wsdd/providers/CPP"> |
| <service name="${serviceName}"/> |
| </undeployment> |
| </echo> |
| </target> |
| |
| <target name="checkParameters"> |
| <description> This target checks that the user has put in the right params to run the default target with no errors. |
| If you find things out that leave you with a bad error message then put them in here to help out future users |
| </description> |
| <if> |
| <not> |
| <available file="${dir.xmlParser}"/> |
| </not> |
| <then> |
| <throw message="dir.xmlparser is not available. It is currently set to '${dir.xmlParser}'"/> |
| </then> |
| </if> |
| <if> |
| <not> |
| <available file="${env.AXISJAVA_LIB}"/> |
| </not> |
| <then> |
| <throw message="AXISJAVA_LIB must be set to where the prereq axis java libs are installed"/> |
| </then> |
| </if> |
| |
| </target> |
| |
| <target name="stopAxisServer" depends="initialize"> |
| <exec executable="${dir.release}/bin/${adminClientExecutableName}${executableSuffix}" |
| timeout="60000" failifexecutionfails="false"> |
| <arg line="localhost ${testPort} STOP 120" /> |
| <env key="PATH" |
| path="${dir.xmlParser}/bin${path.separator}${dir.libraries}${path.separator}${java.library.path}" /> |
| <env key="LD_LIBRARY_PATH" |
| path="${dir.libraries}${path.separator}${dir.xmlParser}/lib" /> |
| <env key="LIBPATH" |
| path="${dir.libraries}${path.separator}${dir.xmlParser}/lib" /> |
| <env key="SHLIB_PATH" |
| path="${dir.libraries}${path.separator}${dir.xmlParser}" /> |
| <env key="AXISCPP_DEPLOY" value="${dir.test.generated}/AdminClient" /> |
| </exec> |
| </target> |
| |
| </project> |
| |