Search in sources :

Example 56 with FileSet

use of org.apache.tools.ant.types.FileSet in project ant-ivy by apache.

the class IvyBuildListTest method testOnMissingDescriptor.

@Test
public void testOnMissingDescriptor() {
    FileSet fs = new FileSet();
    fs.setDir(new File("test/buildlist"));
    fs.setIncludes("**/build.xml");
    fs.setExcludes("E2/build.xml,F/build.xml,G/build.xml");
    buildlist.addFileset(fs);
    // IVY-805: new String instance
    buildlist.setOnMissingDescriptor("tail");
    String[] files = getFiles(buildlist);
    assertEquals(6, files.length);
    assertListOfFiles("test/buildlist/", new String[] { "B", "C", "A", "D", "E", "H" }, files);
}
Also used : FileSet(org.apache.tools.ant.types.FileSet) File(java.io.File) Test(org.junit.Test)

Example 57 with FileSet

use of org.apache.tools.ant.types.FileSet in project ant-ivy by apache.

the class IvyBuildListTest method testOneParent.

@Test
public void testOneParent() {
    FileSet fs = new FileSet();
    fs.setDir(new File("test/buildlists/testOneParent"));
    fs.setIncludes("**/build.xml");
    buildlist.addFileset(fs);
    buildlist.setOnMissingDescriptor("skip");
    buildlist.setHaltonerror(false);
    String[] files = getFiles(buildlist);
    assertEquals(5, files.length);
    assertListOfFiles("test/buildlists/testOneParent/", new String[] { "bootstrap-parent", "master-parent", "croatia", "ireland", "germany" }, files);
}
Also used : FileSet(org.apache.tools.ant.types.FileSet) File(java.io.File) Test(org.junit.Test)

Example 58 with FileSet

use of org.apache.tools.ant.types.FileSet in project ant-ivy by apache.

the class IvyBuildListTest method testWithRootCircular.

@Test
public void testWithRootCircular() {
    FileSet fs = new FileSet();
    fs.setDir(new File("test/buildlist"));
    fs.setIncludes("**/build.xml");
    buildlist.addFileset(fs);
    buildlist.setRoot("F");
    buildlist.setOnMissingDescriptor("skip");
    String[] files = getFiles(buildlist);
    // F and G should be in the list
    assertEquals(2, files.length);
}
Also used : FileSet(org.apache.tools.ant.types.FileSet) File(java.io.File) Test(org.junit.Test)

Example 59 with FileSet

use of org.apache.tools.ant.types.FileSet in project ant-ivy by apache.

the class IvyBuildListTest method testReverse.

@Test
public void testReverse() {
    FileSet fs = new FileSet();
    fs.setDir(new File("test/buildlist"));
    fs.setIncludes("**/build.xml");
    fs.setExcludes("E2/build.xml,F/build.xml,G/build.xml");
    buildlist.addFileset(fs);
    buildlist.setReverse(true);
    buildlist.setOnMissingDescriptor("skip");
    String[] files = getFiles(buildlist);
    assertEquals(5, files.length);
    assertListOfFiles("test/buildlist/", new String[] { "E", "D", "A", "C", "B" }, files);
}
Also used : FileSet(org.apache.tools.ant.types.FileSet) File(java.io.File) Test(org.junit.Test)

Example 60 with FileSet

use of org.apache.tools.ant.types.FileSet in project ant-ivy by apache.

the class IvyBuildListTest method testWithRootExclude.

@Test
public void testWithRootExclude() {
    FileSet fs = new FileSet();
    fs.setDir(new File("test/buildlist"));
    fs.setIncludes("**/build.xml");
    fs.setExcludes("E2/**");
    buildlist.addFileset(fs);
    buildlist.setRoot("C");
    buildlist.setExcludeRoot(true);
    buildlist.setOnMissingDescriptor("skip");
    String[] files = getFiles(buildlist);
    // A, D and C should be filtered out
    assertEquals(1, files.length);
    assertListOfFiles("test/buildlist/", new String[] { "B" }, files);
}
Also used : FileSet(org.apache.tools.ant.types.FileSet) File(java.io.File) Test(org.junit.Test)

Aggregations

FileSet (org.apache.tools.ant.types.FileSet)165 File (java.io.File)124 DirectoryScanner (org.apache.tools.ant.DirectoryScanner)83 BuildException (org.apache.tools.ant.BuildException)49 Test (org.junit.Test)41 IOException (java.io.IOException)36 ArrayList (java.util.ArrayList)29 Project (org.apache.tools.ant.Project)22 Resource (org.apache.tools.ant.types.Resource)12 FileResource (org.apache.tools.ant.types.resources.FileResource)10 URL (java.net.URL)6 Hashtable (java.util.Hashtable)6 ArchiveFileSet (org.apache.tools.ant.types.ArchiveFileSet)6 Path (org.apache.tools.ant.types.Path)6 ResourceCollection (org.apache.tools.ant.types.ResourceCollection)6 PrintStream (java.io.PrintStream)5 HashMap (java.util.HashMap)5 Iterator (java.util.Iterator)5 List (java.util.List)5 ZipFileSet (org.apache.tools.ant.types.ZipFileSet)5