<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE project [
        <!ENTITY properties SYSTEM "file:../../xmls/properties.xml">
        <!ENTITY paths  SYSTEM "file:../../xmls/path_refs.xml">
        <!ENTITY taskdefs SYSTEM "file:../../xmls/taskdefs.xml">
        <!ENTITY taskdefs_post_compile SYSTEM "file:../../xmls/taskdefs_post_compile.xml">
        <!ENTITY targets SYSTEM "file:../../xmls/targets.xml">
]>

<!-- ===================================================================
<description>
   Test/Sample Component file for Axis

Notes:
   This is a build file for use with the Jakarta Ant build tool.

Prerequisites:

   jakarta-ant from http://jakarta.apache.org

Build Instructions:
   To compile
        ant <target>
   To execute
        ant <target>

Author:

Copyright:
  Copyright (c) 2002-2003 Apache Software Foundation.
</description>
==================================================================== -->

<project name="httpunit" default="default" basedir=".">
  <description>
    Test a Web application with HttpUnit. Based on example code in 
    Java Development with Ant, Hatcher and Loughran, 2001.
    Customised for Axis by Steve Loughran.
    1. Needs XSLT support from Xalan to generate the reports.
    2. To run a single test, set testcase=the name of the test.
    3. default URL is http://localhost:8080/axis ; set the 
       axis.url property to target a different system or port.
  </description>
  
<!-- BEGIN TOPLEVEL DECLARATIONS -->

  <property name="axis.home" location="../.." />
  <property name="componentName" value="test/httpunit" />
  <property name="component.home" location="${axis.home}/${componentName}" />
 
  <!-- Load the application specific settings -->
  <!-- #Project specific props -->
  <property file="build.properties"/>
  
  
    &properties;
    &paths;
    &taskdefs;
    &taskdefs_post_compile;
    &targets;
  
      
  <!-- ========================================================== -->
  <!-- Test settings                                              -->
  <!-- ========================================================== -->


  <target name="copy"/>
  
  <target name="deploy"/>
  
  <target name="run" />
  
  <target name="undeploy"/>
  
  
  <path id="test.compile.classpath">
    <path refid="classpath"/>
  </path>
    
  <path id="test.classpath">
    <path refid="test.compile.classpath"/>
    <pathelement location="${test.classes.dir}"/>
  </path>    
  <!-- END TOPLEVEL DECLARATIONS -->
  
  <!-- Public Targets -->

  <target name="default" 
    depends="compile"
    description="compile the tests"
    />

  <!-- cleanup target -->
  <target name="clean" description="cleanup"/>

  <target name="all" depends="compile,test" 
    description="compile and run the tests"/>
  
  <!-- init configures things -->
  <target name="init" depends="setenv">
    <condition property="execute.httpunit">
      <and>
        <isset property="httpunit.present"/>
        <istrue value="${httpunit.enabled}"/>
      </and>
    </condition>
    <echo>
    httpunit.present=${httpunit.present}
    httpunit.enabled = ${httpunit.enabled}
    execute.httpunit=${execute.httpunit}
    </echo>
    <mkdir dir="${test.classes.dir}" />
    <mkdir dir="${test.data.dir}" />
  </target>
  
    <!-- compile the java sources using the compilation classpath -->
  <target name="compile" depends="init" if="execute.httpunit">
    <javac destdir="${test.classes.dir}"
           debug="${build.debug}"
           nowarn="${nowarn}" 
           debuglevel="${debuglevel}"
           includeAntRuntime="false"
           fork="${javac.fork}"
           srcdir="${axis.home}">
      <classpath refid="test.compile.classpath"/>
      <include name="${componentName}/*.java"/>
      <include name="test/AxisTestBase.java"/>
    </javac>
  </target>
  
   <!-- this is our test suite for httpunit -->

  <target name="run-test"
      depends="compile" 
      if="execute.httpunit"
      description="test axis on a server" >
    <junit printsummary="false"
           errorProperty="test.failed"
           failureProperty="test.failed"
           haltonfailure="false"
           fork="true">
      <classpath 
        refid="test.classpath"/>
      <sysproperty key="test.functional.webapp.url" 
        value="${test.functional.webapp.url}"/>
      <formatter type="xml"/>
      <formatter type="brief" usefile="false"/>
      <test name="${testcase}" if="testcase"/>
      <batchtest todir="${test.reports.dir}" unless="testcase">
        <fileset dir="${build.dir}/classes"
          includes="test/httpunit/*Tests.class"
          excludesfile="${axis.home}/junit-exclude-tests.txt"/>
      </batchtest>
    </junit>
  </target>
    
  <!-- generate any test reports and fail, if needed -->
  <target name="test" depends="run-test" >
    <fail if="test.failed">Tests Failed</fail>
  </target>    
    
</project>

