<?xml version="1.0"?>
<project name="listutils-test" default="testfilelist">

  <dirname property="listutils-test.dir" file="${ant.file.listutils-test}"/>
  <import file="${listutils-test.dir}/listutils.xml"/>
  
  <target name="testfilelist">
    <record name="log.txt" loglevel="debug"/>
    <property name="tmp" location="/tmp"/>
    <!-- Construct the filelist to be processed. -->
    <filelist id="flist1" dir="." files="mbox, errors, frames, frames.xml"/>
    <property name="properties" location="${tmp}/recursive.properties"/>
    <filelist-list properties="${properties}" filelist-id="flist1"
                   list.target="list.target" keep-properties="true">
      <filelist-list-args>
        <propertyfile file="@{properties}">
          <entry key="argument1" value="Argument 1 value"/>
          <entry key="argument2" value="Argument 2 value"/>
        </propertyfile>
      </filelist-list-args>
    </filelist-list>
  </target>

  <target name="testunionlist">
    <property name="tmp" location="/tmp"/>
    <filelist id="flist1" dir="." files="mbox, errors, frames, frames.xml"/>
    <union id="union1">
      <filelist refid="flist1"/>
    </union>
    <property name="properties" location="${tmp}/recursive.properties"/>
    <union-list properties="${properties}" union-id="union1"
                list.target="list.target" keep-properties="true">
      <union-list-args>
        <propertyfile file="@{properties}">
          <entry key="argument1" value="Argument 1 value"/>
          <entry key="argument2" value="Argument 2 value"/>
        </propertyfile>
      </union-list-args>
    </union-list>
  </target>  

  <target name="teststringlist">
    <property name="tmp" location="/tmp"/>
    <filelist id="flist1" dir="." files="mbox, errors, frames, frames.xml"/>
    <union id="union1">
      <filelist refid="flist1"/>
    </union>
    <property name="files1" value="${toString:union1}"/>
    <property name="properties" location="${tmp}/recursive.properties"/>
    <string-list properties="${properties}" string="${toString:union1}"
                 list.target="list.target" keep-properties="true" separator="pbw">
      <string-list-args>
        <propertyfile file="@{properties}">
          <entry key="argument1" value="Argument 1 value"/>
          <entry key="argument2" value="Argument 2 value"/>
        </propertyfile>
      </string-list-args>
    </string-list>
  </target>

  <!-- The target to process each element of the list. -->
  <target name="list.target">
    <echo>This list element is ${list.first}</echo>
    <echo>Arguments ${argument1} ${argument2}</echo>
  </target>
  

</project>
