FileContext.this.listStatus(f); while(statusIterator.hasNext()) { FileStatus s = statusIterator.next();
@Override public RemoteIterator<FileStatus> listStatusIterator(Path f) throws AccessControlException, FileNotFoundException, UnsupportedFileSystemException, IOException { return fc.listStatus(f); }
@Override public RemoteIterator<FileStatus> listStatusIterator(Path f) throws AccessControlException, FileNotFoundException, UnsupportedFileSystemException, IOException { return fc.listStatus(f); }
@Override public List<Location> list() throws IOException { RemoteIterator<FileStatus> statuses = fc.listStatus(path); ImmutableList.Builder<Location> result = ImmutableList.builder(); while (statuses.hasNext()) { FileStatus status = statuses.next(); if (!Objects.equals(path, status.getPath())) { result.add(new FileContextLocation(locationFactory, fc, status.getPath())); } } return result.build(); }
@Override public List<Location> list() throws IOException { RemoteIterator<FileStatus> statuses = fc.listStatus(path); ImmutableList.Builder<Location> result = ImmutableList.builder(); while (statuses.hasNext()) { FileStatus status = statuses.next(); if (!Objects.equals(path, status.getPath())) { result.add(new FileContextLocation(locationFactory, fc, status.getPath())); } } return result.build(); }
private static List<FileStatus> listFilteredStatus(FileContext fc, Path root, PathFilter filter) throws IOException { List<FileStatus> fsList = remoteIterToList(fc.listStatus(root)); if (filter == null) { return fsList; } else { List<FileStatus> filteredList = new LinkedList<FileStatus>(); for (FileStatus fs : fsList) { if (filter.accept(fs.getPath())) { filteredList.add(fs); } } return filteredList; } }
private static List<FileStatus> listFilteredStatus(FileContext fc, Path root, PathFilter filter) throws IOException { List<FileStatus> fsList = remoteIterToList(fc.listStatus(root)); if (filter == null) { return fsList; } else { List<FileStatus> filteredList = new LinkedList<FileStatus>(); for (FileStatus fs : fsList) { if (filter.accept(fs.getPath())) { filteredList.add(fs); } } return filteredList; } }
@Test public void testListStatusThrowsExceptionForNonExistentFile() throws Exception { String testFile = "test/hadoop/file"; Path testPath = qualifiedPath(testFile, fc2); try { fc1.listStatus(testPath); Assert.fail("Should throw FileNotFoundException"); } catch (FileNotFoundException fnfe) { // expected } }
public void testListStatusThrowsExceptionForNonExistentFile() throws Exception { try { fc.listStatus(getTestRootPath(fc, "test/hadoop/file")); Assert.fail("Should throw FileNotFoundException"); } catch (FileNotFoundException fnfe) { // expected } }
/** The list operation randomly picks a directory in the test space and * list the directory content. */ private void list() throws IOException { String dirName = dirs.get(r.nextInt(dirs.size())); long startTime = Time.now(); fc.listStatus(new Path(dirName)); executionTime[LIST] += (Time.now()-startTime); totalNumOfOps[LIST]++; }
/** The list operation randomly picks a directory in the test space and * list the directory content. */ private void list() throws IOException { String dirName = dirs.get(r.nextInt(dirs.size())); long startTimestamp = Time.monotonicNow(); fc.listStatus(new Path(dirName)); executionTime[LIST] += (Time.monotonicNow() - startTimestamp); totalNumOfOps[LIST]++; }
private void findFiles(FSWindowReplayWAL wal, int operatorId) throws IOException { String operatorDir = fullStatePath + Path.SEPARATOR + operatorId; Path operatorPath = new Path(operatorDir); if (fileContext.util().exists(operatorPath)) { RemoteIterator<FileStatus> walFilesIter = fileContext.listStatus(operatorPath); while (walFilesIter.hasNext()) { FileStatus fileStatus = walFilesIter.next(); FSWindowReplayWAL.FileDescriptor descriptor = FSWindowReplayWAL.FileDescriptor.create(fileStatus.getPath()); wal.fileDescriptors.put(descriptor.part, descriptor); } } }
/** * Returns {@link RemoteIterator} of {@link LocationStatus} under a directory * represented by the given {@link Location}. */ private static RemoteIterator<LocationStatus> listLocationStatus(Location location) throws IOException { LocationFactory lf = location.getLocationFactory(); if (lf instanceof FileContextLocationFactory) { FileContext fc = ((FileContextLocationFactory) lf).getFileContext(); return transform(fc.listStatus(new Path(location.toURI())), FILE_STATUS_TO_LOCATION_STATUS); } return transform(asRemoteIterator(location.list().iterator()), LOCATION_TO_LOCATION_STATUS); }
/** * Returns {@link RemoteIterator} of {@link LocationStatus} under a directory * represented by the given {@link Location}. */ private static RemoteIterator<LocationStatus> listLocationStatus(Location location) throws IOException { LocationFactory lf = location.getLocationFactory(); if (lf instanceof FileContextLocationFactory) { FileContext fc = ((FileContextLocationFactory) lf).getFileContext(); return transform(fc.listStatus(new Path(location.toURI())), FILE_STATUS_TO_LOCATION_STATUS); } return transform(asRemoteIterator(location.list().iterator()), LOCATION_TO_LOCATION_STATUS); }
@Test public void testListStatusIterator() throws IOException { final Path mockTarget = new Path("mockfs://listStatusIterator/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) .listStatus(mountPoint); AbstractFileSystem mockFs = MockFs.getMockFs(mockTarget.toUri()); verify(mockFs).listStatusIterator(new Path(mockTarget.toUri().getPath())); verify(mockFs, never()).listStatus(any(Path.class)); }
public void testListStatusThrowsExceptionForNonExistentFile() throws Exception { try { fc.listStatus(getTestRootPath(fc, "test/hadoop/file")); Assert.fail("Should throw FileNotFoundException"); } catch (FileNotFoundException fnfe) { // expected } }
public void testListStatusThrowsExceptionForNonExistentFile() throws Exception { try { fc.listStatus(getTestRootPath(fc, "test/hadoop/file")); Assert.fail("Should throw FileNotFoundException"); } catch (FileNotFoundException fnfe) { // expected } }
/** * Override this so that we don't set the targetTestRoot to any path under the * root of the FS, and so that we don't try to delete the test dir, but rather * only its contents. */ @Override void initializeTargetTestRoot() throws IOException { targetTestRoot = fc.makeQualified(new Path("/")); RemoteIterator<FileStatus> dirContents = fc.listStatus(targetTestRoot); while (dirContents.hasNext()) { fc.delete(dirContents.next().getPath(), true); } }
@Test public void testListStatusThrowsExceptionForNonExistentFile() throws Exception { String testFile = "test/hadoop/file"; Path testPath = qualifiedPath(testFile, fc2); try { fc1.listStatus(testPath); Assert.fail("Should throw FileNotFoundException"); } catch (FileNotFoundException fnfe) { // expected } }
@Test public void testListStatusThrowsExceptionForNonExistentFile() throws Exception { String testFile = "test/hadoop/file"; Path testPath = qualifiedPath(testFile, fc2); try { fc1.listStatus(testPath); Assert.fail("Should throw FileNotFoundException"); } catch (FileNotFoundException fnfe) { // expected } }