public virtual void TestList() { FileStatus fs = fSys.GetFileStatus(new Path("/")); Assert.True(fs.IsDirectory()); // should return the full path not the chrooted path Assert.Equal(fs.GetPath(), chrootedTo); // list on Slash FileStatus[] dirPaths = fSys.ListStatus(new Path("/")); Assert.Equal(0, dirPaths.Length); fileSystemTestHelper.CreateFile(fSys, "/foo"); fileSystemTestHelper.CreateFile(fSys, "/bar"); fSys.Mkdirs(new Path("/dirX")); fSys.Mkdirs(fileSystemTestHelper.GetTestRootPath(fSys, "/dirY")); fSys.Mkdirs(new Path("/dirX/dirXX")); dirPaths = fSys.ListStatus(new Path("/")); Assert.Equal(4, dirPaths.Length); // note 2 crc files // Note the the file status paths are the full paths on target fs = FileSystemTestHelper.ContainsPath(new Path(chrootedTo, "foo"), dirPaths); NUnit.Framework.Assert.IsNotNull(fs); Assert.True(fs.IsFile()); fs = FileSystemTestHelper.ContainsPath(new Path(chrootedTo, "bar"), dirPaths); NUnit.Framework.Assert.IsNotNull(fs); Assert.True(fs.IsFile()); fs = FileSystemTestHelper.ContainsPath(new Path(chrootedTo, "dirX"), dirPaths); NUnit.Framework.Assert.IsNotNull(fs); Assert.True(fs.IsDirectory()); fs = FileSystemTestHelper.ContainsPath(new Path(chrootedTo, "dirY"), dirPaths); NUnit.Framework.Assert.IsNotNull(fs); Assert.True(fs.IsDirectory()); }
/// <exception cref="System.IO.IOException"/> private void TestListOnInternalDirsOfMountTableInternal(bool located) { // list on Slash FileStatus[] dirPaths = ListStatusInternal(located, new Path("/")); FileStatus fs; VerifyRootChildren(dirPaths); // list on internal dir dirPaths = ListStatusInternal(located, new Path("/internalDir")); Assert.Equal(2, dirPaths.Length); fs = fileSystemTestHelper.ContainsPath(fsView, "/internalDir/internalDir2", dirPaths ); NUnit.Framework.Assert.IsNotNull(fs); Assert.True("A mount should appear as symlink", fs.IsDirectory( )); fs = fileSystemTestHelper.ContainsPath(fsView, "/internalDir/linkToDir2", dirPaths ); NUnit.Framework.Assert.IsNotNull(fs); Assert.True("A mount should appear as symlink", fs.IsSymlink()); }