예제 #1
0
        public virtual void TestGetUserGroupInformation()
        {
            string userName    = "******";
            string currentUser = "******";
            UserGroupInformation currentUserUgi = UserGroupInformation.CreateUserForTesting(currentUser
                                                                                            , new string[0]);
            NfsConfiguration conf = new NfsConfiguration();

            conf.Set(FileSystem.FsDefaultNameKey, "hdfs://localhost");
            DFSClientCache       cache     = new DFSClientCache(conf);
            UserGroupInformation ugiResult = cache.GetUserGroupInformation(userName, currentUserUgi
                                                                           );

            Assert.AssertThat(ugiResult.GetUserName(), IS.Is(userName));
            Assert.AssertThat(ugiResult.GetRealUser(), IS.Is(currentUserUgi));
            Assert.AssertThat(ugiResult.GetAuthenticationMethod(), IS.Is(UserGroupInformation.AuthenticationMethod
                                                                         .Proxy));
        }
예제 #2
0
        public virtual void TestGetUserGroupInformationSecure()
        {
            string               userName       = "******";
            string               currentUser    = "******";
            NfsConfiguration     conf           = new NfsConfiguration();
            UserGroupInformation currentUserUgi = UserGroupInformation.CreateRemoteUser(currentUser
                                                                                        );

            currentUserUgi.SetAuthenticationMethod(UserGroupInformation.AuthenticationMethod.
                                                   Kerberos);
            UserGroupInformation.SetLoginUser(currentUserUgi);
            DFSClientCache       cache     = new DFSClientCache(conf);
            UserGroupInformation ugiResult = cache.GetUserGroupInformation(userName, currentUserUgi
                                                                           );

            Assert.AssertThat(ugiResult.GetUserName(), IS.Is(userName));
            Assert.AssertThat(ugiResult.GetRealUser(), IS.Is(currentUserUgi));
            Assert.AssertThat(ugiResult.GetAuthenticationMethod(), IS.Is(UserGroupInformation.AuthenticationMethod
                                                                         .Proxy));
        }