blob: ca9b7d69d3aa7305652bd73aa3c1352c1f2a56a9 [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="wsdl-to-java-jtest" basedir="." default="init">
<property environment="env"/>
<property name="build.dir" location="wsdl/build"/>
<property name="cache.dir" location="${build.dir}/cache"/>
<property name="src.dir" location="${build.dir}/src"/>
<property name="classes.dir" location="${build.dir}/classes"/>
<property name="local.wsdl"
location="wsdl/StockQuoteService.wsdl" />
<property name="out.csc" location="${src.dir}/out.cs"/>
<property name="out.app" location="${classes.dir}/out.dll"/>
<property name="out.type" value="module"/>
<property name="out.vbc" location="${src.dir}/out.vb"/>
<property name="endpoint"
value="http://nagoya.apache.org:5049/Axis/StockQuoteService.jws" />
<property name="endpoint.wsdl"
value="http://nagoya.apache.org:5049/Axis/StockQuoteService.jws?wsdl" />
<property name="vb.references"
value="System.Web.dll,System.xml.dll,System.dll,System.Web.Services.dll"/>
<target name="init" depends="validate">
<mkdir dir="${build.dir}"/>
<mkdir dir="${cache.dir}"/>
<mkdir dir="${src.dir}"/>
<mkdir dir="${classes.dir}"/>
</target>
<target name="probe_for_apps" >
<condition property="wsdl.found">
<or>
<available file="wsdl" filepath="${env.PATH}" />
<available file="wsdl.exe" filepath="${env.PATH}" />
<available file="wsdl.exe" filepath="${env.Path}" />
</or>
</condition>
<echo> wsdl.found=${wsdl.found}</echo>
<condition property="csc.found">
<or>
<available file="mcs" filepath="${env.PATH}" />
<available file="csc" filepath="${env.PATH}" />
<available file="csc.exe" filepath="${env.PATH}" />
<available file="csc.exe" filepath="${env.Path}" />
</or>
</condition>
<echo> csc.found=${csc.found}</echo>
<condition property="vbc.found">
<or>
<available file="vbc" filepath="${env.PATH}" />
<available file="vbc.exe" filepath="${env.PATH}" />
<available file="vbc.exe" filepath="${env.Path}" />
</or>
</condition>
<echo> vbc.found=${vbc.found}</echo>
<condition property="dotnetapps.found">
<and>
<isset property="csc.found"/>
<isset property="wsdl.found"/>
</and>
</condition>
<echo> dotnetapps.found=${dotnetapps.found}</echo>
</target>
<target name="teardown">
<delete dir="${build.dir}"/>
</target>
<target name="validate" depends="probe_for_apps" >
<fail unless="dotnetapps.found">Needed .net apps are missing</fail>
</target>
<target name="testNoParams">
<wsdltodotnet/>
</target>
<target name="testNoSrc">
<wsdltodotnet destFile="${out.csc}"/>
</target>
<target name="testDestIsDir" depends="init">
<wsdltodotnet destFile="${build.dir}"
srcFile="${local.wsdl}"/>
</target>
<target name="testBothSrc" depends="init">
<wsdltodotnet destFile="${out.csc}"
srcFile="${local.wsdl}"
url="${endpoint.wsdl}"
/>
</target>
<target name="testSrcIsDir" depends="init">
<wsdltodotnet destFile="${out.csc}"
srcFile="${build.dir}"
/>
</target>
<target name="testSrcIsMissing" depends="init">
<wsdltodotnet destFile="${out.csc}"
srcFile="${build.dir}/invalidfile.wsdl"
/>
</target>
<target name="testLocalWsdl" depends="init">
<wsdltodotnet destFile="${out.csc}"
srcFile="${local.wsdl}"
/>
<csc
srcDir="${src.dir}"
destFile="${out.app}"
targetType="${out.type}"
references="System.Web.Services.dll"
/>
<available property="app.created" file="${out.app}"/>
<fail unless="app.created">No app created</fail>
</target>
<target name="testLocalWsdlServer" depends="init">
<wsdltodotnet destFile="${out.csc}"
srcFile="${local.wsdl}"
server="true"
/>
<csc
srcDir="${src.dir}"
destFile="${out.app}"
targetType="${out.type}"
fileAlign="512"
references="System.Web.Services.dll"
/>
<available property="app.created" file="${out.app}"/>
<fail unless="app.created">No app created</fail>
</target>
<target name="testInvalidExtraOps" depends="init">
<wsdltodotnet destFile="${out.csc}"
srcFile="${local.wsdl}"
extraOptions="/newOption:not-one-known-of"
/>
</target>
<target name="testLocalWsdlVB" depends="init" if="vbc.found">
<wsdltodotnet destFile="${out.vbc}"
language="VB"
srcFile="${local.wsdl}"
/>
<vbc
srcDir="${src.dir}"
destFile="${out.app}"
targetType="${out.type}"
references="${vb.references}"
>
</vbc>
<available property="app.created" file="${out.app}"/>
<fail unless="app.created">No app created</fail>
</target>
<target name="testLocalWsdlServerVB"
depends="init" if="vbc.found">
<wsdltodotnet destFile="${out.vbc}"
language="VB"
srcFile="${local.wsdl}"
server="true"
/>
<vbc
srcDir="${src.dir}"
destFile="${out.app}"
targetType="${out.type}"
optionExplicit="true"
optionStrict="false"
optionCompare="text"
references="${vb.references}"
/>
<available property="app.created" file="${out.app}"/>
<fail unless="app.created">No app created</fail>
</target>
<target name="testInvalidExtraOpsVB" depends="init">
<wsdltodotnet destFile="${out.vbc}"
language="VB"
srcFile="${local.wsdl}"
extraOptions="/newOption:not-one-known-of"
/>
</target>
<target name="testideErrorsIgnoredWhenFalse" depends="init">
<wsdltodotnet destFile="${out.csc}"
srcFile="${local.wsdl}"
ideErrors="false"
>
</wsdltodotnet>
</target>
<target name="testSchemaMustBeSet" depends="init">
<wsdltodotnet destFile="${out.csc}"
srcFile="${local.wsdl}"
>
<schema/>
</wsdltodotnet>
</target>
<target name="testSchemaFileMustExist" depends="init">
<wsdltodotnet destFile="${out.csc}"
srcFile="${local.wsdl}"
>
<schema file="this-file-does-not-exist.xsd"/>
</wsdltodotnet>
</target>
<target name="testSchemaFileMustHaveOneOptionOnly" depends="init">
<wsdltodotnet destFile="${out.csc}"
srcFile="${local.wsdl}"
>
<schema file="WsdlToDotnet.xml"
url="http://ant.apache.org/xml/AntSchema.xsd"/>
</wsdltodotnet>
</target>
</project>