<!--
  JBoss, Home of Professional Open Source
  Copyright 2008, Red Hat Middleware LLC, and individual contributors
  as indicated by the @author tags.
  See the copyright.txt in the distribution for a
  full listing of individual contributors.
  This copyrighted material is made available to anyone wishing to use,
  modify, copy, or redistribute it subject to the terms and conditions
  of the GNU Lesser General Public License, v. 2.1.
  This program is distributed in the hope that it will be useful, but WITHOUT A
  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
  You should have received a copy of the GNU Lesser General Public License,
  v.2.1 along with this distribution; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  MA  02110-1301, USA.

  (C) 2008,
  @author JBoss Inc.
-->

<project name="Local JUnit Test for basic XTS testsuite" default="tests-both" basedir=".">

    <!-- this should be run from the installed tree i.e. <JBossTSDir>/XTS/xts-install/tests -->

    <!-- location of XTS root dir -->
    <property name="root.dir" value="../.."/>
    <!-- location of JBossTS parent tree -->
    <property name="jbossts.dir" location="${root.dir}/.."/>
    <!-- all libraries external to JBossTS should be found in parent build/extlib -->
    <property name="jbossts.build.dir" location="${jbossts.dir}/build"/>
    <property name="jbossts.build.extlib.dir" location="${jbossts.build.dir}/extlib"/>

    <property environment="env"/>
    <property name="server.hostname" value="${env.MYTESTIP_1}"/>
    <property name="base.url" value="http://${server.hostname}:8080"/>
    <property name="reports.dir" value="reports"/>
    <property name="localjunit.lib.dir" value="." />

    <path id="tests.classpath">
        <pathelement location="${localjunit.lib.dir}/localjunit.jar"/>
        <pathelement location="${jbossts.build.extlib.dir}/commons-httpclient.jar"/>
		<pathelement location="${jbossts.build.extlib.dir}/commons-codec.jar"/>
        <pathelement location="${jbossts.build.extlib.dir}/slf4j-api.jar"/>
        <pathelement location="${jbossts.build.extlib.dir}/jcl-over-slf4j.jar"/>
        <pathelement location="${jbossts.build.extlib.dir}/slf4j-simple.jar"/>
		<pathelement location="${jbossts.build.extlib.dir}/junit.jar"/>
    </path>


    <target name="init">
        <mkdir dir="${reports.dir}"/>
    </target>

    <!-- target for 1.1 tests -->
    <target name="tests-11" depends="init">
        <run-localjunit-test serverUrl="${base.url}/wsas-tests/index.xml" tag="wsas" />
        <run-localjunit-test serverUrl="${base.url}/ws-c11-tests/index.xml" tag="ws-c11" />
        <run-localjunit-test serverUrl="${base.url}/ws-t11-tests/index.xml" tag="ws-t11" />
        <run-localjunit-test serverUrl="${base.url}/wscf11-tests/index.xml" tag="wscf11" />
        <run-localjunit-test serverUrl="${base.url}/wstx11-tests/index.xml" tag="wstx11" />
    </target>

    <macrodef name="run-localjunit-test">
        <attribute name="serverUrl" />
        <attribute name="tag" />
        <sequential>
            <junit printsummary="yes" haltonfailure="no" fork="true" dir="." maxmemory="256m" showoutput="yes">
                <classpath>
                    <path refid="tests.classpath"/>
                </classpath>

                <formatter type="xml"/>

                <sysproperty key="serverUrl" value="@{serverUrl}" />
                <sysproperty key="outfile" value="${reports.dir}/TEST-@{tag}-test.xml" />

                <test name="com.arjuna.qa.junit.LocalJUnitRunner" outfile="TEST-com.arjuna.qa.junit.LocalJUnitRunner-@{tag}"/>

                <!--jvmarg value="-Xdebug"/>
                <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/-->
            </junit>
        </sequential>
     </macrodef>

</project>
