<?xml version="1.0"?>

<project name="available-test" basedir="." default="test1">

  <target name="test1">
    <available/>
  </target>

  <target name="test2">
    <available property="test"/>
  </target>

  <target name="test3">
    <available file="test"/>
  </target>

  <target name="test4">
    <available property="test" 
               file="src/etc/testcases/taskdefs/this_file_does_not_exist"/>
  </target>

  <target name="test5">
    <available property="test" 
               file="available.xml"/>
  </target>

  <target name="test6">
    <available property="test" 
               resource="org/apache/tools/ant/taskdefs/this_resource_does_not_exist"/>
  </target>

  <target name="test7">
    <available property="test" 
               resource="org/apache/tools/ant/taskdefs/defaults.properties"/>
  </target>

  <target name="test8">
    <available property="test" 
               classname="org.apache.tools.ant.taskdefs.this_class_does_not_exist"/>
  </target>

  <target name="test9">
    <available property="test" 
               classname="org.apache.tools.ant.taskdefs.Ant"/>
  </target>

  <target name="test10">
    <available property="test" 
               file="available.xml"
               resource="org/apache/tools/ant/taskdefs/defaults.properties"
               classname="org.apache.tools.ant.taskdefs.Ant"/>
  </target>
  
  <target name="test11">
    <available property="test" 
               file="src/etc/testcases/taskdefs/available.xml"
               resource="org/apache/tools/ant/taskdefs/defaults.properties"
               classname="org.apache.tools.ant.taskdefs.this_class_does_not_exist"/>
  </target>  
  
  <target name="test12">
    <available property="" 
               file="available.xml"/>
  </target>

  <target name="test13">
    <available property="test" 
               file="" type="file" />
  </target>

  <target name="test13b">
    <available property="test" 
               file=""/>
  </target>

  <target name="test14">
    <available property="test" 
               resource=""/>
  </target>

  <target name="test15">
    <available property="test" 
               classname="org.apache.tools.ant.taskdefs.this_class_does_not_exist"/>
  </target>

  <target name="test16">
    <available property="test" 
               file="" type="dir"/>
  </target>

  <target name="test17">
    <available property="test" 
               file="../taskdefs" type="dir"/>
  </target>

  <target name="test18">
    <available property="test" 
               file="../this_dir_should_never_exist" type="dir"/>
  </target>

  <target name="test19">
    <available property="test" 
               file="available.xml" type="Foo"/>
  </target>

  <target name="test20">
    <available property="test" ignoresystemclasses="true"
               classname="java.awt.Graphics"/>
  </target>

  <target name="test21">
    <available property="test" ignoresystemclasses="true"
               classname="java.awt.Graphics">
      <classpath>
        <pathelement location="${java.home}/lib/rt.jar" />
        <pathelement location="${java.home}/lib/classes.zip" />
        <pathelement location="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes/classes.jar" />
        <pathelement location="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes/ui.jar" />
      </classpath>
    </available>
  </target>

  <target name="test22">
    <available property="test" ignoresystemclasses="false"
               classname="java.awt.Graphics"/>
  </target>

  <target name="test23">
    <available property="test"
               classname="java.awt.Graphics"/>
  </target>

  <target name="test24">
    <!-- create a dummy file and look for it -->
    <mkdir dir="${user.dir}/test"/>
    <echo message="package test;public class test {}" file="${user.dir}/test/test.java"/>
    <javac srcdir="${user.dir}" includes="test/test.java"/>
    <jar destfile="${user.dir}/test.jar" basedir="${user.dir}" includes="test/test.class"/>
    <available property="test"
               classname="test.test" classpath="${user.dir}/test.jar"/>
    <delete dir="${user.dir}/test"/>
    <delete file="${user.dir}/test.jar"/>
  </target>

  <target name="searchInPathNotThere">
    <available file="not_there" filepath="..:optional"
               property="test" />
  </target>

  <target name="searchInPathIsThere">
    <available file="pvcs.xml" filepath="..:optional"
               property="test" />
  </target>
</project>
