@Override public RemoteIterator<LocatedFileStatus> next( final AbstractFileSystem fs, final Path p) throws IOException, UnresolvedLinkException { return fs.listLocatedStatus(p); } }.resolve(this, absF);
@Override public RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f) throws IOException, UnresolvedLinkException { return myFs.listLocatedStatus(fullPath(f)); }
@Override public RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException { checkPath(f); return myFs.listLocatedStatus(f); }
@Override public RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException { final RemoteIterator<LocatedFileStatus> iter = getMyFs().listLocatedStatus(f); return new RemoteIterator<LocatedFileStatus>() { private LocatedFileStatus next = null; @Override public boolean hasNext() throws IOException { while (next == null && iter.hasNext()) { LocatedFileStatus unfilteredNext = iter.next(); if (!isChecksumFile(unfilteredNext.getPath())) { next = unfilteredNext; } } return next != null; } @Override public LocatedFileStatus next() throws IOException { if (!hasNext()) { throw new NoSuchElementException(); } LocatedFileStatus tmp = next; next = null; return tmp; } }; }
@Override public RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException { final InodeTree.ResolveResult<AbstractFileSystem> res = fsState.resolve(getUriPath(f), true); final RemoteIterator<LocatedFileStatus> fsIter = res.targetFileSystem.listLocatedStatus(res.remainingPath); if (res.isInternalDir()) { return fsIter; } return new WrappingRemoteIterator<LocatedFileStatus>(res, fsIter, f) { @Override public LocatedFileStatus getViewFsFileStatus(LocatedFileStatus stat, Path newPath) { return new ViewFsLocatedFileStatus(stat, newPath); } }; }
@Override public RemoteIterator<LocatedFileStatus> next( final AbstractFileSystem fs, final Path p) throws IOException, UnresolvedLinkException { return fs.listLocatedStatus(p); } }.resolve(this, absF);
@Override public RemoteIterator<LocatedFileStatus> next( final AbstractFileSystem fs, final Path p) throws IOException, UnresolvedLinkException { return fs.listLocatedStatus(p); } }.resolve(this, absF);
@Override public RemoteIterator<LocatedFileStatus> next( final AbstractFileSystem fs, final Path p) throws IOException, UnresolvedLinkException { return fs.listLocatedStatus(p); } }.resolve(this, absF);
@Override public RemoteIterator<LocatedFileStatus> next( final AbstractFileSystem fs, final Path p) throws IOException, UnresolvedLinkException { return fs.listLocatedStatus(p); } }.resolve(this, absF);
@Override public RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f) throws IOException, UnresolvedLinkException { return myFs.listLocatedStatus(fullPath(f)); }
@Override public RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException { checkPath(f); return myFs.listLocatedStatus(f); }
@Override public RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f) throws IOException, UnresolvedLinkException { return myFs.listLocatedStatus(fullPath(f)); }
@Override public RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f) throws IOException, UnresolvedLinkException { return myFs.listLocatedStatus(fullPath(f)); }
@Override public RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException { final InodeTree.ResolveResult<AbstractFileSystem> res = fsState.resolve(getUriPath(f), true); final RemoteIterator<LocatedFileStatus> fsIter = res.targetFileSystem.listLocatedStatus(res.remainingPath); if (res.isInternalDir()) { return fsIter; } return new WrappingRemoteIterator<LocatedFileStatus>(res, fsIter, f) { @Override public LocatedFileStatus getViewFsFileStatus(LocatedFileStatus stat, Path newPath) { return new ViewFsLocatedFileStatus(stat, newPath); } }; }
@Override public RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException { final InodeTree.ResolveResult<AbstractFileSystem> res = fsState.resolve(getUriPath(f), true); final RemoteIterator<LocatedFileStatus> fsIter = res.targetFileSystem.listLocatedStatus(res.remainingPath); if (res.isInternalDir()) { return fsIter; } return new WrappingRemoteIterator<LocatedFileStatus>(res, fsIter, f) { @Override public LocatedFileStatus getViewFsFileStatus(LocatedFileStatus stat, Path newPath) { return new ViewFsLocatedFileStatus(stat, newPath); } }; }
@Override public RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException { final InodeTree.ResolveResult<AbstractFileSystem> res = fsState.resolve(getUriPath(f), true); final RemoteIterator<LocatedFileStatus> fsIter = res.targetFileSystem.listLocatedStatus(res.remainingPath); if (res.isInternalDir()) { return fsIter; } return new WrappingRemoteIterator<LocatedFileStatus>(res, fsIter, f) { @Override public LocatedFileStatus getViewFsFileStatus(LocatedFileStatus stat, Path newPath) { return new ViewFsLocatedFileStatus(stat, newPath); } }; }
@Test public void testListLocatedStatus() throws IOException { final Path mockTarget = new Path("mockfs://listLocatedStatus/foo"); final Path mountPoint = new Path("/fooMount"); final Configuration newConf = new Configuration(); newConf.setClass("fs.AbstractFileSystem.mockfs.impl", MockFs.class, AbstractFileSystem.class); ConfigUtil.addLink(newConf, mountPoint.toString(), mockTarget.toUri()); FileContext.getFileContext(URI.create("viewfs:///"), newConf) .listLocatedStatus(mountPoint); AbstractFileSystem mockFs = MockFs.getMockFs(mockTarget.toUri()); verify(mockFs).listLocatedStatus(new Path(mockTarget.toUri().getPath())); verify(mockFs, never()).listStatus(any(Path.class)); verify(mockFs, never()).listStatusIterator(any(Path.class)); }