<?xml version="1.0"?>

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

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

  <target name="test2">
    <zip destFile="zip.tmp"/>
  </target>

  <!-- Test when the zip file includes itself
  when target file exists before the zip task is run -->
  <target name="test3">
    <touch file="test3.zip"/>
    <zip destFile="test3.zip"
         basedir="."/>
  </target>

  <!-- Test when the zip file includes itself
  when target file does not exist before the zip task is run
  <target name="test4">
     <zip destFile="test4.zip"
         basedir="."/>
  </target>
  -->

  <target name="test5">
    <zip zipfile="test5.zip" basedir="." >
      <exclude name="test5.zip" />
    </zip>
  </target>

  <target name="test6">
    <zip destFile="test6.zip" basedir=".">
      <include name="*.xml" />
      <exclude name="zip.*" />
    </zip>
  </target>

  <target name="test7">
    <zip destFile="inner7.zip" basedir="." >
      <exclude name="inner7.zip" />
    </zip>
    <zip destFile="test7.zip" basedir=".">
      <exclude name="**/*.*" />
      <zipfileset src="inner7.zip" />
    </zip>
  </target>

  <target name="feather">
    <zip destFile="asf-logo.gif.zip"
         basedir=".."
         includes="asf-logo.gif" />
  </target>

  <!-- legacy attribute support -->
  <target name="test8">
    <zip zipfile="test8.zip" basedir="." >
      <exclude name="test8.zip" />
    </zip>
  </target>

  <target name="testZipgroupfileset">

    <zip zipfile="zipgroupfileset.zip" basedir=".">
      <zipgroupfileset dir="zip" 
        includes="zipgroupfileset*.zip" 
        excludes="zipgroupfileset3.zip" />
      <include name="zip/zipgroupfileset3.zip" />
    </zip>
  </target>

  <target name="testDuplicateFail">

    <zip zipfile="duplicateFail.zip" basedir="." duplicate="fail">
      <zipgroupfileset dir="duplicate" includes="duplicate*.zip" />
    </zip>
  </target>

  <target name="testUpdateNotNecessary" depends="feather">
    <zip destFile="asf-logo.gif.zip"
         basedir=".."
         includes="asf-logo.gif"
         update="true" />
  </target>

  <target name="testUpdateIsNecessary" depends="feather">
    <sleep seconds="5" />
    <touch file="../dummyfile" />
    <zip destFile="asf-logo.gif.zip"
         basedir=".."
         includes="asf-logo.gif,dummyfile"
         update="true" />
  </target>

  <target name="cleanup">
    <delete file="test3.zip"/>
    <delete file="test4.zip"/>
    <delete file="test5.zip"/>
    <delete file="test6.zip"/>
    <delete file="inner7.zip"/>
    <delete file="test7.zip"/>
    <delete file="test8.zip"/>
    <delete file="asf-logo.gif.zip"/>
    <delete file="zipgroupfileset.zip"/>
    <delete file="../dummyfile" />
  </target>
</project>
