if (file.isDirectory()) { // if it is a folder, we do it recursively AlluxioURI dirURI = new AlluxioURI(file.getPath()); String prefix = new AlluxioURI(inputPath).getLeadingPath(dirURI.getDepth()); if (prefix != null && match(dirURI, new AlluxioURI(prefix))) { res.addAll(getFiles(inputPath, dirURI.getPath()));
/** * Tests the {@link AlluxioURI#getLeadingPath(int)} method. */ @Test public void getLeadingPath() { assertEquals("/", new AlluxioURI("/a/b/c/").getLeadingPath(0)); assertEquals("/a", new AlluxioURI("/a/b/c/").getLeadingPath(1)); assertEquals("/a/b", new AlluxioURI("/a/b/c/").getLeadingPath(2)); assertEquals("/a/b/c", new AlluxioURI("/a/b/c/").getLeadingPath(3)); assertEquals(null, new AlluxioURI("/a/b/c/").getLeadingPath(4)); assertEquals("/", new AlluxioURI("/").getLeadingPath(0)); assertEquals("", new AlluxioURI("").getLeadingPath(0)); assertEquals(null, new AlluxioURI("").getLeadingPath(1)); assertEquals(".", new AlluxioURI(".").getLeadingPath(0)); assertEquals(null, new AlluxioURI(".").getLeadingPath(1)); assertEquals("a/b", new AlluxioURI("a/b/c").getLeadingPath(1)); }
AlluxioURI dirURI = new AlluxioURI(inputURI.getScheme(), inputURI.getAuthority(), status.getPath()); String prefix = inputURI.getLeadingPath(dirURI.getDepth()); if (prefix != null && match(dirURI, new AlluxioURI(prefix))) { res.addAll(getAlluxioURIs(alluxioClient, inputURI, dirURI));