Esempio n. 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));
        }
Esempio n. 2
0
        public virtual void TestEviction()
        {
            NfsConfiguration conf = new NfsConfiguration();

            conf.Set(FileSystem.FsDefaultNameKey, "hdfs://localhost");
            // Only one entry will be in the cache
            int            MaxCacheSize = 1;
            DFSClientCache cache        = new DFSClientCache(conf, MaxCacheSize);
            DFSClient      c1           = cache.GetDfsClient("test1");

            NUnit.Framework.Assert.IsTrue(cache.GetDfsClient("test1").ToString().Contains("ugi=test1"
                                                                                          ));
            NUnit.Framework.Assert.AreEqual(c1, cache.GetDfsClient("test1"));
            NUnit.Framework.Assert.IsFalse(IsDfsClientClose(c1));
            cache.GetDfsClient("test2");
            NUnit.Framework.Assert.IsTrue(IsDfsClientClose(c1));
            NUnit.Framework.Assert.IsTrue("cache size should be the max size or less", cache.
                                          clientCache.Size() <= MaxCacheSize);
        }
Esempio n. 3
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));
        }
Esempio n. 4
0
 public _CacheLoader_238(DFSClientCache _enclosing)
 {
     this._enclosing = _enclosing;
 }
Esempio n. 5
0
 internal CacheFinalizer(DFSClientCache _enclosing)
 {
     this._enclosing = _enclosing;
 }