<!--

    Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Distribution License v. 1.0, which is available at
    http://www.eclipse.org/org/documents/edl-v10.php.

    SPDX-License-Identifier: BSD-3-Clause

-->

<property file="build.properties"/>
<property file="../../build.properties"/>
<!--<property file="../build.properties"/>-->
<property name="lib.sample.home" value="${basedir}/../lib"/>
<property name="build.home" value="${basedir}/../build"/>
<property name="build.classes.home" value="${build.home}/classes"/>
<property name="build.war.home" value="${build.home}/war"/>
<property name="build.lib.home" value="${build.home}/lib"/>
    <condition property="client" value="sun">
	<or>
	<equals arg1="${test.type}" arg2="s-m-m" />
	<equals arg1="${test.type}" arg2="s-m-s" />
	<equals arg1="${test.type}" arg2="s-s-m" />
	<equals arg1="${test.type}" arg2="s-s-s" />
	</or>
    </condition>
    <condition property="client" value="ms">
	<or>
	<equals arg1="${test.type}" arg2="m-s-s" />
	<equals arg1="${test.type}" arg2="m-s-m" />
	<equals arg1="${test.type}" arg2="m-m-s" />
	<equals arg1="${test.type}" arg2="m-m-m" />
	</or>
    </condition>
    <condition property="sts" value="sun">
	<or>
	<equals arg1="${test.type}" arg2="m-s-m" />
	<equals arg1="${test.type}" arg2="m-s-s" />
	<equals arg1="${test.type}" arg2="s-s-m" />
	<equals arg1="${test.type}" arg2="s-s-s" />
	</or>
    </condition>
    <condition property="sts" value="ms">
	<or>
	<equals arg1="${test.type}" arg2="m-m-m" />
	<equals arg1="${test.type}" arg2="m-m-s" />
	<equals arg1="${test.type}" arg2="s-m-m" />
	<equals arg1="${test.type}" arg2="s-m-s" />
	</or>
    </condition>
    <condition property="server" value="sun">
	<or>
	<equals arg1="${test.type}" arg2="m-m-s" />
	<equals arg1="${test.type}" arg2="m-s-s" />
	<equals arg1="${test.type}" arg2="s-m-s" />
	<equals arg1="${test.type}" arg2="s-s-s" />
	</or>
    </condition>
    <condition property="server" value="ms">
	<or>
	<equals arg1="${test.type}" arg2="m-m-m" />
	<equals arg1="${test.type}" arg2="m-s-m" />
	<equals arg1="${test.type}" arg2="s-m-m" />
	<equals arg1="${test.type}" arg2="s-s-m" />
	</or>
    </condition>
    <condition property="client.wsdl" value="${sunsts-sunserver.client.wsdl}">
	<and>
	<equals arg1="${sts}" arg2="sun" />
	<equals arg1="${server}" arg2="sun" />
	<equals arg1="${client}" arg2="sun" />
	</and>
    </condition>

    <condition property="client.wsdl" value="${mssts-msserver.client.wsdl}">
	<and>
	<equals arg1="${sts}" arg2="ms" />
	<equals arg1="${server}" arg2="ms" />
	<equals arg1="${client}" arg2="sun" />
	</and>
    </condition>

    <condition property="client.wsdl" value="${sunsts-msserver.client.wsdl}">
	<and>
	<equals arg1="${sts}" arg2="sun" />
	<equals arg1="${server}" arg2="ms" />
	<equals arg1="${client}" arg2="sun" />
	</and>
    </condition>

    <condition property="client.wsdl" value="${mssts-sunserver.client.wsdl}">
	<and>
	<equals arg1="${sts}" arg2="ms" />
	<equals arg1="${server}" arg2="sun" />
	<equals arg1="${client}" arg2="sun" />
	</and>
    </condition>

    <condition property="client.wsdl" value="${sunsts-sunserver.client.wsdl}">
	<and>
	<equals arg1="${server}" arg2="sun" />
	<equals arg1="${sts}" arg2="sun" />
	<equals arg1="${client}" arg2="sun" />
	</and>
    </condition>

    <condition property="client.wsdl" value="${hostedclient.wsdl}">
	<equals arg1="${client}" arg2="ms" />
    </condition>

    <condition property="service.url" value="${sun.service.url}" >
	<equals arg1="${server}" arg2="sun" />
    </condition>
    <condition property="service.url" value="${ms.service.url}" >
	<equals arg1="${server}" arg2="ms" />
    </condition>
    <condition property="build.sun.server" >
	<equals arg1="${server}" arg2="sun" />
    </condition>
    <condition property="build.sun.sts" >
	<equals arg1="${sts}" arg2="sun" />
    </condition>
    <condition property="excludes" value="PingServiceClientMS.java">
	<and>
	<equals arg1="${server}" arg2="ms" />
	<equals arg1="${sts}" arg2="sun" />
	</and>
    </condition>
    <condition property="excludes" value="PingServiceClient.java">
	<equals arg1="${server}" arg2="ms" />
    </condition>
    <condition property="excludes" value="PingServiceClientMS.java">
	<equals arg1="${server}" arg2="sun" />
    </condition>
    <condition property="client.class" value="simple.client.PingServiceClientMS">
	<and>
	<equals arg1="${server}" arg2="ms" />
	<equals arg1="${sts}" arg2="ms" />
	<equals arg1="${client}" arg2="sun" />
	</and>
    </condition>
    <condition property="client.class" value="simple.client.PingServiceClient">
	<and>
		<or>
			<equals arg1="${server}" arg2="sun" />
			<equals arg1="${sts}" arg2="sun" />
		</or>
		<equals arg1="${client}" arg2="sun" />
	</and>
    </condition>
    <condition property="client.class" value="simple.hostedclient.HostedClient">
	<equals arg1="${client}" arg2="ms" />
    </condition>
    <condition property="client.binding" value="${ms.client.binding}">
	<and>
	<equals arg1="${server}" arg2="ms" />
	<equals arg1="${sts}" arg2="ms" />
	<equals arg1="${client}" arg2="sun" />
	</and>
    </condition>
    <condition property="client.binding" value="${sun.client.binding}">
	<and>
	<equals arg1="${server}" arg2="sun" />
	<equals arg1="${sts}" arg2="sun" />
	<equals arg1="${client}" arg2="sun" />
	</and>
    </condition>
    <condition property="client.binding" value="${mslocal.client.binding}">
	<and>
	<equals arg1="${server}" arg2="ms" />
	<equals arg1="${sts}" arg2="sun" />
	<equals arg1="${client}" arg2="sun" />
	</and>
    </condition>
    <condition property="client.binding" value="${sunlocal.client.binding}">
	<and>
	<equals arg1="${server}" arg2="sun" />
	<equals arg1="${sts}" arg2="ms" />
	<equals arg1="${client}" arg2="sun" />
	</and>
    </condition>
    <condition property="server.wsdl" value="${sunlocal.server.wsdl}">
	<and>
	<equals arg1="${server}" arg2="sun" />
	<equals arg1="${sts}" arg2="ms" />
	</and>
    </condition>
    <condition property="server.wsdl" value="${sun.server.wsdl}">
	<and>
	<equals arg1="${server}" arg2="sun" />
	<equals arg1="${sts}" arg2="sun" />
	</and>
    </condition>
    <condition property="server.binding" value="${local.server.binding}">
	<and>
	<equals arg1="${server}" arg2="sun" />
	<equals arg1="${sts}" arg2="ms" />
	</and>
    </condition>
    <condition property="server.binding" value="${sun.server.binding}">
	<and>
	<equals arg1="${server}" arg2="sun" />
	<equals arg1="${sts}" arg2="sun" />
	</and>
    </condition>
    <condition property="sun.client" >
	<equals arg1="${client}" arg2="sun" />
    </condition>
    <condition property="ms.client" >
	<equals arg1="${client}" arg2="ms" />
    </condition>

<target name="setup-tc" if="tomcat.home">
    <replace  dir="etc/service" includes="PingService*.wsdl" token="WCF-HOST" value="${ms.host}"/>
    <replace  dir="etc/service" includes="PingService*.wsdl" token="$WSIT_HOME" value="${basedir}/../../../certs"/>
    <replace  dir="etc/sts" includes="sts.wsdl" token="$WSIT_HOME" value="${basedir}/../../../certs"/>
    <replace  dir="etc/client-config" includes="wsit-client.xml" token="$WSIT_HOME" value="${basedir}/../../../certs"/>
    <mkdir dir="${build.home}"/>
    <mkdir dir="${build.classes.home}"/>
    <mkdir dir="${build.war.home}"/>
    &tomcat;
</target>

<target  name="check-client-wsdl" >
	<available file="${client.wsdl}" property="client.wsdl.isfile" />
</target>

<target name="setup-glassfish" if="glassfish.home">
    <replace  dir="etc/service" includes="PingService*.wsdl" token="WCF-HOST" value="${ms.host}"/>
    <replace  dir="etc/service" includes="PingService*.wsdl" token="$WSIT_HOME" value="${basedir}/../../../certs"/>
    <replace  dir="etc/sts" includes="sts.wsdl" token="$WSIT_HOME" value="${basedir}/../../../certs"/>
    <replace  dir="etc/client-config" includes="wsit-client.xml" token="$WSIT_HOME" value="${basedir}/../../../certs"/>
    <mkdir dir="${build.home}"/>
    <mkdir dir="${build.classes.home}"/>
    <mkdir dir="${build.war.home}"/>
    &glassfish;
</target>

<target name="server" depends="setup-tc, setup-glassfish, compile-callbacks" if="build.sun.server">	
    <antcall target="clean" />
    <antcall target="compile-callbacks" />
    <antcall target="build-server-wsdl" />
    <antcall target="create-server-war" />
    <antcall target="deploy-server" />
    <sleep seconds="10"/>
</target>

<target name="build-server-java" depends="setup-tc, setup-glassfish">
    <apt
        fork="true"
        debug="${debug}"
    	verbose="${verbose}"
    	destdir="${build.classes.home}"
    	sourcedestdir="${build.classes.home}"
    	sourcePath="${basedir}/${sample.name}">
        <classpath>
        <path refid="jaxws.classpath"/>
            <pathelement location="${basedir}/src/${sample.name}"/>
        </classpath>
        <option key="r" value="${build.home}"/>
        <option key="verbose" value="${verbose}"/>
        <source dir="${basedir}/src/${sample.name}">
            <include name="**/server/*.java"/>
	    <include name="**/common/*.java"/>
            <include name="**/${ant.project.name}/server/*.java"/>
        </source>
    </apt>
    <!-- copy handlers descriptor file -->
    <copy todir="${build.classes.home}">
        <fileset dir="${basedir}/src/${sample.name}">
            <include name="**/server/**/*.xml"/>
        </fileset>
    </copy>
</target>

<target name="server-j2se" depends="setup-tc, setup-glassfish">

    <antcall target="clean" />
    <antcall target="build-server-java" />
    <java fork="true" classname="${j2se.sei}">
        <classpath>
            <path refid="jaxws.classpath"/>
            <pathelement location="${build.classes.home}"/>
        </classpath>
        <jvmarg value="-Djakarta.xml.ws.EndpointFactory=com.sun.xml.ws.transport.http.server.EndpointFactoryImpl"/>
    </java>

</target>

<target name="build-server-wsdl" depends="setup-tc">
	<wsimport
        fork="false"
        debug="${debug}"
        verbose="${verbose}"
        keep="${keep}"
        destdir="${build.classes.home}"
        extension="${extension}"
        wsdl="${basedir}/${server.wsdl}">
        <binding dir="${basedir}" includes="${server.binding}"/>
    </wsimport>
    <javac
        fork="true"
        debug="${debug}"
        srcdir="${basedir}"
        destdir="${build.classes.home}"
        includes="**/server/**">
    	<classpath>
    	    <path refid="jaxws.classpath"/>
    	</classpath>
    </javac>
</target>

<target name="create-server-war">
    <basename property="server.wsdl.name" file="${server.wsdl}"/>
    <replace  file="etc/service/sun-jaxws.xml" token="PingService.wsdl" value="${server.wsdl.name}"/>
    <war warfile="${build.war.home}/jaxws-${ant.project.name}.war" webxml="../../etc/service/web.xml">
	<webinf dir="etc/service" includes="sun-jaxws.xml"/>
	<zipfileset
            dir="etc/service"
            includes="*.xsd"
            prefix="WEB-INF/wsdl"/>
	<zipfileset
            dir="etc/service"
            includes="${server.wsdl.name}"
            prefix="WEB-INF/wsdl"/>
	<classes dir="${build.classes.home}"/>
    </war>
    <replace  file="etc/service/sun-jaxws.xml" value="PingService.wsdl" token="${server.wsdl.name}"/>
</target>

<target name="deploy-server-tc" if="tomcat.home">
     <copy file="${build.war.home}/jaxws-${ant.project.name}.war" todir="${tomcat.home}/webapps"/>
</target>

<!--Glassfish -->
<target name="deploy-server-glassfish" if="glassfish.home">
    <copy file="${build.war.home}/jaxws-${ant.project.name}.war"
        todir="${glassfish.home}/domains/${domain}/autodeploy"/>
</target>

<target name="deploy-server" depends="deploy-server-tc, deploy-server-glassfish"/>

<target name="sts" depends="setup-tc, compile-callbacks" if="build.sun.sts">	
    <antcall target="compile-callbacks" />
    <antcall target="build-sts-wsdl" />
    <antcall target="create-sts-war" />
    <antcall target="deploy-sts" />
    <sleep seconds="10"/>
</target>

<target name="build-sts-wsdl" depends="setup-tc, setup-glassfish">
    <javac
        fork="true"
        debug="${debug}"
        srcdir="${basedir}"
        destdir="${build.classes.home}"
        includes="**/sts/**">
    	<classpath>
    	    <path refid="jaxws.classpath"/>
    	</classpath>
    </javac>
</target>

<target name="create-sts-war">
    <war warfile="${build.war.home}/jaxws-${ant.project.name}-sts.war" webxml="../../etc/sts/web.xml">
	<webinf dir="etc/sts" includes="sun-jaxws.xml"/>
	<zipfileset
            dir="etc/sts"
            includes="sts.wsdl, *.xsd"
            prefix="WEB-INF/wsdl"/>
	<classes dir="${build.classes.home}" includes="**/sts/**, **/com/**, **/common/**"/>
    </war>
</target>

<target name="deploy-sts-tc" if="tomcat.home">
     <copy file="${build.war.home}/jaxws-${ant.project.name}-sts.war" todir="${tomcat.home}/webapps"/>
</target>

<target name="deploy-sts-glassfish" if="glassfish.home">
    <copy file="${build.war.home}/jaxws-${ant.project.name}-sts.war"
        todir="${glassfish.home}/domains/${domain}/autodeploy"/>
</target>

<target name="deploy-sts" depends="deploy-sts-tc, deploy-sts-glassfish"/>

<target name="compile-callbacks" depends="setup-tc, setup-glassfish" >
    <javac
        fork="true"
        debug="${debug}"
        srcdir="${basedir}/.."
        destdir="${build.classes.home}" 
        includes="common/SampleUsernamePasswordCallbackHandler.java, common/SampleUsernamePasswordValidator.java">
        <classpath refid="jaxws.classpath"/>
    </javac>
</target>


<target name="generate-client" depends="setup-tc, setup-glassfish" >
    <replace  dir="${basedir}/etc" token="WCF-HOST" value="${ms.host}"/>
    <wsimport
        fork="false"
        debug="${debug}"
        verbose="${verbose}"
        extension="${extension}"
        keep="${keep}"
        destdir="${build.classes.home}"
        wsdl="${client.wsdl}">
        <binding dir="${basedir}" includes="${client.binding}"/>
    </wsimport>
    <replace  dir="${basedir}/etc" value="WCF-HOST" token="${ms.host}"/>
    <javac
        fork="true"
        debug="${debug}"
        srcdir="${build.classes.home}"
        destdir="${build.classes.home}"
        includes="**/client/**">
        <classpath>
            <pathelement location="${build.classes.home}"/>
            <path refid="jaxws.classpath"/>
        </classpath>
    </javac>
</target>

<target name="client" depends="generate-client, compile-callbacks,hosted-client" if="sun.client">
    <javac
        fork="true"
        debug="${debug}"
        srcdir="${basedir}"
        destdir="${build.classes.home}"
        includes="**/client/**"
        excludes="**/client/${excludes}">
        <classpath>
            <pathelement location="${build.classes.home}"/>
            <path refid="jaxws.classpath"/>
        </classpath>
    </javac>
</target>
<target name="hosted-client" depends="generate-client, compile-callbacks" if="ms.client">
    <javac
        fork="true"
        debug="${debug}"
        srcdir="${basedir}"
        destdir="${build.classes.home}"
        includes="**/hostedclient/**">
        <classpath>
            <pathelement location="${build.classes.home}"/>
            <path refid="jaxws.classpath"/>
        </classpath>
    </javac>
</target>

<target name="run-tc-ssl" if="tomcat.home">
   <mkdir dir="${build.classes.home}/META-INF/services"/>
    <replace  dir="${basedir}/etc/client-config" token="WCF-HOST" value="${ms.host}"/>
   <java fork="true" classname="${client.class}">
        <sysproperty key="tomcat.home" value="${tomcat.home}"/>
        <sysproperty key="service.url" value="${service.url}"/>
        <sysproperty key="javax.net.ssl.keyStore" value="${javax.net.ssl.keyStore}"/>
        <sysproperty key="javax.net.ssl.keyStoreType" value="${javax.net.ssl.keyStoreType}"/>
        <sysproperty key="javax.net.ssl.keyStorePassword" value="${javax.net.ssl.keyStorePassword}"/>
       <sysproperty key="javax.net.ssl.trustStore" value="${javax.net.ssl.trustStore}"/>
       <sysproperty key="javax.net.ssl.trustStoreType" value="${javax.net.ssl.trustStoreType}"/>
       <sysproperty key="javax.net.ssl.trustStorePassword" value="${javax.net.ssl.trustStorePassword}"/>
        <sysproperty key="msclient.sunsts.url" value="${msclient.sunsts.url}"/>
        <sysproperty key="msclient.mssts.url" value="${msclient.mssts.url}"/>
        <sysproperty key="sts" value="${sts}"/>
        <classpath>
            <path refid="jaxws.classpath"/>
            <pathelement location="${build.classes.home}"/>
            <pathelement location="${build.classes.home}/../"/>
        </classpath>
        <jvmarg value="-DWSIT_HOME=${tomcat.home}"/>
        <!--
        <jvmarg value="-Xdebug"/>
        <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9009"/>
        -->  
    </java>  
    <replace  dir="etc/service" includes="PingService*.wsdl" value="WCF-HOST" token="${ms.host}"/>
    <replace  dir="${basedir}/etc/client-config" value="WCF-HOST" token="${ms.host}"/>
    <replace  dir="etc/service" includes="PingService*.wsdl" value="$WSIT_HOME" token="${basedir}/../../../certs"/>
    <replace  dir="etc/sts" includes="sts.wsdl" value="$WSIT_HOME" token="${basedir}/../../../certs"/>
    <replace  dir="etc/client-config" includes="wsit-client.xml" value="$WSIT_HOME" token="${basedir}/../../../certs"/>
</target>

<target name="run-tc" if="tomcat.home">
   <mkdir dir="${build.classes.home}/META-INF/services"/>
    <replace  dir="${basedir}/etc/client-config" token="WCF-HOST" value="${ms.host}"/>
   <java fork="true" classname="${client.class}">
        <sysproperty key="tomcat.home" value="${tomcat.home}"/>
        <sysproperty key="service.url" value="${service.url}"/>
	<!--
        <sysproperty key="com.sun.xml.ws.assembler.client.wss.before" value="true"/>
        <sysproperty key="com.sun.xml.ws.assembler.client.wss.after" value="true"/>
	-->
        <classpath>
            <path refid="jaxws.classpath"/>
            <pathelement location="${build.classes.home}"/>
            <pathelement location="${build.classes.home}/../"/>
        </classpath>
        <jvmarg value="-DWSIT_HOME=${tomcat.home}"/>
        <!--
        <jvmarg value="-Xdebug"/>
        <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9006"/>
        -->
        <sysproperty key="msclient.sunsts.url" value="${msclient.sunsts.url}"/>
        <sysproperty key="msclient.mssts.url" value="${msclient.mssts.url}"/>
        <sysproperty key="sts" value="${sts}"/>
	<sysproperty key="java.endorsed.dirs" value="${glassfish.home}/lib/endorsed"/> 
    </java>  
    <replace  dir="etc/service" includes="PingService*.wsdl" value="WCF-HOST" token="${ms.host}"/>
    <replace  dir="${basedir}/etc/client-config" value="WCF-HOST" token="${ms.host}"/>
    <replace  dir="etc/service" includes="PingService*.wsdl" value="$WSIT_HOME" token="${basedir}/../../../certs"/>
    <replace  dir="etc/sts" includes="sts.wsdl" value="$WSIT_HOME" token="${basedir}/../../../certs"/>
    <replace  dir="etc/client-config" includes="wsit-client.xml" value="$WSIT_HOME" token="${basedir}/../../../certs"/>
</target>

<target name="run-glassfish" if="glassfish.home">
   <mkdir dir="${build.classes.home}/META-INF/services"/>
    <replace  dir="${basedir}/etc/client-config" token="WCF-HOST" value="${ms.host}"/>
   <java fork="true" classname="${client.class}">
        <sysproperty key="glassfish.home" value="${glassfish.home}"/>
        <sysproperty key="service.url" value="${service.url}"/>
	<!--
        <sysproperty key="DebugSecurity" value="true"/>
        <sysproperty key="com.sun.xml.ws.assembler.client.wss.before" value="true"/>
        <sysproperty key="com.sun.xml.ws.assembler.client.wss.after" value="true"/>
	-->
        <sysproperty key="msclient.sunsts.url" value="${msclient.sunsts.url}"/>
        <sysproperty key="msclient.mssts.url" value="${msclient.mssts.url}"/>
        <sysproperty key="sts" value="${sts}"/>
	<sysproperty key="java.endorsed.dirs" value="${glassfish.home}/lib/endorsed"/> 
        <classpath>
            <path refid="jaxws.classpath"/>
            <pathelement location="${build.classes.home}"/>
            <pathelement location="${build.classes.home}/../"/>            
        </classpath>
        <jvmarg value="-DWSIT_HOME=${glassfish.home}"/>
	<!--
        <jvmarg value="-Xdebug"/>
        <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9006"/>
	-->
    </java>  
    <replace  dir="etc/service" includes="PingService*.wsdl" value="WCF-HOST" token="${ms.host}"/>
    <replace  dir="${basedir}/etc/client-config" value="WCF-HOST" token="${ms.host}"/>
    <replace  dir="etc/service" includes="PingService*.wsdl" value="$WSIT_HOME" token="${basedir}/../../../certs"/>
    <replace  dir="etc/sts" includes="sts.wsdl" value="$WSIT_HOME" token="${basedir}/../../../certs"/>
    <replace  dir="etc/client-config" includes="wsit-client.xml" value="$WSIT_HOME" token="${basedir}/../../../certs"/>
</target>

<target name="run-glassfish-ssl" if="glassfish.home">
   <mkdir dir="${build.classes.home}/META-INF/services"/>
    <replace  dir="${basedir}/etc/client-config" token="WCF-HOST" value="${ms.host}"/>
   <java fork="true" classname="${client.class}">
        <sysproperty key="glassfish.home" value="${glassfish.home}"/>
        <sysproperty key="service.url" value="${service.url}"/>
	<!--
        <sysproperty key="DebugSecurity" value="true"/>
        <sysproperty key="com.sun.xml.ws.assembler.client.wss.before" value="true"/>
        <sysproperty key="com.sun.xml.ws.assembler.client.wss.after" value="true"/>
	-->
        <sysproperty key="javax.net.ssl.keyStore" value="${javax.net.ssl.keyStore}"/>
        <sysproperty key="javax.net.ssl.keyStoreType" value="${javax.net.ssl.keyStoreType}"/>
        <sysproperty key="javax.net.ssl.keyStorePassword" value="${javax.net.ssl.keyStorePassword}"/>
       <sysproperty key="javax.net.ssl.trustStore" value="${javax.net.ssl.trustStore}"/>
       <sysproperty key="javax.net.ssl.trustStoreType" value="${javax.net.ssl.trustStoreType}"/>
       <sysproperty key="javax.net.ssl.trustStorePassword" value="${javax.net.ssl.trustStorePassword}"/>
        <sysproperty key="msclient.sunsts.url" value="${msclient.sunsts.url}"/>
        <sysproperty key="msclient.mssts.url" value="${msclient.mssts.url}"/>
        <sysproperty key="sts" value="${sts}"/>
	<sysproperty key="java.endorsed.dirs" value="${glassfish.home}/lib/endorsed"/> 
        <classpath>
            <path refid="jaxws.classpath"/>
            <pathelement location="${build.classes.home}"/>
            <pathelement location="${build.classes.home}/../"/>            
        </classpath>
        <jvmarg value="-DWSIT_HOME=${glassfish.home}"/>
	<!--
        <jvmarg value="-Xdebug"/>
        <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9006"/>
	-->
    </java>  
    <replace  dir="etc/service" includes="PingService*.wsdl" value="WCF-HOST" token="${ms.host}"/>
    <replace  dir="${basedir}/etc/client-config" value="WCF-HOST" token="${ms.host}"/>
    <replace  dir="etc/service" includes="PingService*.wsdl" value="$WSIT_HOME" token="${basedir}/../../../certs"/>
    <replace  dir="etc/sts" includes="sts.wsdl" value="$WSIT_HOME" token="${basedir}/../../../certs"/>
    <replace  dir="etc/client-config" includes="wsit-client.xml" value="$WSIT_HOME" token="${basedir}/../../../certs"/>
</target>

<target name="run-ssl" depends="setup-tc, run-tc-ssl, setup-glassfish, run-glassfish-ssl" if="sun.client"/>
<target name="run" depends="setup-tc, run-tc, setup-glassfish, run-glassfish" if="sun.client"/>


<target name="clean">
    <delete dir="${build.home}" includeEmptyDirs="true" />
</target>

<target name="help">
    <echo message="server:       Builds and deploy the service endpoint WAR"/>
    <echo message="sts   :       Builds and deploy the security token service WAR"/>
    <echo message="client:       Builds the client"/>
    <echo message="run:          Runs the client"/>
    <echo message="main:         Default target builds the server,sts and client and runs client"/>
    <echo message="s-s-s:        Runs the sun client against sun sts and sun service"/>
    <echo message="s-s-m:        Runs the sun client against sun sts and microsoft service"/>
    <echo message="s-m-s:        Runs the sun client against microsoft sts and sun service"/>
    <echo message="s-m-m:        Runs the sun client against microsoft sts and microsoft service"/>
    <echo message="m-s-s:        Runs the microsoft client against sun sts and sun service"/>
    <echo message="m-s-m:        Runs the microsoft client against sun sts and microsoft service"/>
    <echo message="m-m-s:        Runs the microsoft client against microsoft sts and sun service"/>
    <echo message="m-m-m:        Runs the microsoft client against microsoft sts and microsoft service"/>
</target>

<target name="s-s-s" depends="" >
	<property name="test.type" value="s-s-s"/>
	<antcall target="main" />
</target>

<target name="s-s-m" depends="" >
	<property name="test.type" value="s-s-m"/>
	<antcall target="main" />
</target>

<target name="s-m-s" depends="" >
	<property name="test.type" value="s-m-s"/>
	<antcall target="main" />
</target>

<target name="s-m-m" depends="" >
	<property name="test.type" value="s-m-m"/>
	<antcall target="main" />
</target>

<target name="m-s-s" depends="" >
	<property name="test.type" value="m-s-s"/>
	<antcall target="main" />
</target>

<target name="m-s-m" depends="" >
	<property name="test.type" value="m-s-m"/>
	<antcall target="main" />
</target>

<target name="m-m-s" depends="" >
	<property name="test.type" value="m-m-s"/>
	<antcall target="main" />
</target>

<target name="m-m-m" depends="" >
	<property name="test.type" value="m-m-m"/>
	<antcall target="main" />
</target>

<target name="echo" depends="" >
	<echo> client = ${client} </echo>
	<echo> sts = ${sts} </echo>
	<echo> server = ${server} </echo>
	<echo> client.wsdl = ${client.wsdl} </echo>
	<echo> service.url = ${service.url} </echo>
</target>
