Exemplo n.º 1
0
        public virtual void TestList()
        {
            FileStatus fs = fc.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 = fc.Util().ListStatus(new Path("/"));
            Assert.Equal(0, dirPaths.Length);
            fileContextTestHelper.CreateFileNonRecursive(fc, "/foo");
            fileContextTestHelper.CreateFileNonRecursive(fc, "/bar");
            fc.Mkdir(new Path("/dirX"), FileContext.DefaultPerm, false);
            fc.Mkdir(fileContextTestHelper.GetTestRootPath(fc, "/dirY"), FileContext.DefaultPerm
                     , false);
            fc.Mkdir(new Path("/dirX/dirXX"), FileContext.DefaultPerm, false);
            dirPaths = fc.Util().ListStatus(new Path("/"));
            Assert.Equal(4, dirPaths.Length);
            // Note the the file status paths are the full paths on target
            fs = fileContextTestHelper.ContainsPath(fcTarget, "foo", dirPaths);
            NUnit.Framework.Assert.IsNotNull(fs);
            Assert.True(fs.IsFile());
            fs = fileContextTestHelper.ContainsPath(fcTarget, "bar", dirPaths);
            NUnit.Framework.Assert.IsNotNull(fs);
            Assert.True(fs.IsFile());
            fs = fileContextTestHelper.ContainsPath(fcTarget, "dirX", dirPaths);
            NUnit.Framework.Assert.IsNotNull(fs);
            Assert.True(fs.IsDirectory());
            fs = fileContextTestHelper.ContainsPath(fcTarget, "dirY", dirPaths);
            NUnit.Framework.Assert.IsNotNull(fs);
            Assert.True(fs.IsDirectory());
        }
Exemplo n.º 2
0
        public virtual void TestListOnInternalDirsOfMountTable()
        {
            // test list on internal dirs of mount table
            // list on Slash
            FileStatus[] dirPaths = fcView.Util().ListStatus(new Path("/"));
            FileStatus   fs;

            Assert.Equal(7, dirPaths.Length);
            fs = fileContextTestHelper.ContainsPath(fcView, "/user", dirPaths);
            NUnit.Framework.Assert.IsNotNull(fs);
            Assert.True("A mount should appear as symlink", fs.IsSymlink());
            fs = fileContextTestHelper.ContainsPath(fcView, "/data", dirPaths);
            NUnit.Framework.Assert.IsNotNull(fs);
            Assert.True("A mount should appear as symlink", fs.IsSymlink());
            fs = fileContextTestHelper.ContainsPath(fcView, "/internalDir", dirPaths);
            NUnit.Framework.Assert.IsNotNull(fs);
            Assert.True("InternalDirs should appear as dir", fs.IsDirectory
                            ());
            fs = fileContextTestHelper.ContainsPath(fcView, "/danglingLink", dirPaths);
            NUnit.Framework.Assert.IsNotNull(fs);
            Assert.True("A mount should appear as symlink", fs.IsSymlink());
            fs = fileContextTestHelper.ContainsPath(fcView, "/linkToAFile", dirPaths);
            NUnit.Framework.Assert.IsNotNull(fs);
            Assert.True("A mount should appear as symlink", fs.IsSymlink());
            // list on internal dir
            dirPaths = fcView.Util().ListStatus(new Path("/internalDir"));
            Assert.Equal(2, dirPaths.Length);
            fs = fileContextTestHelper.ContainsPath(fcView, "/internalDir/internalDir2", dirPaths
                                                    );
            NUnit.Framework.Assert.IsNotNull(fs);
            Assert.True("InternalDirs should appear as dir", fs.IsDirectory
                            ());
            fs = fileContextTestHelper.ContainsPath(fcView, "/internalDir/linkToDir2", dirPaths
                                                    );
            NUnit.Framework.Assert.IsNotNull(fs);
            Assert.True("A mount should appear as symlink", fs.IsSymlink());
        }