public virtual void TestSymbolicLinks() { WriteFile(fc, File1, FileLen); WriteFile(fc, File2, FileLen); WriteFile(fc, File3, FileLen); Path dir4 = new Path(TestDir, "dir4"); Path dir5 = new Path(dir4, "dir5"); Path file4 = new Path(dir4, "file4"); fc.CreateSymlink(Dir1, dir5, true); fc.CreateSymlink(File1, file4, true); RemoteIterator <LocatedFileStatus> itor = fc.Util().ListFiles(dir4, true); LocatedFileStatus stat = itor.Next(); NUnit.Framework.Assert.IsTrue(stat.IsFile()); NUnit.Framework.Assert.AreEqual(fc.MakeQualified(File2), stat.GetPath()); stat = itor.Next(); NUnit.Framework.Assert.IsTrue(stat.IsFile()); NUnit.Framework.Assert.AreEqual(fc.MakeQualified(File3), stat.GetPath()); stat = itor.Next(); NUnit.Framework.Assert.IsTrue(stat.IsFile()); NUnit.Framework.Assert.AreEqual(fc.MakeQualified(File1), stat.GetPath()); NUnit.Framework.Assert.IsFalse(itor.HasNext()); itor = fc.Util().ListFiles(dir4, false); stat = itor.Next(); NUnit.Framework.Assert.IsTrue(stat.IsFile()); NUnit.Framework.Assert.AreEqual(fc.MakeQualified(File1), stat.GetPath()); NUnit.Framework.Assert.IsFalse(itor.HasNext()); }
public virtual void TestFile() { fc.Mkdir(TestDir, FsPermission.GetDefault(), true); WriteFile(fc, File1, FileLen); RemoteIterator <LocatedFileStatus> itor = fc.Util().ListFiles(File1, true); LocatedFileStatus stat = itor.Next(); NUnit.Framework.Assert.IsFalse(itor.HasNext()); NUnit.Framework.Assert.IsTrue(stat.IsFile()); NUnit.Framework.Assert.AreEqual(FileLen, stat.GetLen()); NUnit.Framework.Assert.AreEqual(fc.MakeQualified(File1), stat.GetPath()); NUnit.Framework.Assert.AreEqual(1, stat.GetBlockLocations().Length); itor = fc.Util().ListFiles(File1, false); stat = itor.Next(); NUnit.Framework.Assert.IsFalse(itor.HasNext()); NUnit.Framework.Assert.IsTrue(stat.IsFile()); NUnit.Framework.Assert.AreEqual(FileLen, stat.GetLen()); NUnit.Framework.Assert.AreEqual(fc.MakeQualified(File1), stat.GetPath()); NUnit.Framework.Assert.AreEqual(1, stat.GetBlockLocations().Length); }
public virtual void TestDirectory() { fc.Mkdir(Dir1, FsPermission.GetDefault(), true); // test empty directory RemoteIterator <LocatedFileStatus> itor = fc.Util().ListFiles(Dir1, true); NUnit.Framework.Assert.IsFalse(itor.HasNext()); itor = fc.Util().ListFiles(Dir1, false); NUnit.Framework.Assert.IsFalse(itor.HasNext()); // testing directory with 1 file WriteFile(fc, File2, FileLen); itor = fc.Util().ListFiles(Dir1, true); LocatedFileStatus stat = itor.Next(); NUnit.Framework.Assert.IsFalse(itor.HasNext()); NUnit.Framework.Assert.IsTrue(stat.IsFile()); NUnit.Framework.Assert.AreEqual(FileLen, stat.GetLen()); NUnit.Framework.Assert.AreEqual(fc.MakeQualified(File2), stat.GetPath()); NUnit.Framework.Assert.AreEqual(1, stat.GetBlockLocations().Length); itor = fc.Util().ListFiles(Dir1, false); stat = itor.Next(); NUnit.Framework.Assert.IsFalse(itor.HasNext()); NUnit.Framework.Assert.IsTrue(stat.IsFile()); NUnit.Framework.Assert.AreEqual(FileLen, stat.GetLen()); NUnit.Framework.Assert.AreEqual(fc.MakeQualified(File2), stat.GetPath()); NUnit.Framework.Assert.AreEqual(1, stat.GetBlockLocations().Length); // test more complicated directory WriteFile(fc, File1, FileLen); WriteFile(fc, File3, FileLen); itor = fc.Util().ListFiles(TestDir, true); stat = itor.Next(); NUnit.Framework.Assert.IsTrue(stat.IsFile()); NUnit.Framework.Assert.AreEqual(fc.MakeQualified(File2), stat.GetPath()); stat = itor.Next(); NUnit.Framework.Assert.IsTrue(stat.IsFile()); NUnit.Framework.Assert.AreEqual(fc.MakeQualified(File3), stat.GetPath()); stat = itor.Next(); NUnit.Framework.Assert.IsTrue(stat.IsFile()); NUnit.Framework.Assert.AreEqual(fc.MakeQualified(File1), stat.GetPath()); NUnit.Framework.Assert.IsFalse(itor.HasNext()); itor = fc.Util().ListFiles(TestDir, false); stat = itor.Next(); NUnit.Framework.Assert.IsTrue(stat.IsFile()); NUnit.Framework.Assert.AreEqual(fc.MakeQualified(File1), stat.GetPath()); NUnit.Framework.Assert.IsFalse(itor.HasNext()); }
public override bool IsFile() { return(myFs.IsFile()); }