diff options
author | Valerij Fredriksen <valerijf@verizonmedia.com> | 2020-04-24 10:57:03 +0200 |
---|---|---|
committer | Valerij Fredriksen <valerijf@verizonmedia.com> | 2020-04-24 11:03:21 +0200 |
commit | 59684f45818f16dfffeacec1a9dcb3bd7aa80ed0 (patch) | |
tree | 0648099e2ac5cb3de99af2f69cc225e94def4bda /node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileFinderTest.java | |
parent | e83700c6f617f5fbcb78be9f7a1289523aee987d (diff) |
Implement FileFinder::prune
Diffstat (limited to 'node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileFinderTest.java')
-rw-r--r-- | node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileFinderTest.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileFinderTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileFinderTest.java index 8fff2141252..26897839b32 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileFinderTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileFinderTest.java @@ -61,6 +61,27 @@ public class FileFinderTest { } @Test + public void all_files_recursive_with_prune_relative() { + assertFileHelper(FileFinder.files(testRoot()).prune(fileSystem.getPath("test")), + + of("file-1.json", "test.json", "test.txt"), + of("test", "test/file.txt", "test/data.json", "test/subdir-1", "test/subdir-1/test", "test/subdir-2")); + } + + @Test + public void all_files_recursive_with_prune_absolute() { + assertFileHelper(FileFinder.files(testRoot()).prune(testRoot().resolve("test/subdir-1")), + + of("file-1.json", "test.json", "test.txt", "test/file.txt", "test/data.json"), + of("test", "test/subdir-1", "test/subdir-1/test", "test/subdir-2")); + } + + @Test(expected = IllegalArgumentException.class) + public void throws_if_prune_path_not_under_base_path() { + FileFinder.files(Paths.get("/some/path")).prune(Paths.get("/other/path")); + } + + @Test public void with_file_filter_recursive() { assertFileHelper(FileFinder.files(testRoot()) .match(FileFinder.nameEndsWith(".json")), |