Search in sources :

Example 1 with FileResource

use of org.gradle.api.internal.file.FileResource in project gradle by gradle.

the class TarFileTreeTest method readsGzippedTarFile.

@Test
public void readsGzippedTarFile() {
    TestFile tgz = tmpDir.getTestDirectory().file("test.tgz");
    rootDir.file("subdir/file1.txt").write("content");
    rootDir.file("subdir2/file2.txt").write("content");
    rootDir.tgzTo(tgz);
    TarFileTree tree = new TarFileTree(tarFile, new MaybeCompressedFileResource(new FileResource(tgz)), expandDir, fileSystem(), fileSystem(), directoryFileTreeFactory());
    assertVisits(tree, toList("subdir/file1.txt", "subdir2/file2.txt"), toList("subdir", "subdir2"));
    assertSetContainsForAllTypes(tree, toList("subdir/file1.txt", "subdir2/file2.txt"));
}
Also used : MaybeCompressedFileResource(org.gradle.api.internal.file.MaybeCompressedFileResource) TestFile(org.gradle.test.fixtures.file.TestFile) MaybeCompressedFileResource(org.gradle.api.internal.file.MaybeCompressedFileResource) FileResource(org.gradle.api.internal.file.FileResource) Test(org.junit.Test)

Example 2 with FileResource

use of org.gradle.api.internal.file.FileResource in project gradle by gradle.

the class TarFileTreeTest method readsBzippedTarFile.

@Test
public void readsBzippedTarFile() {
    TestFile tbz2 = tmpDir.getTestDirectory().file("test.tbz2");
    rootDir.file("subdir/file1.txt").write("content");
    rootDir.file("subdir2/file2.txt").write("content");
    rootDir.tbzTo(tbz2);
    TarFileTree tree = new TarFileTree(tarFile, new MaybeCompressedFileResource(new FileResource(tbz2)), expandDir, fileSystem(), fileSystem(), directoryFileTreeFactory());
    assertVisits(tree, toList("subdir/file1.txt", "subdir2/file2.txt"), toList("subdir", "subdir2"));
    assertSetContainsForAllTypes(tree, toList("subdir/file1.txt", "subdir2/file2.txt"));
}
Also used : MaybeCompressedFileResource(org.gradle.api.internal.file.MaybeCompressedFileResource) TestFile(org.gradle.test.fixtures.file.TestFile) MaybeCompressedFileResource(org.gradle.api.internal.file.MaybeCompressedFileResource) FileResource(org.gradle.api.internal.file.FileResource) Test(org.junit.Test)

Aggregations

FileResource (org.gradle.api.internal.file.FileResource)2 MaybeCompressedFileResource (org.gradle.api.internal.file.MaybeCompressedFileResource)2 TestFile (org.gradle.test.fixtures.file.TestFile)2 Test (org.junit.Test)2