예제 #1
0
        /// <exception cref="System.Exception"/>
        protected override void SetUp()
        {
            //get file system as a non-superuser
            UserGroupInformation current = UserGroupInformation.GetCurrentUser();

            ugi = UserGroupInformation.CreateUserForTesting(current.GetShortUserName() + "x",
                                                            new string[] { "user" });
            fs = WebHdfsTestUtil.GetWebHdfsFileSystemAs(ugi, conf, WebHdfsFileSystem.Scheme);
            defaultWorkingDirectory = fs.GetWorkingDirectory().ToUri().GetPath();
        }
예제 #2
0
        public virtual void TestAccess()
        {
            Path p1 = new Path("/pathX");

            try
            {
                UserGroupInformation ugi = UserGroupInformation.CreateUserForTesting("alpha", new
                                                                                     string[] { "beta" });
                WebHdfsFileSystem fs = WebHdfsTestUtil.GetWebHdfsFileSystemAs(ugi, conf, WebHdfsFileSystem
                                                                              .Scheme);
                fs.Mkdirs(p1);
                fs.SetPermission(p1, new FsPermission((short)0x124));
                fs.Access(p1, FsAction.Read);
                try
                {
                    fs.Access(p1, FsAction.Write);
                    Fail("The access call should have failed.");
                }
                catch (AccessControlException)
                {
                }
                // expected
                Path badPath = new Path("/bad");
                try
                {
                    fs.Access(badPath, FsAction.Read);
                    Fail("The access call should have failed");
                }
                catch (FileNotFoundException)
                {
                }
            }
            finally
            {
                // expected
                fs.Delete(p1, true);
            }
        }
예제 #3
0
 /// <summary>Overridden to provide a WebHdfsFileSystem wrapper for a specific user.</summary>
 /// <param name="user">UserGroupInformation specific user</param>
 /// <returns>WebHdfsFileSystem for specific user</returns>
 /// <exception cref="System.Exception">if creation fails</exception>
 protected internal override FileSystem CreateFileSystem(UserGroupInformation user
                                                         )
 {
     return(WebHdfsTestUtil.GetWebHdfsFileSystemAs(user, conf, WebHdfsFileSystem.Scheme
                                                   ));
 }