| <?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" |
| xmlns:au="antlib:org.apache.ant.antunit" |
| xmlns:dn="antlib:org.apache.ant.dotnet"> |
| |
| <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="setUp" 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="gmcs" 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> |
| <condition property="is.mono"> |
| <and> |
| <available file="gmcs" filepath="${env.PATH}" /> |
| <not> |
| <available file="csc.exe" filepath="${env.PATH}" /> |
| </not> |
| </and> |
| </condition> |
| </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"> |
| <au:expectfailure message="no dest file"> |
| <dn:wsdltodotnet/> |
| </au:expectfailure> |
| </target> |
| |
| <target name="testNoSrc"> |
| <au:expectfailure message="no source file"> |
| <dn:wsdltodotnet destFile="${out.csc}"/> |
| </au:expectfailure> |
| </target> |
| |
| <target name="testDestIsDir"> |
| <au:expectfailure message="dest is a directory"> |
| <dn:wsdltodotnet destFile="${build.dir}" |
| srcFile="${local.wsdl}"/> |
| </au:expectfailure> |
| </target> |
| |
| <target name="testBothSrc"> |
| <au:expectfailure message="can only have one source"> |
| <dn:wsdltodotnet destFile="${out.csc}" |
| srcFile="${local.wsdl}" |
| url="${endpoint.wsdl}" |
| /> |
| </au:expectfailure> |
| </target> |
| |
| <target name="testSrcIsDir"> |
| <au:expectfailure message="source is a directory"> |
| <dn:wsdltodotnet destFile="${out.csc}" |
| srcFile="${build.dir}" |
| /> |
| </au:expectfailure> |
| </target> |
| |
| <target name="testSrcIsMissing"> |
| <au:expectfailure message="source file is not present"> |
| <dn:wsdltodotnet destFile="${out.csc}" |
| srcFile="${build.dir}/invalidfile.wsdl" |
| /> |
| </au:expectfailure> |
| </target> |
| |
| <target name="testLocalWsdl"> |
| <au:assertFileDoesntExist file="${out.csc}"/> |
| <dn:wsdltodotnet destFile="${out.csc}" |
| srcFile="${local.wsdl}" |
| /> |
| <au:assertFileExists file="${out.csc}"/> |
| <dn:csc |
| srcDir="${src.dir}" |
| destFile="${out.app}" |
| targetType="${out.type}" |
| references="System.Web.Services.dll" |
| /> |
| <au:assertFileExists file="${out.app}"/> |
| </target> |
| |
| <target name="testLocalWsdlServer"> |
| <au:assertFileDoesntExist file="${out.csc}"/> |
| <dn:wsdltodotnet destFile="${out.csc}" |
| srcFile="${local.wsdl}" |
| server="true" |
| /> |
| <au:assertFileExists file="${out.csc}"/> |
| <dn:csc |
| srcDir="${src.dir}" |
| destFile="${out.app}" |
| targetType="${out.type}" |
| fileAlign="512" |
| references="System.Web.Services.dll" |
| /> |
| <au:assertFileExists file="${out.app}"/> |
| </target> |
| |
| <target name="testInvalidExtraOps" unless="is.mono"> |
| <au:expectfailure message="extra options are unknown to wsdl.exe"> |
| <dn:wsdltodotnet destFile="${out.csc}" |
| srcFile="${local.wsdl}" |
| extraOptions="/newOption:not-one-known-of" |
| /> |
| </au:expectfailure> |
| </target> |
| |
| <target name="testLocalWsdlVB" if="vbc.found"> |
| <au:assertFileDoesntExist file="${out.vbc}"/> |
| <dn:wsdltodotnet destFile="${out.vbc}" |
| language="VB" |
| srcFile="${local.wsdl}" |
| /> |
| <au:assertFileExists file="${out.vbc}"/> |
| <dn:vbc |
| srcDir="${src.dir}" |
| destFile="${out.app}" |
| targetType="${out.type}" |
| references="${vb.references}" |
| > |
| |
| </dn:vbc> |
| <au:assertFileExists file="${out.app}"/> |
| </target> |
| |
| <target name="testLocalWsdlServerVB" |
| if="vbc.found"> |
| <au:assertFileDoesntExist file="${out.vbc}"/> |
| <dn:wsdltodotnet destFile="${out.vbc}" |
| language="VB" |
| srcFile="${local.wsdl}" |
| server="true" |
| /> |
| <au:assertFileExists file="${out.vbc}"/> |
| <dn:vbc |
| srcDir="${src.dir}" |
| destFile="${out.app}" |
| targetType="${out.type}" |
| optionExplicit="true" |
| optionStrict="false" |
| optionCompare="text" |
| references="${vb.references}" |
| /> |
| <au:assertFileExists file="${out.app}"/> |
| </target> |
| |
| <target name="testInvalidExtraOpsVB" unless="is.mono"> |
| <au:expectfailure message="extra options are unknown to wsdl.exe"> |
| <dn:wsdltodotnet destFile="${out.vbc}" |
| language="VB" |
| srcFile="${local.wsdl}" |
| extraOptions="/newOption:not-one-known-of" |
| /> |
| </au:expectfailure> |
| </target> |
| |
| |
| <target name="testSchemaMustBeSet"> |
| <au:expectfailure message="schema hasn't been set"> |
| <dn:wsdltodotnet destFile="${out.csc}" |
| srcFile="${local.wsdl}" |
| > |
| <schema/> |
| </dn:wsdltodotnet> |
| </au:expectfailure> |
| </target> |
| |
| <target name="testSchemaFileMustExist"> |
| <au:expectfailure message="schema doesn't exist"> |
| <dn:wsdltodotnet destFile="${out.csc}" |
| srcFile="${local.wsdl}" |
| > |
| <schema file="this-file-does-not-exist.xsd"/> |
| </dn:wsdltodotnet> |
| </au:expectfailure> |
| </target> |
| |
| <target name="testSchemaFileMustHaveOneOptionOnly"> |
| <au:expectfailure message="can't have file and url on schema"> |
| <dn:wsdltodotnet destFile="${out.csc}" |
| srcFile="${local.wsdl}" |
| > |
| <schema file="WsdlToDotnet.xml" |
| url="http://ant.apache.org/xml/AntSchema.xsd"/> |
| </dn:wsdltodotnet> |
| </au:expectfailure> |
| </target> |
| |
| </project> |